First approach to a KF5 port of KDE Connect

Ported using KDELibs4Support, for a smaller delta, so we can keep
developing on master until we decide not to.

At the moment, it builds and installs but tests don't pass because
of a QCA2 initialization problem I didn't manage to debug yet.

CCMAIL: kdeconnect@kde.org
This commit is contained in:
Aleix Pol 2014-06-16 20:02:07 +02:00
parent 734b27ed50
commit a1a560c469
52 changed files with 237 additions and 157 deletions

View file

@ -1,20 +1,24 @@
project(kdeconnect)
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.12)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(ECM 0.0.9 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake)
find_package(KDE4 REQUIRED)
find_package(QJSON REQUIRED)
find_package(Qt5 5.2 REQUIRED COMPONENTS Qml Quick Xml Svg OpenGL PrintSupport Test)
find_package(KF5 REQUIRED COMPONENTS I18n KIO Notifications ConfigWidgets DBusAddons KCMUtils KDELibs4Support)
find_package(QCA2 REQUIRED)
find_package(QJSON REQUIRED)
#if(CMAKE_COMPILER_IS_GNUCXX)
# add_definitions(-std=gnu++0x)
#endif()
include(KDEInstallDirs)
include(KDECompilerSettings)
include(KDECMakeSettings)
include(ECMAddTests)
include(ECMSetupVersion)
include(ECMInstallIcons)
include(FeatureSummary)
include(GenerateExportHeader)
include(KDE4Defaults)
include_directories(${KDE4_INCLUDES})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(core)

View file

@ -2,6 +2,6 @@ include_directories(${CMAKE_SOURCE_DIR})
add_executable(kdeconnect-cli kdeconnect-cli.cpp)
target_link_libraries(kdeconnect-cli kdeconnectinterfaces ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBS})
target_link_libraries(kdeconnect-cli kdeconnectinterfaces Qt5::Gui ${KDE4_KDEUI_LIBS})
install(TARGETS kdeconnect-cli ${INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -21,6 +21,7 @@
#include <KApplication>
#include <KUrl>
#include <kcmdlineargs.h>
#include <k4aboutdata.h>
#include <kaboutdata.h>
#include <interfaces/devicesmodel.h>
#include <iostream>
@ -29,8 +30,8 @@
int main(int argc, char** argv)
{
KAboutData about("kctool", 0, ki18n(("kctool")), "1.0", ki18n("KDE Connect CLI tool"),
KAboutData::License_GPL, ki18n("(C) 2013 Aleix Pol Gonzalez"));
K4AboutData about("kctool", 0, ki18n(("kctool")), "1.0", ki18n("KDE Connect CLI tool"),
K4AboutData::License_GPL, ki18n("(C) 2013 Aleix Pol Gonzalez"));
about.addAuthor( ki18n("Aleix Pol Gonzalez"), KLocalizedString(), "aleixpol@kde.org" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;

48
cmake/FindQCA2.cmake Normal file
View file

@ -0,0 +1,48 @@
# - Try to find QCA2 (Qt Cryptography Architecture 2)
# Once done this will define
#
# QCA2_FOUND - system has QCA2
# QCA2_INCLUDE_DIR - the QCA2 include directory
# QCA2_LIBRARIES - the libraries needed to use QCA2
# QCA2_DEFINITIONS - Compiler switches required for using QCA2
#
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
# Copyright (c) 2006, Michael Larouche, <michael.larouche@kdemail.net>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include(FindLibraryWithDebug)
if (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES)
# in cache already
set(QCA2_FOUND TRUE)
else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES)
if (NOT WIN32)
find_package(PkgConfig)
pkg_check_modules(PC_QCA2 QUIET qca2)
set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER})
endif (NOT WIN32)
find_library_with_debug(QCA2_LIBRARIES
WIN32_DEBUG_POSTFIX d
NAMES qca
HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS}
)
find_path(QCA2_INCLUDE_DIR QtCrypto
HINTS ${PC_QCA2_INCLUDEDIR} ${PC_QCA2_INCLUDE_DIRS}
PATH_SUFFIXES QtCrypto)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QCA2 DEFAULT_MSG QCA2_LIBRARIES QCA2_INCLUDE_DIR)
mark_as_advanced(QCA2_INCLUDE_DIR QCA2_LIBRARIES)
endif (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES)

View file

@ -1,15 +1,13 @@
include(KDE4Defaults)
macro (generate_and_install_dbus_interface main_project_target header_file output_xml_file) #OPTIONS qdbus_options
QT4_EXTRACT_OPTIONS(
extra_files_ignore
qdbus_options
${ARGN}
)
qt4_generate_dbus_interface(
# qt5_extract_options(
# extra_files_ignore
# qdbus_options
# ${ARGN}
# )
qt5_generate_dbus_interface(
${header_file}
${output_xml_file}
OPTIONS ${qdbus_options}
# OPTIONS ${qdbus_options}
)
add_custom_target(
${output_xml_file}
@ -23,4 +21,4 @@ macro (generate_and_install_dbus_interface main_project_target header_file outpu
${main_project_target}
${output_xml_file}
)
endmacro (generate_and_install_dbus_interface)
endmacro ()

View file

@ -1,7 +1,6 @@
project(KDEConnectCore)
include_directories(
${KDE4_KIO_LIBS}
${QJSON_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${QCA2_INCLUDE_DIR}
@ -26,15 +25,16 @@ set(kded_kdeconnect_SRCS
kdebugnamespace.cpp
)
kde4_add_library(kdeconnectcore SHARED ${kded_kdeconnect_SRCS})
add_library(kdeconnectcore SHARED ${kded_kdeconnect_SRCS})
target_link_libraries(kdeconnectcore
PUBLIC
${KDE4_KDECORE_LIBS}
KF5::KDELibs4Support
PRIVATE
${KDE4_KIO_LIBS}
KF5::KIOWidgets
KF5::KCMUtils
Qt5::Network
${QJSON_LIBRARIES}
${QT_QTNETWORK_LIBRARY}
${QCA2_LIBRARIES}
)
target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

View file

@ -80,7 +80,7 @@ Daemon::Daemon(QObject *parent)
const QFile::Permissions strict = QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::WriteUser;
if (!config->group("myself").hasKey("privateKeyPath"))
{
const QString privateKeyPath = KStandardDirs::locateLocal("appdata", "key.pem", true, KComponentData("kdeconnect", "kdeconnect"));
const QString privateKeyPath = KStandardDirs::locateLocal("appdata", "key.pem", true);
QFile privKey(privateKeyPath);

View file

@ -25,7 +25,6 @@
#include <QSet>
#include <QMap>
#include <KDEDModule>
#include <KPluginFactory>
#include "kdeconnectcore_export.h"

View file

@ -34,6 +34,8 @@
#include <KServiceTypeTrader>
#include <KNotification>
#include <KIcon>
#include <KGlobal>
#include <KComponentData>
#include "kdebugnamespace.h"
#include "kdeconnectplugin.h"
@ -82,7 +84,7 @@ Device::Device(QObject* parent, const NetworkPackage& identityPackage, DeviceLin
void Device::initPrivateKey()
{
//TODO: It is redundant to have our own private key in every instance of Device, move this to a singleton somewhere (Daemon?)
const QString privateKeyPath = KStandardDirs::locateLocal("appdata", "key.pem", true, KComponentData("kdeconnect", "kdeconnect"));
const QString privateKeyPath = KStandardDirs::locateLocal("appdata", "key.pem", true);
QFile privKey(privateKeyPath);
privKey.open(QIODevice::ReadOnly);
m_privateKey = QCA::PrivateKey::fromPEM(privKey.readAll());
@ -353,7 +355,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
KNotification* notification = new KNotification("pingReceived"); //KNotification::Persistent
notification->setPixmap(KIcon("dialog-information").pixmap(48, 48));
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
notification->setComponentName("kdeconnect");
notification->setTitle("KDE Connect");
notification->setText(i18n("Pairing request from %1", m_deviceName));
notification->setActions(QStringList() << i18n("Accept") << i18n("Reject"));

View file

@ -64,17 +64,17 @@ void FileTransferJob::doStart()
KUrl destCheck = mDestination;
if (QFile::exists(destCheck.path())) {
QFileInfo destInfo(destCheck.path());
KIO::RenameDialog *dialog = new KIO::RenameDialog(0,
KIO::RenameDialog *dialog = new KIO::RenameDialog(Q_NULLPTR,
i18n("Incoming file exists"),
KUrl(mDeviceName + ":/" + destCheck.fileName()),
QUrl(mDeviceName + ":/" + destCheck.fileName()),
destCheck,
KIO::M_OVERWRITE,
KIO::RenameDialog_Overwrite,
mSize,
destInfo.size(),
-1,
destInfo.created().toTime_t(),
-1,
destInfo.lastModified().toTime_t()
QDateTime(),
destInfo.created(),
QDateTime(),
destInfo.lastModified()
);
connect(this, SIGNAL(finished(KJob*)), dialog, SLOT(deleteLater()));
connect(dialog, SIGNAL(finished(int)), SLOT(renameDone(int)));

View file

@ -58,7 +58,7 @@ private:
QSharedPointer<QIODevice> mOrigin;
KIO::FileJob* mDestinationJob;
QString mDeviceName;
KUrl mDestination;
QUrl mDestination;
QTime m_time;
qulonglong m_speedBytes;
int mSize;

View file

@ -22,6 +22,7 @@
#define KDEBUG_KDECONNECT_KDED_H
#include <KDebug>
#include <kdemacros.h>
KDE_EXPORT int kdeconnect_kded();

View file

@ -1,6 +1,6 @@
include_directories(${CMAKE_SOURCE_DIR})
kde4_add_plugin(kdeconnectfiletiemaction sendfileitemaction.cpp)
target_link_libraries(kdeconnectfiletiemaction ${KDE4_KIO_LIBS} kdeconnectinterfaces)
add_library(kdeconnectfiletiemaction MODULE sendfileitemaction.cpp)
target_link_libraries(kdeconnectfiletiemaction KF5::KIOWidgets kdeconnectinterfaces)
install(TARGETS kdeconnectfiletiemaction DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES kdeconnectsendfile.desktop DESTINATION ${SERVICES_INSTALL_DIR})

View file

@ -36,6 +36,7 @@
#include <KDebug>
#include <KProcess>
#include <KLocalizedString>
#include <KUrl>
K_PLUGIN_FACTORY(SendFileItemActionFactory, registerPlugin<SendFileItemAction>();)
K_EXPORT_PLUGIN(SendFileItemActionFactory("SendFileItemAction", "kdeconnectfiletiemaction"))
@ -86,3 +87,5 @@ void SendFileItemAction::sendFile()
QDBusConnection::sessionBus().call(msg);
}
}
#include "sendfileitemaction.moc"

View file

@ -1,2 +1,2 @@
kde4_install_icons(${ICON_INSTALL_DIR})
ecm_install_icons(${ICON_INSTALL_DIR})

View file

@ -45,14 +45,14 @@ set_source_files_properties(
${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.notification.xml
PROPERTIES NO_NAMESPACE true
)
qt4_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.daemon.xml daemoninterface)
qt4_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.device.xml deviceinterface)
qt4_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/battery/org.kde.kdeconnect.device.battery.xml devicebatteryinterface )
qt4_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/sftp/org.kde.kdeconnect.device.sftp.xml devicesftpinterface )
qt4_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.xml devicenotificationsinterface )
qt4_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.notification.xml notificationinterface )
qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.daemon.xml daemoninterface)
qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.device.xml deviceinterface)
qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/battery/org.kde.kdeconnect.device.battery.xml devicebatteryinterface )
qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/sftp/org.kde.kdeconnect.device.sftp.xml devicesftpinterface )
qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.xml devicenotificationsinterface )
qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.notification.xml notificationinterface )
kde4_add_library(kdeconnectinterfaces SHARED ${libkdeconnect_SRC})
add_library(kdeconnectinterfaces SHARED ${libkdeconnect_SRC})
set_target_properties(kdeconnectinterfaces PROPERTIES
VERSION ${KDECONNECT_VERSION}
SOVERSION ${KDECONNECT_VERSION_MAJOR}
@ -71,16 +71,18 @@ add_dependencies(kdeconnectinterfaces
target_link_libraries(kdeconnectinterfaces
${KDE4_KDEUI_LIBS}
${QT_QTCORE_LIBRARY}
${QT_QTDBUS_LIBRARY}
${KDE4_KDECORE_LIBS}
Qt5::Core
Qt5::DBus
${QJSON_LIBRARIES}
)
configure_file(KDEConnectConfig.cmake.in ${CMAKE_BINARY_DIR}/interfaces/KDEConnectConfig.cmake @ONLY)
macro_write_basic_cmake_version_file(${CMAKE_BINARY_DIR}/interfaces/KDEConnectConfigVersion.cmake
${KDECONNECT_VERSION_MAJOR} ${KDECONNECT_VERSION_MINOR} ${KDECONNECT_VERSION_PATCH})
ecm_setup_version( "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}" VARIABLE_PREFIX KDECONNECTINTERFACES
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterfaces_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDEConnectConfigVersion.cmake"
SOVERSION ${KDECONNECT_VERSION_MAJOR})
install(TARGETS kdeconnectinterfaces EXPORT kdeconnectLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -10,15 +10,15 @@ set(kcm_SRCS
kdebugnamespace.cpp
)
kde4_add_ui_files(kcm_SRCS kcm.ui)
qt5_wrap_ui(kcm_SRCS kcm.ui)
kde4_add_plugin(kcm_kdeconnect ${kcm_SRCS})
add_library(kcm_kdeconnect MODULE ${kcm_SRCS})
target_link_libraries(kcm_kdeconnect
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
Qt5::Core
Qt5::Gui
${KDE4_KDEUI_LIBRARY}
${KDE4_KCMUTILS_LIBS}
KF5::KCMUtils
kdeconnectinterfaces
)

View file

@ -20,19 +20,21 @@
#include "kcm.h"
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QAction>
#include <QtGui/QStackedLayout>
#include <QtGui/QListView>
#include <QLabel>
#include <QMenu>
#include <QMenuBar>
#include <QAction>
#include <QStackedLayout>
#include <QListView>
#include <QDBusConnection>
#include <QDBusInterface>
#include <KServiceTypeTrader>
#include <KPluginInfo>
#include <KPluginFactory>
#include <KAboutData>
#include <KStandardDirs>
#include <KLocalizedString>
#include "ui_kcm.h"
#include "interfaces/dbusinterfaces.h"
@ -44,7 +46,7 @@ K_PLUGIN_FACTORY(KdeConnectKcmFactory, registerPlugin<KdeConnectKcm>();)
K_EXPORT_PLUGIN(KdeConnectKcmFactory("kdeconnect-kcm", "kdeconnect-kcm"))
KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList&)
: KCModule(KdeConnectKcmFactory::componentData(), parent)
: KCModule(KAboutData::pluginData("kdeconnect-kcm"), parent)
, kcmUi(new Ui::KdeConnectKcmUi())
, devicesModel(new DevicesModel(this))
, currentDevice(0)
@ -252,3 +254,6 @@ void KdeConnectKcm::sendPing()
if (!currentDevice) return;
currentDevice->sendPing();
}
#include "kcm.moc"
#include "moc_kcm.cpp"

View file

@ -1,11 +1,11 @@
include_directories(${CMAKE_SOURCE_DIR})
kde4_add_executable(kdeconnectd kdeconnectd.cpp)
target_link_libraries(kdeconnectd kdeconnectcore ${KDE4_KDEUI_LIBS})
add_executable(kdeconnectd kdeconnectd.cpp)
target_link_libraries(kdeconnectd kdeconnectcore KF5::ConfigWidgets)
kde4_add_plugin(kded_kdeconnect kded.cpp)
add_library(kded_kdeconnect MODULE kded.cpp)
target_link_libraries(kded_kdeconnect ${KDE4_KDECORE_LIBS})
target_link_libraries(kded_kdeconnect KF5::DBusAddons KF5::KDELibs4Support)
install(TARGETS kdeconnectd DESTINATION ${LIBEXEC_INSTALL_DIR})
install(TARGETS kded_kdeconnect DESTINATION ${PLUGIN_INSTALL_DIR})

View file

@ -25,7 +25,7 @@
#include <QSocketNotifier>
#include <KUniqueApplication>
#include <KAboutData>
#include <k4aboutdata.h>
#include <KCmdLineArgs>
#include "core/daemon.h"
@ -59,11 +59,11 @@ void initializeTermHandlers(QCoreApplication* app, Daemon* daemon)
int main(int argc, char* argv[])
{
KAboutData aboutData("kdeconnect", "kdeconnect-kded",
K4AboutData aboutData("kdeconnect", "kdeconnect-kded",
ki18n("kdeconnect"),
"0.1",
ki18n("Connect your devices and KDE"),
KAboutData::License_GPL,
K4AboutData::License_GPL,
KLocalizedString(),
KLocalizedString(),
"http://albertvaka.wordpress.com");

View file

@ -118,3 +118,5 @@ void Kded::checkIfDaemonTerminated()
m_daemon->kill();
kWarning(theArea) << "Daemon killed";
}
#include "kded.moc"

View file

@ -4,14 +4,13 @@ set(kio_kdeconnect_PART_SRCS
kiokdeconnect.cpp
kdebugnamespace.cpp)
kde4_add_plugin(kio_kdeconnect ${kio_kdeconnect_PART_SRCS})
add_library(kio_kdeconnect MODULE ${kio_kdeconnect_PART_SRCS})
target_link_libraries(kio_kdeconnect
${KDE4_KDECORE_LIBS}
${KDE4_KIO_LIBRARY}
${KDE4_KDEUI_LIBRARY}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
KF5::KIOCore
KF5::KDELibs4Support
Qt5::Core
Qt5::Gui
kdeconnectinterfaces
)

View file

@ -27,16 +27,17 @@
#include <KDebug>
#include <KComponentData>
#include <KCmdLineArgs>
#include <KAboutData>
#include <KProcess>
#include <KApplication>
#include <KLocale>
#include <k4aboutdata.h>
#include <kdemacros.h>
#include "kdebugnamespace.h"
extern "C" int KDE_EXPORT kdemain(int argc, char **argv)
{
KAboutData about("kiokdeconnect", "kdeconnect-kio", ki18n("kiokdeconnect"), "1.0");
K4AboutData about("kiokdeconnect", "kdeconnect-kio", ki18n("kiokdeconnect"), "1.0");
KCmdLineArgs::init(&about);
KApplication app;
@ -182,7 +183,7 @@ void KioKdeconnect::listDevice()
void KioKdeconnect::listDir(const KUrl &url)
void KioKdeconnect::listDir(const QUrl &url)
{
kDebug(kdeconnect_kio()) << "Listing..." << url;
@ -204,7 +205,7 @@ void KioKdeconnect::listDir(const KUrl &url)
}
}
void KioKdeconnect::stat(const KUrl &url)
void KioKdeconnect::stat(const QUrl &url)
{
kDebug(kdeconnect_kio()) << "Stat: " << url;
@ -215,7 +216,7 @@ void KioKdeconnect::stat(const KUrl &url)
finished();
}
void KioKdeconnect::get(const KUrl &url)
void KioKdeconnect::get(const QUrl &url)
{
kDebug(kdeconnect_kio()) << "Get: " << url;
mimeType("");

View file

@ -34,9 +34,9 @@ class KioKdeconnect : public QObject, public KIO::SlaveBase
public:
KioKdeconnect(const QByteArray &pool, const QByteArray &app);
void get(const KUrl &url);
void listDir(const KUrl &url);
void stat(const KUrl &url);
void get(const QUrl &url);
void listDir(const QUrl &url);
void stat(const QUrl &url);
void setHost(const QString &constHostname, quint16 port, const QString &user, const QString &pass);

View file

@ -12,15 +12,12 @@ set(kdeconnectdeclarativeplugin_MOC
objectfactory.h
)
qt4_wrap_cpp(kdeconnectdeclarativeplugin_SRC ${kdeconnectdeclarativeplugin_MOC})
qt5_wrap_cpp(kdeconnectdeclarativeplugin_SRC ${kdeconnectdeclarativeplugin_MOC})
kde4_add_library(kdeconnectdeclarativeplugin SHARED ${kdeconnectdeclarativeplugin_SRC})
add_library(kdeconnectdeclarativeplugin SHARED ${kdeconnectdeclarativeplugin_SRC})
target_link_libraries(kdeconnectdeclarativeplugin
${KDE4_KDEUI_LIBS}
${KDE4_KDECORE_LIBS}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTDECLARATIVE_LIBRARY}
Qt5::Qml
Qt5::Gui
kdeconnectinterfaces
)
install(TARGETS kdeconnectdeclarativeplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/kdeconnect)

View file

@ -20,11 +20,11 @@
#include "kdeconnectdeclarativeplugin.h"
#include <QtDeclarative/QDeclarativeItem>
#include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeContext>
#include <QQmlEngine>
#include <QQmlContext>
#include <QDBusPendingCall>
#include <QDBusPendingReply>
#include <QtQml>
#include "objectfactory.h"
#include "responsewaiter.h"
@ -32,8 +32,6 @@
#include "interfaces/devicesmodel.h"
#include "interfaces/notificationsmodel.h"
Q_EXPORT_PLUGIN2(kdeconnectdeclarativeplugin, KdeConnectDeclarativePlugin)
QObject* createDeviceDbusInterface(QVariant deviceId)
{
return new DeviceDbusInterface(deviceId.toString());
@ -63,9 +61,9 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri)
qmlRegisterType<DBusAsyncResponse>("org.kde.kdeconnect", 1, 0, "DBusAsyncResponse");
}
void KdeConnectDeclarativePlugin::initializeEngine(QDeclarativeEngine* engine, const char* uri)
void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri)
{
QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
QQmlExtensionPlugin::initializeEngine(engine, uri);
engine->rootContext()->setContextProperty("DeviceDbusInterfaceFactory"
, new ObjectFactory(engine, createDeviceDbusInterface));

View file

@ -21,12 +21,16 @@
#ifndef ANALITZADECLARATIVEPLUGIN_H
#define ANALITZADECLARATIVEPLUGIN_H
#include <QDeclarativeExtensionPlugin>
#include <QQmlExtensionPlugin>
class KdeConnectDeclarativePlugin : public QDeclarativeExtensionPlugin
class KdeConnectDeclarativePlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
virtual void registerTypes(const char* uri);
virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri);
virtual void initializeEngine(QQmlEngine *engine, const char *uri);
};

View file

@ -6,8 +6,6 @@
#include <QVariant>
#include <QTimer>
#include <QDeclarativeEngine>
class QDBusPendingCall;
class QDBusPendingCallWatcher;

View file

@ -3,7 +3,7 @@ set(kdeconnect_battery_SRCS
batterydbusinterface.cpp
)
kde4_add_plugin(kdeconnect_battery ${kdeconnect_battery_SRCS})
add_library(kdeconnect_battery MODULE ${kdeconnect_battery_SRCS})
target_link_libraries(kdeconnect_battery kdeconnectcore ${KDE4_KDEUI_LIBS})

View file

@ -73,7 +73,7 @@ bool BatteryPlugin::receivePackage(const NetworkPackage& np)
if ( thresholdEvent == ThresholdBatteryLow && !isCharging ) {
KNotification* notification = new KNotification("batteryLow");
notification->setPixmap(KIcon("battery-040").pixmap(48, 48));
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect-kded"));
notification->setComponentName("kdeconnect");
notification->setTitle(i18nc("device name: low battery", "%1: low battery", device()->name()));
notification->setText(i18n("Battery at %1%", currentCharge));
notification->sendEvent();
@ -83,3 +83,4 @@ bool BatteryPlugin::receivePackage(const NetworkPackage& np)
}
#include "batteryplugin.moc"

View file

@ -2,9 +2,9 @@ set(kdeconnect_clipboard_SRCS
clipboardplugin.cpp
)
kde4_add_plugin(kdeconnect_clipboard ${kdeconnect_clipboard_SRCS})
add_library(kdeconnect_clipboard MODULE ${kdeconnect_clipboard_SRCS})
target_link_libraries(kdeconnect_clipboard kdeconnectcore ${QT_QTGUI_LIBRARY})
target_link_libraries(kdeconnect_clipboard kdeconnectcore Qt5::Gui)
install(TARGETS kdeconnect_clipboard DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_clipboard.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -54,3 +54,5 @@ bool ClipboardPlugin::receivePackage(const NetworkPackage& np)
clipboard->setText(np.get<QString>("content"));
return true;
}
#include "clipboardplugin.moc"

View file

@ -2,19 +2,19 @@ set(kdeconnect_mpriscontrol_SRCS
mpriscontrolplugin.cpp
)
qt4_add_dbus_interface(
qt5_add_dbus_interface(
kdeconnect_mpriscontrol_SRCS
mprisdbusinterface.xml
mprisdbusinterface
)
qt4_add_dbus_interface(
qt5_add_dbus_interface(
kdeconnect_mpriscontrol_SRCS
propertiesInterface.xml
propertiesdbusinterface
)
kde4_add_plugin(kdeconnect_mpriscontrol ${kdeconnect_mpriscontrol_SRCS})
add_library(kdeconnect_mpriscontrol MODULE ${kdeconnect_mpriscontrol_SRCS})
target_link_libraries(kdeconnect_mpriscontrol kdeconnectcore)

View file

@ -215,3 +215,5 @@ void MprisControlPlugin::sendPlayerList()
np.set("playerList",playerList.keys());
sendPackage(np);
}
#include "mpriscontrolplugin.moc"

View file

@ -8,6 +8,11 @@
<arg type="s" name="property_name" direction="in"/>
<arg type="v" name="value" direction="out"/>
</method>
<method name="GetAll">
<arg type="s" name="interface_name" direction="in"/>
<arg type="a{sv}" name="properties" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
</method>
<method name="Set">
<arg type="s" name="interface_name" direction="in"/>
<arg type="s" name="property_name" direction="in"/>
@ -15,11 +20,9 @@
</method>
<signal name="PropertiesChanged">
<arg type="s" name="interface_name"/>
<arg type="a{sv}" name="changed_properties">
<annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QVariantMap" />
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap" />
</arg>
<arg type="a{sv}" name="changed_properties"/>
<arg type="as" name="invalidated_properties"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
</signal>
</interface>
</node>

View file

@ -4,7 +4,7 @@ set(kdeconnect_notifications_SRCS
notificationsdbusinterface.cpp
)
kde4_add_plugin(kdeconnect_notifications ${kdeconnect_notifications_SRCS})
add_library(kdeconnect_notifications MODULE ${kdeconnect_notifications_SRCS})
target_link_libraries(kdeconnect_notifications kdeconnectcore ${KDE4_KDEUI_LIBS})

View file

@ -74,7 +74,7 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np)
if (!mInternalIdToPublicId.contains(noti->internalId()) && !np.get<bool>("requestAnswer", false)) {
KNotification* notification = new KNotification("notification", KNotification::CloseOnTimeout, this);
notification->setPixmap(KIcon("preferences-desktop-notification").pixmap(48, 48));
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
notification->setComponentName("kdeconnect");
notification->setTitle(mDevice->name());
notification->setText(noti->appName() + ": " + noti->ticker());
notification->sendEvent();
@ -149,3 +149,5 @@ QString NotificationsDbusInterface::newId()
return QString::number(++mLastId);
}
#include "notificationsdbusinterface.moc"

View file

@ -62,4 +62,4 @@ bool NotificationsPlugin::receivePackage(const NetworkPackage& np)
return true;
}
#include "notificationsplugin.moc"

View file

@ -2,7 +2,7 @@ set(kdeconnect_pausemusic_SRCS
pausemusicplugin.cpp
)
kde4_add_plugin(kdeconnect_pausemusic ${kdeconnect_pausemusic_SRCS})
add_library(kdeconnect_pausemusic MODULE ${kdeconnect_pausemusic_SRCS})
target_link_libraries(kdeconnect_pausemusic
kdeconnectcore
@ -16,11 +16,11 @@ install(FILES kdeconnect_pausemusic.desktop DESTINATION ${SERVICES_INSTALL_DIR}
# Config
set( kdeconnect_pausemusic_config_SRCS pausemusic_config.cpp )
kde4_add_ui_files( kdeconnect_pausemusic_config_SRCS pausemusic_config.ui )
qt5_wrap_ui( kdeconnect_pausemusic_config_SRCS pausemusic_config.ui )
kde4_add_plugin( kdeconnect_pausemusic_config ${kdeconnect_pausemusic_config_SRCS} )
add_library(kdeconnect_pausemusic_config MODULE ${kdeconnect_pausemusic_config_SRCS} )
target_link_libraries( kdeconnect_pausemusic_config
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
)

View file

@ -23,6 +23,7 @@
#include <KPluginFactory>
#include <KSharedConfig>
#include <KConfigGroup>
#include <KAboutData>
#include <core/kdebugnamespace.h>
@ -32,7 +33,7 @@ K_PLUGIN_FACTORY(PauseMusicConfigFactory, registerPlugin<PauseMusicConfig>();)
K_EXPORT_PLUGIN(PauseMusicConfigFactory("kdeconnect_pausemusic_config", "kdeconnect-kded"))
PauseMusicConfig::PauseMusicConfig(QWidget *parent, const QVariantList& )
: KCModule(PauseMusicConfigFactory::componentData(), parent)
: KCModule(KAboutData::pluginData("kdeconnect_pausemusic_config"), parent)
, m_ui(new Ui::PauseMusicConfigUi())
, m_cfg(KSharedConfig::openConfig("kdeconnect/plugins/pausemusic"))
{
@ -79,3 +80,4 @@ void PauseMusicConfig::save()
Q_EMIT changed(false);
}
#include "pausemusic_config.moc"

View file

@ -134,3 +134,5 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
return true;
}
#include "pausemusicplugin.moc"

View file

@ -2,7 +2,7 @@ set(kdeconnect_ping_SRCS
pingplugin.cpp
)
kde4_add_plugin(kdeconnect_ping ${kdeconnect_ping_SRCS})
add_library(kdeconnect_ping MODULE ${kdeconnect_ping_SRCS})
target_link_libraries(kdeconnect_ping kdeconnectcore ${KDE4_KDEUI_LIBS})

View file

@ -45,7 +45,7 @@ bool PingPlugin::receivePackage(const NetworkPackage& np)
{
KNotification* notification = new KNotification("pingReceived"); //KNotification::Persistent
notification->setPixmap(KIcon("dialog-ok").pixmap(48, 48));
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect-kded"));
notification->setComponentName("kdeconnect");
notification->setTitle(device()->name());
notification->setText(np.get<QString>("message",i18n("Ping!"))); //This can be a source of spam
notification->sendEvent();
@ -53,3 +53,5 @@ bool PingPlugin::receivePackage(const NetworkPackage& np)
return true;
}
#include "pingplugin.moc"

View file

@ -4,7 +4,7 @@ set(kdeconnect_sftp_SRCS
sftpplugin.cpp
)
kde4_add_plugin(kdeconnect_sftp ${kdeconnect_sftp_SRCS})
add_library(kdeconnect_sftp MODULE ${kdeconnect_sftp_SRCS})
target_link_libraries(kdeconnect_sftp kdeconnectcore ${KDE4_KFILE_LIBS})
@ -24,13 +24,13 @@ generate_and_install_dbus_interface(
# Config
set( kdeconnect_sftp_config_SRCS sftp_config.cpp )
kde4_add_ui_files( kdeconnect_sftp_config_SRCS sftp_config.ui )
qt5_wrap_ui( kdeconnect_sftp_config_SRCS sftp_config.ui )
kde4_add_plugin( kdeconnect_sftp_config ${kdeconnect_sftp_config_SRCS} )
add_library(kdeconnect_sftp_config MODULE ${kdeconnect_sftp_config_SRCS} )
target_link_libraries( kdeconnect_sftp_config
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
KF5::KIOWidgets
)
install(TARGETS kdeconnect_sftp_config DESTINATION ${PLUGIN_INSTALL_DIR} )

View file

@ -25,6 +25,8 @@
#include <KPluginFactory>
#include <KSharedConfig>
#include <KStandardDirs>
#include <KAboutData>
#include <KIconLoader>
#include "sftpplugin.h"
#include <core/kdebugnamespace.h>
@ -35,7 +37,7 @@ K_PLUGIN_FACTORY(SftpConfigFactory, registerPlugin<SftpConfig>();)
K_EXPORT_PLUGIN(SftpConfigFactory("kdeconnect_sftp_config", "kdeconnect-kded"))
SftpConfig::SftpConfig(QWidget *parent, const QVariantList& )
: KCModule(SftpConfigFactory::componentData(), parent)
: KCModule(KAboutData::pluginData("kdeconnect_sftp_config"), parent)
, m_ui(new Ui::SftpConfigUi())
, m_cfg(SftpConfig::config())
{
@ -93,4 +95,4 @@ void SftpConfig::save()
Q_EMIT changed(false);
}
#include "sftp_config.moc"

View file

@ -154,7 +154,7 @@ bool SftpPlugin::receivePackage(const NetworkPackage& np)
QString SftpPlugin::mountPoint()
{
const QString mountDir = KStandardDirs::locateLocal("appdata", "", true, KComponentData("kdeconnect", "kdeconnect"));
const QString mountDir = KStandardDirs::locateLocal("appdata", "", true);
return QDir(mountDir).absoluteFilePath(device()->id());
}
@ -197,3 +197,4 @@ void SftpPlugin::knotify(int type, const QString& text, const QPixmap& icon) con
, KNotification::CloseOnTimeout);
}
#include "sftpplugin.moc"

View file

@ -3,9 +3,9 @@ set(kdeconnect_share_SRCS
autoclosingqfile.cpp
)
kde4_add_plugin(kdeconnect_share ${kdeconnect_share_SRCS})
add_library(kdeconnect_share MODULE ${kdeconnect_share_SRCS})
target_link_libraries(kdeconnect_share kdeconnectcore ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS})
target_link_libraries(kdeconnect_share kdeconnectcore ${KDE4_KFILE_LIBS} KF5::KIOWidgets)
install(TARGETS kdeconnect_share DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_share.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
@ -15,13 +15,13 @@ install(FILES kdeconnect_share.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
# Config
set( kdeconnect_share_config_SRCS share_config.cpp )
kde4_add_ui_files( kdeconnect_share_config_SRCS share_config.ui )
qt5_wrap_ui( kdeconnect_share_config_SRCS share_config.ui )
kde4_add_plugin( kdeconnect_share_config ${kdeconnect_share_config_SRCS} )
add_library(kdeconnect_share_config MODULE ${kdeconnect_share_config_SRCS} )
target_link_libraries( kdeconnect_share_config
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
KF5::KIOWidgets
)
install(TARGETS kdeconnect_share_config DESTINATION ${PLUGIN_INSTALL_DIR} )

View file

@ -25,6 +25,7 @@
#include <KPluginFactory>
#include <KSharedConfig>
#include <KUrlRequester>
#include <KAboutData>
#include <core/kdebugnamespace.h>
@ -34,7 +35,7 @@ K_PLUGIN_FACTORY(ShareConfigFactory, registerPlugin<ShareConfig>();)
K_EXPORT_PLUGIN(ShareConfigFactory("kdeconnect_share_config", "kdeconnect_share_config"))
ShareConfig::ShareConfig(QWidget *parent, const QVariantList& )
: KCModule(ShareConfigFactory::componentData(), parent)
: KCModule(KAboutData::pluginData("kdeconnect_share_config"), parent)
, m_ui(new Ui::ShareConfigUi())
, m_cfg(KSharedConfig::openConfig("kdeconnect/plugins/share"))
{
@ -77,3 +78,4 @@ void ShareConfig::save()
Q_EMIT changed(false);
}
#include "share_config.moc"

View file

@ -131,7 +131,7 @@ void SharePlugin::finished(KJob* job)
FileTransferJob* transferJob = (FileTransferJob*)job;
KNotification* notification = new KNotification("pingReceived"); //KNotification::Persistent
notification->setPixmap(KIcon(error? "edit-delete" : "dialog-ok").pixmap(48, 48));
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect-kded"));
notification->setComponentName("kdeconnect");
notification->setTitle(i18n("Transfer finished"));
notification->setText(transferJob->destination().fileName());
notification->setActions(QStringList(i18n("Open destination folder")));
@ -166,3 +166,5 @@ QString SharePlugin::dbusPath() const
{
return "/modules/kdeconnect/devices/" + device()->id() + "/share";
}
#include "shareplugin.moc"

View file

@ -2,7 +2,7 @@ set(kdeconnect_telephony_SRCS
telephonyplugin.cpp
)
kde4_add_plugin(kdeconnect_telephony ${kdeconnect_telephony_SRCS})
add_library(kdeconnect_telephony MODULE ${kdeconnect_telephony_SRCS})
target_link_libraries(kdeconnect_telephony kdeconnectcore ${KDE4_KDEUI_LIBS})

View file

@ -70,7 +70,7 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
KNotification* notification = new KNotification(type, KNotification::CloseOnTimeout, this); //, KNotification::Persistent
notification->setPixmap(KIcon(icon).pixmap(48, 48));
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect-kded"));
notification->setComponentName("kdeconnect");
notification->setTitle(title);
notification->setText(content);
@ -96,3 +96,5 @@ bool TelephonyPlugin::receivePackage(const NetworkPackage& np)
return true;
}
#include "telephonyplugin.moc"

View file

@ -7,20 +7,13 @@ include_directories(
)
set(kdeconnect_libraries
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
${QT_QTNETWORK_LIBRARY}
KF5::KIOWidgets
Qt5::Network
${QJSON_LIBRARIES}
${QCA2_LIBRARIES}
${QT_QTTEST_LIBRARY}
Qt5::Test
kdeconnectcore
)
#NetworkPackage
kde4_add_unit_test(kdeconnect_tests networkpackagetests.cpp)
target_link_libraries(kdeconnect_tests ${kdeconnect_libraries})
#Socketlinereader
kde4_add_unit_test(testsocketlinereader testsocketlinereader.cpp ../core/backends/lan/socketlinereader.cpp)
target_link_libraries(testsocketlinereader ${kdeconnect_libraries})
ecm_add_test(networkpackagetests.cpp LINK_LIBRARIES ${kdeconnect_libraries})
ecm_add_test(testsocketlinereader.cpp ../core/backends/lan/socketlinereader.cpp TEST_NAME testsocketlinereader LINK_LIBRARIES ${kdeconnect_libraries})