summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rpm/saltoq.spec9
-rw-r--r--rpm/saltoq.yaml7
-rw-r--r--saltoq.pro3
-rw-r--r--saltoq/qml/cover/CoverPage.qml54
-rw-r--r--saltoq/qml/pages/FirstPage.qml73
-rw-r--r--saltoq/qml/pages/SecondPage.qml62
-rw-r--r--saltoq/qml/saltoq.qml41
-rw-r--r--saltoq/saltoq.desktop6
-rw-r--r--saltoq/saltoq.pngbin0 -> 2965 bytes
-rw-r--r--saltoq/saltoq.pro31
-rw-r--r--saltoq/src/saltoq.cpp51
-rw-r--r--saltoq/translations/saltoq.ts37
-rw-r--r--saltoqd/saltoq-bt-sniff-subrate.service10
-rw-r--r--saltoqd/saltoqd.pro10
-rw-r--r--saltoqd/toqmanager.cpp9
-rw-r--r--saltoqd/toqmanager.h24
-rw-r--r--saltoqd/toqmanageradaptor.cpp24
-rw-r--r--saltoqd/toqmanageradaptor.h39
18 files changed, 455 insertions, 35 deletions
diff --git a/rpm/saltoq.spec b/rpm/saltoq.spec
index 80ee58b..45af0cd 100644
--- a/rpm/saltoq.spec
+++ b/rpm/saltoq.spec
@@ -41,6 +41,7 @@ BuildRequires: pkgconfig(libmkcal-qt5)
BuildRequires: pkgconfig(libkcalcoren-qt5)
BuildRequires: pkgconfig(openobex)
BuildRequires: qt5-qtconnectivity-qtbluetooth-devel
+BuildRequires: desktop-file-utils
%description
Qualcomm Toq.
@@ -72,6 +73,10 @@ rm -rf %{buildroot}
# >> install post
# << install post
+desktop-file-install --delete-original \
+ --dir %{buildroot}%{_datadir}/applications \
+ %{buildroot}%{_datadir}/applications/*.desktop
+
%post
# >> post
if [ "$1" -ge 1 ]; then
@@ -92,6 +97,10 @@ fi
%files
%defattr(-,root,root,-)
%{_bindir}
+%{_datadir}/%{name}
+%{_datadir}/applications/%{name}.desktop
+%{_datadir}/icons/hicolor/86x86/apps/%{name}.png
%{_libdir}/systemd/user/saltoqd.service
+%{_libdir}/systemd/system/saltoq-bt-sniff-subrate.service
# >> files
# << files
diff --git a/rpm/saltoq.yaml b/rpm/saltoq.yaml
index 59bf336..5a21166 100644
--- a/rpm/saltoq.yaml
+++ b/rpm/saltoq.yaml
@@ -42,7 +42,8 @@ Requires:
Files:
- '%{_bindir}'
-# - '%{_datadir}/%{name}'
-# - '%{_datadir}/applications/%{name}.desktop'
-# - '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
+ - '%{_datadir}/%{name}'
+ - '%{_datadir}/applications/%{name}.desktop'
+ - '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
- '%{_libdir}/systemd/user/saltoqd.service'
+ - '%{_libdir}/systemd/system/saltoq-bt-sniff-subrate.service'
diff --git a/saltoq.pro b/saltoq.pro
index 83f6021..272f452 100644
--- a/saltoq.pro
+++ b/saltoq.pro
@@ -1,6 +1,7 @@
TEMPLATE = subdirs
SUBDIRS += \
- saltoqd
+ saltoqd \
+ saltoq
OTHER_FILES = rpm/saltoq.yaml rpm/saltoq.spec
diff --git a/saltoq/qml/cover/CoverPage.qml b/saltoq/qml/cover/CoverPage.qml
new file mode 100644
index 0000000..341b7f9
--- /dev/null
+++ b/saltoq/qml/cover/CoverPage.qml
@@ -0,0 +1,54 @@
+/*
+ Copyright (C) 2013 Jolla Ltd.
+ Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ All rights reserved.
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Jolla Ltd nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+CoverBackground {
+ Label {
+ id: label
+ anchors.centerIn: parent
+ text: qsTr("My Cover")
+ }
+
+ CoverActionList {
+ id: coverAction
+
+ CoverAction {
+ iconSource: "image://theme/icon-cover-next"
+ }
+
+ CoverAction {
+ iconSource: "image://theme/icon-cover-pause"
+ }
+ }
+}
+
+
diff --git a/saltoq/qml/pages/FirstPage.qml b/saltoq/qml/pages/FirstPage.qml
new file mode 100644
index 0000000..f503e67
--- /dev/null
+++ b/saltoq/qml/pages/FirstPage.qml
@@ -0,0 +1,73 @@
+/*
+ Copyright (C) 2013 Jolla Ltd.
+ Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ All rights reserved.
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Jolla Ltd nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+
+Page {
+ id: page
+
+ // To enable PullDownMenu, place our content in a SilicaFlickable
+ SilicaFlickable {
+ anchors.fill: parent
+
+ // PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
+ PullDownMenu {
+ MenuItem {
+ text: qsTr("Show Page 2")
+ onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
+ }
+ }
+
+ // Tell SilicaFlickable the height of its content.
+ contentHeight: column.height
+
+ // Place our content in a Column. The PageHeader is always placed at the top
+ // of the page, followed by our content.
+ Column {
+ id: column
+
+ width: page.width
+ spacing: Theme.paddingLarge
+ PageHeader {
+ title: qsTr("Saltoq")
+ }
+ Label {
+ x: Theme.paddingLarge
+ text: qsTr("Hello Toq users")
+ color: Theme.secondaryHighlightColor
+ font.pixelSize: Theme.fontSizeExtraLarge
+ }
+ }
+ }
+}
+
+
diff --git a/saltoq/qml/pages/SecondPage.qml b/saltoq/qml/pages/SecondPage.qml
new file mode 100644
index 0000000..c5b288d
--- /dev/null
+++ b/saltoq/qml/pages/SecondPage.qml
@@ -0,0 +1,62 @@
+/*
+ Copyright (C) 2013 Jolla Ltd.
+ Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ All rights reserved.
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Jolla Ltd nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+
+Page {
+ id: page
+ SilicaListView {
+ id: listView
+ model: 20
+ anchors.fill: parent
+ header: PageHeader {
+ title: qsTr("Nested Page")
+ }
+ delegate: BackgroundItem {
+ id: delegate
+
+ Label {
+ x: Theme.paddingLarge
+ text: qsTr("Item") + " " + index
+ anchors.verticalCenter: parent.verticalCenter
+ color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
+ }
+ onClicked: console.log("Clicked " + index)
+ }
+ VerticalScrollDecorator {}
+ }
+}
+
+
+
+
+
diff --git a/saltoq/qml/saltoq.qml b/saltoq/qml/saltoq.qml
new file mode 100644
index 0000000..ddbf376
--- /dev/null
+++ b/saltoq/qml/saltoq.qml
@@ -0,0 +1,41 @@
+/*
+ Copyright (C) 2013 Jolla Ltd.
+ Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ All rights reserved.
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Jolla Ltd nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import "pages"
+
+ApplicationWindow
+{
+ initialPage: Component { FirstPage { } }
+ cover: Qt.resolvedUrl("cover/CoverPage.qml")
+}
+
+
diff --git a/saltoq/saltoq.desktop b/saltoq/saltoq.desktop
new file mode 100644
index 0000000..88ea59b
--- /dev/null
+++ b/saltoq/saltoq.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Application
+X-Nemo-Application-Type=silica-qt5
+Icon=saltoq
+Exec=saltoq
+Name=Saltoq
diff --git a/saltoq/saltoq.png b/saltoq/saltoq.png
new file mode 100644
index 0000000..4c883a0
--- /dev/null
+++ b/saltoq/saltoq.png
Binary files differ
diff --git a/saltoq/saltoq.pro b/saltoq/saltoq.pro
new file mode 100644
index 0000000..b490a31
--- /dev/null
+++ b/saltoq/saltoq.pro
@@ -0,0 +1,31 @@
+# NOTICE:
+#
+# Application name defined in TARGET has a corresponding QML filename.
+# If name defined in TARGET is changed, the following needs to be done
+# to match new name:
+# - corresponding QML filename must be changed
+# - desktop icon filename must be changed
+# - desktop filename must be changed
+# - icon definition filename in desktop file must be changed
+# - translation filenames have to be changed
+
+# The name of your application
+TARGET = saltoq
+
+CONFIG += sailfishapp
+
+SOURCES += src/saltoq.cpp
+
+OTHER_FILES += qml/saltoq.qml \
+ qml/cover/CoverPage.qml \
+ qml/pages/FirstPage.qml \
+ qml/pages/SecondPage.qml \
+ rpm/saltoq.changes.in \
+ rpm/saltoq.spec \
+ rpm/saltoq.yaml \
+ translations/*.ts \
+ saltoq.desktop
+
+CONFIG += sailfishapp_i18n
+
+#TRANSLATIONS += translations/saltoq-de.ts
diff --git a/saltoq/src/saltoq.cpp b/saltoq/src/saltoq.cpp
new file mode 100644
index 0000000..df9646c
--- /dev/null
+++ b/saltoq/src/saltoq.cpp
@@ -0,0 +1,51 @@
+/*
+ Copyright (C) 2013 Jolla Ltd.
+ Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ All rights reserved.
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Jolla Ltd nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifdef QT_QML_DEBUG
+#include <QtQuick>
+#endif
+
+#include <sailfishapp.h>
+
+
+int main(int argc, char *argv[])
+{
+ // SailfishApp::main() will display "qml/template.qml", if you need more
+ // control over initialization, you can use:
+ //
+ // - SailfishApp::application(int, char *[]) to get the QGuiApplication *
+ // - SailfishApp::createView() to get a new QQuickView * instance
+ // - SailfishApp::pathTo(QString) to get a QUrl to a resource file
+ //
+ // To display the view, call "show()" (will show fullscreen on device).
+
+ return SailfishApp::main(argc, argv);
+}
+
diff --git a/saltoq/translations/saltoq.ts b/saltoq/translations/saltoq.ts
new file mode 100644
index 0000000..79326b9
--- /dev/null
+++ b/saltoq/translations/saltoq.ts
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name>CoverPage</name>
+ <message>
+ <source>My Cover</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>FirstPage</name>
+ <message>
+ <source>Show Page 2</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Saltoq</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Hello Toq users</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SecondPage</name>
+ <message>
+ <source>Nested Page</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Item</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/saltoqd/saltoq-bt-sniff-subrate.service b/saltoqd/saltoq-bt-sniff-subrate.service
new file mode 100644
index 0000000..08bad83
--- /dev/null
+++ b/saltoqd/saltoq-bt-sniff-subrate.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Set Bluetooth's sniff_max_interval
+After=local-fs.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "/bin/echo 1600 > /sys/class/bluetooth/hci0/sniff_max_interval"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/saltoqd/saltoqd.pro b/saltoqd/saltoqd.pro
index 4a51905..4337097 100644
--- a/saltoqd/saltoqd.pro
+++ b/saltoqd/saltoqd.pro
@@ -25,7 +25,8 @@ SOURCES += main.cpp \
cardmanager.cpp \
agendamanager.cpp \
settings.cpp \
- settingsmanager.cpp
+ settingsmanager.cpp \
+ toqmanageradaptor.cpp
HEADERS += \
toqconnection.h \
@@ -44,7 +45,8 @@ HEADERS += \
cardmanager.h \
agendamanager.h \
settings.h \
- settingsmanager.h
+ settingsmanager.h \
+ toqmanageradaptor.h
DBUS_INTERFACES += com.nokia.profiled.xml org.nemomobile.voicecall.VoiceCallManager.xml org.nemomobile.voicecall.VoiceCall.xml
QDBUSXML2CPP_INTERFACE_HEADER_FLAGS = -i voicecallmanager.h
@@ -55,3 +57,7 @@ INSTALLS += target
unit.path = /usr/lib/systemd/user/
unit.files = saltoqd.service
INSTALLS += unit
+
+workaround.path = /usr/lib/systemd/system/
+workaround.files = saltoq-bt-sniff-subrate.service
+INSTALLS += workaround
diff --git a/saltoqd/toqmanager.cpp b/saltoqd/toqmanager.cpp
index 6e738fe..c319939 100644
--- a/saltoqd/toqmanager.cpp
+++ b/saltoqd/toqmanager.cpp
@@ -1,6 +1,7 @@
#include <QtDBus/QDBusConnection>
#include "toqmanager.h"
+#include "toqmanageradaptor.h"
#include "obexconnection.h"
@@ -51,7 +52,7 @@ ToqManager::ToqManager(Settings *settings, QObject *parent) :
_conn->setAddress(QBluetoothAddress(_settings->address()));
- new ToqManagerAdaptor(this);
+ new ToqManagerAdaptor(_fmsManager, this);
QDBusConnection::sessionBus().registerObject("/com/javispedro/saltoq/ToqManager", this);
}
@@ -126,9 +127,3 @@ 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 6cc8b8d..a7e99b2 100644
--- a/saltoqd/toqmanager.h
+++ b/saltoqd/toqmanager.h
@@ -2,7 +2,6 @@
#define TOQMANAGER_H
#include <QtCore/QObject>
-#include <QtDBus/QDBusAbstractAdaptor>
#include "toqconnection.h"
#include "settings.h"
@@ -27,6 +26,8 @@ class ToqManager : public QObject
Q_OBJECT
Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged)
+ friend class ToqManagerAdaptor;
+
public:
explicit ToqManager(Settings *settings, QObject *parent = 0);
@@ -81,22 +82,6 @@ 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();
@@ -107,9 +92,4 @@ inline quint16 ToqManager::newTransactionId()
return _conn->newTransactionId();
}
-inline bool ToqManagerAdaptor::isConnected() const
-{
- return static_cast<ToqManager*>(parent())->isConnected();
-}
-
#endif // TOQMANAGER_H
diff --git a/saltoqd/toqmanageradaptor.cpp b/saltoqd/toqmanageradaptor.cpp
new file mode 100644
index 0000000..d5ee41d
--- /dev/null
+++ b/saltoqd/toqmanageradaptor.cpp
@@ -0,0 +1,24 @@
+#include <QtCore/QFile>
+
+#include "toqmanageradaptor.h"
+#include "fmsmanager.h"
+
+ToqManagerAdaptor::ToqManagerAdaptor(FmsManager *fms, ToqManager *parent)
+ : QDBusAbstractAdaptor(parent),
+ _conn(QDBusConnection::sessionBus()),
+ _toq(parent), _fms(fms)
+{
+ setAutoRelaySignals(true);
+}
+
+void ToqManagerAdaptor::PutFile(const QString &localFile, const QString &remoteFile, const QDBusMessage &msg)
+{
+ QFile f(localFile);
+ if (!f.open(QIODevice::ReadOnly)) {
+ QDBusMessage reply = msg.createErrorReply("com.javispedro.saltoq.InvalidFile", "File does not exist");
+ _conn.send(reply);
+ return;
+ }
+
+ _fms->updateFile(remoteFile, f.readAll());
+}
diff --git a/saltoqd/toqmanageradaptor.h b/saltoqd/toqmanageradaptor.h
new file mode 100644
index 0000000..c2e62e9
--- /dev/null
+++ b/saltoqd/toqmanageradaptor.h
@@ -0,0 +1,39 @@
+#ifndef TOQMANAGERADAPTOR_H
+#define TOQMANAGERADAPTOR_H
+
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusAbstractAdaptor>
+#include <QtDBus/QDBusMessage>
+
+#include "toqmanager.h"
+
+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(FmsManager *fms, ToqManager *parent);
+
+ bool isConnected() const;
+
+public slots:
+ void PutFile(const QString &localFile, const QString &remoteFile, const QDBusMessage &msg);
+
+signals:
+ void connectedChanged();
+
+private:
+ QDBusConnection _conn;
+ ToqManager *_toq;
+ FmsManager *_fms;
+};
+
+inline bool ToqManagerAdaptor::isConnected() const
+{
+ return _toq->isConnected();
+}
+
+#endif // TOQMANAGERADAPTOR_H