Merge lp:~renatofilho/sync-monitor/start-after-unity8 into lp:sync-monitor

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Bill Filler
Approved revision: 47
Merged at revision: 39
Proposed branch: lp:~renatofilho/sync-monitor/start-after-unity8
Merge into: lp:sync-monitor
Prerequisite: lp:~renatofilho/sync-monitor/check-network
Diff against target: 354 lines (+84/-66)
14 files modified
CMakeLists.txt (+1/-2)
Ubuntu/SyncMonitor/syncmonitor-qml.cpp (+2/-0)
data/CMakeLists.txt (+0/-8)
data/com.canonical.SyncMonitor.service.in (+0/-3)
debian/sync-monitor.install (+0/-1)
src/eds-helper.cpp (+40/-31)
src/eds-helper.h (+1/-0)
src/sync-daemon.cpp (+14/-3)
src/sync-daemon.h (+2/-0)
src/sync-dbus.cpp (+14/-1)
src/sync-dbus.h (+7/-0)
tests/unittest/eds-helper-mock.h (+3/-1)
upstart/CMakeLists.txt (+0/-7)
upstart/sync-monitor.conf.in (+0/-9)
To merge this branch: bzr merge lp:~renatofilho/sync-monitor/start-after-unity8
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+240278@code.launchpad.net

This proposal supersedes a proposal from 2014-10-22.

Commit message

Do not sync on startup, only after a client registers with sync-monitor (apps, or online accounts).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
47. By Renato Araujo Oliveira Filho

Merged parent branch.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

tested according to "Test Network" section of test plan. All working.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-11-06 03:58:10 +0000
3+++ CMakeLists.txt 2014-11-06 03:58:10 +0000
4@@ -27,12 +27,11 @@
5 enable_testing()
6 add_subdirectory(3rd_party)
7 add_subdirectory(src)
8-add_subdirectory(upstart)
9 add_subdirectory(accounts)
10 add_subdirectory(templates)
11-add_subdirectory(data)
12 add_subdirectory(tests)
13 add_subdirectory(po)
14 add_subdirectory(Ubuntu)
15+add_subdirectory(upstart)
16
17 configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
18
19=== modified file 'Ubuntu/SyncMonitor/syncmonitor-qml.cpp'
20--- Ubuntu/SyncMonitor/syncmonitor-qml.cpp 2014-04-25 14:00:57 +0000
21+++ Ubuntu/SyncMonitor/syncmonitor-qml.cpp 2014-11-06 03:58:10 +0000
22@@ -55,6 +55,7 @@
23 SyncMonitorQml::~SyncMonitorQml()
24 {
25 if (m_iface) {
26+ m_iface->call("detach");
27 delete m_iface;
28 m_iface = 0;
29 }
30@@ -111,6 +112,7 @@
31
32 connect(m_iface, SIGNAL(stateChanged()), SIGNAL(stateChanged()));
33 connect(m_iface, SIGNAL(enabledServicesChanged()), SIGNAL(enabledServicesChanged()));
34+ m_iface->call("attach");
35 Q_EMIT stateChanged();
36 Q_EMIT enabledServicesChanged();
37 }
38
39=== removed directory 'data'
40=== removed file 'data/CMakeLists.txt'
41--- data/CMakeLists.txt 2014-03-25 15:10:15 +0000
42+++ data/CMakeLists.txt 1970-01-01 00:00:00 +0000
43@@ -1,8 +0,0 @@
44-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.SyncMonitor.service.in"
45- "${CMAKE_CURRENT_BINARY_DIR}/com.canonical.SyncMonitor.service"
46- IMMEDIATE @ONLY
47-)
48-
49-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/com.canonical.SyncMonitor.service
50- DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/dbus-1/services/
51-)
52
53=== removed file 'data/com.canonical.SyncMonitor.service.in'
54--- data/com.canonical.SyncMonitor.service.in 2014-04-08 18:51:17 +0000
55+++ data/com.canonical.SyncMonitor.service.in 1970-01-01 00:00:00 +0000
56@@ -1,3 +0,0 @@
57-[D-BUS Service]
58-Name=com.canonical.SyncMonitor
59-Exec=@CMAKE_INSTALL_FULL_LIBDIR@/sync-monitor/sync-monitor
60
61=== modified file 'debian/sync-monitor.install'
62--- debian/sync-monitor.install 2014-04-08 14:55:20 +0000
63+++ debian/sync-monitor.install 2014-11-06 03:58:10 +0000
64@@ -1,4 +1,3 @@
65 usr/lib/*/sync-monitor/sync-monitor
66 usr/share/upstart/sessions/sync-monitor.conf
67 usr/share/sync-monitor/templates/*
68-usr/share/dbus-1/services/com.canonical.SyncMonitor.service
69
70=== modified file 'src/eds-helper.cpp'
71--- src/eds-helper.cpp 2014-11-06 03:58:10 +0000
72+++ src/eds-helper.cpp 2014-11-06 03:58:10 +0000
73@@ -28,39 +28,10 @@
74 qRegisterMetaType<QList<QOrganizerItemId> >("QList<QOrganizerItemId>");
75 qRegisterMetaType<QList<QContactId> >("QList<QContactId>");
76
77- m_timeoutTimer.setSingleShot(true);
78-
79 m_contactEngine = new QContactManager(contactManager, QMap<QString, QString>());
80- connect(m_contactEngine,
81- SIGNAL(contactsAdded(QList<QContactId>)),
82- SLOT(contactChangedFilter(QList<QContactId>)),
83- Qt::QueuedConnection);
84- connect(m_contactEngine,
85- SIGNAL(contactsChanged(QList<QContactId>)),
86- SLOT(contactChangedFilter(QList<QContactId>)),
87- Qt::QueuedConnection);
88- connect(m_contactEngine,
89- SIGNAL(contactsRemoved(QList<QContactId>)),
90- SLOT(contactChanged()),
91- Qt::QueuedConnection);
92- connect(m_contactEngine,
93- SIGNAL(dataChanged()),
94- SLOT(contactDataChanged()),
95- Qt::QueuedConnection);
96-
97 m_organizerEngine = new QOrganizerManager(organizerManager, QMap<QString, QString>());
98- connect(m_organizerEngine,
99- SIGNAL(itemsAdded(QList<QOrganizerItemId>)),
100- SLOT(calendarChanged(QList<QOrganizerItemId>)), Qt::QueuedConnection);
101- connect(m_organizerEngine,
102- SIGNAL(itemsRemoved(QList<QOrganizerItemId>)),
103- SLOT(calendarChanged(QList<QOrganizerItemId>)), Qt::QueuedConnection);
104- connect(m_organizerEngine,
105- SIGNAL(itemsChanged(QList<QOrganizerItemId>)),
106- SLOT(calendarChanged(QList<QOrganizerItemId>)), Qt::QueuedConnection);
107- connect(m_organizerEngine,
108- SIGNAL(collectionsModified(QList<QPair<QOrganizerCollectionId,QOrganizerManager::Operation> >)),
109- SLOT(calendarCollectionsChanged()));
110+
111+ m_timeoutTimer.setSingleShot(true);
112 }
113
114 EdsHelper::~EdsHelper()
115@@ -117,6 +88,44 @@
116 m_pendingCalendars.clear();
117 }
118
119+void EdsHelper::setEnabled(bool enabled)
120+{
121+ if (enabled) {
122+ connect(m_contactEngine,
123+ SIGNAL(contactsAdded(QList<QContactId>)),
124+ SLOT(contactChangedFilter(QList<QContactId>)),
125+ Qt::QueuedConnection);
126+ connect(m_contactEngine,
127+ SIGNAL(contactsChanged(QList<QContactId>)),
128+ SLOT(contactChangedFilter(QList<QContactId>)),
129+ Qt::QueuedConnection);
130+ connect(m_contactEngine,
131+ SIGNAL(contactsRemoved(QList<QContactId>)),
132+ SLOT(contactChanged()),
133+ Qt::QueuedConnection);
134+ connect(m_contactEngine,
135+ SIGNAL(dataChanged()),
136+ SLOT(contactDataChanged()),
137+ Qt::QueuedConnection);
138+
139+ connect(m_organizerEngine,
140+ SIGNAL(itemsAdded(QList<QOrganizerItemId>)),
141+ SLOT(calendarChanged(QList<QOrganizerItemId>)), Qt::QueuedConnection);
142+ connect(m_organizerEngine,
143+ SIGNAL(itemsRemoved(QList<QOrganizerItemId>)),
144+ SLOT(calendarChanged(QList<QOrganizerItemId>)), Qt::QueuedConnection);
145+ connect(m_organizerEngine,
146+ SIGNAL(itemsChanged(QList<QOrganizerItemId>)),
147+ SLOT(calendarChanged(QList<QOrganizerItemId>)), Qt::QueuedConnection);
148+ connect(m_organizerEngine,
149+ SIGNAL(collectionsModified(QList<QPair<QOrganizerCollectionId,QOrganizerManager::Operation> >)),
150+ SLOT(calendarCollectionsChanged()));
151+ } else {
152+ m_contactEngine->disconnect(this);
153+ m_organizerEngine->disconnect(this);
154+ }
155+}
156+
157 void EdsHelper::contactChangedFilter(const QList<QContactId>& contactIds)
158 {
159 if (m_freezed) {
160
161=== modified file 'src/eds-helper.h'
162--- src/eds-helper.h 2014-11-06 03:58:10 +0000
163+++ src/eds-helper.h 2014-11-06 03:58:10 +0000
164@@ -47,6 +47,7 @@
165 void freezeNotify();
166 void unfreezeNotify();
167 void flush();
168+ void setEnabled(bool enabled);
169
170 Q_SIGNALS:
171 void dataChanged(const QString &serviceName, const QString &sourceName);
172
173=== modified file 'src/sync-daemon.cpp'
174--- src/sync-daemon.cpp 2014-11-06 03:58:10 +0000
175+++ src/sync-daemon.cpp 2014-11-06 03:58:10 +0000
176@@ -41,9 +41,10 @@
177 m_manager(0),
178 m_eds(0),
179 m_dbusAddaptor(0),
180+ m_currentAccount(0),
181 m_syncing(false),
182 m_aboutToQuit(false),
183- m_currentAccount(0)
184+ m_firstClient(true)
185 {
186 m_provider = new ProviderTemplate();
187 m_provider->load();
188@@ -109,6 +110,16 @@
189 }
190 }
191
192+void SyncDaemon::onClientAttached()
193+{
194+ if (m_firstClient) {
195+ m_firstClient = false;
196+ // accept eds changes
197+ qDebug() << "First client connected, will auto-sync on next EDS change";
198+ m_eds->setEnabled(true);
199+ }
200+}
201+
202 void SyncDaemon::onOnlineStatusChanged(bool isOnline)
203 {
204 Q_EMIT isOnlineChanged(isOnline);
205@@ -221,13 +232,13 @@
206 }
207
208 m_dbusAddaptor = new SyncDBus(connection, this);
209- if (!connection.registerObject(SYNCMONITOR_OBJECT_PATH, this))
210- {
211+ if (!connection.registerObject(SYNCMONITOR_OBJECT_PATH, this)) {
212 qWarning() << "Could not register object!" << SYNCMONITOR_OBJECT_PATH;
213 delete m_dbusAddaptor;
214 m_dbusAddaptor = 0;
215 return false;
216 }
217+ connect(m_dbusAddaptor, SIGNAL(clientAttached(int)), SLOT(onClientAttached()));
218 }
219 return true;
220 }
221
222=== modified file 'src/sync-daemon.h'
223--- src/sync-daemon.h 2014-11-06 03:58:10 +0000
224+++ src/sync-daemon.h 2014-11-06 03:58:10 +0000
225@@ -72,6 +72,7 @@
226 void onAccountEnableChanged(const QString &serviceName, bool enabled);
227 void onAccountConfigured(const QString &serviceName);
228 void onDataChanged(const QString &serviceName, const QString &sourceName);
229+ void onClientAttached();
230
231 void onOnlineStatusChanged(bool isOnline);
232
233@@ -90,6 +91,7 @@
234 bool m_syncing;
235 bool m_aboutToQuit;
236 QElapsedTimer m_syncElapsedTime;
237+ bool m_firstClient;
238
239 void setupAccounts();
240 void setupTriggers();
241
242=== modified file 'src/sync-dbus.cpp'
243--- src/sync-dbus.cpp 2014-11-06 03:58:10 +0000
244+++ src/sync-dbus.cpp 2014-11-06 03:58:10 +0000
245@@ -23,7 +23,8 @@
246 SyncDBus::SyncDBus(const QDBusConnection &connection, SyncDaemon *parent)
247 : QDBusAbstractAdaptor(parent),
248 m_parent(parent),
249- m_connection(connection)
250+ m_connection(connection),
251+ m_clientCount(0)
252 {
253 connect(m_parent, SIGNAL(syncStarted(SyncAccount*,QString)), SLOT(onSyncStarted(SyncAccount*,QString)));
254 connect(m_parent, SIGNAL(syncFinished(SyncAccount*,QString)), SLOT(onSyncFinished(SyncAccount*,QString)));
255@@ -77,6 +78,18 @@
256 return m_parent->availableServices();
257 }
258
259+void SyncDBus::attach()
260+{
261+ m_clientCount++;
262+ Q_EMIT clientAttached(m_clientCount);
263+}
264+
265+void SyncDBus::detach()
266+{
267+ m_clientCount--;
268+ Q_EMIT clientDeattached(m_clientCount);
269+}
270+
271 void SyncDBus::onSyncStarted(SyncAccount *syncAcc, const QString &serviceName)
272 {
273 updateState();
274
275=== modified file 'src/sync-dbus.h'
276--- src/sync-dbus.h 2014-04-07 14:00:14 +0000
277+++ src/sync-dbus.h 2014-11-06 03:58:10 +0000
278@@ -63,6 +63,8 @@
279 " <method name=\"cancel\">\n"
280 " <arg direction=\"in\" type=\"as\"/>\n"
281 " </method>\n"
282+" <method name=\"attach\"/>\n"
283+" <method name=\"detach\"/>\n"
284 " </interface>\n"
285 "")
286 Q_PROPERTY(QString state READ state NOTIFY stateChanged)
287@@ -78,6 +80,8 @@
288 void syncError(const QString &account, const QString &service, const QString &error);
289 void stateChanged();
290 void enabledServicesChanged();
291+ void clientAttached(int count);
292+ void clientDeattached(int count);
293
294 public Q_SLOTS:
295 void sync(QStringList service);
296@@ -85,6 +89,8 @@
297 QString state() const;
298 QStringList enabledServices() const;
299 QStringList servicesAvailable();
300+ void attach();
301+ void detach();
302
303 private Q_SLOTS:
304 void onSyncStarted(SyncAccount *syncAcc, const QString &serviceName);
305@@ -96,6 +102,7 @@
306 SyncDaemon *m_parent;
307 QDBusConnection m_connection;
308 QString m_state;
309+ int m_clientCount;
310 };
311
312 #endif
313
314=== modified file 'tests/unittest/eds-helper-mock.h'
315--- tests/unittest/eds-helper-mock.h 2014-04-10 20:39:20 +0000
316+++ tests/unittest/eds-helper-mock.h 2014-11-06 03:58:10 +0000
317@@ -37,7 +37,9 @@
318 public:
319 EdsHelperMock(QObject *parent = 0)
320 : EdsHelper(parent, "memory", "memory")
321- {}
322+ {
323+ setEnabled(true);
324+ }
325
326
327 QtOrganizer::QOrganizerManager *organizerEngine()
328
329=== removed directory 'upstart'
330=== removed file 'upstart/CMakeLists.txt'
331--- upstart/CMakeLists.txt 2014-02-18 15:22:19 +0000
332+++ upstart/CMakeLists.txt 1970-01-01 00:00:00 +0000
333@@ -1,7 +0,0 @@
334-project(synq-upstart)
335-
336-configure_file(sync-monitor.conf.in ${CMAKE_CURRENT_BINARY_DIR}/sync-monitor.conf)
337-
338-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sync-monitor.conf
339- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/upstart/sessions
340-)
341
342=== removed file 'upstart/sync-monitor.conf.in'
343--- upstart/sync-monitor.conf.in 2014-04-08 20:18:27 +0000
344+++ upstart/sync-monitor.conf.in 1970-01-01 00:00:00 +0000
345@@ -1,9 +0,0 @@
346-description "sync-monitor"
347-author "Renato Oliveira Filho <renato.filho@canonical.com>"
348-
349-start on started address-book-service
350-stop on session-end
351-
352-respawn
353-
354-exec @CMAKE_INSTALL_FULL_LIBDIR@/sync-monitor/sync-monitor

Subscribers

People subscribed via source and target branches