Merge lp:~renatofilho/address-book-app/avoid-edit-readonly-contacts into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 530
Merged at revision: 525
Proposed branch: lp:~renatofilho/address-book-app/avoid-edit-readonly-contacts
Merge into: lp:address-book-app
Diff against target: 64 lines (+18/-7)
3 files modified
src/app/addressbookapp.cpp (+14/-4)
src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml (+3/-2)
src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml (+1/-1)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/avoid-edit-readonly-contacts
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Gustavo Pichorim Boiko (community) Approve
Review via email: mp+280961@code.launchpad.net

Commit message

Block edit read-only contacts.
Does not allow select read-only sources while creating a new contact;

To post a comment you must log in.
528. By Renato Araujo Oliveira Filho

Remove debug messages.

529. By Renato Araujo Oliveira Filho

Revert unnecessary changes.

530. By Renato Araujo Oliveira Filho

Add comments.

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/addressbookapp.cpp'
2--- src/app/addressbookapp.cpp 2015-12-16 18:35:33 +0000
3+++ src/app/addressbookapp.cpp 2015-12-18 13:49:02 +0000
4@@ -450,11 +450,21 @@
5
6 bool AddressBookApp::notify(QObject *obj, QEvent *event)
7 {
8- if ((event->type() == QEvent::KeyPress) && !m_withKeyboard) {
9- m_withKeyboard = true;
10- Q_EMIT usingKeyboardChanged();
11- return true;
12+ switch(event->type())
13+ {
14+ case QEvent::KeyPress:
15+ // we have no way to detect when a physical keyboard is connected, so we
16+ // assume there is one when the down key is pressed
17+ if (!m_withKeyboard && (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Down)) {
18+ m_withKeyboard = true;
19+ Q_EMIT usingKeyboardChanged();
20+ return false;
21+ }
22+ break;
23+ default:
24+ break;
25 }
26+
27 return QGuiApplication::notify(obj, event);
28 }
29
30
31=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml'
32--- src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml 2015-12-16 18:35:33 +0000
33+++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml 2015-12-18 13:49:02 +0000
34@@ -66,7 +66,8 @@
35 var contactSyncTarget = contact.syncTarget.value(SyncTarget.SyncTarget + 1)
36
37 for (var i = 0; i < writableSources.count; i++) {
38- if (writableSources.get(i).contact.guid.guid === contactSyncTarget) {
39+ var source = writableSources.get(i)
40+ if (source.sourceId === contactSyncTarget) {
41 return false
42 }
43 }
44@@ -132,7 +133,7 @@
45 var data = []
46 for(var i in contacts) {
47 var sourceMetaData = getSourceMetaData(contacts[i])
48- if (!sourceMetaData['readOnly']) {
49+ if (!sourceMetaData['read-only']) {
50 data.push({'sourceId': contacts[i].guid.guid,
51 'sourceName': contacts[i].displayLabel.label,
52 'accountId': sourceMetaData['account-id'],
53
54=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml'
55--- src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2015-12-10 19:08:19 +0000
56+++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2015-12-18 13:49:02 +0000
57@@ -454,7 +454,7 @@
58 }
59
60 Component.onCompleted: Qt.inputMethod.hide()
61- Component.onDestruction: contactEditor.pageStack.pop()
62+ Component.onDestruction: contactEditor.pageStack.removePages(contactEditor)
63 }
64 }
65

Subscribers

People subscribed via source and target branches