Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Weixuan Xiao
kdeconnect-kde
Commits
b5a5416c
Commit
b5a5416c
authored
Aug 31, 2013
by
Albert Vaca Cintora
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed QSslKeys to QCA keys that will actually allow us to encrypt things
parent
1604309a
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
142 additions
and
129 deletions
+142
-129
daemon/CMakeLists.txt
daemon/CMakeLists.txt
+10
-2
daemon/daemon.cpp
daemon/daemon.cpp
+13
-52
daemon/daemon.h
daemon/daemon.h
+8
-15
daemon/device.cpp
daemon/device.cpp
+21
-24
daemon/device.h
daemon/device.h
+15
-7
daemon/networkpackage.cpp
daemon/networkpackage.cpp
+19
-9
daemon/networkpackage.h
daemon/networkpackage.h
+5
-1
daemon/plugins/battery/CMakeLists.txt
daemon/plugins/battery/CMakeLists.txt
+6
-2
daemon/plugins/clipboard/CMakeLists.txt
daemon/plugins/clipboard/CMakeLists.txt
+6
-2
daemon/plugins/filetransfer/CMakeLists.txt
daemon/plugins/filetransfer/CMakeLists.txt
+6
-2
daemon/plugins/mpriscontrol/CMakeLists.txt
daemon/plugins/mpriscontrol/CMakeLists.txt
+6
-2
daemon/plugins/notifications/CMakeLists.txt
daemon/plugins/notifications/CMakeLists.txt
+6
-2
daemon/plugins/pausemusic/CMakeLists.txt
daemon/plugins/pausemusic/CMakeLists.txt
+6
-2
daemon/plugins/ping/CMakeLists.txt
daemon/plugins/ping/CMakeLists.txt
+6
-2
daemon/plugins/telephony/CMakeLists.txt
daemon/plugins/telephony/CMakeLists.txt
+6
-2
libkdeconnect/devicesmodel.cpp
libkdeconnect/devicesmodel.cpp
+3
-3
No files found.
daemon/CMakeLists.txt
View file @
b5a5416c
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
)
...
...
daemon/daemon.cpp
View file @
b5a5416c
...
...
@@ -29,10 +29,12 @@
#include <QDBusConnection>
#include <QNetworkSession>
#include <QNetworkConfigurationManager>
#include <Q
SslKey
>
#include <Q
Debug
>
#include <K
Icon
>
#include <K
Config
>
#include <KConfigGroup>
#include <KNotification>
#include <KIcon>
K_PLUGIN_FACTORY
(
KdeConnectFactory
,
registerPlugin
<
Daemon
>
();)
K_EXPORT_PLUGIN
(
KdeConnectFactory
(
"kdeconnect"
,
"kdeconnect"
))
...
...
@@ -51,55 +53,14 @@ Daemon::Daemon(QObject *parent, const QList<QVariant>&)
qDebug
()
<<
"My id:"
<<
uuid
;
}
if
(
!
config
->
group
(
"myself"
).
hasKey
(
"privateKey"
))
{
//TODO: Generate
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
"
);
if
(
!
config
->
group
(
"myself"
).
hasKey
(
"privateKey"
)
||
!
config
->
group
(
"myself"
).
hasKey
(
"publicKey"
))
{
//
Test for validity
//QSslKey publicKey(key.toAscii(), QSsl::Rsa, QSsl::Pem, QSsl::PublicKey
);
//qDebug() << "Valid public key:" << !publicKey.isNull(
);
//
http://delta.affinix.com/docs/qca/rsatest_8cpp-example.html
QCA
::
PrivateKey
privateKey
=
QCA
::
KeyGenerator
().
createRSA
(
1024
);
config
->
group
(
"myself"
).
writeEntry
(
"privateKey"
,
privateKey
.
toPEM
()
);
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
->
r
eachable
())
{
if
(
device
->
isR
eachable
())
{
ret
.
append
(
device
->
id
());
}
}
...
...
@@ -199,9 +160,9 @@ void Daemon::onDeviceReachableStatusChanged()
Device
*
device
=
(
Device
*
)
sender
();
QString
id
=
device
->
id
();
Q_EMIT
deviceVisibilityChanged
(
id
,
device
->
r
eachable
());
Q_EMIT
deviceVisibilityChanged
(
id
,
device
->
isR
eachable
());
if
(
!
device
->
r
eachable
())
{
if
(
!
device
->
isR
eachable
())
{
if
(
!
device
->
isPaired
())
{
qDebug
()
<<
"Destroying device"
;
...
...
daemon/daemon.h
View file @
b5a5416c
...
...
@@ -18,32 +18,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DAEMON_H
#define DAEMON_H
#include <QObject>
#include <QRegExp>
#include <map>
#include <KDEDModule>
#include <KNotification>
#include "networkpackage.h"
#include <KDE/KPluginFactory>
#include <QFile>
#include <qtextstream.h>
#include <QSet>
#include <QMap>
#include <QtCrypto>
#include <KConfig>
#include <KDEDModule>
#include <KPluginFactory>
#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
<
QString
,
Device
*>
mDevices
;
// The Initializer object sets things up, and also does cleanup when it goes out of scope
QCA
::
Initializer
init
;
};
#endif // UDP_WIRELESS_H
daemon/device.cpp
View file @
b5a5416c
...
...
@@ -10,7 +10,6 @@
#include <KNotification>
#include <KIcon>
#include <QSslKey>
#include <QDebug>
#include "plugins/kdeconnectplugin.h"
...
...
@@ -31,9 +30,9 @@ Device::Device(const QString& id)
m_deviceName
=
name
;
const
QByteArray
&
key
=
data
.
readEntry
<
QByteArray
>
(
"publicKey"
,
QByteArray
());
m_publicKey
=
Q
SslKey
(
key
,
QSsl
::
Rsa
,
QSsl
::
Pem
,
QSsl
::
PublicK
ey
);
m_publicKey
=
Q
CA
::
RSAPublicKey
::
fromDER
(
k
ey
);
m_pair
ingRequested
=
false
;
m_pair
Status
=
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_pair
ingRequested
=
false
;
m_pair
Status
=
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
()
&&
r
eachable
())
{
//Do not load any plugin for unpaired devices, nor useless loading them for unreachable devices
if
(
isPaired
()
&&
isR
eachable
())
{
//Do not load any plugin for unpaired devices, nor useless loading them for unreachable devices
QString
path
=
KStandardDirs
().
resourceDirs
(
"config"
).
first
()
+
"kdeconnect/"
;
QMap
<
QString
,
QString
>
pluginStates
=
KSharedConfig
::
openConfig
(
path
+
id
())
->
group
(
"Plugins"
).
entryMap
();
...
...
@@ -134,11 +133,11 @@ QSslKey myPrivateKey() {
void
Device
::
requestPair
()
{
if
(
isPaired
()
||
m_pairingRequest
ed
)
{
if
(
m_pairStatus
!=
NotPair
ed
)
{
Q_EMIT
pairingFailed
(
i18n
(
"Already paired"
));
return
;
}
if
(
!
r
eachable
())
{
if
(
!
isR
eachable
())
{
Q_EMIT
pairingFailed
(
i18n
(
"Device not reachable"
));
return
;
}
...
...
@@ -156,7 +155,7 @@ void Device::requestPair()
return
;
}
m_pair
ing
Requested
=
true
;
m_pair
Status
=
Pair
Requested
;
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
(
r
eachable
())
{
if
(
isR
eachable
())
{
NetworkPackage
np
(
PACKAGE_TYPE_PAIR
);
np
.
set
(
"pair"
,
false
);
sendPackage
(
np
);
...
...
@@ -186,7 +184,7 @@ void Device::unpair()
void
Device
::
pairingTimeout
()
{
m_pair
ingRequested
=
false
;
m_pair
Status
=
NotPaired
;
Q_EMIT
Q_EMIT
pairingFailed
(
"Timed out"
);
}
...
...
@@ -263,28 +261,28 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
qDebug
()
<<
"Pair package"
;
bool
p
air
=
np
.
get
<
bool
>
(
"pair"
);
if
(
p
air
==
isPaired
())
{
qDebug
()
<<
"Already"
<<
(
p
air
?
"paired"
:
"unpaired"
);
bool
wantsP
air
=
np
.
get
<
bool
>
(
"pair"
);
if
(
wantsP
air
==
isPaired
())
{
qDebug
()
<<
"Already"
<<
(
wantsP
air
?
"paired"
:
"unpaired"
);
return
;
}
KSharedConfigPtr
config
=
KSharedConfig
::
openConfig
(
"kdeconnectrc"
);
if
(
p
air
)
{
if
(
wantsP
air
)
{
if
(
m_pair
ing
Requested
)
{
//We started pairing
if
(
m_pair
Status
==
Device
::
Pair
Requested
)
{
//We started pairing
qDebug
()
<<
"Pair answer"
;
m_pair
ingRequested
=
false
;
m_pair
Status
=
Paired
;
pairingTimer
.
stop
();
//Store as trusted device
const
QByteArray
&
key
=
np
.
get
<
QByteArray
>
(
"publicKey"
);
config
->
group
(
"devices"
).
group
(
id
()).
writeEntry
(
"publicKey"
,
key
);
config
->
group
(
"devices"
).
group
(
id
()).
writeEntry
(
"name"
,
name
());
m_publicKey
=
Q
SslKey
(
key
,
QSsl
::
Rsa
,
QSsl
::
Pem
,
QSsl
::
PublicK
ey
);
m_publicKey
=
Q
CA
::
RSAPublicKey
::
fromDER
(
k
ey
);
Q_EMIT
pairingSuccesful
();
...
...
@@ -292,8 +290,8 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
qDebug
()
<<
"Pair request"
;
const
Q
String
&
key
=
np
.
get
<
Q
String
>
(
"publicKey"
);
m_
tempP
ublicKey
=
Q
SslKey
(
key
.
toAscii
(),
QSsl
::
Rsa
,
QSsl
::
Pem
,
QSsl
::
PublicK
ey
);
const
Q
ByteArray
&
key
=
np
.
get
<
Q
ByteArray
>
(
"publicKey"
);
m_
p
ublicKey
=
Q
CA
::
RSAPublicKey
::
fromDER
(
k
ey
);
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_pair
ing
Requested
)
{
if
(
m_pair
Status
==
Pair
Requested
)
{
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
...
...
daemon/device.h
View file @
b5a5416c
...
...
@@ -27,6 +27,7 @@
#include <QMap>
#include <QSslKey>
#include <QTimer>
#include <QtCrypto>
#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
<
DeviceLink
*>
m_deviceLinks
;
QMap
<
QString
,
KdeConnectPlugin
*>
m_plugins
;
...
...
daemon/networkpackage.cpp
View file @
b5a5416c
...
...
@@ -19,23 +19,26 @@
*/
#include "networkpackage.h"
#include <ksharedconfig.h>
#include <kconfiggroup.h>
#include <qbytearray.h>
#include <qdatastream.h>
#include <KSharedConfig>
#include <KConfigGroup>
#include <QByteArray>
#include <QDataStream>
#include <QHostInfo>
#include <sstream>
#include <string>
#include <QSslKey>
#include <QDateTime>
#include <QtCrypto/QtCrypto>
#include <qjson/serializer.h>
#include <iostream>
#include <ctime>
#include <qjson/qobjecthelper.h>
#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
();
}
daemon/networkpackage.h
View file @
b5a5416c
...
...
@@ -27,12 +27,14 @@
#include <QString>
#include <QVariant>
#include <QStringList>
#include <QSsl>
#include <QSsl
Key
>
#include <qjson/parser.h>
#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
;
}
...
...
daemon/plugins/battery/CMakeLists.txt
View file @
b5a5416c
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
}
)
...
...
daemon/plugins/clipboard/CMakeLists.txt
View file @
b5a5416c
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
}
)
...
...
daemon/plugins/filetransfer/CMakeLists.txt
View file @
b5a5416c
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
}
)
...
...
daemon/plugins/mpriscontrol/CMakeLists.txt
View file @
b5a5416c
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
}
)
...
...
daemon/plugins/notifications/CMakeLists.txt
View file @
b5a5416c
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
}
)
...
...
daemon/plugins/pausemusic/CMakeLists.txt
View file @
b5a5416c
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
}
)
...
...
daemon/plugins/ping/CMakeLists.txt
View file @
b5a5416c
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
}
)
...
...
daemon/plugins/telephony/CMakeLists.txt
View file @
b5a5416c
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
}
)
...
...
libkdeconnect/devicesmodel.cpp
View file @
b5a5416c
...
...
@@ -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
->
r
eachable
())
continue
;
if
(
onlyReachable
&&
!
deviceDbusInterface
->
isR
eachable
())
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
->
r
eachable
();
bool
reachable
=
device
->
isR
eachable
();
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
->
r
eachable
())
{
if
(
device
->
isR
eachable
())
{
status
|=
StatusReachable
;