Changeset View
Changeset View
Standalone View
Standalone View
plugins/README.txt
1 | Writting a plugin for KDE Connect | 1 | Writting a plugin for KDE Connect | ||
---|---|---|---|---|---|
2 | ================================= | 2 | ================================= | ||
3 | 3 | | |||
4 | For the desktop client (this project): | 4 | For the desktop client (this project): | ||
5 | -------------------------------------- | 5 | -------------------------------------- | ||
6 | 6 | | |||
7 | 1. Enter the "plugins" directory. | 7 | 1. Enter the "plugins" directory. | ||
8 | 2. Copy the "ping" under a different name ("findmyphone" in this example). | 8 | 2. Copy the "ping" under a different name ("findmyphone" in this example). | ||
9 | 3. Add "add_subdirectory(findmyphone)" to CMakeLists.txt after the others "add_subdirectory". | 9 | 3. Add "add_subdirectory(findmyphone)" to CMakeLists.txt after the others "add_subdirectory". | ||
10 | 1. Enter the new "findmyphone" directory. | 10 | 1. Enter the new "findmyphone" directory. | ||
11 | 5. Edit CMakeLists.txt by replacing "ping" with "findmyphone". | 11 | 5. Edit CMakeLists.txt by replacing "ping" with "findmyphone". | ||
12 | 6. Rename other files in this directory by replacing "ping" with "findmyphone" | 12 | 6. Rename other files in this directory by replacing "ping" with "findmyphone" | ||
13 | 7. Write a description of your plugin into "README" | 13 | 7. Write a description of your plugin into "README" | ||
14 | 8. Edit findmyphoneplugin.cpp and findmyphoneplugin.h. | 14 | 8. Edit findmyphoneplugin.cpp and findmyphoneplugin.h. | ||
15 | A. Change license header. | 15 | A. Change license header. | ||
16 | B. Replace (case sensitive) "ping" with "findmyphone", "PingPlugin" with "FindMyPhonePlugin" and "PING" with "FINDMYPHONE". | 16 | B. Replace (case sensitive) "ping" with "findmyphone", "PingPlugin" with "FindMyPhonePlugin" and "PING" with "FINDMYPHONE". | ||
17 | 9. Edit kdeconnect_findmyphone.desktop file: | 17 | 9. Edit kdeconnect_findmyphone.desktop file: | ||
18 | A. Replace "ping" with "findmyphone". | 18 | A. Replace "ping" with "findmyphone". | ||
19 | B. Change name, description, icon, author, email, version, website, license info. | 19 | B. Change name, description, icon, author, email, version, website, license info. | ||
20 | C. Remove all the translations | 20 | C. Remove all the translations | ||
21 | D. Set X-KDEConnect-SupportedPackageType and X-KDEConnect-OutgoingPackageType to the package type your plugin will receive | 21 | D. Set X-KDEConnect-SupportedPacketType and X-KDEConnect-OutgoingPacketType to the packet type your plugin will receive | ||
22 | and send, respectively. In this example this is "kdeconnect.findmyphone". Make sure that this matches what is defined in | 22 | and send, respectively. In this example this is "kdeconnect.findmyphone". Make sure that this matches what is defined in | ||
23 | the findmyplugin.h file (in the line "#define PACKAGE_TYPE_..."), and also in Android. | 23 | the findmyplugin.h file (in the line "#define PACKET_TYPE_..."), and also in Android. | ||
24 | 10. Now you have an empty skeleton to implement your new plugin logic. | 24 | 10. Now you have an empty skeleton to implement your new plugin logic. | ||
25 | 25 | | |||
26 | For Android (project kdeconnect-android): | 26 | For Android (project kdeconnect-android): | ||
27 | ----------------------------------------- | 27 | ----------------------------------------- | ||
28 | 28 | | |||
29 | 1. Change directory to src/org/kde/kdeconnect/Plugins. | 29 | 1. Change directory to src/org/kde/kdeconnect/Plugins. | ||
30 | 2. Copy "PingPlugin" under a different name ("FindMyPhonePlugin" in this example). | 30 | 2. Copy "PingPlugin" under a different name ("FindMyPhonePlugin" in this example). | ||
31 | 1. Enter the new "FindMyPhonePlugin" directory. | 31 | 1. Enter the new "FindMyPhonePlugin" directory. | ||
32 | 4. Rename "PingPlugin.java" to "FindMyPhonePlugin.java" | 32 | 4. Rename "PingPlugin.java" to "FindMyPhonePlugin.java" | ||
33 | 5. Edit it. Replace (case sensitive) "Ping" with "FindMyPhone", "ping" with "findmyphone", "PING" with "FINDMYPHONE" | 33 | 5. Edit it. Replace (case sensitive) "Ping" with "FindMyPhone", "ping" with "findmyphone", "PING" with "FINDMYPHONE" | ||
34 | and "plugin_ping" with "plugin_findmyphone". | 34 | and "plugin_ping" with "plugin_findmyphone". | ||
35 | 6. Open res/values/strings.xml. Find and copy the lines "pref_plugin_ping_desc" and "pref_plugin_ping" replacing "ping" | 35 | 6. Open res/values/strings.xml. Find and copy the lines "pref_plugin_ping_desc" and "pref_plugin_ping" replacing "ping" | ||
36 | with "findmyphone" and edit the plugin name and description between <string> </string>). | 36 | with "findmyphone" and edit the plugin name and description between <string> </string>). | ||
37 | 7. Open src/org/kde/kdeconnect/Plugins/PluginFactory.java. | 37 | 7. Open src/org/kde/kdeconnect/Plugins/PluginFactory.java. | ||
38 | A. Copy "import … PingPlugin" line with replacing "PingPlugin" with "FindMyPhonePlugin". | 38 | A. Copy "import … PingPlugin" line with replacing "PingPlugin" with "FindMyPhonePlugin". | ||
39 | B. Copy "PluginFactory.registerPlugin(PingPlugin.class);" line with replacing "PingPlugin" with "FindMyPhonePlugin". | 39 | B. Copy "PluginFactory.registerPlugin(PingPlugin.class);" line with replacing "PingPlugin" with "FindMyPhonePlugin". | ||
40 | 8. Open src/org/kde/kdeconnect/NetworkPackage.java. Copy a "public final static String PACKAGE_TYPE_PING = …" line | 40 | 8. Open src/org/kde/kdeconnect/NetworkPacket.java. Copy a "public final static String PACKET_TYPE_PING = …" line | ||
41 | replacing "PING" with the package type you will be using (should match the desktop client). | 41 | replacing "PING" with the packet type you will be using (should match the desktop client). | ||
42 | 9. Now you have an empty skeleton to implement your new plugin logic. | 42 | 9. Now you have an empty skeleton to implement your new plugin logic. |