diff options
| author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
|---|---|---|
| committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
| commit | 90825e2392b2d70e43c7a25b8a3752299a933894 (patch) | |
| tree | e33aa27f02b74604afbfd0ea4f1cfca8833d882a /dcopjava/binding/org/kde/DCOP/Client.java | |
| download | tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip | |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dcopjava/binding/org/kde/DCOP/Client.java')
| -rw-r--r-- | dcopjava/binding/org/kde/DCOP/Client.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/dcopjava/binding/org/kde/DCOP/Client.java b/dcopjava/binding/org/kde/DCOP/Client.java new file mode 100644 index 00000000..55ba943e --- /dev/null +++ b/dcopjava/binding/org/kde/DCOP/Client.java @@ -0,0 +1,63 @@ +package org.kde.DCOP; + + +public class Client +{ + // attach to DCOP server as 'anonymous' + public native boolean attach(); + + // attach to DCOP server using appName as key + public native String registerAs(String appName); + + // report if we are registered at the server + public native boolean isRegistered(); + + // return the registered application id + public native String appId(); + + // suspend DCOP processing + public native void suspend(); + + // resume DCOP processing + public native void resume(); + + // detach from the DCOP server + public native boolean detach(); + + // report if we are attached to DCOP server + public native boolean isAttached(); + + // send a command to the server + public native boolean send(String remApp, String remObj, String remFun, byte[] data); + + // send a command string to the server + public native boolean send(String remApp, String remObj, String remFun, String data); + + // call a function and get the result + public native Response call(String remApp, String remObj, String remFun, byte[] data, boolean eventLoop); + + // Checks whether remApp is registered with the DCOP server. + public native boolean isApplicationRegistered ( String remApp); + + public static void main(String[] args) + { + Client client = new Client(); + + System.out.println("Registering as: " + client.registerAs("Java-App")); + if (client.isAttached()) + System.out.println("Attached!"); + + client.send("kdesktop", "KDesktopIface", "selectAll()", ""); + + java.io.ByteArrayOutputStream bs = new java.io.ByteArrayOutputStream(); + Response res = client.call("kdesktop", "KDesktopIface", "selectedURLs()", bs.toByteArray(), false); + System.out.println("Result type: " + res.returnType); + } + + static + { + System.loadLibrary("javadcop"); + } + +} + |
