diff options
-rw-r--r-- | rpm/saltoq.spec | 3 | ||||
-rw-r--r-- | rpm/saltoq.yaml | 3 | ||||
-rw-r--r-- | saltoqd/main.cpp | 3 | ||||
-rw-r--r-- | saltoqd/notificationmonitor.cpp | 1 | ||||
-rw-r--r-- | saltoqd/org.freedesktop.Notifications.xml | 20 | ||||
-rw-r--r-- | saltoqd/saltoqd.pro | 2 | ||||
-rw-r--r-- | saltoqd/toqmanager.cpp | 13 | ||||
-rw-r--r-- | saltoqd/toqmanager.h | 25 |
8 files changed, 43 insertions, 27 deletions
diff --git a/rpm/saltoq.spec b/rpm/saltoq.spec index cb629a6..80ee58b 100644 --- a/rpm/saltoq.spec +++ b/rpm/saltoq.spec @@ -13,7 +13,7 @@ Name: saltoq %{!?qtc_make:%define qtc_make make} %{?qtc_builddir:%define _builddir %qtc_builddir} Summary: Qualcomm Toq manager application -Version: 0.0.1 +Version: 0.1 Release: 1 Group: Communications/Bluetooth License: GPLv3 @@ -22,7 +22,6 @@ Source0: %{name}-%{version}.tar.bz2 Source100: saltoq.yaml Requires: sailfishsilica-qt5 >= 0.10.9 Requires: sailfish-components-bluetooth-qt5 -Requires: nemo-qml-plugin-configuration-qt5 Requires: systemd Requires: systemd-user-session-targets BuildRequires: pkgconfig(sailfishapp) >= 1.0.2 diff --git a/rpm/saltoq.yaml b/rpm/saltoq.yaml index f82b9ef..59bf336 100644 --- a/rpm/saltoq.yaml +++ b/rpm/saltoq.yaml @@ -1,6 +1,6 @@ Name: saltoq Summary: Qualcomm Toq manager application -Version: 0.0.1 +Version: 0.1 Release: 1 Group: Communications/Bluetooth URL: https://gitorious.org/javispedro-jolla-misc/salmeta/ @@ -37,7 +37,6 @@ PkgBR: Requires: - sailfishsilica-qt5 >= 0.10.9 - sailfish-components-bluetooth-qt5 - - nemo-qml-plugin-configuration-qt5 - systemd - systemd-user-session-targets diff --git a/saltoqd/main.cpp b/saltoqd/main.cpp index 4910dca..570f6c4 100644 --- a/saltoqd/main.cpp +++ b/saltoqd/main.cpp @@ -1,4 +1,5 @@ #include <QtCore> +#include <QtDBus> #include "toqmanager.h" Q_DECL_EXPORT int main(int argc, char **argv) @@ -8,5 +9,7 @@ Q_DECL_EXPORT int main(int argc, char **argv) QScopedPointer<Settings> settings(new Settings("/apps/saltoq")); QScopedPointer<ToqManager> manager(new ToqManager(settings.data())); + QDBusConnection::sessionBus().registerService("com.javispedro.saltoq.daemon"); + return app.exec(); } diff --git a/saltoqd/notificationmonitor.cpp b/saltoqd/notificationmonitor.cpp index 107e165..83d9820 100644 --- a/saltoqd/notificationmonitor.cpp +++ b/saltoqd/notificationmonitor.cpp @@ -3,7 +3,6 @@ #include <dbus/dbus.h> #include "notificationmonitor.h" -#include "notifications_adaptor.h" namespace { diff --git a/saltoqd/org.freedesktop.Notifications.xml b/saltoqd/org.freedesktop.Notifications.xml deleted file mode 100644 index 3e645a0..0000000 --- a/saltoqd/org.freedesktop.Notifications.xml +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> -<node> - <interface name="org.freedesktop.Notifications"> - <!-- (Partial) Desktop Notification Specification interface --> - <method name="Notify"> - <arg name="app_name" type="s" direction="in"/> - <arg name="replaces_id" type="u" direction="in"/> - <arg name="app_icon" type="s" direction="in"/> - <arg name="summary" type="s" direction="in"/> - <arg name="body" type="s" direction="in"/> - <arg name="actions" type="as" direction="in"/> - <arg name="hints" type="a{sv}" direction="in"/> - <arg name="expire_timeout" type="i" direction="in"/> - <arg name="id" type="u" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In6" value="QVariantHash"/> - </method> - <method name="CloseNotification"> - <arg name="id" type="u" direction="in"/> - </method> -</node> diff --git a/saltoqd/saltoqd.pro b/saltoqd/saltoqd.pro index d7cb076..4a51905 100644 --- a/saltoqd/saltoqd.pro +++ b/saltoqd/saltoqd.pro @@ -46,8 +46,6 @@ HEADERS += \ settings.h \ settingsmanager.h -DBUS_ADAPTORS += org.freedesktop.Notifications.xml - DBUS_INTERFACES += com.nokia.profiled.xml org.nemomobile.voicecall.VoiceCallManager.xml org.nemomobile.voicecall.VoiceCall.xml QDBUSXML2CPP_INTERFACE_HEADER_FLAGS = -i voicecallmanager.h diff --git a/saltoqd/toqmanager.cpp b/saltoqd/toqmanager.cpp index dcc22f4..6e738fe 100644 --- a/saltoqd/toqmanager.cpp +++ b/saltoqd/toqmanager.cpp @@ -1,3 +1,5 @@ +#include <QtDBus/QDBusConnection> + #include "toqmanager.h" #include "obexconnection.h" @@ -42,10 +44,15 @@ ToqManager::ToqManager(Settings *settings, QObject *parent) : this, &ToqManager::connected); connect(_conn, &ToqConnection::disconnected, this, &ToqManager::disconnected); + connect(_conn, &ToqConnection::connectedChanged, + this, &ToqManager::connectedChanged); connect(_settings, &Settings::addressChanged, this, &ToqManager::handleSettingsAddressChanged); _conn->setAddress(QBluetoothAddress(_settings->address())); + + new ToqManagerAdaptor(this); + QDBusConnection::sessionBus().registerObject("/com/javispedro/saltoq/ToqManager", this); } void ToqManager::setEndpointListener(ToqConnection::Endpoint ep, EndpointHandler *handler) @@ -119,3 +126,9 @@ void ToqManager::handleSettingsAddressChanged() { _conn->setAddress(QBluetoothAddress(_settings->address())); } + +ToqManagerAdaptor::ToqManagerAdaptor(ToqManager *parent) + : QDBusAbstractAdaptor(parent) +{ + setAutoRelaySignals(true); +} diff --git a/saltoqd/toqmanager.h b/saltoqd/toqmanager.h index 422884d..6cc8b8d 100644 --- a/saltoqd/toqmanager.h +++ b/saltoqd/toqmanager.h @@ -2,6 +2,7 @@ #define TOQMANAGER_H #include <QtCore/QObject> +#include <QtDBus/QDBusAbstractAdaptor> #include "toqconnection.h" #include "settings.h" @@ -24,6 +25,8 @@ class NotificationManager; class ToqManager : public QObject { Q_OBJECT + Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged) + public: explicit ToqManager(Settings *settings, QObject *parent = 0); @@ -51,6 +54,7 @@ public: signals: void connected(); void disconnected(); + void connectedChanged(); private slots: void handleToqMessage(const ToqConnection::Message &msg); @@ -77,6 +81,22 @@ private: NotificationManager *_notificationManager; }; +class ToqManagerAdaptor : public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.javispedro.saltoq.ToqManager") + + Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged) + +public: + ToqManagerAdaptor(ToqManager *parent); + + bool isConnected() const; + +signals: + void connectedChanged(); +}; + inline bool ToqManager::isConnected() const { return _conn->isConnected(); @@ -87,4 +107,9 @@ inline quint16 ToqManager::newTransactionId() return _conn->newTransactionId(); } +inline bool ToqManagerAdaptor::isConnected() const +{ + return static_cast<ToqManager*>(parent())->isConnected(); +} + #endif // TOQMANAGER_H |