From b5a5416c19de15e552497f2a6abd96169e803fb9 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sat, 31 Aug 2013 13:04:00 +0200 Subject: [PATCH] Changed QSslKeys to QCA keys that will actually allow us to encrypt things --- daemon/CMakeLists.txt | 12 +++- daemon/daemon.cpp | 65 +++++---------------- daemon/daemon.h | 23 +++----- daemon/device.cpp | 45 +++++++------- daemon/device.h | 22 ++++--- daemon/networkpackage.cpp | 28 ++++++--- daemon/networkpackage.h | 6 +- daemon/plugins/battery/CMakeLists.txt | 8 ++- daemon/plugins/clipboard/CMakeLists.txt | 8 ++- daemon/plugins/filetransfer/CMakeLists.txt | 8 ++- daemon/plugins/mpriscontrol/CMakeLists.txt | 8 ++- daemon/plugins/notifications/CMakeLists.txt | 8 ++- daemon/plugins/pausemusic/CMakeLists.txt | 8 ++- daemon/plugins/ping/CMakeLists.txt | 8 ++- daemon/plugins/telephony/CMakeLists.txt | 8 ++- libkdeconnect/devicesmodel.cpp | 6 +- 16 files changed, 142 insertions(+), 129 deletions(-) diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index 3f2d8e093..60c8ae7ce 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -1,3 +1,8 @@ +include_directories( + ${QJSON_INCLUDE_DIR} + ${QCA2_INCLUDE_DIR} +) + set(kded_kdeconnect_SRCS linkproviders/linkprovider.cpp @@ -20,12 +25,15 @@ add_subdirectory(plugins) kde4_add_plugin(kded_kdeconnect ${kded_kdeconnect_SRCS}) +find_package (QJSON REQUIRED) +find_package (QCA2 REQUIRED) + target_link_libraries(kded_kdeconnect ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} - #kdnssd - qjson ${QT_QTNETWORK_LIBRARY} + ${QJSON_LIBRARIES} + ${QCA2_LIBRARIES} ) include(../cmakemacros.txt) diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp index 98de7f266..07746abff 100644 --- a/daemon/daemon.cpp +++ b/daemon/daemon.cpp @@ -29,10 +29,12 @@ #include #include #include -#include +#include -#include +#include #include +#include +#include K_PLUGIN_FACTORY(KdeConnectFactory, registerPlugin();) K_EXPORT_PLUGIN(KdeConnectFactory("kdeconnect", "kdeconnect")) @@ -51,55 +53,14 @@ Daemon::Daemon(QObject *parent, const QList&) qDebug() << "My id:" << uuid; } - if (!config->group("myself").hasKey("privateKey")) { + if (!config->group("myself").hasKey("privateKey") || !config->group("myself").hasKey("publicKey")) { - //TODO: Generate + //http://delta.affinix.com/docs/qca/rsatest_8cpp-example.html + QCA::PrivateKey privateKey = QCA::KeyGenerator().createRSA(1024); + config->group("myself").writeEntry("privateKey", privateKey.toPEM()); - QByteArray key = QByteArray( - "-----BEGIN RSA PRIVATE KEY-----\n" - "MIICXAIBAAKBgQCnKxy6aZrABVvbxuWqMPbohH4KRDBGqyO/OwxvUD1qHpqZ9cJT\n" - "bgttiIaXzdQny5esf6brI6Di/ssIp9awdLBlMT+eR6zR7g446tbxaCFuUiL0QIei\n" - "izEveTDNRbson/8DPJrn8/81doTeXsuV7YbqmtUGwdZ5kiocAW92ZZukdQIDAQAB\n" - "AoGBAI18yuLoMQdnQblBne8vZDumsDsmPaoCfc4EP2ETi/d+kaHPxTryABAkJq7j\n" - "kjZgdi6VGIUacbjOqK/Zxrcw/H460EwOUzh97Z4t9CDtDhz6t3ddT8CfbG2TUgbx\n" - "Vv3mSYSUDBdNBV6YY4fyLtZl6oI2V+rBaFIT48+vAK9doKlhAkEA2ZKm9dc80IjU\n" - "c/Wwn8ij+6ALs4Mpa0dPYivgZ2QhXiX5TfMymal2dDufkOH4wIUO+8vV8CSmmTRU\n" - "8Lv/B3pY7QJBAMSxeJtTSFwBcGRaZKRMIqeuZ/yMMT4EqqIh1DjBpujCRKApVpkO\n" - "kVx3Yu7xyOfniXBwujiYNSL6LrWdKykEsKkCQEr2UDgbtIRU4H4jhHtI8dbcSavL\n" - "4RVpOFymqWZ2BVke1EqbJC/1Ry687DlK4h3Sulre3BMlTZEziqB25WN6L/ECQBJv\n" - "B3yXG4rz35KoHhJ/yCeq4rf6c4r6aPt07Cy9iWT6/+96sFD72oet8KmwI0IIowrU\n" - "pb80FJbIl6QRrL/VXrECQBDdeCAG6J3Cwm4ozQiDQyiNd1qJqWc4co9savJxLtEU\n" - "s5L4Qwfrexm16oCJimGmsa5q6Y0n4f5gY+MRh3n+nQo=\n" - "-----END RSA PRIVATE KEY-----\n" - ); - - //Test for validity - //QSslKey privateKey(key.toAscii(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); - //qDebug() << "Valid private key:" << !privateKey.isNull(); - - config->group("myself").writeEntry("privateKey", key); - - } - - if (!config->group("myself").hasKey("publicKey")) { - - //TODO: Generate - - QByteArray key = QByteArray( - "-----BEGIN PUBLIC KEY-----\n" - "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnKxy6aZrABVvbxuWqMPbohH4K\n" - "RDBGqyO/OwxvUD1qHpqZ9cJTbgttiIaXzdQny5esf6brI6Di/ssIp9awdLBlMT+e\n" - "R6zR7g446tbxaCFuUiL0QIeiizEveTDNRbson/8DPJrn8/81doTeXsuV7YbqmtUG\n" - "wdZ5kiocAW92ZZukdQIDAQAB\n" - "-----END PUBLIC KEY-----\n" - - ); - - //Test for validity - //QSslKey publicKey(key.toAscii(), QSsl::Rsa, QSsl::Pem, QSsl::PublicKey); - //qDebug() << "Valid public key:" << !publicKey.isNull(); - - config->group("myself").writeEntry("publicKey", key); + QCA::PublicKey publicKey = privateKey.toPublicKey(); + config->group("myself").writeEntry("publicKey", publicKey.toPEM()); } @@ -157,7 +118,7 @@ QStringList Daemon::visibleDevices() { QStringList ret; Q_FOREACH(Device* device, mDevices) { - if (device->reachable()) { + if (device->isReachable()) { ret.append(device->id()); } } @@ -199,9 +160,9 @@ void Daemon::onDeviceReachableStatusChanged() Device* device = (Device*)sender(); QString id = device->id(); - Q_EMIT deviceVisibilityChanged(id, device->reachable()); + Q_EMIT deviceVisibilityChanged(id, device->isReachable()); - if (!device->reachable()) { + if (!device->isReachable()) { if (!device->isPaired()) { qDebug() << "Destroying device"; diff --git a/daemon/daemon.h b/daemon/daemon.h index a53c3458e..f0a00f08d 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -18,32 +18,22 @@ * along with this program. If not, see . */ - #ifndef DAEMON_H #define DAEMON_H #include -#include -#include +#include +#include +#include #include -#include - -#include "networkpackage.h" -#include -#include -#include - -#include - -#include +#include #include "device.h" +#include "networkpackage.h" #include "devicelinks/devicelink.h" #include "linkproviders/linkprovider.h" -class QUdpSocket; - class Daemon : public KDEDModule { @@ -82,6 +72,9 @@ private: //Every known device QMap mDevices; + // The Initializer object sets things up, and also does cleanup when it goes out of scope + QCA::Initializer init; + }; #endif // UDP_WIRELESS_H diff --git a/daemon/device.cpp b/daemon/device.cpp index 5f6876a73..d0a7cb4dc 100644 --- a/daemon/device.cpp +++ b/daemon/device.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include "plugins/kdeconnectplugin.h" @@ -31,9 +30,9 @@ Device::Device(const QString& id) m_deviceName = name; const QByteArray& key = data.readEntry("publicKey",QByteArray()); - m_publicKey = QSslKey(key, QSsl::Rsa, QSsl::Pem, QSsl::PublicKey); + m_publicKey = QCA::RSAPublicKey::fromDER(key); - m_pairingRequested = false; + m_pairStatus = Device::Paired; //Register in bus QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors); @@ -47,7 +46,7 @@ Device::Device(const NetworkPackage& identityPackage, DeviceLink* dl) addLink(dl); - m_pairingRequested = false; + m_pairStatus = Device::Device::NotPaired; //Register in bus QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors); @@ -72,7 +71,7 @@ void Device::reloadPlugins() { QMap< QString, KdeConnectPlugin* > newPluginMap; - if (isPaired() && reachable()) { //Do not load any plugin for unpaired devices, nor useless loading them for unreachable devices + if (isPaired() && isReachable()) { //Do not load any plugin for unpaired devices, nor useless loading them for unreachable devices QString path = KStandardDirs().resourceDirs("config").first()+"kdeconnect/"; QMap pluginStates = KSharedConfig::openConfig(path + id())->group("Plugins").entryMap(); @@ -134,11 +133,11 @@ QSslKey myPrivateKey() { void Device::requestPair() { - if (isPaired() || m_pairingRequested) { + if (m_pairStatus != NotPaired) { Q_EMIT pairingFailed(i18n("Already paired")); return; } - if (!reachable()) { + if (!isReachable()) { Q_EMIT pairingFailed(i18n("Device not reachable")); return; } @@ -156,7 +155,7 @@ void Device::requestPair() return; } - m_pairingRequested = true; + m_pairStatus = PairRequested; pairingTimer.start(20 * 1000); connect(&pairingTimer, SIGNAL(timeout()), this, SLOT(pairingTimeout())); @@ -167,14 +166,13 @@ void Device::unpair() { if (!isPaired()) return; - m_publicKey = QSslKey(); - m_pairingRequested = false; + m_pairStatus = NotPaired; pairingTimer.stop(); KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc"); config->group("devices").deleteGroup(id()); - if (reachable()) { + if (isReachable()) { NetworkPackage np(PACKAGE_TYPE_PAIR); np.set("pair", false); sendPackage(np); @@ -186,7 +184,7 @@ void Device::unpair() void Device::pairingTimeout() { - m_pairingRequested = false; + m_pairStatus = NotPaired; Q_EMIT Q_EMIT pairingFailed("Timed out"); } @@ -263,28 +261,28 @@ void Device::privateReceivedPackage(const NetworkPackage& np) qDebug() << "Pair package"; - bool pair = np.get("pair"); - if (pair == isPaired()) { - qDebug() << "Already" << (pair? "paired":"unpaired"); + bool wantsPair = np.get("pair"); + if (wantsPair == isPaired()) { + qDebug() << "Already" << (wantsPair? "paired":"unpaired"); return; } KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc"); - if (pair) { + if (wantsPair) { - if (m_pairingRequested) { //We started pairing + if (m_pairStatus == Device::PairRequested) { //We started pairing qDebug() << "Pair answer"; - m_pairingRequested = false; + m_pairStatus = Paired; pairingTimer.stop(); //Store as trusted device const QByteArray& key = np.get("publicKey"); config->group("devices").group(id()).writeEntry("publicKey",key); config->group("devices").group(id()).writeEntry("name",name()); - m_publicKey = QSslKey(key, QSsl::Rsa, QSsl::Pem, QSsl::PublicKey); + m_publicKey = QCA::RSAPublicKey::fromDER(key); Q_EMIT pairingSuccesful(); @@ -292,8 +290,8 @@ void Device::privateReceivedPackage(const NetworkPackage& np) qDebug() << "Pair request"; - const QString& key = np.get("publicKey"); - m_tempPublicKey = QSslKey(key.toAscii(), QSsl::Rsa, QSsl::Pem, QSsl::PublicKey); + const QByteArray& key = np.get("publicKey"); + m_publicKey = QCA::RSAPublicKey::fromDER(key); KNotification* notification = new KNotification("pingReceived"); //KNotification::Persistent notification->setPixmap(KIcon("dialog-information").pixmap(48, 48)); @@ -310,7 +308,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np) } else { qDebug() << "Unpair request"; - if (m_pairingRequested) { + if (m_pairStatus == PairRequested) { pairingTimer.stop(); Q_EMIT pairingFailed(i18n("Canceled by other peer")); } @@ -350,8 +348,7 @@ void Device::acceptPairing() } //Store as trusted device - m_publicKey = m_tempPublicKey; - config->group("devices").group(id()).writeEntry("publicKey", m_tempPublicKey.toPem()); + config->group("devices").group(id()).writeEntry("publicKey", m_publicKey.toDER()); config->group("devices").group(id()).writeEntry("name", name()); reloadPlugins(); //This will load plugins diff --git a/daemon/device.h b/daemon/device.h index edcaadf62..84cbbbf5e 100644 --- a/daemon/device.h +++ b/daemon/device.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "networkpackage.h" @@ -41,6 +42,12 @@ class Device Q_PROPERTY(QString id READ id) Q_PROPERTY(QString name READ name) + enum PairStatus { + NotPaired, + PairRequested, + Paired, + }; + public: //Read device from KConfig, we already know it but we need to wait for a incoming devicelink to communicate Device(const QString& id); @@ -58,12 +65,14 @@ public: void addLink(DeviceLink*); void removeLink(DeviceLink*); + Q_SCRIPTABLE bool isPaired() const { return m_pairStatus==Device::Paired; } + Q_SCRIPTABLE bool pairRequested() const { return m_pairStatus==Device::PairRequested; } + Q_SCRIPTABLE QStringList availableLinks() const; - Q_SCRIPTABLE bool isPaired() const { return !m_publicKey.isNull(); } - Q_SCRIPTABLE bool pairRequested() const { return m_pairingRequested; } - Q_SCRIPTABLE bool reachable() const { return !m_deviceLinks.empty(); } - Q_SCRIPTABLE bool hasPlugin(const QString& name); + Q_SCRIPTABLE bool isReachable() const { return !m_deviceLinks.empty(); } + Q_SCRIPTABLE QStringList loadedPlugins(); + Q_SCRIPTABLE bool hasPlugin(const QString& name); //Send and receive Q_SIGNALS: @@ -94,9 +103,8 @@ Q_SIGNALS: private: QString m_deviceId; QString m_deviceName; - QSslKey m_publicKey; - QSslKey m_tempPublicKey; - bool m_pairingRequested; + QCA::PublicKey m_publicKey; + PairStatus m_pairStatus; QList m_deviceLinks; QMap m_plugins; diff --git a/daemon/networkpackage.cpp b/daemon/networkpackage.cpp index 21afcf3e8..117f6d4d9 100644 --- a/daemon/networkpackage.cpp +++ b/daemon/networkpackage.cpp @@ -19,23 +19,26 @@ */ #include "networkpackage.h" -#include -#include -#include -#include + +#include +#include +#include +#include #include -#include -#include +#include +#include +#include + #include -#include -#include #include +#include "encryptednetworkpackage.h" + const static int CURRENT_PACKAGE_VERSION = 1; NetworkPackage::NetworkPackage(const QString& type) { - mId = time(NULL); + mId = QDateTime::currentMSecsSinceEpoch(); mType = type; mVersion = CURRENT_PACKAGE_VERSION; } @@ -103,4 +106,11 @@ void NetworkPackage::createIdentityPackage(NetworkPackage* np) //qDebug() << "createIdentityPackage" << np->serialize(); } +EncryptedNetworkPackage NetworkPackage::encrypt ( const QSslKey& key ) const +{ + QByteArray serialized = serialize(); + return EncryptedNetworkPackage(); + +} + diff --git a/daemon/networkpackage.h b/daemon/networkpackage.h index a2db3b5cf..b29b87222 100644 --- a/daemon/networkpackage.h +++ b/daemon/networkpackage.h @@ -27,12 +27,14 @@ #include #include #include -#include +#include #include #include "default_args.h" +class EncryptedNetworkPackage; + class NetworkPackage : public QObject { Q_OBJECT @@ -63,6 +65,8 @@ public: bool has(const QString& key) const { return mBody.contains(key); } + EncryptedNetworkPackage encrypt(const QSslKey& key) const; + private: void setId(long id) { mId = id; } void setType(const QString& t) { mType = t; } diff --git a/daemon/plugins/battery/CMakeLists.txt b/daemon/plugins/battery/CMakeLists.txt index 74c56b690..66c7d8b03 100644 --- a/daemon/plugins/battery/CMakeLists.txt +++ b/daemon/plugins/battery/CMakeLists.txt @@ -1,5 +1,8 @@ find_package(KDE4 REQUIRED) -include (KDE4Defaults) +find_package(QJSON REQUIRED) +find_package(QCA2 REQUIRED) + +include(KDE4Defaults) include_directories(${KDE4_INCLUDES}) set(kdeconnect_battery_SRCS @@ -17,7 +20,8 @@ target_link_libraries(kdeconnect_battery ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTNETWORK_LIBRARY} - qjson + ${QJSON_LIBRARIES} + ${QCA2_LIBRARIES} ) install(TARGETS kdeconnect_battery DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/daemon/plugins/clipboard/CMakeLists.txt b/daemon/plugins/clipboard/CMakeLists.txt index 6ece9e21f..60771e0ed 100644 --- a/daemon/plugins/clipboard/CMakeLists.txt +++ b/daemon/plugins/clipboard/CMakeLists.txt @@ -1,5 +1,8 @@ find_package(KDE4 REQUIRED) -include (KDE4Defaults) +find_package(QJSON REQUIRED) +find_package(QCA2 REQUIRED) + +include(KDE4Defaults) include_directories(${KDE4_INCLUDES}) set(kdeconnect_clipboard_SRCS @@ -16,7 +19,8 @@ target_link_libraries(kdeconnect_clipboard ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTNETWORK_LIBRARY} - qjson + ${QJSON_LIBRARIES} + ${QCA2_LIBRARIES} ) install(TARGETS kdeconnect_clipboard DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/daemon/plugins/filetransfer/CMakeLists.txt b/daemon/plugins/filetransfer/CMakeLists.txt index fc25242a1..8f170a40c 100644 --- a/daemon/plugins/filetransfer/CMakeLists.txt +++ b/daemon/plugins/filetransfer/CMakeLists.txt @@ -1,5 +1,8 @@ find_package(KDE4 REQUIRED) -include (KDE4Defaults) +find_package(QJSON REQUIRED) +find_package(QCA2 REQUIRED) + +include(KDE4Defaults) include_directories(${KDE4_INCLUDES}) set(kdeconnect_filetransfer_SRCS @@ -16,7 +19,8 @@ target_link_libraries(kdeconnect_filetransfer ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTNETWORK_LIBRARY} - qjson + ${QJSON_LIBRARIES} + ${QCA2_LIBRARIES} ) install(TARGETS kdeconnect_filetransfer DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/daemon/plugins/mpriscontrol/CMakeLists.txt b/daemon/plugins/mpriscontrol/CMakeLists.txt index 840d614fe..f330c2049 100644 --- a/daemon/plugins/mpriscontrol/CMakeLists.txt +++ b/daemon/plugins/mpriscontrol/CMakeLists.txt @@ -1,5 +1,8 @@ find_package(KDE4 REQUIRED) -include (KDE4Defaults) +find_package(QJSON REQUIRED) +find_package(QCA2 REQUIRED) + +include(KDE4Defaults) include_directories(${KDE4_INCLUDES}) set(kdeconnect_mpriscontrol_SRCS @@ -28,7 +31,8 @@ target_link_libraries(kdeconnect_mpriscontrol ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTNETWORK_LIBRARY} - qjson + ${QJSON_LIBRARIES} + ${QCA2_LIBRARIES} ) install(TARGETS kdeconnect_mpriscontrol DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/daemon/plugins/notifications/CMakeLists.txt b/daemon/plugins/notifications/CMakeLists.txt index dfe3e45b4..ad9c5e04d 100644 --- a/daemon/plugins/notifications/CMakeLists.txt +++ b/daemon/plugins/notifications/CMakeLists.txt @@ -1,5 +1,8 @@ find_package(KDE4 REQUIRED) -include (KDE4Defaults) +find_package(QJSON REQUIRED) +find_package(QCA2 REQUIRED) + +include(KDE4Defaults) include_directories(${KDE4_INCLUDES}) set(kdeconnect_notifications_SRCS @@ -18,7 +21,8 @@ target_link_libraries(kdeconnect_notifications ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTNETWORK_LIBRARY} - qjson + ${QJSON_LIBRARIES} + ${QCA2_LIBRARIES} ) install(TARGETS kdeconnect_notifications DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/daemon/plugins/pausemusic/CMakeLists.txt b/daemon/plugins/pausemusic/CMakeLists.txt index d1afc2fa7..cc51ae9fb 100644 --- a/daemon/plugins/pausemusic/CMakeLists.txt +++ b/daemon/plugins/pausemusic/CMakeLists.txt @@ -1,5 +1,8 @@ find_package(KDE4 REQUIRED) -include (KDE4Defaults) +find_package(QJSON REQUIRED) +find_package(QCA2 REQUIRED) + +include(KDE4Defaults) include_directories(${KDE4_INCLUDES}) set(kdeconnect_pausemusic_SRCS @@ -13,7 +16,8 @@ target_link_libraries(kdeconnect_pausemusic ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTNETWORK_LIBRARY} - qjson + ${QJSON_LIBRARIES} + ${QCA2_LIBRARIES} ) install(TARGETS kdeconnect_pausemusic DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/daemon/plugins/ping/CMakeLists.txt b/daemon/plugins/ping/CMakeLists.txt index 4da742525..305ace1a9 100644 --- a/daemon/plugins/ping/CMakeLists.txt +++ b/daemon/plugins/ping/CMakeLists.txt @@ -1,5 +1,8 @@ find_package(KDE4 REQUIRED) -include (KDE4Defaults) +find_package(QJSON REQUIRED) +find_package(QCA2 REQUIRED) + +include(KDE4Defaults) include_directories(${KDE4_INCLUDES}) set(kdeconnect_ping_SRCS @@ -13,7 +16,8 @@ target_link_libraries(kdeconnect_ping ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTNETWORK_LIBRARY} - qjson + ${QJSON_LIBRARIES} + ${QCA2_LIBRARIES} ) install(TARGETS kdeconnect_ping DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/daemon/plugins/telephony/CMakeLists.txt b/daemon/plugins/telephony/CMakeLists.txt index c376981b4..fa8461a1b 100644 --- a/daemon/plugins/telephony/CMakeLists.txt +++ b/daemon/plugins/telephony/CMakeLists.txt @@ -1,5 +1,8 @@ find_package(KDE4 REQUIRED) -include (KDE4Defaults) +find_package(QJSON REQUIRED) +find_package(QCA2 REQUIRED) + +include(KDE4Defaults) include_directories(${KDE4_INCLUDES}) set(kdeconnect_telephony_SRCS @@ -13,7 +16,8 @@ target_link_libraries(kdeconnect_telephony ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTNETWORK_LIBRARY} - qjson + ${QJSON_LIBRARIES} + ${QCA2_LIBRARIES} ) install(TARGETS kdeconnect_telephony DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/libkdeconnect/devicesmodel.cpp b/libkdeconnect/devicesmodel.cpp index ccca7957d..915bf623f 100644 --- a/libkdeconnect/devicesmodel.cpp +++ b/libkdeconnect/devicesmodel.cpp @@ -123,7 +123,7 @@ void DevicesModel::refreshDeviceList() bool onlyPaired = (m_displayFilter & StatusPaired); if (onlyPaired && !deviceDbusInterface->isPaired()) continue; bool onlyReachable = (m_displayFilter & StatusReachable); - if (onlyReachable && !deviceDbusInterface->reachable()) continue; + if (onlyReachable && !deviceDbusInterface->isReachable()) continue; int firstRow = m_deviceList.size(); int lastRow = firstRow; @@ -155,7 +155,7 @@ QVariant DevicesModel::data(const QModelIndex &index, int role) const switch (role) { case IconModelRole: { bool paired = device->isPaired(); - bool reachable = device->reachable(); + bool reachable = device->isReachable(); QString icon = reachable? (paired? "user-online" : "user-busy") : "user-offline"; return KIcon(icon).pixmap(32, 32); } @@ -167,7 +167,7 @@ QVariant DevicesModel::data(const QModelIndex &index, int role) const return QVariant(); //To implement case StatusModelRole: { int status = StatusUnknown; - if (device->reachable()) { + if (device->isReachable()) { status |= StatusReachable; if (device->isPaired()) status |= StatusPaired; }