mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +03:00
Dolphin shell extention: adapt to the change in KDE Frameworks
This commit is contained in:
parent
cac219aca8
commit
731d4b3d4d
3 changed files with 17 additions and 15 deletions
|
@ -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(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons KIO)
|
||||||
|
|
||||||
find_package(DolphinVcs REQUIRED)
|
|
||||||
|
|
||||||
set_package_properties(DolphinVcs PROPERTIES
|
set_package_properties(DolphinVcs PROPERTIES
|
||||||
DESCRIPTION "the Dolphin plugin library"
|
DESCRIPTION "the Dolphin plugin library"
|
||||||
URL "http://dolphin.kde.org/"
|
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_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
|
||||||
|
|
||||||
add_library(ownclouddolphinplugin MODULE ownclouddolphinplugin.cpp)
|
kcoreaddons_add_plugin(ownclouddolphinplugin INSTALL_NAMESPACE "kf5/overlayicon" JSON ownclouddolphinplugin.json SOURCES ownclouddolphinplugin.cpp)
|
||||||
target_link_libraries(ownclouddolphinplugin DolphinVcs Qt5::Network KF5::CoreAddons KF5::KIOCore)
|
target_link_libraries(ownclouddolphinplugin Qt5::Network KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets)
|
||||||
install(FILES ownclouddolphinplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
|
|
||||||
install(TARGETS ownclouddolphinplugin DESTINATION ${KDE_INSTALL_PLUGINDIR})
|
|
||||||
|
|
||||||
|
|
||||||
add_library(ownclouddolphinpluginaction MODULE ownclouddolphinpluginaction.cpp)
|
add_library(ownclouddolphinpluginaction MODULE ownclouddolphinpluginaction.cpp)
|
||||||
target_link_libraries(ownclouddolphinpluginaction Qt5::Network KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets)
|
target_link_libraries(ownclouddolphinpluginaction Qt5::Network KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets)
|
||||||
|
|
|
@ -17,30 +17,29 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include <Dolphin/KOverlayIconPlugin>
|
#include <KOverlayIconPlugin>
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
#include <KPluginLoader>
|
|
||||||
#include <QtNetwork/QLocalSocket>
|
#include <QtNetwork/QLocalSocket>
|
||||||
#include <KIOCore/kfileitem.h>
|
#include <KIOCore/kfileitem.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class OwncloudDolphinPlugin : public KOverlayIconPlugin
|
class OwncloudDolphinPlugin : public KOverlayIconPlugin
|
||||||
{
|
{
|
||||||
|
Q_PLUGIN_METADATA(IID "com.owncloud.ovarlayiconplugin" FILE "ownclouddolphinplugin.json");
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
QLocalSocket m_socket;
|
QLocalSocket m_socket;
|
||||||
typedef QHash<QByteArray, QByteArray> StatusMap;
|
typedef QHash<QByteArray, QByteArray> StatusMap;
|
||||||
StatusMap m_status;
|
StatusMap m_status;
|
||||||
QByteArray m_line;
|
QByteArray m_line;
|
||||||
|
|
||||||
public:
|
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()));
|
connect(&m_socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
|
||||||
tryConnect();
|
tryConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QStringList getOverlays(const KFileItem& item) {
|
virtual QStringList getOverlays(const QUrl& url) override {
|
||||||
auto url = item.url();
|
|
||||||
if (!url.isLocalFile())
|
if (!url.isLocalFile())
|
||||||
return QStringList();
|
return QStringList();
|
||||||
const QByteArray localFile = url.toLocalFile().toUtf8();
|
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"
|
#include "ownclouddolphinplugin.moc"
|
||||||
|
|
8
shell_integration/dolphin_kf5/ownclouddolphinplugin.json
Normal file
8
shell_integration/dolphin_kf5/ownclouddolphinplugin.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"KPlugin": {
|
||||||
|
"Description": "Overlay icon for owncloud",
|
||||||
|
"ServiceTypes": [
|
||||||
|
"KOverlayIconPlugin"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue