Changeset View
Changeset View
Standalone View
Standalone View
daemon/kdeconnectd.cpp
Show All 12 Lines | |||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. | ||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifdef SAILFISHOS | ||||
22 | #include <QCoreApplication> | ||||
23 | #else | ||||
21 | #include <QApplication> | 24 | #include <QApplication> | ||
25 | #endif | ||||
26 | | ||||
22 | #include <QNetworkAccessManager> | 27 | #include <QNetworkAccessManager> | ||
23 | #include <QTimer> | 28 | #include <QTimer> | ||
24 | 29 | | |||
25 | #include <KDBusService> | 30 | #include <KDBusService> | ||
26 | #include <KNotification> | | |||
27 | #include <KLocalizedString> | 31 | #include <KLocalizedString> | ||
32 | | ||||
33 | #ifndef SAILFISHOS | ||||
28 | #include <KIO/AccessManager> | 34 | #include <KIO/AccessManager> | ||
35 | #endif | ||||
29 | 36 | | |||
30 | #include "core/daemon.h" | 37 | #include "core/daemon.h" | ||
31 | #include "core/device.h" | 38 | #include "core/device.h" | ||
32 | #include "core/backends/pairinghandler.h" | 39 | #include "core/backends/pairinghandler.h" | ||
33 | #include "kdeconnect-version.h" | 40 | #include "kdeconnect-version.h" | ||
34 | 41 | | |||
42 | #ifdef SAILFISHOS | ||||
43 | #include "sfos/sailfishdaemon.h" | ||||
44 | #else | ||||
45 | #include <KNotification> | ||||
nicolasfella: Can you move this into a new file (within the sfos folder?) | |||||
35 | class DesktopDaemon : public Daemon | 46 | class DesktopDaemon : public Daemon | ||
nicolasfella: We could split this into DesktopDaemon and SailfishDaemon | |||||
piggz: true ... i'll give that a shot | |||||
36 | { | 47 | { | ||
37 | Q_OBJECT | 48 | Q_OBJECT | ||
38 | Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.daemon") | 49 | Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.daemon") | ||
39 | public: | 50 | public: | ||
40 | DesktopDaemon(QObject* parent = Q_NULLPTR) | 51 | DesktopDaemon(QObject* parent = Q_NULLPTR) | ||
41 | : Daemon(parent) | 52 | : Daemon(parent) | ||
42 | , m_nam(Q_NULLPTR) | 53 | , m_nam(Q_NULLPTR) | ||
43 | {} | 54 | {} | ||
Show All 23 Lines | 75 | { | |||
67 | } | 78 | } | ||
68 | return m_nam; | 79 | return m_nam; | ||
69 | } | 80 | } | ||
70 | 81 | | |||
71 | private: | 82 | private: | ||
72 | QNetworkAccessManager* m_nam; | 83 | QNetworkAccessManager* m_nam; | ||
73 | }; | 84 | }; | ||
74 | 85 | | |||
86 | #endif | ||||
87 | | ||||
75 | int main(int argc, char* argv[]) | 88 | int main(int argc, char* argv[]) | ||
76 | { | 89 | { | ||
90 | #ifdef SAILFISHOS | ||||
91 | QCoreApplication app(argc, argv); | ||||
92 | #else | ||||
77 | QApplication app(argc, argv); | 93 | QApplication app(argc, argv); | ||
94 | #endif | ||||
95 | | ||||
78 | app.setApplicationName(QStringLiteral("kdeconnectd")); | 96 | app.setApplicationName(QStringLiteral("kdeconnectd")); | ||
79 | app.setApplicationVersion(QStringLiteral(KDECONNECT_VERSION_STRING)); | 97 | app.setApplicationVersion(QStringLiteral(KDECONNECT_VERSION_STRING)); | ||
80 | app.setOrganizationDomain(QStringLiteral("kde.org")); | 98 | app.setOrganizationDomain(QStringLiteral("kde.org")); | ||
99 | | ||||
100 | #ifndef SAILFISHOS | ||||
81 | app.setQuitOnLastWindowClosed(false); | 101 | app.setQuitOnLastWindowClosed(false); | ||
102 | #endif | ||||
82 | 103 | | |||
83 | KDBusService dbusService(KDBusService::Unique); | 104 | KDBusService dbusService(KDBusService::Unique); | ||
84 | 105 | | |||
106 | #ifdef SAILFISHOS | ||||
107 | Daemon* daemon = new SailfishDaemon; | ||||
108 | #else | ||||
85 | Daemon* daemon = new DesktopDaemon; | 109 | Daemon* daemon = new DesktopDaemon; | ||
110 | #endif | ||||
111 | | ||||
86 | QObject::connect(daemon, SIGNAL(destroyed(QObject*)), &app, SLOT(quit())); | 112 | QObject::connect(daemon, SIGNAL(destroyed(QObject*)), &app, SLOT(quit())); | ||
87 | 113 | | |||
88 | return app.exec(); | 114 | return app.exec(); | ||
89 | } | 115 | } | ||
90 | 116 | | |||
91 | #include "kdeconnectd.moc" | 117 | #include "kdeconnectd.moc" |
Can you move this into a new file (within the sfos folder?)