Commit a1a560c4 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

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
parent 734b27ed
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)
......
......@@ -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})
......@@ -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;
......
# - 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)
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 ()
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})
......
......@@ -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);
......
......@@ -25,7 +25,6 @@
#include <QSet>
#include <QMap>
#include <KDEDModule>
#include <KPluginFactory>
#include "kdeconnectcore_export.h"
......
......@@ -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"));
......
......@@ -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)));
......
......@@ -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;
......
......@@ -22,6 +22,7 @@
#define KDEBUG_KDECONNECT_KDED_H
#include <KDebug>
#include <kdemacros.h>
KDE_EXPORT int kdeconnect_kded();
......
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})
......@@ -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"
kde4_install_icons(${ICON_INSTALL_DIR})
\ No newline at end of file
ecm_install_icons(${ICON_INSTALL_DIR})
\ No newline at end of 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})
......
......@@ -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
)
......
......@@ -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"
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})
......
......@@ -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");
......
......@@ -118,3 +118,5 @@ void Kded::checkIfDaemonTerminated()
m_daemon->kill();
kWarning(theArea) << "Daemon killed";
}
#include "kded.moc"
......@@ -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
)
......
......@@ -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("");
......
......@@ -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);
......
......@@ -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)
......
......@@ -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));
......
......@@ -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);
};
......
......@@ -6,8 +6,6 @@
#include <QVariant>
#include <QTimer>
#include <QDeclarativeEngine>
class QDBusPendingCall;
class QDBusPendingCallWatcher;
......
......@@ -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})
......
......@@ -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"
......@@ -2,9 +2,9 @@ set(kdeconnect_clipboard_SRCS
clipboardplugin.cpp