From 731d4b3d4dc95868f4916978faa62d8448ea4952 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 19 Oct 2015 08:57:25 +0200 Subject: [PATCH] Dolphin shell extention: adapt to the change in KDE Frameworks --- shell_integration/dolphin_kf5/CMakeLists.txt | 10 ++++------ .../dolphin_kf5/ownclouddolphinplugin.cpp | 14 +++++--------- .../dolphin_kf5/ownclouddolphinplugin.json | 8 ++++++++ 3 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 shell_integration/dolphin_kf5/ownclouddolphinplugin.json diff --git a/shell_integration/dolphin_kf5/CMakeLists.txt b/shell_integration/dolphin_kf5/CMakeLists.txt index b896d4d0c..0a22cbe81 100644 --- a/shell_integration/dolphin_kf5/CMakeLists.txt +++ b/shell_integration/dolphin_kf5/CMakeLists.txt @@ -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) diff --git a/shell_integration/dolphin_kf5/ownclouddolphinplugin.cpp b/shell_integration/dolphin_kf5/ownclouddolphinplugin.cpp index c542e7b45..c039bd42e 100644 --- a/shell_integration/dolphin_kf5/ownclouddolphinplugin.cpp +++ b/shell_integration/dolphin_kf5/ownclouddolphinplugin.cpp @@ -17,30 +17,29 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************/ -#include +#include #include -#include #include #include - class OwncloudDolphinPlugin : public KOverlayIconPlugin { + Q_PLUGIN_METADATA(IID "com.owncloud.ovarlayiconplugin" FILE "ownclouddolphinplugin.json"); Q_OBJECT + QLocalSocket m_socket; typedef QHash StatusMap; StatusMap m_status; QByteArray m_line; public: - explicit OwncloudDolphinPlugin(QObject* parent, const QList&) : 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();) -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 index 000000000..a0e25f82f --- /dev/null +++ b/shell_integration/dolphin_kf5/ownclouddolphinplugin.json @@ -0,0 +1,8 @@ +{ + "KPlugin": { + "Description": "Overlay icon for owncloud", + "ServiceTypes": [ + "KOverlayIconPlugin" + ] + } +} \ No newline at end of file