Dolphin shell extention: adapt to the change in KDE Frameworks
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 19 Oct 2015 06:57:25 +0000 (08:57 +0200)
committerOlivier Goffart <ogoffart@woboq.com>
Mon, 19 Oct 2015 13:39:51 +0000 (15:39 +0200)
shell_integration/dolphin_kf5/CMakeLists.txt
shell_integration/dolphin_kf5/ownclouddolphinplugin.cpp
shell_integration/dolphin_kf5/ownclouddolphinplugin.json [new file with mode: 0644]

index b896d4d0cc0eda94b923fe974d9b94c8ec0360fc..0a22cbe815bc1a4779f6dd5956847c482f0d0c0e 100644 (file)
@@ -13,7 +13,8 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_
 
 find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons KIO)
 
-find_package(DolphinVcs REQUIRED)
+
+
 set_package_properties(DolphinVcs PROPERTIES
     DESCRIPTION "the Dolphin plugin library"
     URL "http://dolphin.kde.org/"
@@ -31,11 +32,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
 add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
 
-add_library(ownclouddolphinplugin MODULE ownclouddolphinplugin.cpp)
-target_link_libraries(ownclouddolphinplugin DolphinVcs Qt5::Network KF5::CoreAddons KF5::KIOCore)
-install(FILES ownclouddolphinplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
-install(TARGETS ownclouddolphinplugin DESTINATION ${KDE_INSTALL_PLUGINDIR})
-
+kcoreaddons_add_plugin(ownclouddolphinplugin INSTALL_NAMESPACE "kf5/overlayicon" JSON ownclouddolphinplugin.json SOURCES ownclouddolphinplugin.cpp)
+target_link_libraries(ownclouddolphinplugin Qt5::Network KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets)
 
 add_library(ownclouddolphinpluginaction MODULE ownclouddolphinpluginaction.cpp)
 target_link_libraries(ownclouddolphinpluginaction Qt5::Network KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets)
index c542e7b45520eab33580c742333fe85f4ebcdac5..c039bd42ea29a873df4254f8eb437a3002d4d050 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA               *
  ******************************************************************************/
 
-#include <Dolphin/KOverlayIconPlugin>
+#include <KOverlayIconPlugin>
 #include <KPluginFactory>
-#include <KPluginLoader>
 #include <QtNetwork/QLocalSocket>
 #include <KIOCore/kfileitem.h>
 
 
-
 class OwncloudDolphinPlugin : public KOverlayIconPlugin
 {
+    Q_PLUGIN_METADATA(IID "com.owncloud.ovarlayiconplugin" FILE "ownclouddolphinplugin.json");
     Q_OBJECT
+
     QLocalSocket m_socket;
     typedef QHash<QByteArray, QByteArray> StatusMap;
     StatusMap m_status;
     QByteArray m_line;
 
 public:
-    explicit OwncloudDolphinPlugin(QObject* parent, const QList<QVariant>&) : KOverlayIconPlugin(parent) {
+    explicit OwncloudDolphinPlugin(QObject* parent = 0) : KOverlayIconPlugin(parent) {
         connect(&m_socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
         tryConnect();
     }
 
-    virtual QStringList getOverlays(const KFileItem& item) {
-        auto url = item.url();
+    virtual QStringList getOverlays(const QUrl& url) override {
         if (!url.isLocalFile())
             return QStringList();
         const QByteArray localFile = url.toLocalFile().toUtf8();
@@ -122,7 +121,4 @@ private slots:
     }
 };
 
-K_PLUGIN_FACTORY(OwncloudDolphinPluginFactory, registerPlugin<OwncloudDolphinPlugin>();)
-K_EXPORT_PLUGIN(OwncloudDolphinPluginFactory("ownclouddolhpinplugin"))
-
 #include "ownclouddolphinplugin.moc"
diff --git a/shell_integration/dolphin_kf5/ownclouddolphinplugin.json b/shell_integration/dolphin_kf5/ownclouddolphinplugin.json
new file mode 100644 (file)
index 0000000..a0e25f8
--- /dev/null
@@ -0,0 +1,8 @@
+{
+    "KPlugin": {
+        "Description": "Overlay icon for owncloud",
+        "ServiceTypes": [
+            "KOverlayIconPlugin"
+        ]
+    }
+}
\ No newline at end of file