Merge lp:~renatofilho/address-book-app/disable-sync-on-update into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Michael Sheldon
Approved revision: 488
Merged at revision: 485
Proposed branch: lp:~renatofilho/address-book-app/disable-sync-on-update
Merge into: lp:address-book-app
Diff against target: 173 lines (+69/-6)
7 files modified
src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml (+8/-1)
src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml (+1/-1)
src/imports/Ubuntu/AddressBook/ContactView/ContactDetailSyncTargetView.qml (+25/-0)
src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml (+6/-1)
src/imports/Ubuntu/Contacts/ContactListView.qml (+1/-1)
src/imports/Ubuntu/Contacts/contacts.cpp (+16/-2)
src/imports/Ubuntu/Contacts/contacts.h (+12/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/disable-sync-on-update
Reviewer Review Type Date Requested Status
Michael Sheldon (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+274034@code.launchpad.net

Commit message

Disable sync button while the update is running.

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

Implemented Contacts.updateIsRunning as property.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
486. By Renato Araujo Oliveira Filho

Show "Personal " prefix for local sources.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
487. By Renato Araujo Oliveira Filho

Fix updateIsRunning property.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
488. By Renato Araujo Oliveira Filho

Show "Personal" prefix for local accounts.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Looks good

review: Approve
489. By Renato Araujo Oliveira Filho

Added a extra "-" in the account name.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml'
2--- src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml 2015-09-30 04:57:26 +0000
3+++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml 2015-10-15 16:00:42 +0000
4@@ -163,7 +163,14 @@
5 }
6
7 delegate: OptionSelectorDelegate {
8- text: contact.displayLabel.label
9+ text: {
10+ if ((contact.guid.guid != "system-address-book") &&
11+ (iconSource == "image://theme/address-book-app-symbolic")) {
12+ return i18n.dtr("address-book-app", "Personal - %1").arg(contact.displayLabel.label)
13+ } else {
14+ return contact.displayLabel.label
15+ }
16+ }
17 constrainImage: true
18 iconSource: {
19 var details = contact.details(ContactDetail.ExtendedDetail)
20
21=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml'
22--- src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2015-09-29 19:03:44 +0000
23+++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2015-10-15 16:00:42 +0000
24@@ -423,7 +423,7 @@
25
26 title: i18n.dtr("address-book-app", "Contact Editor")
27 text: {
28- if (ContactsUI.Contacts.updateIsRunning()) {
29+ if (ContactsUI.Contacts.updateIsRunning) {
30 return i18n.dtr("address-book-app",
31 "Your <b>%1</b> contact sync account needs to be upgraded.\nWait until the upgrade is complete to edit contacts.")
32 .arg(contactEditor.contact.syncTarget.syncTarget)
33
34=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailSyncTargetView.qml'
35--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailSyncTargetView.qml 2015-08-17 18:47:15 +0000
36+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailSyncTargetView.qml 2015-10-15 16:00:42 +0000
37@@ -66,5 +66,30 @@
38 autoUpdate: false
39 }
40
41+ detailDelegate: ContactDetailWithTypeView {
42+ property variant detailType: detail && root.contact && root.typeModelReady ? root.getType(detail) : ""
43+
44+ action: root.defaultAction
45+ contact: root.contact
46+ fields: root.fields
47+ typeLabel: detailType ? detailType.label : ""
48+
49+ height: implicitHeight
50+ width: root.width
51+
52+ onClicked: root.actionTrigerred(root.defaultAction.name, detail)
53+
54+ function overrideValue(detail, field)
55+ {
56+ if (detail.value(field + 1) == "system-address-book") {
57+ return detail.value(field)
58+ } else if (detail.value(field + 2) == "0") {
59+ return i18n.dtr("address-book-app", "Personal - %1").arg(detail.value(field))
60+ } else {
61+ return detail.value(field)
62+ }
63+ }
64+ }
65+
66 Component.onCompleted: sourceModel.update()
67 }
68
69=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml'
70--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml 2015-08-17 18:47:15 +0000
71+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml 2015-10-15 16:00:42 +0000
72@@ -32,12 +32,17 @@
73 if (isReady) {
74 var values = []
75 for(var i=0; i < fields.length; i++) {
76- values.push(detail.value(fields[i]))
77+ values.push(overrideValue(detail, fields[i]))
78 }
79 view.values = values
80 }
81 }
82
83+ function overrideValue(detail, field)
84+ {
85+ return detail.value(field)
86+ }
87+
88 implicitHeight: view.implicitHeight
89 onIsReadyChanged: populateValues()
90
91
92=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
93--- src/imports/Ubuntu/Contacts/ContactListView.qml 2015-09-18 13:18:40 +0000
94+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2015-10-15 16:00:42 +0000
95@@ -206,7 +206,7 @@
96
97 This property holds if the list is running a sync with online accounts or not
98 */
99- readonly property alias syncing: buteoSync.syncing
100+ readonly property bool syncing: buteoSync.syncing || Contacts.Contacts.updateIsRunning
101 /*!
102 \qmlproperty bool syncEnabled
103
104
105=== modified file 'src/imports/Ubuntu/Contacts/contacts.cpp'
106--- src/imports/Ubuntu/Contacts/contacts.cpp 2015-09-18 13:18:40 +0000
107+++ src/imports/Ubuntu/Contacts/contacts.cpp 2015-10-15 16:00:42 +0000
108@@ -27,8 +27,17 @@
109 #include "config.h"
110
111 UbuntuContacts::UbuntuContacts(QObject *parent)
112- : QObject(parent)
113+ : QObject(parent),
114+ m_fileWatcher(new QFileSystemWatcher)
115 {
116+ // We need to monitor the tmp dir since the file could not exists at this point
117+ m_fileWatcher->addPath(QDir::tempPath());
118+ connect(m_fileWatcher.data(),
119+ SIGNAL(directoryChanged(QString)),
120+ SIGNAL(updateIsRunningChanged()));
121+ connect(m_fileWatcher.data(),
122+ SIGNAL(fileChanged(QString)),
123+ SIGNAL(updateIsRunningChanged()));
124 }
125
126 QString UbuntuContacts::tempPath() const
127@@ -108,5 +117,10 @@
128
129 bool UbuntuContacts::updateIsRunning() const
130 {
131- return QFile::exists(QDir::tempPath() + "/address-book-updater.lock");
132+ return QFile::exists(updaterLockFile());
133+}
134+
135+QString UbuntuContacts::updaterLockFile()
136+{
137+ return QString("%1/%2").arg(QDir::tempPath()).arg("/address-book-updater.lock");
138 }
139
140=== modified file 'src/imports/Ubuntu/Contacts/contacts.h'
141--- src/imports/Ubuntu/Contacts/contacts.h 2015-09-18 13:18:40 +0000
142+++ src/imports/Ubuntu/Contacts/contacts.h 2015-10-15 16:00:42 +0000
143@@ -20,11 +20,14 @@
144 #include <QtCore/QObject>
145 #include <QtCore/QString>
146 #include <QtCore/QUrl>
147+#include <QtCore/QScopedPointer>
148+#include <QtCore/QFileSystemWatcher>
149
150 class UbuntuContacts : public QObject
151 {
152 Q_OBJECT
153 Q_PROPERTY(QString tempPath READ tempPath)
154+ Q_PROPERTY(bool updateIsRunning READ updateIsRunning NOTIFY updateIsRunningChanged)
155
156 public:
157 UbuntuContacts(QObject *parent = 0);
158@@ -37,6 +40,15 @@
159 Q_INVOKABLE bool containsLetters(const QString &value);
160 Q_INVOKABLE bool removeFile(const QUrl &file);
161 Q_INVOKABLE bool updateIsRunning() const;
162+
163+Q_SIGNALS:
164+ void updateIsRunningChanged();
165+
166+private:
167+ QScopedPointer<QFileSystemWatcher> m_fileWatcher;
168+
169+ static QString updaterLockFile();
170+
171 };
172
173 #endif //_UBUNTU_CONTACTS_H_

Subscribers

People subscribed via source and target branches