Buteo Synchronization Framework: SyncDBusAdaptor.h Source File

Buteo Synchronization Framework

SyncDBusAdaptor.h
1 /*
2 * This file is part of buteo-syncfw package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 * Copyright (C) 2015 Jolla Ltd.
6 *
7 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * version 2.1 as published by the Free Software Foundation.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25 #ifndef SYNCDBUSADAPTOR_H_1383642656
26 #define SYNCDBUSADAPTOR_H_1383642656
27
28 #include <QtCore/QObject>
29 #include <QtDBus/QtDBus>
30 class QByteArray;
31 template<class T> class QList;
32 template<class Key, class Value> class QMap;
33 class QString;
34 class QStringList;
35 class QVariant;
36
37 /*
38 * Adaptor class for interface com.meego.msyncd
39 */
40 class SyncDBusAdaptor: public QDBusAbstractAdaptor
41 {
42 Q_OBJECT
43 Q_CLASSINFO("D-Bus Interface", "com.meego.msyncd")
44 Q_CLASSINFO("D-Bus Introspection", ""
45 " <interface name=\"com.meego.msyncd\">\n"
46 " <signal name=\"syncStatus\">\n"
47 " <arg direction=\"out\" type=\"s\" name=\"aProfileName\"/>\n"
48 " <arg direction=\"out\" type=\"i\" name=\"aStatus\"/>\n"
49 " <arg direction=\"out\" type=\"s\" name=\"aMessage\"/>\n"
50 " <arg direction=\"out\" type=\"i\" name=\"aMoreDetails\"/>\n"
51 " </signal>\n"
52 " <signal name=\"transferProgress\">\n"
53 " <arg direction=\"out\" type=\"s\" name=\"aProfileName\"/>\n"
54 " <arg direction=\"out\" type=\"i\" name=\"aTransferDatabase\"/>\n"
55 " <arg direction=\"out\" type=\"i\" name=\"aTransferType\"/>\n"
56 " <arg direction=\"out\" type=\"s\" name=\"aMimeType\"/>\n"
57 " <arg direction=\"out\" type=\"i\" name=\"aCommittedItems\"/>\n"
58 " </signal>\n"
59 " <signal name=\"signalProfileChanged\">\n"
60 " <arg direction=\"out\" type=\"s\" name=\"aProfileName\"/>\n"
61 " <arg direction=\"out\" type=\"i\" name=\"aChangeType\"/>\n"
62 " <arg direction=\"out\" type=\"s\" name=\"aProfileAsXml\"/>\n"
63 " </signal>\n"
64 " <signal name=\"backupInProgress\"/>\n"
65 " <signal name=\"backupDone\"/>\n"
66 " <signal name=\"restoreInProgress\"/>\n"
67 " <signal name=\"restoreDone\"/>\n"
68 " <signal name=\"resultsAvailable\">\n"
69 " <arg direction=\"out\" type=\"s\" name=\"aProfileName\"/>\n"
70 " <arg direction=\"out\" type=\"s\" name=\"aResultsAsXml\"/>\n"
71 " </signal>\n"
72 " <signal name=\"statusChanged\">\n"
73 " <arg direction=\"out\" type=\"u\" name=\"aAccountId\"/>\n"
74 " <arg direction=\"out\" type=\"i\" name=\"aNewStatus\"/>\n"
75 " <arg direction=\"out\" type=\"i\" name=\"aFailedReason\"/>\n"
76 " <arg direction=\"out\" type=\"x\" name=\"aPrevSyncTime\"/>\n"
77 " <arg direction=\"out\" type=\"x\" name=\"aNextSyncTime\"/>\n"
78 " </signal>\n"
79 " <signal name=\"syncedExternallyStatus\">\n"
80 " <arg direction=\"out\" type=\"u\" name=\"AccountId\"/>\n"
81 " <arg direction=\"out\" type=\"s\" name=\"aClientProfileName\"/>\n"
82 " <arg direction=\"out\" type=\"b\" name=\"aState\"/>\n"
83 " </signal>\n"
84 " <method name=\"startSync\">\n"
85 " <arg direction=\"out\" type=\"b\"/>\n"
86 " <arg direction=\"in\" type=\"s\" name=\"aProfileId\"/>\n"
87 " </method>\n"
88 " <method name=\"abortSync\">\n"
89 " <arg direction=\"in\" type=\"s\" name=\"aProfileId\"/>\n"
90 " <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
91 " </method>\n"
92 " <method name=\"removeProfile\">\n"
93 " <arg direction=\"out\" type=\"b\"/>\n"
94 " <arg direction=\"in\" type=\"s\" name=\"aProfileId\"/>\n"
95 " </method>\n"
96 " <method name=\"updateProfile\">\n"
97 " <arg direction=\"out\" type=\"b\"/>\n"
98 " <arg direction=\"in\" type=\"s\" name=\"aProfileAsXml\"/>\n"
99 " </method>\n"
100 " <method name=\"requestStorages\">\n"
101 " <arg direction=\"out\" type=\"b\"/>\n"
102 " <arg direction=\"in\" type=\"as\" name=\"aStorageNames\"/>\n"
103 " </method>\n"
104 " <method name=\"isConnectivityAvailable\">\n"
105 " <arg direction=\"out\" type=\"b\"/>\n"
106 " <arg direction=\"in\" type=\"i\" name=\"connectivityType\"/>\n"
107 " </method>\n"
108 " <method name=\"releaseStorages\">\n"
109 " <arg direction=\"in\" type=\"as\" name=\"aStorageNames\"/>\n"
110 " <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
111 " </method>\n"
112 " <method name=\"runningSyncs\">\n"
113 " <arg direction=\"out\" type=\"as\"/>\n"
114 " </method>\n"
115 " <method name=\"getBackUpRestoreState\">\n"
116 " <arg direction=\"out\" type=\"b\"/>\n"
117 " </method>\n"
118 " <method name=\"setSyncSchedule\">\n"
119 " <arg direction=\"out\" type=\"b\"/>\n"
120 " <arg direction=\"in\" type=\"s\" name=\"aProfileId\"/>\n"
121 " <arg direction=\"in\" type=\"s\" name=\"aScheduleAsXml\"/>\n"
122 " </method>\n"
123 " <method name=\"saveSyncResults\">\n"
124 " <arg direction=\"out\" type=\"b\"/>\n"
125 " <arg direction=\"in\" type=\"s\" name=\"aProfileId\"/>\n"
126 " <arg direction=\"in\" type=\"s\" name=\"aSyncResults\"/>\n"
127 " </method>\n"
128 " <method name=\"getLastSyncResult\">\n"
129 " <arg direction=\"out\" type=\"s\"/>\n"
130 " <arg direction=\"in\" type=\"s\" name=\"aProfileId\"/>\n"
131 " </method>\n"
132 " <method name=\"allVisibleSyncProfiles\">\n"
133 " <arg direction=\"out\" type=\"as\"/>\n"
134 " </method>\n"
135 " <method name=\"syncProfile\">\n"
136 " <arg direction=\"out\" type=\"s\"/>\n"
137 " <arg direction=\"in\" type=\"s\" name=\"aProfileId\"/>\n"
138 " </method>\n"
139 " <method name=\"syncProfilesByKey\">\n"
140 " <arg direction=\"out\" type=\"as\"/>\n"
141 " <arg direction=\"in\" type=\"s\" name=\"aKey\"/>\n"
142 " <arg direction=\"in\" type=\"s\" name=\"aValue\"/>\n"
143 " </method>\n"
144 " <method name=\"syncProfilesByType\">\n"
145 " <arg direction=\"out\" type=\"as\"/>\n"
146 " <arg direction=\"in\" type=\"s\" name=\"aType\"/>\n"
147 " </method>\n"
148 " <method name=\"start\">\n"
149 " <arg direction=\"in\" type=\"u\" name=\"aAccountId\"/>\n"
150 " <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
151 " </method>\n"
152 " <method name=\"stop\">\n"
153 " <arg direction=\"in\" type=\"u\" name=\"aAccountId\"/>\n"
154 " <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
155 " </method>\n"
156 " <method name=\"syncingAccounts\">\n"
157 " <arg direction=\"out\" type=\"au\"/>\n"
158 " <annotation value=\"QList&lt;uint>\" name=\"com.trolltech.QtDBus.QtTypeName.Out0\"/>\n"
159 " </method>\n"
160 " <method name=\"createSyncProfileForAccount\">\n"
161 " <arg direction=\"out\" type=\"s\"/>\n"
162 " <arg direction=\"in\" type=\"u\" name=\"aAccountId\"/>\n"
163 " </method>\n"
164 " <method name=\"status\">\n"
165 " <arg direction=\"out\" type=\"i\"/>\n"
166 " <arg direction=\"in\" type=\"u\" name=\"aAccountId\"/>\n"
167 " <arg direction=\"out\" type=\"i\" name=\"aFailedReason\"/>\n"
168 " <arg direction=\"out\" type=\"x\" name=\"aPrevSyncTime\"/>\n"
169 " <arg direction=\"out\" type=\"x\" name=\"aNextSyncTime\"/>\n"
170 " </method>\n"
171 " <method name=\"isSyncedExternally\">\n"
172 " <arg direction=\"in\" type=\"u\" name=\"aAccountId\"/>\n"
173 " <arg direction=\"in\" type=\"s\" name=\"aClientProfileName\"/>\n"
174 " <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
175 " </method>\n"
176 " </interface>\n"
177 "")
178 public:
179 SyncDBusAdaptor(QObject *parent);
180 virtual ~SyncDBusAdaptor();
181
182 public: // PROPERTIES
183 public Q_SLOTS: // METHODS
184 Q_NOREPLY void abortSync(const QString &aProfileId);
185 QStringList allVisibleSyncProfiles();
186 bool getBackUpRestoreState();
187 QString getLastSyncResult(const QString &aProfileId);
188 bool isConnectivityAvailable(int connectivityType);
189 Q_NOREPLY void releaseStorages(const QStringList &aStorageNames);
190 bool removeProfile(const QString &aProfileId);
191 bool requestStorages(const QStringList &aStorageNames);
192 QStringList runningSyncs();
193 bool saveSyncResults(const QString &aProfileId, const QString &aSyncResults);
194 bool setSyncSchedule(const QString &aProfileId, const QString &aScheduleAsXml);
195 Q_NOREPLY void start(uint aAccountId);
196 bool startSync(const QString &aProfileId);
197 int status(uint aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime);
198 Q_NOREPLY void stop(uint aAccountId);
199 QString syncProfile(const QString &aProfileId);
200 QStringList syncProfilesByKey(const QString &aKey, const QString &aValue);
201 QStringList syncProfilesByType(const QString &aType);
202 QList<uint> syncingAccounts();
203 bool updateProfile(const QString &aProfileAsXml);
204 Q_NOREPLY void isSyncedExternally(uint aAccountId, const QString aClientProfileName);
205 QString createSyncProfileForAccount(uint aAccountId);
206 Q_SIGNALS: // SIGNALS
207 void backupDone();
208 void backupInProgress();
209 void restoreDone();
210 void restoreInProgress();
211 void resultsAvailable(const QString &aProfileName, const QString &aResultsAsXml);
212 void signalProfileChanged(const QString &aProfileName, int aChangeType, const QString &aProfileAsXml);
213 void statusChanged(uint aAccountId, int aNewStatus, int aFailedReason, qlonglong aPrevSyncTime,
214 qlonglong aNextSyncTime);
215 void syncStatus(const QString &aProfileName, int aStatus, const QString &aMessage, int aMoreDetails);
216 void transferProgress(const QString &aProfileName, int aTransferDatabase, int aTransferType, const QString &aMimeType,
217 int aCommittedItems);
218 void syncedExternallyStatus(uint aAccountId, const QString &aClientProfileName, bool aState);
219 };
220
221 #endif
QList
Definition: SyncBackupAdaptor.h:40
QMap
Definition: SyncBackupAdaptor.h:41
SyncDBusAdaptor
Definition: SyncDBusAdaptor.h:41