Commit 741abafa authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Move the plugins into a different top-ĺevel directory

Reviewed by Albert Vaca
parent 232c4383
......@@ -2,6 +2,8 @@ project(kdeconnect)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(KDE4 REQUIRED)
find_package(QJSON REQUIRED)
find_package(QCA2 REQUIRED)
......@@ -22,6 +24,7 @@ add_subdirectory(icon)
add_subdirectory(interfaces)
add_subdirectory(kded)
add_subdirectory(plugins)
add_subdirectory(plasmoid)
add_subdirectory(cli)
......
......@@ -3,12 +3,10 @@ project(KDEConnectCore)
include_directories(
${KDE4_KIO_LIBS}
${QJSON_INCLUDE_DIR}
${QCA2_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${QCA2_INCLUDE_DIR}
)
add_subdirectory(plugins)
add_subdirectory(backends/lan)
add_subdirectory(backends/loopback)
......@@ -18,8 +16,8 @@ set(kded_kdeconnect_SRCS
backends/linkprovider.cpp
backends/devicelink.cpp
plugins/kdeconnectplugin.cpp
plugins/pluginloader.cpp
kdeconnectplugin.cpp
pluginloader.cpp
networkpackage.cpp
filetransferjob.cpp
......@@ -39,9 +37,10 @@ PRIVATE
${QT_QTNETWORK_LIBRARY}
${QCA2_LIBRARIES}
)
target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
generate_export_header(kdeconnectcore EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectcore_export.h BASE_NAME KDEConnectCore)
include(../macros.cmake)
include(macros)
generate_and_install_dbus_interface(
kdeconnectcore
......
......@@ -36,8 +36,8 @@
#include <KIcon>
#include "kdebugnamespace.h"
#include "plugins/kdeconnectplugin.h"
#include "plugins/pluginloader.h"
#include "kdeconnectplugin.h"
#include "pluginloader.h"
#include "backends/devicelink.h"
#include "backends/linkprovider.h"
#include "networkpackage.h"
......@@ -483,4 +483,4 @@ QString Device::type2str(Device::DeviceType deviceType) {
if (deviceType == Phone) return "phone";
if (deviceType == Tablet) return "tablet";
return "unknown";
}
\ No newline at end of file
}
......@@ -20,12 +20,20 @@
#include "kdeconnectplugin.h"
#include "../device.h"
struct KdeConnectPluginPrivate
{
Device* mDevice;
// The Initializer object sets things up, and also does cleanup when it goes out of scope
// Since the plugins use their own memory, they need their own initializer in order to send encrypted packages
QCA::Initializer init;
};
KdeConnectPlugin::KdeConnectPlugin(QObject* parent, const QVariantList& args)
: QObject(parent)
, d(new KdeConnectPluginPrivate)
{
mDevice = qvariant_cast< Device* >(args.first());
d->mDevice = qvariant_cast< Device* >(args.first());
}
KdeConnectPlugin::~KdeConnectPlugin()
......@@ -34,10 +42,10 @@ KdeConnectPlugin::~KdeConnectPlugin()
Device* KdeConnectPlugin::device()
{
return mDevice;
return d->mDevice;
}
Device const* KdeConnectPlugin::device() const
{
return mDevice;
return d->mDevice;
}
......@@ -24,14 +24,16 @@
#include <QObject>
#include <QVariantList>
#include <kdemacros.h>
#include <KPluginFactory>
#include <KPluginLoader>
#include "../networkpackage.h"
#include "../device.h"
#include "kdeconnectcore_export.h"
#include "networkpackage.h"
#include "device.h"
class KDE_EXPORT KdeConnectPlugin
struct KdeConnectPluginPrivate;
class KDECONNECTCORE_EXPORT KdeConnectPlugin
: public QObject
{
Q_OBJECT
......@@ -57,11 +59,7 @@ public Q_SLOTS:
virtual void connected() = 0;
private:
Device* mDevice;
// The Initializer object sets things up, and also does cleanup when it goes out of scope
// Since the plugins use their own memory, they need their own initializer in order to send encrypted packages
QCA::Initializer init;
QScopedPointer<KdeConnectPluginPrivate> d;
};
......
......@@ -22,8 +22,8 @@
#include <KServiceTypeTrader>
#include "../kdebugnamespace.h"
#include "../device.h"
#include "kdebugnamespace.h"
#include "device.h"
#include "kdeconnectplugin.h"
PluginLoader* PluginLoader::instance()
......
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/core ${QCA2_INCLUDE_DIR})
install(FILES kdeconnect_plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
add_subdirectory(ping)
......
......@@ -10,7 +10,7 @@ target_link_libraries(kdeconnect_battery kdeconnectcore ${KDE4_KDEUI_LIBS})
install(TARGETS kdeconnect_battery DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_battery.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
include(../../../macros.cmake)
include(macros)
generate_and_install_dbus_interface(
kdeconnect_battery
......
......@@ -20,7 +20,7 @@
#include "batterydbusinterface.h"
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
BatteryDbusInterface::BatteryDbusInterface(QObject *parent)
: QDBusAbstractAdaptor(parent)
......
......@@ -24,7 +24,7 @@
#include <KIcon>
#include <KLocalizedString>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
#include "batterydbusinterface.h"
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< BatteryPlugin >(); )
......
......@@ -21,7 +21,7 @@
#ifndef BATTERYPLUGIN_H
#define BATTERYPLUGIN_H
#include "../kdeconnectplugin.h"
#include <core/kdeconnectplugin.h>
#define PACKAGE_TYPE_BATTERY QLatin1String("kdeconnect.battery")
......
......@@ -24,9 +24,7 @@
#include <QObject>
#include <QClipboard>
#include "../kdeconnectplugin.h"
#include "../../networkpackage.h"
#include "../../device.h"
#include <core/kdeconnectplugin.h>
#define PACKAGE_TYPE_CLIPBOARD QLatin1String("kdeconnect.clipboard")
......
......@@ -28,7 +28,8 @@
#include <QDBusReply>
#include <QDBusMessage>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
#include <core/device.h>
#include "mprisdbusinterface.h"
#include "propertiesdbusinterface.h"
......
......@@ -24,7 +24,7 @@
#include <QString>
#include <QHash>
#include "../kdeconnectplugin.h"
#include <core/kdeconnectplugin.h>
#define PACKAGE_TYPE_MPRIS QLatin1String("kdeconnect.mpris")
......
......@@ -11,7 +11,7 @@ target_link_libraries(kdeconnect_notifications kdeconnectcore ${KDE4_KDEUI_LIBS}
install(TARGETS kdeconnect_notifications DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_notifications.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
include(../../../macros.cmake)
include(macros)
generate_and_install_dbus_interface(
kdeconnect_notifications
notificationsdbusinterface.h
......
......@@ -22,7 +22,7 @@
#include <QDBusConnection>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
Notification::Notification(const NetworkPackage& np, const QString& iconPath, QObject* parent)
: QObject(parent)
......
......@@ -24,7 +24,7 @@
#include <QObject>
#include <QString>
#include "../../networkpackage.h"
#include <core/networkpackage.h>
class Notification
: public QObject
......
......@@ -26,8 +26,8 @@
#include <KIcon>
#include <KMD5>
#include "../../kdebugnamespace.h"
#include "../../filetransferjob.h"
#include <core/kdebugnamespace.h>
#include <core/filetransferjob.h>
#include "notificationsplugin.h"
NotificationsDbusInterface::NotificationsDbusInterface(Device* device, QObject *parent)
......
......@@ -27,7 +27,7 @@
#include <QStringList>
#include <QDir>
#include "../../device.h"
#include <core/device.h>
#include "notification.h"
class NotificationsDbusInterface
......
......@@ -22,7 +22,7 @@
#include <KIcon>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
#include "notificationsdbusinterface.h"
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< NotificationsPlugin >(); )
......
......@@ -23,7 +23,7 @@
#include <knotification.h>
#include "../kdeconnectplugin.h"
#include <core/kdeconnectplugin.h>
#define PACKAGE_TYPE_NOTIFICATION QLatin1String("kdeconnect.notification")
/*
......
set(kdeconnect_pausemusic_SRCS
pausemusicplugin.cpp
../kdeconnectplugin.cpp
../../kdebugnamespace.cpp
)
kde4_add_plugin(kdeconnect_pausemusic ${kdeconnect_pausemusic_SRCS})
target_link_libraries(kdeconnect_pausemusic
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${QT_QTNETWORK_LIBRARY}
${QJSON_LIBRARIES}
${QCA2_LIBRARIES}
kdeconnectcore
)
install(TARGETS kdeconnect_pausemusic DESTINATION ${PLUGIN_INSTALL_DIR} )
......
......@@ -24,7 +24,7 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
#include "ui_pausemusic_config.h"
......
......@@ -29,7 +29,8 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
#include <core/networkpackage.h>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PauseMusicPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_pausemusic", "kdeconnect-kded") )
......
......@@ -25,7 +25,7 @@
#include <QSet>
#include <QString>
#include "../kdeconnectplugin.h"
#include <core/kdeconnectplugin.h>
class PauseMusicPlugin
: public KdeConnectPlugin
......
......@@ -24,7 +24,8 @@
#include <KIcon>
#include <KLocalizedString>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
#include <core/device.h>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PingPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_ping", "kdeconnect-kded") )
......
......@@ -23,7 +23,7 @@
#include <QObject>
#include "../kdeconnectplugin.h"
#include <core/kdeconnectplugin.h>
class KDE_EXPORT PingPlugin
: public KdeConnectPlugin
......
......@@ -11,7 +11,7 @@ target_link_libraries(kdeconnect_sftp kdeconnectcore ${KDE4_KFILE_LIBS})
install(TARGETS kdeconnect_sftp DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_sftp.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
include(../../../macros.cmake)
include(macros)
generate_and_install_dbus_interface(
kdeconnect_sftp
......
......@@ -24,7 +24,7 @@
#include <KLocalizedString>
#include <KStandardDirs>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
#include "mounter.h"
......
......@@ -27,7 +27,7 @@
#include <KStandardDirs>
#include "sftpplugin.h"
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
#include "ui_sftp_config.h"
......
......@@ -35,7 +35,7 @@
#include "sftp_config.h"
#include "mounter.h"
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< SftpPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_sftp", "kdeconnect-kded") )
......
......@@ -21,7 +21,8 @@
#ifndef SFTPPLUGIN_H
#define SFTPPLUGIN_H
#include "../kdeconnectplugin.h"
#include <core/kdeconnectplugin.h>
#include <core/device.h>
#define PACKAGE_TYPE_SFTP QLatin1String("kdeconnect.sftp")
......
......@@ -23,7 +23,7 @@
#include <QFile>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
class AutoClosingQFile : public QFile
{
......
......@@ -26,7 +26,7 @@
#include <KSharedConfig>
#include <KUrlRequester>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
#include "ui_share_config.h"
......
......@@ -33,8 +33,8 @@
#include <QDesktopServices>
#include <QDBusConnection>
#include "../../kdebugnamespace.h"
#include "../../filetransferjob.h"
#include <core/kdebugnamespace.h>
#include <core/filetransferjob.h>
#include "autoclosingqfile.h"
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< SharePlugin >(); )
......
......@@ -24,7 +24,7 @@
#include <KNotification>
#include <KIO/Job>
#include "../kdeconnectplugin.h"
#include <core/kdeconnectplugin.h>
#define PACKAGE_TYPE_SHARE QLatin1String("kdeconnect.share")
......
......@@ -23,7 +23,7 @@
#include <KLocalizedString>
#include <KIcon>
#include "../../kdebugnamespace.h"
#include <core/kdebugnamespace.h>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< TelephonyPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_telephony", "kdeconnect-kded") )
......
......@@ -23,7 +23,7 @@
#include <knotification.h>
#include "../kdeconnectplugin.h"
#include <core/kdeconnectplugin.h>
#include <KStatusNotifierItem>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment