Merge lp:~renatofilho/address-book-app/release-2014-06-27 into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 196
Merged at revision: 215
Proposed branch: lp:~renatofilho/address-book-app/release-2014-06-27
Merge into: lp:address-book-app
Diff against target: 1436 lines (+681/-178)
18 files modified
click/CMakeLists.txt (+4/-0)
debian/address-book-app.install (+1/-0)
debian/control (+5/-3)
po/address-book-app.pot (+99/-36)
src/app/addressbookapp.cpp (+7/-1)
src/imports/ContactEdit/ContactDetailAvatarEditor.qml (+1/-1)
src/imports/ContactList/CMakeLists.txt (+1/-0)
src/imports/ContactList/ContactListPage.qml (+33/-12)
src/imports/ContactList/VCardImportDialog.qml (+94/-0)
src/imports/MainWindow.qml (+14/-0)
src/imports/Ubuntu/Contacts/CMakeLists.txt (+1/-0)
src/imports/Ubuntu/Contacts/ContactAvatar.qml (+1/-1)
src/imports/Ubuntu/Contacts/ContactDelegate.qml (+84/-10)
src/imports/Ubuntu/Contacts/ContactListView.qml (+149/-32)
src/imports/Ubuntu/Contacts/ContactSimpleListView.qml (+1/-80)
src/imports/Ubuntu/Contacts/Contacts.js (+2/-2)
src/imports/Ubuntu/Contacts/MostCalledModel.qml (+183/-0)
src/imports/Ubuntu/Contacts/qmldir (+1/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/release-2014-06-27
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Gustavo Pichorim Boiko (community) Approve
Review via email: mp+224809@code.launchpad.net

Commit message

* Updated pot file.
* Implemented frequently called list.
* Implemented vcard import.
* Search contacts by phone number and name.

To post a comment you must log in.
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

Are there any related MPs required for this MP to build/function as expected? YES
  * https://code.launchpad.net/~renatofilho/history-service/qml-fetch-more/+merge/224169

Is your branch in sync with latest trunk? YES

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator? YES

Did you successfully run all tests found in your component's Test Plan on device or emulator? YES

If you changed the UI, was the change specified/approved by design? NO UI CHANGE

If you changed the packaging (debian), did you subscribe a core-dev to this MP? NO PACKAGE CHANGED

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

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Code looks good and works as expected!

review: Approve
197. By Renato Araujo Oliveira Filho

Fixed MostCalled list visibility.

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
=== modified file 'click/CMakeLists.txt'
--- click/CMakeLists.txt 2014-03-12 01:34:34 +0000
+++ click/CMakeLists.txt 2014-06-27 21:27:44 +0000
@@ -9,4 +9,8 @@
9 DESTINATION ${CMAKE_INSTALL_PREFIX})9 DESTINATION ${CMAKE_INSTALL_PREFIX})
10 install(FILES address-book-content.json10 install(FILES address-book-content.json
11 DESTINATION ${CMAKE_INSTALL_PREFIX})11 DESTINATION ${CMAKE_INSTALL_PREFIX})
12else(CLICK_MODE)
13 install(FILES address-book-content.json
14 DESTINATION ${CMAKE_INSTALL_DATADIR}/content-hub/peers
15 RENAME address-book-app)
12endif(CLICK_MODE)16endif(CLICK_MODE)
1317
=== modified file 'debian/address-book-app.install'
--- debian/address-book-app.install 2014-02-10 21:09:43 +0000
+++ debian/address-book-app.install 2014-06-27 21:27:44 +0000
@@ -3,4 +3,5 @@
3usr/share/address-book-app/imports3usr/share/address-book-app/imports
4usr/share/applications/address-book-app.desktop4usr/share/applications/address-book-app.desktop
5usr/share/url-dispatcher/urls/5usr/share/url-dispatcher/urls/
6usr/share/content-hub/peers/address-book-app
6usr/share/locale/*/LC_MESSAGES/address-book-app.mo7usr/share/locale/*/LC_MESSAGES/address-book-app.mo
78
=== modified file 'debian/control'
--- debian/control 2014-06-11 21:25:08 +0000
+++ debian/control 2014-06-27 21:27:44 +0000
@@ -25,12 +25,14 @@
25 libqt5versit5,25 libqt5versit5,
26 qmlscene,26 qmlscene,
27 qtcontact5-galera,27 qtcontact5-galera,
28 qtdeclarative5-qtcontacts-plugin,
29 qtdeclarative5-qtquick2-plugin,
28 qtdeclarative5-ubuntu-contacts0.1 (= ${binary:Version}),30 qtdeclarative5-ubuntu-contacts0.1 (= ${binary:Version}),
29 qtdeclarative5-ubuntu-telephony-phonenumber0.1,
30 qtdeclarative5-ubuntu-content0.1,31 qtdeclarative5-ubuntu-content0.1,
32 qtdeclarative5-ubuntu-history0.1,
31 qtdeclarative5-ubuntu-keyboard-extensions0.1,33 qtdeclarative5-ubuntu-keyboard-extensions0.1,
32 qtdeclarative5-qtcontacts-plugin,34 qtdeclarative5-ubuntu-telephony-phonenumber0.1,
33 qtdeclarative5-qtquick2-plugin,35 qtdeclarative5-ubuntu-telephony0.1,
34 ${misc:Depends},36 ${misc:Depends},
35 ${shlibs:Depends},37 ${shlibs:Depends},
36Description: Address Book application38Description: Address Book application
3739
=== modified file 'po/address-book-app.pot'
--- po/address-book-app.pot 2014-05-13 18:53:02 +0000
+++ po/address-book-app.pot 2014-06-27 21:27:44 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: address-book-app\n"9"Project-Id-Version: address-book-app\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2014-05-13 15:51-0300\n"11"POT-Creation-Date: 2014-06-27 09:54-0300\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,16 +17,22 @@
17"Content-Type: text/plain; charset=CHARSET\n"17"Content-Type: text/plain; charset=CHARSET\n"
18"Content-Transfer-Encoding: 8bit\n"18"Content-Transfer-Encoding: 8bit\n"
1919
20#: src/imports/ContactList/ContactListPage.qml:19320#: src/imports/ContactList/VCardImportDialog.qml:72
21msgid "Add"21#, qt-format
22msgstr ""22msgid "%1 vCards imported"
2323msgstr ""
24
25#: src/imports/ContactEdit/ContactEditor.qml:322
26msgid "Add Field"
27msgstr ""
28
29#: src/imports/ContactEdit/AddFieldDialog.qml:59
24#: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:2330#: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:23
25#: src/imports/ContactView/ContactDetailAddressesView.qml:2431#: src/imports/ContactView/ContactDetailAddressesView.qml:24
26msgid "Address"32msgid "Address"
27msgstr ""33msgstr ""
2834
29#: src/imports/ContactEdit/ContactDetailSyncTargetEditor.qml:7335#: src/imports/ContactEdit/ContactDetailSyncTargetEditor.qml:77
30#: src/imports/ContactView/ContactDetailSyncTargetView.qml:4836#: src/imports/ContactView/ContactDetailSyncTargetView.qml:48
31msgid "Addressbook"37msgid "Addressbook"
32msgstr ""38msgstr ""
@@ -35,22 +41,39 @@
35msgid "Aim"41msgid "Aim"
36msgstr ""42msgstr ""
3743
38#: src/imports/Ubuntu/Contacts/ContactListView.qml:6644#: src/imports/Ubuntu/Contacts/ContactListView.qml:316
39msgid "All"45msgid "All"
40msgstr ""46msgstr ""
4147
42#: src/imports/ContactEdit/ContactEditor.qml:30048#: src/imports/Common/RemoveContactsDialog.qml:51
43#: src/imports/ContactEdit/EditToolbar.qml:4249msgid "Are you sure that you want to remove all selected contacts?"
50msgstr ""
51
52#: src/imports/Common/RemoveContactsDialog.qml:49
53msgid "Are you sure that you want to remove this contact?"
54msgstr ""
55
56#: src/imports/ContactEdit/AddFieldDialog.qml:133
57#: src/imports/ContactEdit/ContactEditor.qml:372
58#: src/imports/ContactList/ContactListPage.qml:324
44#: src/imports/Ubuntu/Contacts/DialogButtons.qml:3759#: src/imports/Ubuntu/Contacts/DialogButtons.qml:37
45msgid "Cancel"60msgid "Cancel"
46msgstr ""61msgstr ""
4762
48#: src/imports/ContactEdit/ContactFetchError.qml:2663#: src/imports/ContactList/ContactListPage.qml:252
64msgid "Cancel selection"
65msgstr ""
66
67#: src/imports/ContactList/VCardImportDialog.qml:80
68msgid "Close"
69msgstr ""
70
71#: src/imports/ContactView/ContactFetchError.qml:26
49msgid "Contact not found"72msgid "Contact not found"
50msgstr ""73msgstr ""
5174
52#: data/address-book-app.desktop.in:6 data/address-book-app.desktop.in:775#: data/address-book-app.desktop.in:6 data/address-book-app.desktop.in:7
53#: src/imports/ContactList/ContactListPage.qml:5776#: src/imports/ContactList/ContactListPage.qml:75
54msgid "Contacts"77msgid "Contacts"
55msgstr ""78msgstr ""
5679
@@ -62,21 +85,22 @@
62msgid "Country"85msgid "Country"
63msgstr ""86msgstr ""
6487
65#: src/imports/ContactList/ContactListPage.qml:8388#: src/imports/ContactEdit/ContactEditor.qml:337
66#: src/imports/ContactView/ContactView.qml:18189#: src/imports/ContactList/ContactListPage.qml:148
67#: src/imports/Ubuntu/Contacts/ContactSimpleListView.qml:28890#: src/imports/ContactList/ContactListPage.qml:277
68msgid "Delete"91msgid "Delete"
69msgstr ""92msgstr ""
7093
71#: src/imports/ContactEdit/EditToolbar.qml:57
72#: src/imports/Ubuntu/Contacts/DialogButtons.qml:5394#: src/imports/Ubuntu/Contacts/DialogButtons.qml:53
73msgid "Done"95msgid "Done"
74msgstr ""96msgstr ""
7597
76#: src/imports/ContactView/ContactView.qml:19398#: src/imports/ContactEdit/ContactEditor.qml:141
99#: src/imports/ContactView/ContactView.qml:219
77msgid "Edit"100msgid "Edit"
78msgstr ""101msgstr ""
79102
103#: src/imports/ContactEdit/AddFieldDialog.qml:57
80#: src/imports/ContactEdit/ContactDetailEmailsEditor.qml:23104#: src/imports/ContactEdit/ContactDetailEmailsEditor.qml:23
81#: src/imports/ContactView/ContactDetailEmailsView.qml:23105#: src/imports/ContactView/ContactDetailEmailsView.qml:23
82#: src/imports/ContactView/ContactDetailEmailsView.qml:26106#: src/imports/ContactView/ContactDetailEmailsView.qml:26
@@ -95,23 +119,27 @@
95msgid "Enter an email address"119msgid "Enter an email address"
96msgstr ""120msgstr ""
97121
98#: src/imports/ContactEdit/ContactFetchError.qml:25122#: src/imports/ContactView/ContactFetchError.qml:25
99#: src/imports/MainWindow.qml:94123#: src/imports/MainWindow.qml:98
100msgid "Error"124msgid "Error"
101msgstr ""125msgstr ""
102126
103#: src/imports/ContactView/ContactDetailPhoneNumbersView.qml:33127#: src/imports/ContactView/ContactView.qml:195
104msgid "Favorite"128msgid "Favorite"
105msgstr ""129msgstr ""
106130
107#: src/imports/Ubuntu/Contacts/ContactListView.qml:93131#: src/imports/Ubuntu/Contacts/ContactListView.qml:348
108msgid "Favourites"132msgid "Favourites"
109msgstr ""133msgstr ""
110134
111#: src/imports/ContactEdit/ContactDetailNameEditor.qml:81135#: src/imports/ContactEdit/ContactDetailNameEditor.qml:83
112msgid "First name"136msgid "First name"
113msgstr ""137msgstr ""
114138
139#: src/imports/Ubuntu/Contacts/ContactListView.qml:427
140msgid "Frequently called"
141msgstr ""
142
115#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:116143#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:116
116#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:94144#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:94
117msgid "Home"145msgid "Home"
@@ -125,19 +153,27 @@
125msgid "IM"153msgid "IM"
126msgstr ""154msgstr ""
127155
156#: src/imports/ContactList/VCardImportDialog.qml:71
157msgid "Import vCards"
158msgstr ""
159
160#: src/imports/ContactList/VCardImportDialog.qml:72
161msgid "Importing..."
162msgstr ""
163
128#: src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml:64164#: src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml:64
129msgid "Jabber"165msgid "Jabber"
130msgstr ""166msgstr ""
131167
132#: src/imports/ContactEdit/ContactDetailNameEditor.qml:81168#: src/imports/ContactEdit/ContactDetailNameEditor.qml:83
133msgid "Last name"169msgid "Last name"
134msgstr ""170msgstr ""
135171
136#: src/imports/ContactEdit/ContactDetailAvatarEditor.qml:85172#: src/imports/ContactEdit/AvatarImport.qml:71
137msgid "Loading"173msgid "Loading"
138msgstr ""174msgstr ""
139175
140#: src/imports/ContactList/ContactListPage.qml:163176#: src/imports/ContactList/ContactListPage.qml:242
141msgid "Loading..."177msgid "Loading..."
142msgstr ""178msgstr ""
143179
@@ -153,14 +189,23 @@
153msgid "Mobile"189msgid "Mobile"
154msgstr ""190msgstr ""
155191
156#: src/imports/ContactEdit/TextInputDetail.qml:46192#: src/imports/Common/RemoveContactsDialog.qml:44
193msgid "Multiple contacts"
194msgstr ""
195
196#: src/imports/ContactEdit/TextInputDetail.qml:77
157msgid "Next"197msgid "Next"
158msgstr ""198msgstr ""
159199
200#: src/imports/Common/RemoveContactsDialog.qml:74
160#: src/imports/ContactList/OnlineAccountsMessage.qml:48201#: src/imports/ContactList/OnlineAccountsMessage.qml:48
161msgid "No"202msgid "No"
162msgstr ""203msgstr ""
163204
205#: src/imports/Common/RemoveContactsDialog.qml:40
206msgid "No contact selected."
207msgstr ""
208
164#: src/imports/ContactEdit/ContactDetailOrganizationsEditor.qml:30209#: src/imports/ContactEdit/ContactDetailOrganizationsEditor.qml:30
165msgid "Organization"210msgid "Organization"
166msgstr ""211msgstr ""
@@ -170,6 +215,7 @@
170msgid "Other"215msgid "Other"
171msgstr ""216msgstr ""
172217
218#: src/imports/ContactEdit/AddFieldDialog.qml:55
173#: src/imports/ContactEdit/ContactDetailPhoneNumbersEditor.qml:24219#: src/imports/ContactEdit/ContactDetailPhoneNumbersEditor.qml:24
174#: src/imports/ContactView/ContactDetailPhoneNumbersView.qml:30220#: src/imports/ContactView/ContactDetailPhoneNumbersView.qml:30
175msgid "Phone"221msgid "Phone"
@@ -179,6 +225,10 @@
179msgid "Post code"225msgid "Post code"
180msgstr ""226msgstr ""
181227
228#: src/imports/ContactEdit/AddFieldDialog.qml:63
229msgid "Professional Details"
230msgstr ""
231
182#: src/imports/ContactEdit/ContactDetailOrganizationsEditor.qml:23232#: src/imports/ContactEdit/ContactDetailOrganizationsEditor.qml:23
183#: src/imports/ContactView/ContactDetailOrganizationsView.qml:27233#: src/imports/ContactView/ContactDetailOrganizationsView.qml:27
184msgid "Professional details"234msgid "Professional details"
@@ -192,19 +242,35 @@
192msgid "Role"242msgid "Role"
193msgstr ""243msgstr ""
194244
195#: src/imports/ContactEdit/ContactEditor.qml:295245#: src/imports/ContactEdit/ContactEditor.qml:385
196msgid "Save"246msgid "Save"
197msgstr ""247msgstr ""
198248
199#: src/imports/ContactList/ContactListPage.qml:83249#: src/imports/ContactList/ContactListPage.qml:302
200#: src/imports/ContactList/ContactListPage.qml:185250msgid "Search"
251msgstr ""
252
253#: src/imports/ContactList/ContactListPage.qml:277
201msgid "Select"254msgid "Select"
202msgstr ""255msgstr ""
203256
257#: src/imports/ContactList/ContactListPage.qml:261
258msgid "Select All"
259msgstr ""
260
261#: src/imports/ContactList/ContactListPage.qml:75
262msgid "Select Contacts"
263msgstr ""
264
265#: src/imports/ContactEdit/AddFieldDialog.qml:116
266msgid "Select a field"
267msgstr ""
268
204#: src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml:67269#: src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml:67
205msgid "Skype"270msgid "Skype"
206msgstr ""271msgstr ""
207272
273#: src/imports/ContactEdit/AddFieldDialog.qml:61
208#: src/imports/ContactView/ContactDetailOnlineAccountsView.qml:27274#: src/imports/ContactView/ContactDetailOnlineAccountsView.qml:27
209msgid "Social"275msgid "Social"
210msgstr ""276msgstr ""
@@ -213,15 +279,15 @@
213msgid "Street"279msgid "Street"
214msgstr ""280msgstr ""
215281
216#: src/imports/ContactList/ContactListPage.qml:176282#: src/imports/ContactList/ContactListPage.qml:293
217msgid "Sync"283msgid "Sync"
218msgstr ""284msgstr ""
219285
220#: src/imports/ContactList/ContactListPage.qml:176286#: src/imports/ContactList/ContactListPage.qml:293
221msgid "Syncing"287msgid "Syncing"
222msgstr ""288msgstr ""
223289
224#: src/imports/ContactList/ContactListPage.qml:163290#: src/imports/ContactList/ContactListPage.qml:242
225msgid "Syncing..."291msgid "Syncing..."
226msgstr ""292msgstr ""
227293
@@ -235,14 +301,10 @@
235301
236#. TRANSLATORS: This value is used as default value for phone number format, when no coutry code is provided302#. TRANSLATORS: This value is used as default value for phone number format, when no coutry code is provided
237#. the supported values can be found in: https://www.iso.org/obp/ui/#search303#. the supported values can be found in: https://www.iso.org/obp/ui/#search
238#: src/imports/ContactEdit/TextInputDetail.qml:41304#: src/imports/ContactEdit/TextInputDetail.qml:73
239msgid "US"305msgid "US"
240msgstr ""306msgstr ""
241307
242#: src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml:111
243msgid "View contact's profile"
244msgstr ""
245
246#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:117308#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:117
247#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:96309#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:96
248msgid "Work"310msgid "Work"
@@ -262,6 +324,7 @@
262msgid "Yahoo"324msgid "Yahoo"
263msgstr ""325msgstr ""
264326
327#: src/imports/Common/RemoveContactsDialog.qml:62
265#: src/imports/ContactList/OnlineAccountsMessage.qml:36328#: src/imports/ContactList/OnlineAccountsMessage.qml:36
266msgid "Yes"329msgid "Yes"
267msgstr ""330msgstr ""
268331
=== modified file 'src/app/addressbookapp.cpp'
--- src/app/addressbookapp.cpp 2014-06-11 21:25:08 +0000
+++ src/app/addressbookapp.cpp 2014-06-27 21:27:44 +0000
@@ -43,6 +43,7 @@
43 << "[addressbook:///contact?id=<contact-id>"43 << "[addressbook:///contact?id=<contact-id>"
44 << "[addressbook:///create?phone=<phone-number>"44 << "[addressbook:///create?phone=<phone-number>"
45 << "[addressbook:///pick?single=<true/false>"45 << "[addressbook:///pick?single=<true/false>"
46 << "[addressbook:///importvcard?url=<vcard-file>"
46 << "[--fullscreen]"47 << "[--fullscreen]"
47 << "[--help]"48 << "[--help]"
48 << "[-testability]";49 << "[-testability]";
@@ -297,6 +298,11 @@
297 args << "single";298 args << "single";
298 methodsMetaData.insert("pick", args);299 methodsMetaData.insert("pick", args);
299 args.clear();300 args.clear();
301
302 //vcard
303 args << "url";
304 methodsMetaData.insert("importvcard", args);
305 args.clear();
300 }306 }
301307
302 QUrlQuery query(url);308 QUrlQuery query(url);
@@ -356,7 +362,7 @@
356 method.invoke(mainView);362 method.invoke(mainView);
357 break;363 break;
358 case 1:364 case 1:
359 method.invoke(mainView, Q_ARG(QVariant, QVariant(args[0].toUtf8())));365 method.invoke(mainView, Q_ARG(QVariant, QVariant(args[0])));
360 break;366 break;
361 case 2:367 case 2:
362 method.invoke(mainView, Q_ARG(QVariant, QVariant(args[0].toUtf8())),368 method.invoke(mainView, Q_ARG(QVariant, QVariant(args[0].toUtf8())),
363369
=== modified file 'src/imports/ContactEdit/ContactDetailAvatarEditor.qml'
--- src/imports/ContactEdit/ContactDetailAvatarEditor.qml 2014-06-13 19:54:01 +0000
+++ src/imports/ContactEdit/ContactDetailAvatarEditor.qml 2014-06-27 21:27:44 +0000
@@ -52,7 +52,7 @@
5252
53 if (avatarDetail) {53 if (avatarDetail) {
54 var avatarValue = avatarDetail.value(Avatar.ImageUrl)54 var avatarValue = avatarDetail.value(Avatar.ImageUrl)
55 if (avatarValue != "") {55 if (avatarValue && (avatarValue != "")) {
56 avatarUrl = avatarValue56 avatarUrl = avatarValue
57 }57 }
58 }58 }
5959
=== modified file 'src/imports/ContactList/CMakeLists.txt'
--- src/imports/ContactList/CMakeLists.txt 2014-05-07 13:14:28 +0000
+++ src/imports/ContactList/CMakeLists.txt 2014-06-27 21:27:44 +0000
@@ -3,6 +3,7 @@
3 ContactExporter.qml3 ContactExporter.qml
4 OnlineAccountsMessage.qml4 OnlineAccountsMessage.qml
5 PageWithBottomEdge.qml5 PageWithBottomEdge.qml
6 VCardImportDialog.qml
6)7)
78
8install(FILES ${CONTACT_LIST_QMLS}9install(FILES ${CONTACT_LIST_QMLS}
910
=== modified file 'src/imports/ContactList/ContactListPage.qml'
--- src/imports/ContactList/ContactListPage.qml 2014-06-17 14:25:22 +0000
+++ src/imports/ContactList/ContactListPage.qml 2014-06-27 21:27:44 +0000
@@ -58,6 +58,20 @@
58 return newContact58 return newContact
59 }59 }
6060
61 function createContactWithPhoneNumber(phoneNumber)
62 {
63 var newContact = mainPage.createEmptyContact(phoneNumber)
64 //WORKAROUND: SKD changes the page header as soon as the page get created
65 // setting active false will avoid that
66 mainPage.showBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
67 {model: contactList.listModel,
68 contact: newContact,
69 active: false,
70 enabled: false,
71 initialFocusSection: "name"})
72
73 }
74
61 title: contactList.isInSelectionMode ? i18n.tr("Select Contacts") : i18n.tr("Contacts")75 title: contactList.isInSelectionMode ? i18n.tr("Select Contacts") : i18n.tr("Contacts")
6276
63 //bottom edge page77 //bottom edge page
@@ -121,7 +135,7 @@
121 bottom: keyboard.top135 bottom: keyboard.top
122 right: parent.right136 right: parent.right
123 }137 }
124 contactNameFilter: searchField.text138 filterTerm: searchField.text
125 detailToPick: ContactDetail.PhoneNumber139 detailToPick: ContactDetail.PhoneNumber
126 multiSelectionEnabled: true140 multiSelectionEnabled: true
127 multipleSelection: !pickMode ||141 multipleSelection: !pickMode ||
@@ -160,6 +174,8 @@
160 }174 }
161 }175 }
162176
177 onAddContactClicked: mainPage.createContactWithPhoneNumber(label)
178
163 onInfoRequested: {179 onInfoRequested: {
164 mainPage.state = ""180 mainPage.state = ""
165 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),181 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
@@ -343,6 +359,10 @@
343 __customHeaderContents: searchField359 __customHeaderContents: searchField
344 tools: toolbarItemsSearch360 tools: toolbarItemsSearch
345 }361 }
362 PropertyChanges {
363 target: contactList
364 showFavourites: false
365 }
346 },366 },
347 State {367 State {
348 name: "selection"368 name: "selection"
@@ -388,21 +408,11 @@
388408
389 Connections {409 Connections {
390 target: pageStack410 target: pageStack
411 onCreateContactRequested: mainPage.createContactWithPhoneNumber(phoneNumber)
391 onContactRequested: {412 onContactRequested: {
392 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),413 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
393 {model: contactList.listModel, contactId: contactId})414 {model: contactList.listModel, contactId: contactId})
394 }415 }
395 onCreateContactRequested: {
396 var newContact = mainPage.createEmptyContact(phoneNumber)
397 //WORKAROUND: SKD changes the page header as soon as the page get created
398 // setting active false will avoid that
399 mainPage.showBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
400 {model: contactList.listModel,
401 contact: newContact,
402 active: false,
403 enabled: false,
404 initialFocusSection: "name"})
405 }
406 onEditContatRequested: {416 onEditContatRequested: {
407 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),417 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
408 {model: contactList.listModel,418 {model: contactList.listModel,
@@ -412,6 +422,17 @@
412 onContactCreated: {422 onContactCreated: {
413 mainPage.contactIndex = contact423 mainPage.contactIndex = contact
414 }424 }
425
426 onImportContactRequested: {
427 if (urls.length > 0) {
428 var importDialog = Qt.createQmlObject("VCardImportDialog{}",
429 mainPage,
430 "VCardImportDialog")
431 if (importDialog) {
432 importDialog.importVCards(contactList.listModel, urls)
433 }
434 }
435 }
415 }436 }
416437
417 KeyboardRectangle {438 KeyboardRectangle {
418439
=== added file 'src/imports/ContactList/VCardImportDialog.qml'
--- src/imports/ContactList/VCardImportDialog.qml 1970-01-01 00:00:00 +0000
+++ src/imports/ContactList/VCardImportDialog.qml 2014-06-27 21:27:44 +0000
@@ -0,0 +1,94 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.2
18import QtContacts 5.0
19import Ubuntu.Components 0.1
20import Ubuntu.Components.Popups 0.1 as Popups
21
22Item {
23 id: root
24
25 property alias model: modelConnections.target
26 property var vcards: []
27 property var importedVcards: []
28 property var importErrors: []
29 property var dialog: null
30
31 signal finished()
32
33 function importVCards(model, vcards)
34 {
35 if (dialog || vcards.length === 0) {
36 return
37 }
38
39 root.model = model
40 root.vcards = vcards
41 dialog = Popups.PopupUtils.open(importDialogComponent, root)
42
43 for(var i=0, iMax=vcards.length; i < iMax; i++) {
44 var vcardUrl = vcards[i]
45 model.importContacts(vcardUrl)
46 }
47 }
48
49 Connections {
50 id: modelConnections
51
52 onImportCompleted: {
53 var imported = root.importedVcards
54 var importErrors = root.importErrors
55 imported.push(url)
56 if (error !== ContactModel.ImportNoError) {
57 root.importErrors.push(error)
58 console.error("Fail to import vcard:" + error)
59 }
60 root.importedVcards = imported
61 root.importErrors = importErrors
62 }
63 }
64
65 Component {
66 id: importDialogComponent
67
68 Popups.Dialog {
69 id: importDialog
70
71 title: i18n.tr("Import vCards")
72 text: root.importedVcards.length === 0 ? i18n.tr("Importing...") : i18n.tr("%1 vCards imported").arg(root.importedVcards.length)
73
74 Button {
75 anchors {
76 left: parent.left
77 right: parent.right
78 margins: units.gu(1)
79 }
80 text: i18n.tr("Close")
81 enabled: (root.importedVcards.length === root.vcards.length)
82 onClicked: {
83 root.dialog = null
84 Popups.PopupUtils.close(importDialog)
85 }
86 }
87
88 Component.onDestruction: root.destroy()
89 }
90 }
91}
92
93
94
095
=== modified file 'src/imports/MainWindow.qml'
--- src/imports/MainWindow.qml 2014-06-11 21:25:08 +0000
+++ src/imports/MainWindow.qml 2014-06-27 21:27:44 +0000
@@ -50,6 +50,10 @@
50 mainStack.push(Qt.createComponent("ContactList/ContactListPage.qml"), { pickMode: true, pickMultipleContacts: !isSingle})50 mainStack.push(Qt.createComponent("ContactList/ContactListPage.qml"), { pickMode: true, pickMultipleContacts: !isSingle})
51 }51 }
5252
53 function importvcard(_url) {
54 mainStack.importContactRequested([_url])
55 }
56
53 PageStack {57 PageStack {
54 id: mainStack58 id: mainStack
5559
@@ -60,6 +64,7 @@
60 signal editContatRequested(string contactId, string phoneNumber)64 signal editContatRequested(string contactId, string phoneNumber)
61 signal contactCreated(QtObject contact)65 signal contactCreated(QtObject contact)
62 signal contactModelError(string errorMessage)66 signal contactModelError(string errorMessage)
67 signal importContactRequested(var urls)
6368
64 anchors {69 anchors {
65 fill: parent70 fill: parent
@@ -118,5 +123,14 @@
118 {pickMode: true,123 {pickMode: true,
119 contentHubTransfer: transfer})124 contentHubTransfer: transfer})
120 }125 }
126 onImportRequested: {
127 if (transfer.state === ContentHub.ContentTransfer.Charged) {
128 var urls = []
129 for(var i=0; i < transfer.items.length; i++) {
130 urls.push(transfer.items[i].url)
131 }
132 mainStack.importContactRequested(urls)
133 }
134 }
121 }135 }
122}136}
123137
=== modified file 'src/imports/Ubuntu/Contacts/CMakeLists.txt'
--- src/imports/Ubuntu/Contacts/CMakeLists.txt 2014-06-09 14:12:58 +0000
+++ src/imports/Ubuntu/Contacts/CMakeLists.txt 2014-06-27 21:27:44 +0000
@@ -12,6 +12,7 @@
12 DialogButtons.qml12 DialogButtons.qml
13 FastScroll.qml13 FastScroll.qml
14 FastScroll.js14 FastScroll.js
15 MostCalledModel.qml
15 MultipleSelectionListView.qml16 MultipleSelectionListView.qml
16 MultipleSelectionVisualModel.qml17 MultipleSelectionVisualModel.qml
17 qmldir18 qmldir
1819
=== modified file 'src/imports/Ubuntu/Contacts/ContactAvatar.qml'
--- src/imports/Ubuntu/Contacts/ContactAvatar.qml 2014-06-16 17:25:21 +0000
+++ src/imports/Ubuntu/Contacts/ContactAvatar.qml 2014-06-27 21:27:44 +0000
@@ -26,7 +26,7 @@
26 property string displayName: ContactsJS.formatToDisplay(contactElement, ContactDetail.Name, [Name.FirstName, Name.LastName])26 property string displayName: ContactsJS.formatToDisplay(contactElement, ContactDetail.Name, [Name.FirstName, Name.LastName])
27 readonly property string defaultAvatar: "image://theme/contact"27 readonly property string defaultAvatar: "image://theme/contact"
28 readonly property string avatarUrl: ContactsJS.getAvatar(contactElement, "")28 readonly property string avatarUrl: ContactsJS.getAvatar(contactElement, "")
29 readonly property bool useDefaultAvatar: (displayName === "" || contact.tag.tag === "") && (avatarUrl === "")29 readonly property bool useDefaultAvatar: (contactElement == null) || (displayName === "" || contactElement.tag.tag === "") && (avatarUrl === "")
3030
31 function reload()31 function reload()
32 {32 {
3333
=== modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml'
--- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2014-06-18 21:27:05 +0000
+++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2014-06-27 21:27:44 +0000
@@ -25,7 +25,9 @@
2525
26 property bool showAvatar: true26 property bool showAvatar: true
27 property bool selected: false27 property bool selected: false
28 property bool isCurrentItem: false
28 property string defaultAvatarUrl: ""29 property string defaultAvatarUrl: ""
30 property string defaultTitle: ""
29 property int titleDetail: ContactDetail.Name31 property int titleDetail: ContactDetail.Name
30 property variant titleFields: [ Name.FirstName, Name.LastName ]32 property variant titleFields: [ Name.FirstName, Name.LastName ]
31 property bool detailsShown: false33 property bool detailsShown: false
@@ -35,16 +37,13 @@
35 signal pressAndHold(int index, QtObject contact)37 signal pressAndHold(int index, QtObject contact)
36 signal detailClicked(QtObject contact, QtObject detail, string action)38 signal detailClicked(QtObject contact, QtObject detail, string action)
37 signal infoRequested(int index, QtObject contact)39 signal infoRequested(int index, QtObject contact)
40 signal addContactClicked(string label)
3841
39 function _onDetailClicked(detail, action)42 function _onDetailClicked(detail, action)
40 {43 {
41 detailClicked(contact, detail, action)44 detailClicked(contact, detail, action)
42 }45 }
4346
44 // ListItemWithActions
45 //onItemClicked: root.clicked(index, contact)
46 //onItemPressAndHold: root.pressAndHold(index, contact)
47
48 height: delegate.height47 height: delegate.height
49 implicitHeight: delegate.height + (pickerLoader.item ? pickerLoader.item.height : 0)48 implicitHeight: delegate.height + (pickerLoader.item ? pickerLoader.item.height : 0)
50 width: parent ? parent.width : 049 width: parent ? parent.width : 0
@@ -100,7 +99,7 @@
100 }99 }
101 font.pointSize: 88100 font.pointSize: 88
102 color: UbuntuColors.lightAubergine101 color: UbuntuColors.lightAubergine
103 text: ContactsJS.formatToDisplay(contact, root.titleDetail, root.titleFields)102 text: contact ? ContactsJS.formatToDisplay(contact, root.titleDetail, root.titleFields, "") : root.defaultTitle
104 elide: Text.ElideRight103 elide: Text.ElideRight
105 }104 }
106105
@@ -113,7 +112,7 @@
113 rightMargin: units.gu(2)112 rightMargin: units.gu(2)
114 verticalCenter: parent.verticalCenter113 verticalCenter: parent.verticalCenter
115 }114 }
116 name: "contact"115 name: contact ? "contact" : "new-contact"
117 height: units.gu(3)116 height: units.gu(3)
118 width: opacity > 0.0 ? height : 0117 width: opacity > 0.0 ? height : 0
119 opacity: root.detailsShown ? 1.0 : 0.0118 opacity: root.detailsShown ? 1.0 : 0.0
@@ -122,8 +121,14 @@
122 }121 }
123122
124 MouseArea {123 MouseArea {
125 anchors.fill: parent124 anchors.fill: parent
126 onClicked: root.infoRequested(index, contact)125 onClicked: {
126 if (contact) {
127 root.infoRequested(index, contact)
128 } else {
129 root.addContactClicked(name.text)
130 }
131 }
127 }132 }
128 }133 }
129134
@@ -139,7 +144,7 @@
139 return Qt.resolvedUrl("ContactDetailPickerPhoneNumberDelegate.qml")144 return Qt.resolvedUrl("ContactDetailPickerPhoneNumberDelegate.qml")
140 }145 }
141 }146 }
142 active: root.detailsShown147 active: contact && root.detailsShown
143 asynchronous: true148 asynchronous: true
144 anchors {149 anchors {
145 top: delegate.bottom150 top: delegate.bottom
@@ -153,10 +158,79 @@
153 }158 }
154159
155 onStatusChanged: {160 onStatusChanged: {
156 if (status == Loader.Ready) {161 if ((status == Loader.Ready) && contact) {
157 pickerLoader.item.updateDetails(contact)162 pickerLoader.item.updateDetails(contact)
158 pickerLoader.item.detailClicked.connect(root._onDetailClicked)163 pickerLoader.item.detailClicked.connect(root._onDetailClicked)
159 }164 }
160 }165 }
161 }166 }
167
168 Behavior on height {
169 id: behaviorOnHeight
170
171 enabled: false
172 UbuntuNumberAnimation { }
173 }
174
175 state: isCurrentItem ? "expanded" : ""
176 states: [
177 State {
178 name: "expanded"
179 PropertyChanges {
180 target: root
181 clip: true
182 height: root.implicitHeight
183 loaderOpacity: 1.0
184 // FIXME: Setting detailsShown to true on expanded state cause the property to change to false and true during the state transition, and that
185 // causes the loader to load twice
186 //detailsShown: true
187 }
188 PropertyChanges {
189 target: behaviorOnHeight
190 enabled: true
191 }
192 }
193 ]
194 transitions: [
195 Transition {
196 from: "expanded"
197 to: ""
198 SequentialAnimation {
199 UbuntuNumberAnimation {
200 target: root
201 properties: "height, loaderOpacity"
202 }
203 PropertyAction {
204 target: root
205 property: "clip"
206 }
207 PropertyAction {
208 target: root
209 property: "detailsShown"
210 value: false
211 }
212 PropertyAction {
213 target: root
214 property: "ListView.delayRemove"
215 value: false
216 }
217 }
218 },
219 Transition {
220 from: ""
221 to: "expanded"
222 SequentialAnimation {
223 PropertyAction {
224 target: root
225 properties: "detailsShown"
226 value: true
227 }
228 PropertyAction {
229 target: root
230 properties: "ListView.delayRemove"
231 value: true
232 }
233 }
234 }
235 ]
162}236}
163237
=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
--- src/imports/Ubuntu/Contacts/ContactListView.qml 2014-06-18 15:56:42 +0000
+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2014-06-27 21:27:44 +0000
@@ -45,12 +45,12 @@
45 readonly property alias count: view.count45 readonly property alias count: view.count
4646
47 /*!47 /*!
48 \qmlproperty string contactNameFilter48 \qmlproperty string contactStringFilter
4949
50 This property holds a string that will be used to filter contacts on the list50 This property holds a string that will be used to filter contacts on the list
51 By default this is set to empty51 By default this is set to empty
52 */52 */
53 property string contactNameFilter: ""53 property string filterTerm: ""
54 /*!54 /*!
55 \qmlproperty Filter filter55 \qmlproperty Filter filter
5656
@@ -223,6 +223,10 @@
223 */223 */
224 signal detailClicked(QtObject contact, QtObject detail, string action)224 signal detailClicked(QtObject contact, QtObject detail, string action)
225 /*!225 /*!
226 This handler is called when a unknown contact is clicked, the label contains the phone number
227 */
228 signal addContactClicked(string label)
229 /*!
226 This handler is called when the contact delegate disapear (height === 0) caused by the function call makeDisappear230 This handler is called when the contact delegate disapear (height === 0) caused by the function call makeDisappear
227 */231 */
228 signal contactDisappeared(QtObject contact)232 signal contactDisappeared(QtObject contact)
@@ -290,7 +294,8 @@
290 Rectangle {294 Rectangle {
291 id: itemHeader295 id: itemHeader
292296
293 height: units.gu(2)297 visible: root.showFavourites && (root.filterTerm.length === 0)
298 height: visible ? units.gu(2) : 0
294 anchors {299 anchors {
295 left: parent.left300 left: parent.left
296 right: parent.right301 right: parent.right
@@ -311,14 +316,14 @@
311 text: i18n.dtr("address-book-app", "All")316 text: i18n.dtr("address-book-app", "All")
312 horizontalAlignment: Text.AlignHCenter317 horizontalAlignment: Text.AlignHCenter
313 verticalAlignment: Text.AlignVCenter318 verticalAlignment: Text.AlignVCenter
314 color: root.showFavourites ? UbuntuColors.warmGrey : UbuntuColors.orange319 color: view.favouritesIsSelected ? UbuntuColors.warmGrey : UbuntuColors.orange
315 MouseArea {320 MouseArea {
316 anchors.fill: parent321 anchors.fill: parent
317 onClicked: {322 onClicked: {
318 //WORKAROUND: clear the model before start populate it with the new contacts323 //WORKAROUND: clear the model before start populate it with the new contacts
319 //otherwise the model will wait for all contacts before show any new contact324 //otherwise the model will wait for all contacts before show any new contact
320 root.changeFilter(root.filter)325 root.changeFilter(root.filter)
321 root.showFavourites = false326 view.favouritesIsSelected = false
322 }327 }
323 }328 }
324 }329 }
@@ -343,21 +348,22 @@
343 text: i18n.dtr("address-book-app", "Favourites")348 text: i18n.dtr("address-book-app", "Favourites")
344 horizontalAlignment: Text.AlignHCenter349 horizontalAlignment: Text.AlignHCenter
345 verticalAlignment: Text.AlignVCenter350 verticalAlignment: Text.AlignVCenter
346 color: root.showFavourites ? UbuntuColors.orange : UbuntuColors.warmGrey351 color: view.favouritesIsSelected ? UbuntuColors.orange : UbuntuColors.warmGrey
347 MouseArea {352 MouseArea {
348 anchors.fill: parent353 anchors.fill: parent
349 onClicked: root.showFavourites = true354 onClicked: view.favouritesIsSelected = true
350 }355 }
351 }356 }
352 }357 }
353 }358 }
354359
355 onContactNameFilterChanged: contactSearchTimeout.restart()360 onFilterTermChanged: contactSearchTimeout.restart()
356361
357 ContactSimpleListView {362 ContactSimpleListView {
358 id: view363 id: view
359364
360 property bool showFavourites: false365 property bool showFavourites: true
366 property bool favouritesIsSelected: false
361367
362 function getSectionText(index) {368 function getSectionText(index) {
363 var tag = listModel.contacts[index].tag.tag369 var tag = listModel.contacts[index].tag.tag
@@ -371,14 +377,93 @@
371 top: itemHeader.bottom377 top: itemHeader.bottom
372 left: parent.left378 left: parent.left
373 right: parent.right379 right: parent.right
380 bottom: parent.bottom
374 rightMargin: fastScroll.showing ? fastScroll.width - units.gu(1) : 0381 rightMargin: fastScroll.showing ? fastScroll.width - units.gu(1) : 0
375 bottom: parent.bottom
376
377 Behavior on rightMargin {382 Behavior on rightMargin {
378 UbuntuNumberAnimation {}383 UbuntuNumberAnimation {}
379 }384 }
380 }385 }
381386
387 header: Column {
388 id: mostCalledView
389
390 function makeItemVisible(item)
391 {
392 var itemY = mostCalledView.y + item.y
393 var areaY = view.contentY
394 if (itemY < areaY) {
395 view.contentY = itemY
396 }
397 }
398
399 anchors {
400 left: parent.left
401 right: parent.right
402 }
403 height: visible ? childrenRect.height : 0
404 visible: view.favouritesIsSelected && (callerRepeat.count > 0)
405 onHeightChanged: {
406 // make selected item fully visible
407 if (calledModel.currentIndex != -1) {
408 mostCalledView.makeItemVisible(callerRepeat.itemAt(calledModel.currentIndex))
409 } else {
410 // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
411 // this should fix the Y position (630 is the header height)
412 view.contentY = -630
413 }
414 }
415
416 Rectangle {
417 color: Theme.palette.normal.background
418 anchors {
419 left: parent.left
420 right: parent.right
421 margins: units.gu(1)
422 }
423 height: units.gu(3)
424 Label {
425 anchors.fill: parent
426 verticalAlignment: Text.AlignVCenter
427 text: i18n.tr("Frequently called")
428 font.pointSize: 76
429 }
430 ListItem.ThinDivider {
431 anchors {
432 left: parent.left
433 right: parent.right
434 bottom: parent.bottom
435 }
436 }
437 }
438 Repeater {
439 id: callerRepeat
440
441 model: MostCalledModel {
442 id: calledModel
443 maxCount: 20
444
445 onInfoRequested: root.infoRequested(contact)
446 onDetailClicked: root.detailClicked(contact, detail, action)
447 onAddContactClicked: root.addContactClicked(label)
448 onCurrentIndexChanged: {
449 if (currentIndex !== -1) {
450 view.currentIndex = -1
451 }
452 }
453 }
454 }
455
456 Connections {
457 target: view
458 onCurrentIndexChanged: {
459 if (view.currentIndex !== -1) {
460 calledModel.currentIndex = -1
461 }
462 }
463 }
464 }
465
466 height: Math.min(root.height, contentHeight)
382 onError: root.error(message)467 onError: root.error(message)
383 onInfoRequested: root.infoRequested(contact)468 onInfoRequested: root.infoRequested(contact)
384 onDetailClicked: root.detailClicked(contact, detail, action)469 onDetailClicked: root.detailClicked(contact, detail, action)
@@ -400,6 +485,34 @@
400 matchFlags: DetailFilter.MatchExactly485 matchFlags: DetailFilter.MatchExactly
401 }486 }
402487
488 UnionFilter {
489 id: contactTermFilter
490
491 property string value: ""
492
493 DetailFilter {
494 detail: ContactDetail.DisplayLabel
495 field: DisplayLabel.Label
496 value: contactTermFilter.value
497 matchFlags: DetailFilter.MatchContains
498 }
499
500 DetailFilter {
501 detail: ContactDetail.PhoneNumber
502 field: PhoneNumber.Number
503 value: contactTermFilter.value
504 matchFlags: DetailFilter.MatchPhoneNumber
505 }
506
507 DetailFilter {
508 detail: ContactDetail.PhoneNumber
509 field: PhoneNumber.Number
510 value: contactTermFilter.value
511 matchFlags: DetailFilter.MatchContains
512 }
513 }
514
515
403 IntersectionFilter {516 IntersectionFilter {
404 id: contactsFilter517 id: contactsFilter
405518
@@ -407,29 +520,21 @@
407520
408 filters: {521 filters: {
409 var filters = []522 var filters = []
410 if (root.showFavourites) {523 if (contactTermFilter.value.length > 0) {
524 filters.push(contactTermFilter)
525 } else if (view.showFavourites && view.favouritesIsSelected) {
411 filters.push(favouritesFilter)526 filters.push(favouritesFilter)
412 }527 }
528
413 if (root.filter) {529 if (root.filter) {
414 filters.push(root.filter)530 filters.push(root.filter)
415 }531 }
416 if (nameFilter.value && (nameFilter.value.length > 0)) {532
417 filters.push(nameFilter)
418 }
419 active = (filters.length > 0)533 active = (filters.length > 0)
420 return filters534 return filters
421 }535 }
422 }536 }
423537
424 DetailFilter {
425 id: nameFilter
426
427 detail: ContactDetail.DisplayLabel
428 field: DisplayLabel.Label
429 value: root.nameFilter
430 matchFlags: DetailFilter.MatchContains
431 }
432
433 Timer {538 Timer {
434 id: contactSearchTimeout539 id: contactSearchTimeout
435540
@@ -437,14 +542,26 @@
437 repeat: false542 repeat: false
438 interval: 300543 interval: 300
439 onTriggered: {544 onTriggered: {
440 if (root.contactNameFilter === "") { // if the search criteria is empty clear the list before show all contacts545 var needUpdate = false
441 contactList.changeFilter(root.filter)546 if (root.filterTerm === "") { // if the search criteria is empty clear the list before show all contacts
442 nameFilter.value = ""547 if (contactTermFilter.value !== "") {
548 root.changeFilter(root.filter)
549 contactTermFilter.value = ""
550 needUpdate = true
551 }
443 } else {552 } else {
444 if (nameFilter.value === "") { // if the search starts clear the list before show results553 if (contactTermFilter.value !== root.filterTerm) {
445 contactList.changeFilter(root.filter)554 if (contactTermFilter.value === "") { // if the search starts clear the list before show results
555 root.changeFilter(root.filter)
556 }
557 contactTermFilter.value = root.filterTerm
558 needUpdate = true
446 }559 }
447 nameFilter.value = root.contactNameFilter560 }
561
562 // manually update if autoUpdate is disabled
563 if (needUpdate && !root.autoUpdate) {
564 contactsModel.update()
448 }565 }
449 }566 }
450 }567 }
@@ -499,9 +616,9 @@
499 enabled: view.contentHeight > (view.height * 2)616 enabled: view.contentHeight > (view.height * 2)
500617
501 anchors {618 anchors {
502 top: itemHeader.bottom619 top: view.top
503 topMargin: units.gu(0.5)620 topMargin: units.gu(0.5)
504 bottom: parent.bottom621 bottom: view.bottom
505 right: parent.right622 right: parent.right
506 }623 }
507 }624 }
508625
=== modified file 'src/imports/Ubuntu/Contacts/ContactSimpleListView.qml'
--- src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-06-16 17:33:52 +0000
+++ src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-06-27 21:27:44 +0000
@@ -268,34 +268,16 @@
268 listDelegate: ContactDelegate {268 listDelegate: ContactDelegate {
269 id: contactDelegate269 id: contactDelegate
270270
271 // overwrite
272 function disappeared()
273 {
274 contactListView.contactDisappeared(contact)
275 }
276
277 width: parent.width271 width: parent.width
278 selected: contactListView.multiSelectionEnabled && contactListView.isSelected(contactDelegate)272 selected: contactListView.multiSelectionEnabled && contactListView.isSelected(contactDelegate)
279 defaultAvatarUrl: contactListView.defaultAvatarImageUrl273 defaultAvatarUrl: contactListView.defaultAvatarImageUrl
280 titleDetail: contactListView.titleDetail274 titleDetail: contactListView.titleDetail
281 titleFields: contactListView.titleFields275 titleFields: contactListView.titleFields
282276 isCurrentItem: ListView.isCurrentItem
283 // ListItemWithActions
284 //locked: contactListView.isInSelectionMode || detailsShown
285 //triggerActionOnMouseRelease: true
286 //leftSideAction: contactListView.leftSideAction
287 //rightSideActions: contactListView.rightSideActions
288277
289 onDetailClicked: contactListView.detailClicked(contact, detail, action)278 onDetailClicked: contactListView.detailClicked(contact, detail, action)
290 onInfoRequested: contactListView._fetchContact(index, contact)279 onInfoRequested: contactListView._fetchContact(index, contact)
291280
292 Behavior on height {
293 id: behaviorOnHeight
294
295 enabled: false
296 UbuntuNumberAnimation { }
297 }
298
299 // collapse the item before remove it, to avoid crash281 // collapse the item before remove it, to avoid crash
300 ListView.onRemove: SequentialAnimation {282 ListView.onRemove: SequentialAnimation {
301 ScriptAction {283 ScriptAction {
@@ -333,67 +315,6 @@
333 contactListView.selectItem(contactDelegate)315 contactListView.selectItem(contactDelegate)
334 }316 }
335 }317 }
336 state: ListView.isCurrentItem ? "expanded" : ""
337 states: [
338 State {
339 name: "expanded"
340 PropertyChanges {
341 target: contactDelegate
342 clip: true
343 height: contactDelegate.implicitHeight
344 loaderOpacity: 1.0
345 // FIXME: Setting detailsShown to true on expanded state cause the property to change to false and true during the state transition, and that
346 // causes the loader to load twice
347 //detailsShown: true
348 }
349 PropertyChanges {
350 target: behaviorOnHeight
351 enabled: true
352 }
353 }
354 ]
355 transitions: [
356 Transition {
357 from: "expanded"
358 to: ""
359 SequentialAnimation {
360 UbuntuNumberAnimation {
361 target: contactDelegate
362 properties: "height, loaderOpacity"
363 }
364 PropertyAction {
365 target: contactDelegate
366 property: "clip"
367 }
368 PropertyAction {
369 target: contactDelegate
370 property: "detailsShown"
371 value: false
372 }
373 PropertyAction {
374 target: contactDelegate
375 property: "ListView.delayRemove"
376 value: false
377 }
378 }
379 },
380 Transition {
381 from: ""
382 to: "expanded"
383 SequentialAnimation {
384 PropertyAction {
385 target: contactDelegate
386 properties: "detailsShown"
387 value: true
388 }
389 PropertyAction {
390 target: contactDelegate
391 properties: "ListView.delayRemove"
392 value: true
393 }
394 }
395 }
396 ]
397 }318 }
398319
399 ContactFetch {320 ContactFetch {
400321
=== modified file 'src/imports/Ubuntu/Contacts/Contacts.js'
--- src/imports/Ubuntu/Contacts/Contacts.js 2014-06-06 17:52:58 +0000
+++ src/imports/Ubuntu/Contacts/Contacts.js 2014-06-27 21:27:44 +0000
@@ -2,9 +2,9 @@
2var phoneTypeModel = null2var phoneTypeModel = null
33
4// Format contact name to be displayed4// Format contact name to be displayed
5function formatToDisplay(contact, contactDetail, detailFields, detail) {5function formatToDisplay(contact, contactDetail, detailFields, detail, defaultTitle) {
6 if (!contact) {6 if (!contact) {
7 return ""7 return defaultTitle
8 }8 }
99
10 if (!detail) {10 if (!detail) {
1111
=== added file 'src/imports/Ubuntu/Contacts/MostCalledModel.qml'
--- src/imports/Ubuntu/Contacts/MostCalledModel.qml 1970-01-01 00:00:00 +0000
+++ src/imports/Ubuntu/Contacts/MostCalledModel.qml 2014-06-27 21:27:44 +0000
@@ -0,0 +1,183 @@
1/*
2 * Copyright (C) 2012-2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17
18import QtQuick 2.2
19import QtContacts 5.0
20import Ubuntu.History 0.1
21import Ubuntu.Telephony 0.1
22
23VisualDataModel {
24 id: root
25
26 property int maxCount: 10
27 property var contactModel: null
28 property var historyModel
29 property int currentIndex: -1
30
31 signal clicked(int index, QtObject contact)
32 signal detailClicked(QtObject contact, QtObject detail, string action)
33 signal infoRequested(int index, QtObject contact)
34 signal addContactClicked(string label)
35
36 function filterEntries()
37 {
38 var contacts = {}
39 var interval = new Date()
40 var secs = (interval.getTime() - 2592000000) // one month ago
41 interval.setTime(secs)
42
43 var totalCount = 0
44 var i = 0;
45 while(true) {
46 var event = historyModel.getItem(i)
47 if (!event) {
48 break
49 }
50
51 if (event.timestamp < interval) {
52 break
53 }
54
55 var participants = event.participants
56 for (var p=0; p < participants.length; p++) {
57 var phoneNumber = participants[p]
58 if (phoneNumber) {
59 if (contacts[phoneNumber] === undefined) {
60 contacts[phoneNumber] = 1
61 } else {
62 var count = contacts[phoneNumber]
63 contacts[phoneNumber] = count + 1
64 }
65 totalCount += 1
66 }
67 }
68 i++
69 }
70
71 listModel.clear()
72 if (totalCount == 0) {
73 return
74 }
75
76 // sort phones most called first
77 var mostCalledFirst = []
78 for (var key in contacts) {
79 mostCalledFirst.push([key, contacts[key]]);
80 }
81
82 mostCalledFirst.sort(function(a, b) {
83 a = a[1];
84 b = b[1];
85
86 return a < b ? -1 : (a > b ? 1 : 0);
87 });
88
89 contacts = {}
90 for (var i = 0; i < mostCalledFirst.length; i++) {
91 var key = mostCalledFirst[i][0];
92 var value = mostCalledFirst[i][1];
93 contacts[key] = value
94 }
95
96 // get the avarage frequency
97 var average = totalCount / mostCalledFirst.length
98
99 for (var phone in contacts) {
100 if (contacts[phone] >= average) {
101 listModel.insert(0, {"participant": phone})
102 if (listModel.count >= root.maxCount) {
103 return;
104 }
105 }
106 }
107 }
108
109 model: ListModel {
110 id: listModel
111 }
112
113 historyModel: HistoryEventModel {
114
115 function getItem(row) {
116 while ((row >= count) && (canFetchMore())) {
117 fetchMore()
118 }
119 return get(row)
120 }
121
122 type: HistoryThreadModel.EventTypeVoice
123 sort: HistorySort {
124 sortField: "timestamp"
125 sortOrder: HistorySort.DescendingOrder
126 }
127 Component.onCompleted: root.filterEntries()
128 }
129
130
131 delegate: ContactDelegate {
132 id: contactDelegate
133
134 readonly property alias contact: contactFetch.contact
135
136 onDetailClicked: root.detailClicked(contact, detail, action)
137 onInfoRequested: root.infoRequested(index, contact)
138 onAddContactClicked: root.addContactClicked(label)
139
140 defaultAvatarUrl: "image://theme/contacts"
141 defaultTitle: participant
142 width: parent.width
143 titleDetail: ContactDetail.DisplayLabel
144 titleFields: [ DisplayLabel.Label ]
145 isCurrentItem: root.currentIndex === index
146
147 // collapse the item before remove it, to avoid crash
148 ListView.onRemove: SequentialAnimation {
149 ScriptAction {
150 script: {
151 if (contactDelegate.state !== "") {
152 historyModel.currentIndex = -1
153 }
154 }
155 }
156 }
157
158 onClicked: {
159 if (root.currentIndex === index) {
160 root.currentIndex = -1
161 return
162 } else if (detailToPick !== 0) {
163 root.currentIndex = index
164 return
165 } else if (detailToPick == 0) {
166 contactListView.detailClicked(contact, null, "")
167 }
168 }
169
170 ContactWatcher {
171 id: contactWatcher
172
173 phoneNumber: participant
174 onContactIdChanged: contactFetch.fetchContact(contactId)
175 }
176
177 ContactFetch {
178 id: contactFetch
179
180 model: contactsModel
181 }
182 }
183}
0184
=== modified file 'src/imports/Ubuntu/Contacts/qmldir'
--- src/imports/Ubuntu/Contacts/qmldir 2014-06-09 15:52:06 +0000
+++ src/imports/Ubuntu/Contacts/qmldir 2014-06-27 21:27:44 +0000
@@ -16,3 +16,4 @@
16internal ContactJs Contacts.js16internal ContactJs Contacts.js
17internal FastScroll FastScroll.qml17internal FastScroll FastScroll.qml
18internal FastScrollJs FastScroll.js18internal FastScrollJs FastScroll.js
19internal MostCalledModel MostCalledModel.qml

Subscribers

People subscribed via source and target branches