Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KDE Connect
Commits
54310738
Commit
54310738
authored
Jun 09, 2019
by
Weixuan Xiao
Browse files
Add wrapper for macos dbus connection
parent
af57aca5
Pipeline
#4155
passed with stage
in 17 minutes and 40 seconds
Changes
28
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cli/CMakeLists.txt
View file @
54310738
...
...
@@ -7,6 +7,7 @@ target_include_directories(kdeconnect-cli PUBLIC ${CMAKE_BINARY_DIR})
target_link_libraries
(
kdeconnect-cli
kdeconnectinterfaces
kdeconnectcore
KF5::CoreAddons
KF5::I18n
)
...
...
cli/kdeconnect-cli.cpp
View file @
54310738
...
...
@@ -21,7 +21,6 @@
#include <QCryptographicHash>
#include <QIODevice>
#include <QDBusMessage>
#include <QDBusConnection>
#include <QCoreApplication>
#include <QTextStream>
#include <QFile>
...
...
@@ -34,6 +33,8 @@
#include "interfaces/dbushelpers.h"
#include "kdeconnect-version.h"
#include <dbushelper.h>
int
main
(
int
argc
,
char
**
argv
)
{
QCoreApplication
app
(
argc
,
argv
);
...
...
@@ -166,7 +167,7 @@ int main(int argc, char** argv)
}
}
else
if
(
parser
.
isSet
(
QStringLiteral
(
"refresh"
)))
{
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
QStringLiteral
(
"org.kde.kdeconnect"
),
QStringLiteral
(
"/modules/kdeconnect"
),
QStringLiteral
(
"org.kde.kdeconnect.daemon"
),
QStringLiteral
(
"forceOnNetworkChange"
));
blockOnReply
(
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
));
blockOnReply
(
DbusHelper
::
sessionBus
().
asyncCall
(
msg
));
}
else
{
QString
device
=
parser
.
value
(
QStringLiteral
(
"device"
));
...
...
@@ -199,7 +200,7 @@ int main(int argc, char** argv)
QStringLiteral
(
"org.kde.kdeconnect.device.share"
),
QStringLiteral
(
"shareUrls"
));
msg
.
setArguments
(
QVariantList
()
<<
QVariant
(
urls
));
blockOnReply
(
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
));
blockOnReply
(
DbusHelper
::
sessionBus
().
asyncCall
(
msg
));
for
(
const
QString
&
url
:
qAsConst
(
urls
))
{
QTextStream
(
stdout
)
<<
i18n
(
"Shared %1"
,
url
)
<<
endl
;
...
...
@@ -207,7 +208,7 @@ int main(int argc, char** argv)
}
else
if
(
parser
.
isSet
(
QStringLiteral
(
"share-text"
)))
{
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
QStringLiteral
(
"org.kde.kdeconnect"
),
"/modules/kdeconnect/devices/"
+
device
+
"/share"
,
QStringLiteral
(
"org.kde.kdeconnect.device.share"
),
QStringLiteral
(
"shareText"
));
msg
.
setArguments
(
QVariantList
()
<<
parser
.
value
(
QStringLiteral
(
"share-text"
)));
blockOnReply
(
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
));
blockOnReply
(
DbusHelper
::
sessionBus
().
asyncCall
(
msg
));
QTextStream
(
stdout
)
<<
i18n
(
"Shared text: %1"
,
parser
.
value
(
QStringLiteral
(
"share-text"
)))
<<
endl
;
}
else
if
(
parser
.
isSet
(
QStringLiteral
(
"pair"
)))
{
DeviceDbusInterface
dev
(
device
);
...
...
@@ -250,22 +251,22 @@ int main(int argc, char** argv)
QString
message
=
parser
.
value
(
QStringLiteral
(
"ping-msg"
));
msg
.
setArguments
(
QVariantList
()
<<
message
);
}
blockOnReply
(
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
));
blockOnReply
(
DbusHelper
::
sessionBus
().
asyncCall
(
msg
));
}
else
if
(
parser
.
isSet
(
QStringLiteral
(
"send-sms"
)))
{
if
(
parser
.
isSet
(
QStringLiteral
(
"destination"
)))
{
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
QStringLiteral
(
"org.kde.kdeconnect"
),
"/modules/kdeconnect/devices/"
+
device
+
"/sms"
,
QStringLiteral
(
"org.kde.kdeconnect.device.sms"
),
QStringLiteral
(
"sendSms"
));
msg
.
setArguments
({
parser
.
value
(
"destination"
),
parser
.
value
(
"send-sms"
)
});
blockOnReply
(
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
));
blockOnReply
(
DbusHelper
::
sessionBus
().
asyncCall
(
msg
));
}
else
{
QTextStream
(
stderr
)
<<
i18n
(
"error: should specify the SMS's recipient by passing --destination <phone number>"
);
return
1
;
}
}
else
if
(
parser
.
isSet
(
QStringLiteral
(
"ring"
)))
{
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
QStringLiteral
(
"org.kde.kdeconnect"
),
"/modules/kdeconnect/devices/"
+
device
+
"/findmyphone"
,
QStringLiteral
(
"org.kde.kdeconnect.device.findmyphone"
),
QStringLiteral
(
"ring"
));
blockOnReply
(
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
));
blockOnReply
(
DbusHelper
::
sessionBus
().
asyncCall
(
msg
));
}
else
if
(
parser
.
isSet
(
QStringLiteral
(
"photo"
)))
{
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
QStringLiteral
(
"org.kde.kdeconnect"
),
"/modules/kdeconnect/devices/"
+
device
+
"/photo"
,
QStringLiteral
(
"org.kde.kdeconnect.device.photo"
),
QStringLiteral
(
"requestPhoto"
));
blockOnReply
(
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
));
blockOnReply
(
DbusHelper
::
sessionBus
().
asyncCall
(
msg
));
}
else
if
(
parser
.
isSet
(
"send-keys"
))
{
QString
seq
=
parser
.
value
(
"send-keys"
);
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
"org.kde.kdeconnect"
,
"/modules/kdeconnect/devices/"
+
device
+
"/remotekeyboard"
,
"org.kde.kdeconnect.device.remotekeyboard"
,
"sendKeyPress"
);
...
...
@@ -276,13 +277,13 @@ int main(int argc, char** argv)
while
(
!
in
.
atEnd
())
{
QByteArray
line
=
in
.
readLine
();
// sanitize to ASCII-codes > 31?
msg
.
setArguments
({
QString
(
line
),
-
1
,
false
,
false
,
false
});
blockOnReply
(
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
));
blockOnReply
(
DbusHelper
::
sessionBus
().
asyncCall
(
msg
));
}
in
.
close
();
}
}
else
{
msg
.
setArguments
({
seq
,
-
1
,
false
,
false
,
false
});
blockOnReply
(
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
));
blockOnReply
(
DbusHelper
::
sessionBus
().
asyncCall
(
msg
));
}
}
else
if
(
parser
.
isSet
(
QStringLiteral
(
"list-notifications"
)))
{
NotificationsModel
notifications
;
...
...
core/CMakeLists.txt
View file @
54310738
...
...
@@ -2,6 +2,10 @@ project(KDEConnectCore)
add_definitions
(
-DTRANSLATION_DOMAIN=\"kdeconnect-core\"
)
set
(
KDECONNECT_PRIVATE_DBUS_ADDR unix:path=/tmp/kdeconnect-dbus
)
set
(
KDECONNECT_PRIVATE_DBUS_NAME DBusKDEConnectOnly
)
configure_file
(
dbushelper.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/dbushelper.h
)
add_subdirectory
(
backends/lan
)
add_subdirectory
(
backends/loopback
)
...
...
core/daemon.cpp
View file @
54310738
...
...
@@ -20,7 +20,6 @@
#include "daemon.h"
#include <QDBusConnection>
#include <QDBusMetaType>
#include <QNetworkAccessManager>
#include <QDebug>
...
...
@@ -29,6 +28,7 @@
#include "core_debug.h"
#include "kdeconnectconfig.h"
#include "networkpacket.h"
#include "dbushelper.h"
#include "notificationserverinfo.h"
#ifdef KDECONNECT_BLUETOOTH
...
...
@@ -108,8 +108,8 @@ void Daemon::init()
//Register on DBus
qDBusRegisterMetaType
<
QMap
<
QString
,
QString
>
>
();
QDBusConnection
::
sessionBus
().
registerService
(
QStringLiteral
(
"org.kde.kdeconnect"
));
QDBusConnection
::
sessionBus
().
registerObject
(
QStringLiteral
(
"/modules/kdeconnect"
),
this
,
QDBusConnection
::
ExportScriptableContents
);
DbusHelper
::
sessionBus
().
registerService
(
QStringLiteral
(
"org.kde.kdeconnect"
));
DbusHelper
::
sessionBus
().
registerObject
(
QStringLiteral
(
"/modules/kdeconnect"
),
this
,
QDBusConnection
::
ExportScriptableContents
);
NotificationServerInfo
::
instance
().
init
();
...
...
core/dbushelper.cpp
View file @
54310738
...
...
@@ -20,8 +20,6 @@
#include "dbushelper.h"
#include <QRegExp>
namespace
DbusHelper
{
void
filterNonExportableCharacters
(
QString
&
s
)
...
...
@@ -30,4 +28,13 @@ void filterNonExportableCharacters(QString& s)
s
.
replace
(
regexp
,
QLatin1String
(
"_"
));
}
QDBusConnection
sessionBus
()
{
#ifdef Q_OS_MAC
return
QDBusConnection
::
connectToBus
(
QStringLiteral
(
KDECONNECT_PRIVATE_DBUS_ADDR
),
QStringLiteral
(
KDECONNECT_PRIVATE_DBUS_NAME
));
#else
return
QDBusConnection
::
sessionBus
();
#endif
}
}
core/dbushelper.h
→
core/dbushelper.h
.in
View file @
54310738
...
...
@@ -21,11 +21,17 @@
#ifndef KDECONNECT_DBUSHELPER_H
#define KDECONNECT_DBUSHELPER_H
#include <QString>
#include <QDBusConnection>
#include "kdeconnectcore_export.h"
#define KDECONNECT_PRIVATE_DBUS_ADDR "${KDECONNECT_PRIVATE_DBUS_ADDR}"
#define KDECONNECT_PRIVATE_DBUS_NAME "${KDECONNECT_PRIVATE_DBUS_NAME}"
namespace DbusHelper {
void KDECONNECTCORE_EXPORT filterNonExportableCharacters(QString& s);
QDBusConnection KDECONNECTCORE_EXPORT sessionBus();
}
#endif
core/device.cpp
View file @
54310738
...
...
@@ -20,7 +20,6 @@
#include "device.h"
#include <QDBusConnection>
#include <QVector>
#include <QSet>
#include <QSslCertificate>
...
...
@@ -38,6 +37,7 @@
#include "networkpacket.h"
#include "kdeconnectconfig.h"
#include "daemon.h"
#include "dbushelper.h"
//In older Qt released, qAsConst isnt available
#include "qtcompat_p.h"
...
...
@@ -87,7 +87,7 @@ Device::Device(QObject* parent, const QString& id)
d
->
m_deviceType
=
str2type
(
info
.
deviceType
);
//Register in bus
QDBusConnection
::
sessionBus
().
registerObject
(
dbusPath
(),
this
,
QDBusConnection
::
ExportScriptableContents
|
QDBusConnection
::
ExportAdaptors
);
DbusHelper
::
sessionBus
().
registerObject
(
dbusPath
(),
this
,
QDBusConnection
::
ExportScriptableContents
|
QDBusConnection
::
ExportAdaptors
);
//Assume every plugin is supported until addLink is called and we can get the actual list
d
->
m_allPlugins
=
PluginLoader
::
instance
()
->
getPluginList
().
toSet
();
...
...
@@ -106,7 +106,7 @@ Device::Device(QObject* parent, const NetworkPacket& identityPacket, DeviceLink*
addLink
(
identityPacket
,
dl
);
//Register in bus
QDBusConnection
::
sessionBus
().
registerObject
(
dbusPath
(),
this
,
QDBusConnection
::
ExportScriptableContents
|
QDBusConnection
::
ExportAdaptors
);
DbusHelper
::
sessionBus
().
registerObject
(
dbusPath
(),
this
,
QDBusConnection
::
ExportScriptableContents
|
QDBusConnection
::
ExportAdaptors
);
connect
(
this
,
&
Device
::
pairingError
,
this
,
&
warn
);
}
...
...
@@ -196,7 +196,7 @@ void Device::reloadPlugins()
d
->
m_plugins
=
newPluginMap
;
d
->
m_pluginsByIncomingCapability
=
newPluginsByIncomingCapability
;
QDBusConnection
bus
=
QDBusConnection
::
sessionBus
();
QDBusConnection
bus
=
DbusHelper
::
sessionBus
();
for
(
KdeConnectPlugin
*
plugin
:
qAsConst
(
d
->
m_plugins
))
{
//TODO: see how it works in Android (only done once, when created)
plugin
->
connected
();
...
...
core/kdeconnectpluginconfig.cpp
View file @
54310738
...
...
@@ -23,9 +23,9 @@
#include <QDir>
#include <QSettings>
#include <QDBusMessage>
#include <QDBusConnection>
#include "kdeconnectconfig.h"
#include "dbushelper.h"
struct
KdeConnectPluginConfigPrivate
{
...
...
@@ -43,7 +43,7 @@ KdeConnectPluginConfig::KdeConnectPluginConfig(const QString& deviceId, const QS
d
->
m_config
=
new
QSettings
(
d
->
m_configDir
.
absoluteFilePath
(
QStringLiteral
(
"config"
)),
QSettings
::
IniFormat
);
d
->
m_signal
=
QDBusMessage
::
createSignal
(
"/kdeconnect/"
+
deviceId
+
"/"
+
pluginName
,
QStringLiteral
(
"org.kde.kdeconnect.config"
),
QStringLiteral
(
"configChanged"
));
QDBusConnection
::
sessionBus
().
connect
(
QLatin1String
(
""
),
"/kdeconnect/"
+
deviceId
+
"/"
+
pluginName
,
QStringLiteral
(
"org.kde.kdeconnect.config"
),
QStringLiteral
(
"configChanged"
),
this
,
SLOT
(
slotConfigChanged
()));
DbusHelper
::
sessionBus
().
connect
(
QLatin1String
(
""
),
"/kdeconnect/"
+
deviceId
+
"/"
+
pluginName
,
QStringLiteral
(
"org.kde.kdeconnect.config"
),
QStringLiteral
(
"configChanged"
),
this
,
SLOT
(
slotConfigChanged
()));
}
KdeConnectPluginConfig
::~
KdeConnectPluginConfig
()
...
...
@@ -79,7 +79,7 @@ void KdeConnectPluginConfig::set(const QString& key, const QVariant& value)
{
d
->
m_config
->
setValue
(
key
,
value
);
d
->
m_config
->
sync
();
QDBusConnection
::
sessionBus
().
send
(
d
->
m_signal
);
DbusHelper
::
sessionBus
().
send
(
d
->
m_signal
);
}
void
KdeConnectPluginConfig
::
setList
(
const
QString
&
key
,
const
QVariantList
&
list
)
...
...
@@ -91,7 +91,7 @@ void KdeConnectPluginConfig::setList(const QString& key, const QVariantList& lis
}
d
->
m_config
->
endArray
();
d
->
m_config
->
sync
();
QDBusConnection
::
sessionBus
().
send
(
d
->
m_signal
);
DbusHelper
::
sessionBus
().
send
(
d
->
m_signal
);
}
void
KdeConnectPluginConfig
::
slotConfigChanged
()
...
...
daemon/kdeconnectd.cpp
View file @
54310738
...
...
@@ -25,7 +25,6 @@
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QDBusMessage>
#include <QDBusConnection>
#include <QSessionManager>
#include <KAboutData>
...
...
@@ -34,6 +33,8 @@
#include <KLocalizedString>
#include <KIO/AccessManager>
#include <dbushelper.h>
#include "core/daemon.h"
#include "core/device.h"
#include "core/backends/pairinghandler.h"
...
...
@@ -122,10 +123,12 @@ int main(int argc, char* argv[])
QStringLiteral
(
"/MainApplication"
),
QStringLiteral
(
"org.qtproject.Qt.QCoreApplication"
),
QStringLiteral
(
"quit"
));
QDBusConnection
::
sessionBus
().
call
(
message
);
//deliberately block until it's done, so we register the name after the app quits
DbusHelper
::
sessionBus
().
call
(
message
);
//deliberately block until it's done, so we register the name after the app quits
}
#ifndef Q_OS_MAC
KDBusService
dbusService
(
KDBusService
::
Unique
);
#endif
DesktopDaemon
daemon
;
...
...
fileitemactionplugin/CMakeLists.txt
View file @
54310738
...
...
@@ -6,6 +6,7 @@ target_link_libraries(kdeconnectfileitemaction
KF5::KIOWidgets
KF5::I18n
kdeconnectinterfaces
kdeconnectcore
)
install
(
TARGETS kdeconnectfileitemaction DESTINATION
${
PLUGIN_INSTALL_DIR
}
)
install
(
FILES kdeconnectsendfile.desktop DESTINATION
${
SERVICES_INSTALL_DIR
}
)
fileitemactionplugin/sendfileitemaction.cpp
View file @
54310738
...
...
@@ -35,6 +35,8 @@
#include <interfaces/devicesmodel.h>
#include <interfaces/dbusinterfaces.h>
#include <dbushelper.h>
K_PLUGIN_FACTORY
(
SendFileItemActionFactory
,
registerPlugin
<
SendFileItemAction
>
();)
Q_LOGGING_CATEGORY
(
KDECONNECT_FILEITEMACTION
,
"kdeconnect.fileitemaction"
)
...
...
@@ -92,7 +94,7 @@ void SendFileItemAction::sendFile()
for
(
const
QUrl
&
url
:
urls
)
{
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
QStringLiteral
(
"org.kde.kdeconnect"
),
"/modules/kdeconnect/devices/"
+
id
+
"/share"
,
QStringLiteral
(
"org.kde.kdeconnect.device.share"
),
QStringLiteral
(
"shareUrl"
));
msg
.
setArguments
(
QVariantList
()
<<
url
.
toString
());
QDBusConnection
::
sessionBus
().
call
(
msg
);
DbusHelper
::
sessionBus
().
call
(
msg
);
}
}
...
...
indicator/CMakeLists.txt
View file @
54310738
...
...
@@ -16,7 +16,7 @@ ecm_add_app_icon(indicator_SRCS ICONS
add_executable
(
kdeconnect-indicator
${
indicator_SRCS
}
)
target_include_directories
(
kdeconnect-indicator PUBLIC
${
CMAKE_BINARY_DIR
}
)
target_link_libraries
(
kdeconnect-indicator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::Notifications KF5::DBusAddons KF5::KCMUtils kdeconnectinterfaces
)
target_link_libraries
(
kdeconnect-indicator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::Notifications KF5::DBusAddons KF5::KCMUtils kdeconnectinterfaces
kdeconnectcore
)
install
(
TARGETS kdeconnect-indicator
${
INSTALL_TARGETS_DEFAULT_ARGS
}
)
install
(
PROGRAMS org.kde.kdeconnect.nonplasma.desktop DESTINATION
${
XDG_APPS_INSTALL_DIR
}
)
indicator/deviceindicator.cpp
View file @
54310738
...
...
@@ -24,6 +24,8 @@
#include "interfaces/dbusinterfaces.h"
#include <dbushelper.h>
class
BatteryAction
:
public
QAction
{
Q_OBJECT
...
...
@@ -105,7 +107,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
QStringLiteral
(
"org.kde.kdeconnect"
),
"/modules/kdeconnect/devices/"
+
device
->
id
()
+
"/share"
,
QStringLiteral
(
"org.kde.kdeconnect.device.share"
),
QStringLiteral
(
"shareUrl"
));
msg
.
setArguments
(
QVariantList
()
<<
url
.
toString
());
QDBusConnection
::
sessionBus
().
call
(
msg
);
DbusHelper
::
sessionBus
().
call
(
msg
);
});
setWhenAvailable
(
device
->
hasPlugin
(
"kdeconnect_share"
),
[
sendFile
](
bool
available
)
{
sendFile
->
setVisible
(
available
);
},
this
);
}
...
...
indicator/main.cpp
View file @
54310738
...
...
@@ -37,6 +37,8 @@
#include "kdeconnect-version.h"
#include "deviceindicator.h"
#include <dbushelper.h>
int
main
(
int
argc
,
char
**
argv
)
{
QApplication
app
(
argc
,
argv
);
...
...
@@ -52,7 +54,9 @@ int main(int argc, char** argv)
QProcess
::
startDetached
(
"kdeconnectd.exe"
);
#endif
#ifndef Q_OS_MAC
KDBusService
dbusService
(
KDBusService
::
Unique
);
#endif
DevicesModel
model
;
model
.
setDisplayFilter
(
DevicesModel
::
Reachable
|
DevicesModel
::
Paired
);
...
...
interfaces/CMakeLists.txt
View file @
54310738
...
...
@@ -64,7 +64,7 @@ set_target_properties(kdeconnectinterfaces PROPERTIES
generate_export_header
(
kdeconnectinterfaces EXPORT_FILE_NAME
${
CMAKE_CURRENT_BINARY_DIR
}
/kdeconnectinterfaces_export.h BASE_NAME KDEConnectInterfaces
)
target_include_directories
(
kdeconnectinterfaces PUBLIC
${
CMAKE_SOURCE_DIR
}
${
CMAKE_CURRENT_BINARY_DIR
}
)
target_include_directories
(
kdeconnectinterfaces PUBLIC
${
CMAKE_SOURCE_DIR
}
${
CMAKE_CURRENT_BINARY_DIR
}
${
CMAKE_BINARY_DIR
}
)
target_link_libraries
(
kdeconnectinterfaces
LINK_PUBLIC
...
...
@@ -73,6 +73,7 @@ LINK_PUBLIC
LINK_PRIVATE
KF5::ConfigCore
KF5::I18n
kdeconnectcore
)
configure_file
(
KDEConnectConfig.cmake.in
${
CMAKE_BINARY_DIR
}
/interfaces/KDEConnectConfig.cmake @ONLY
)
...
...
interfaces/dbusinterfaces.cpp
View file @
54310738
...
...
@@ -19,18 +19,19 @@
*/
#include "dbusinterfaces.h"
#include <dbushelper.h>
QString
DaemonDbusInterface
::
activatedService
()
{
static
const
QString
service
=
QStringLiteral
(
"org.kde.kdeconnect"
);
auto
reply
=
QDBusConnection
::
sessionBus
().
interface
()
->
startService
(
service
);
auto
reply
=
DbusHelper
::
sessionBus
().
interface
()
->
startService
(
service
);
if
(
!
reply
.
isValid
())
{
qWarning
()
<<
"error activating kdeconnectd:"
<<
QDBusConnection
::
sessionBus
().
interface
()
->
lastError
();
qWarning
()
<<
"error activating kdeconnectd:"
<<
DbusHelper
::
sessionBus
().
interface
()
->
lastError
();
}
return
service
;
}
DaemonDbusInterface
::
DaemonDbusInterface
(
QObject
*
parent
)
:
OrgKdeKdeconnectDaemonInterface
(
DaemonDbusInterface
::
activatedService
(),
QStringLiteral
(
"/modules/kdeconnect"
),
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDaemonInterface
(
DaemonDbusInterface
::
activatedService
(),
QStringLiteral
(
"/modules/kdeconnect"
),
DbusHelper
::
sessionBus
(),
parent
)
{
connect
(
this
,
&
OrgKdeKdeconnectDaemonInterface
::
pairingRequestsChanged
,
this
,
&
DaemonDbusInterface
::
pairingRequestsChangedProxy
);
}
...
...
@@ -41,7 +42,7 @@ DaemonDbusInterface::~DaemonDbusInterface()
}
DeviceDbusInterface
::
DeviceDbusInterface
(
const
QString
&
id
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
,
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDeviceInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
,
DbusHelper
::
sessionBus
(),
parent
)
,
m_id
(
id
)
{
connect
(
this
,
&
OrgKdeKdeconnectDeviceInterface
::
trustedChanged
,
this
,
&
DeviceDbusInterface
::
trustedChangedProxy
);
...
...
@@ -63,11 +64,11 @@ QString DeviceDbusInterface::id() const
void
DeviceDbusInterface
::
pluginCall
(
const
QString
&
plugin
,
const
QString
&
method
)
{
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
QStringLiteral
(
"org.kde.kdeconnect"
),
"/modules/kdeconnect/devices/"
+
id
()
+
'/'
+
plugin
,
"org.kde.kdeconnect.device."
+
plugin
,
method
);
QDBusConnection
::
sessionBus
().
asyncCall
(
msg
);
DbusHelper
::
sessionBus
().
asyncCall
(
msg
);
}
DeviceBatteryDbusInterface
::
DeviceBatteryDbusInterface
(
const
QString
&
id
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceBatteryInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
,
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDeviceBatteryInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
...
...
@@ -78,7 +79,7 @@ DeviceBatteryDbusInterface::~DeviceBatteryDbusInterface()
}
DeviceNotificationsDbusInterface
::
DeviceNotificationsDbusInterface
(
const
QString
&
id
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceNotificationsInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
,
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDeviceNotificationsInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
...
...
@@ -89,7 +90,7 @@ DeviceNotificationsDbusInterface::~DeviceNotificationsDbusInterface()
}
NotificationDbusInterface
::
NotificationDbusInterface
(
const
QString
&
deviceId
,
const
QString
&
notificationId
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceNotificationsNotificationInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/notifications/"
+
notificationId
,
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDeviceNotificationsNotificationInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/notifications/"
+
notificationId
,
DbusHelper
::
sessionBus
(),
parent
)
,
id
(
notificationId
)
{
...
...
@@ -101,7 +102,7 @@ NotificationDbusInterface::~NotificationDbusInterface()
}
DeviceConversationsDbusInterface
::
DeviceConversationsDbusInterface
(
const
QString
&
deviceId
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceConversationsInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
,
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDeviceConversationsInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
...
...
@@ -112,7 +113,7 @@ DeviceConversationsDbusInterface::~DeviceConversationsDbusInterface()
}
SftpDbusInterface
::
SftpDbusInterface
(
const
QString
&
id
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceSftpInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
+
"/sftp"
,
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDeviceSftpInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
+
"/sftp"
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
...
...
@@ -123,7 +124,7 @@ SftpDbusInterface::~SftpDbusInterface()
}
MprisDbusInterface
::
MprisDbusInterface
(
const
QString
&
id
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceMprisremoteInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
+
"/mprisremote"
,
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDeviceMprisremoteInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
+
"/mprisremote"
,
DbusHelper
::
sessionBus
(),
parent
)
{
connect
(
this
,
&
OrgKdeKdeconnectDeviceMprisremoteInterface
::
propertiesChanged
,
this
,
&
MprisDbusInterface
::
propertiesChangedProxy
);
}
...
...
@@ -133,7 +134,7 @@ MprisDbusInterface::~MprisDbusInterface()
}
RemoteControlDbusInterface
::
RemoteControlDbusInterface
(
const
QString
&
id
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceRemotecontrolInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
+
"/remotecontrol"
,
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDeviceRemotecontrolInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
+
"/remotecontrol"
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
...
...
@@ -142,7 +143,7 @@ RemoteControlDbusInterface::~RemoteControlDbusInterface()
}
LockDeviceDbusInterface
::
LockDeviceDbusInterface
(
const
QString
&
id
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceLockdeviceInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
+
"/lockdevice"
,
QDBusConnection
::
sessionBus
(),
parent
)
:
OrgKdeKdeconnectDeviceLockdeviceInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
id
+
"/lockdevice"
,
DbusHelper
::
sessionBus
(),
parent
)
{
connect
(
this
,
&
OrgKdeKdeconnectDeviceLockdeviceInterface
::
lockedChanged
,
this
,
&
LockDeviceDbusInterface
::
lockedChangedProxy
);
Q_ASSERT
(
isValid
());
...
...
@@ -153,7 +154,7 @@ LockDeviceDbusInterface::~LockDeviceDbusInterface()
}
FindMyPhoneDeviceDbusInterface
::
FindMyPhoneDeviceDbusInterface
(
const
QString
&
deviceId
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceFindmyphoneInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/findmyphone"
,
QDBusConnection
::
sessionBus
(),
parent
)
OrgKdeKdeconnectDeviceFindmyphoneInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/findmyphone"
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
...
...
@@ -162,14 +163,14 @@ FindMyPhoneDeviceDbusInterface::~FindMyPhoneDeviceDbusInterface()
}
RemoteCommandsDbusInterface
::
RemoteCommandsDbusInterface
(
const
QString
&
deviceId
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceRemotecommandsInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/remotecommands"
,
QDBusConnection
::
sessionBus
(),
parent
)
OrgKdeKdeconnectDeviceRemotecommandsInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/remotecommands"
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
RemoteCommandsDbusInterface
::~
RemoteCommandsDbusInterface
()
=
default
;
RemoteKeyboardDbusInterface
::
RemoteKeyboardDbusInterface
(
const
QString
&
deviceId
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceRemotekeyboardInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/remotekeyboard"
,
QDBusConnection
::
sessionBus
(),
parent
)
OrgKdeKdeconnectDeviceRemotekeyboardInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/remotekeyboard"
,
DbusHelper
::
sessionBus
(),
parent
)
{
connect
(
this
,
&
OrgKdeKdeconnectDeviceRemotekeyboardInterface
::
remoteStateChanged
,
this
,
&
RemoteKeyboardDbusInterface
::
remoteStateChanged
);
}
...
...
@@ -177,20 +178,20 @@ RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId
RemoteKeyboardDbusInterface
::~
RemoteKeyboardDbusInterface
()
=
default
;
SmsDbusInterface
::
SmsDbusInterface
(
const
QString
&
deviceId
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceSmsInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/sms"
,
QDBusConnection
::
sessionBus
(),
parent
)
OrgKdeKdeconnectDeviceSmsInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/sms"
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
SmsDbusInterface
::~
SmsDbusInterface
()
=
default
;
ShareDbusInterface
::
ShareDbusInterface
(
const
QString
&
deviceId
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceShareInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/share"
,
QDBusConnection
::
sessionBus
(),
parent
)
OrgKdeKdeconnectDeviceShareInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/share"
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
ShareDbusInterface
::~
ShareDbusInterface
()
=
default
;
RemoteSystemVolumeDbusInterface
::
RemoteSystemVolumeDbusInterface
(
const
QString
&
deviceId
,
QObject
*
parent
)
:
OrgKdeKdeconnectDeviceRemotesystemvolumeInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/remotesystemvolume"
,
QDBusConnection
::
sessionBus
(),
parent
)
OrgKdeKdeconnectDeviceRemotesystemvolumeInterface
(
DaemonDbusInterface
::
activatedService
(),
"/modules/kdeconnect/devices/"
+
deviceId
+
"/remotesystemvolume"
,
DbusHelper
::
sessionBus
(),
parent
)
{
}
interfaces/devicesmodel.cpp
View file @
54310738
...
...
@@ -30,6 +30,7 @@
#include <QDBusServiceWatcher>
#include "dbusinterfaces.h"
#include <dbushelper.h>
// #include "modeltest.h"
Q_LOGGING_CATEGORY
(
KDECONNECT_INTERFACES
,
"kdeconnect.interfaces"
);
...
...
@@ -59,7 +60,7 @@ DevicesModel::DevicesModel(QObject* parent)
this
,
&
DevicesModel
::
deviceRemoved
);
QDBusServiceWatcher
*
watcher
=
new
QDBusServiceWatcher
(
DaemonDbusInterface
::
activatedService
(),
QDBusConnection
::
sessionBus
(),
QDBusServiceWatcher
::
WatchForOwnerChange
,
this
);
DbusHelper
::
sessionBus
(),
QDBusServiceWatcher
::
WatchForOwnerChange
,
this
);
connect
(
watcher
,
&
QDBusServiceWatcher
::
serviceRegistered
,
this
,
&
DevicesModel
::
refreshDeviceList
);
connect
(
watcher
,
&
QDBusServiceWatcher
::
serviceUnregistered
,
this
,
&
DevicesModel
::
clearDevices
);
...
...
interfaces/notificationsmodel.cpp
View file @
54310738
...
...
@@ -26,6 +26,8 @@
#include <QIcon>
#include <dbushelper.h>
//#include "modeltest.h"
//In older Qt released, qAsConst isnt available
...
...
@@ -49,7 +51,7 @@ NotificationsModel::NotificationsModel(QObject* parent)
this
,
&
NotificationsModel
::
anyDismissableChanged
);
QDBusServiceWatcher
*
watcher
=
new
QDBusServiceWatcher
(
DaemonDbusInterface
::
activatedService
(),
QDBusConnection
::
sessionBus
(),
QDBusServiceWatcher
::
WatchForOwnerChange
,
this
);
DbusHelper
::
sessionBus
(),
QDBusServiceWatcher
::
WatchForOwnerChange
,
this
);
connect
(
watcher
,
&
QDBusServiceWatcher
::
serviceRegistered
,
this
,
&
NotificationsModel
::
refreshNotificationList
);
connect
(
watcher
,
&
QDBusServiceWatcher
::
serviceUnregistered
,
this
,
&
NotificationsModel
::
clearNotifications
);
}
...
...
interfaces/remotecommandsmodel.cpp
View file @
54310738
...
...
@@ -24,6 +24,8 @@
#include <QDebug>
#include <QDBusInterface>
#include <dbushelper.h>
RemoteCommandsModel
::
RemoteCommandsModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
,
m_dbusInterface
(
nullptr
)
...
...
@@ -35,7 +37,7 @@ RemoteCommandsModel::RemoteCommandsModel(QObject* parent)
this
,
&
RemoteCommandsModel
::
rowsChanged
);
QDBusServiceWatcher
*
watcher
=
new
QDBusServiceWatcher
(
DaemonDbusInterface
::
activatedService
(),
QDBusConnection
::
sessionBus
(),
QDBusServiceWatcher
::
WatchForOwnerChange
,
this
);
DbusHelper
::
sessionBus
(),
QDBusServiceWatcher
::
WatchForOwnerChange
,
this
);
connect
(
watcher
,
&
QDBusServiceWatcher
::
serviceRegistered
,
this
,
&
RemoteCommandsModel
::
refreshCommandList
);
connect
(
watcher
,
&
QDBusServiceWatcher
::
serviceUnregistered
,
this
,
&
RemoteCommandsModel
::
clearCommands
);
}
...
...
interfaces/remotesinksmodel.cpp
View file @
54310738
...
...
@@ -24,6 +24,8 @@
#include <QDebug>
#include <QDBusInterface>
#include <dbushelper.h>
RemoteSinksModel
::
RemoteSinksModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
,
m_dbusInterface
(
nullptr
)
...
...
@@ -35,7 +37,7 @@ RemoteSinksModel::RemoteSinksModel(QObject* parent)
this
,
&
RemoteSinksModel
::
rowsChanged
);
QDBusServiceWatcher
*
watcher
=
new
QDBusServiceWatcher
(
DaemonDbusInterface
::
activatedService
(),
QDBusConnection
::
sessionBus
(),
QDBusServiceWatcher
::
WatchForOwnerChange
,
this
);
DbusHelper
::
sessionBus
(),
QDBusServiceWatcher
::
WatchForOwnerChange
,
this
);
connect
(
watcher
,
&
QDBusServiceWatcher
::
serviceRegistered
,
this
,
&
RemoteSinksModel
::
refreshSinkList
);
connect
(
watcher
,
&
QDBusServiceWatcher
::
serviceUnregistered
,
this
,
&
RemoteSinksModel
::
refreshSinkList
);
}
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment