Merge lp:~phablet-team/address-book-app/address-book-app-desktop-translations into lp:address-book-app

Proposed by Ugo Riboni
Status: Superseded
Proposed branch: lp:~phablet-team/address-book-app/address-book-app-desktop-translations
Merge into: lp:address-book-app
Diff against target: 1401 lines (+435/-220)
21 files modified
CMakeLists.txt (+4/-0)
data/CMakeLists.txt (+5/-7)
data/address-book-app.desktop.in.in (+4/-4)
po/CMakeLists.txt (+7/-4)
po/address-book-app.pot (+34/-33)
po/pt_BR.po (+1/-1)
src/app/addressbookapp.cpp (+38/-5)
src/app/addressbookapp.h (+7/-0)
src/imports/ContactEdit/ContactEditor.qml (+2/-2)
src/imports/ContactEdit/TextInputDetail.qml (+1/-4)
src/imports/ContactList/ContactListPage.qml (+183/-63)
src/imports/ContactView/ContactDetailAvatarView.qml (+2/-1)
src/imports/MainWindow.qml (+63/-41)
src/imports/Ubuntu/Contacts/ContactDelegate.qml (+15/-2)
src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml (+5/-3)
src/imports/Ubuntu/Contacts/ContactListView.qml (+19/-7)
src/imports/Ubuntu/Contacts/ContactSimpleListView.qml (+3/-3)
src/imports/Ubuntu/Contacts/ListItemWithActions.qml (+30/-33)
src/imports/Ubuntu/Contacts/MostCalledModel.qml (+8/-5)
src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp (+3/-2)
src/imports/Ubuntu/Contacts/mostcalledproxymodel.h (+1/-0)
To merge this branch: bzr merge lp:~phablet-team/address-book-app/address-book-app-desktop-translations
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+223362@code.launchpad.net

This proposal has been superseded by a proposal from 2014-07-16.

Commit message

Add translations inside .desktop files

Description of the change

Add translations inside .desktop files

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

could you create a new mr against the staging branch?

211. By Renato Araujo Oliveira Filho

Removed useless code.

212. By Renato Araujo Oliveira Filho

Staging merged.

Unmerged revisions

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-07-07 19:46:23 +0000
3+++ CMakeLists.txt 2014-07-16 12:56:44 +0000
4@@ -18,9 +18,13 @@
5 find_package(Qt5DBus)
6 find_package(PkgConfig REQUIRED)
7
8+find_program(INTLTOOL_MERGE intltool-merge)
9+find_program(INTLTOOL_EXTRACT intltool-extract)
10+
11 set(ADDRESS_BOOK_APP_DIR ${CMAKE_INSTALL_DATADIR}/address-book-app)
12 set(ADDRESS_BOOK_APP_FULL_DIR ${CMAKE_INSTALL_FULL_DATADIR}/address-book-app)
13 set(ADDRESS_BOOK_APP_NAME "Address Book")
14+set(DESKTOP_FILE address-book-app.desktop)
15 set(API_VERSION 0.1)
16
17 # for dh_translations to extract the domain
18
19=== modified file 'data/CMakeLists.txt'
20--- data/CMakeLists.txt 2014-07-07 19:46:23 +0000
21+++ data/CMakeLists.txt 2014-07-16 12:56:44 +0000
22@@ -5,13 +5,11 @@
23 set(ADDRESS_BOOK_APP_ICON "address-book-app.svg")
24 endif()
25
26-file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${ADDRESS_BOOK_APP_DESKTOP_FILE})
27-file(STRINGS ${ADDRESS_BOOK_APP_DESKTOP_FILE}.in DESKTOP_FILE_CONTENTS)
28-foreach(LINE ${DESKTOP_FILE_CONTENTS})
29- string(REGEX REPLACE "tr\\\(\"(.*)\"\\\)" "\\1" LINE "${LINE}")
30- string(CONFIGURE "${LINE}" LINE)
31- file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${ADDRESS_BOOK_APP_DESKTOP_FILE} "${LINE}\n")
32-endforeach(LINE)
33+configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in)
34+add_custom_target(${DESKTOP_FILE} ALL
35+ COMMENT "Merging translations into ${DESKTOP_FILE}"
36+ COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${DESKTOP_FILE}.in ${DESKTOP_FILE} >/dev/null
37+)
38
39 if(CLICK_MODE)
40 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ADDRESS_BOOK_APP_DESKTOP_FILE}
41
42=== renamed file 'data/address-book-app.desktop.in' => 'data/address-book-app.desktop.in.in'
43--- data/address-book-app.desktop.in 2014-07-07 19:46:23 +0000
44+++ data/address-book-app.desktop.in.in 2014-07-16 12:56:44 +0000
45@@ -3,13 +3,13 @@
46 Version=1.0
47 Terminal=false
48 Type=Application
49-Name=tr("Contacts")
50-GenericName=tr("Contacts")
51-Comment=tr("Contacts Address Book")
52+_Name=Contacts
53+_GenericName=Contacts
54+_Comment=Contacts Address Book
55+_Keywords=Contacts;People;Numbers
56 Exec=@DESKTOP_EXEC@ %u
57 Icon=@ADDRESS_BOOK_APP_ICON@
58 X-Ubuntu-Touch=true
59 X-Ubuntu-StageHint=SideStage
60-X-Ubuntu-Gettext-Domain=address-book-app
61 X-Ubuntu-Single-Instance=true
62 @XSCREENSHOT@
63
64=== modified file 'po/CMakeLists.txt'
65--- po/CMakeLists.txt 2014-05-28 19:56:00 +0000
66+++ po/CMakeLists.txt 2014-07-16 12:56:44 +0000
67@@ -4,8 +4,8 @@
68 set(POT_FILE ${DOMAIN}.pot)
69 file(GLOB PO_FILES *.po)
70 file(GLOB_RECURSE I18N_SRCS RELATIVE ${CMAKE_SOURCE_DIR}
71- ${CMAKE_SOURCE_DIR}/src/*.qml
72- ${CMAKE_SOURCE_DIR}/data/*.desktop.in)
73+ ${CMAKE_SOURCE_DIR}/src/*.qml)
74+list(APPEND I18N_SRCS data/${DESKTOP_FILE}.in.in)
75 list(SORT I18N_SRCS)
76
77 foreach(PO_FILE ${PO_FILES})
78@@ -19,8 +19,11 @@
79
80 find_program(XGETTEXT_EXECUTABLE xgettext)
81 if(XGETTEXT_EXECUTABLE)
82- add_custom_target(${POT_FILE})
83- add_custom_command(TARGET ${POT_FILE}
84+ add_custom_target(${POT_FILE} ALL
85+ COMMENT "Generating translation template"
86+ COMMAND ${INTLTOOL_EXTRACT} --update --type=gettext/ini
87+ --srcdir=${CMAKE_SOURCE_DIR} data/${DESKTOP_FILE}.in.in
88+
89 COMMAND ${XGETTEXT_EXECUTABLE} -o ${POT_FILE}
90 --c++ --qt --add-comments=TRANSLATORS
91 --keyword=tr --keyword=tr:1,2
92
93=== modified file 'po/address-book-app.pot'
94--- po/address-book-app.pot 2014-06-30 18:01:45 +0000
95+++ po/address-book-app.pot 2014-07-16 12:56:44 +0000
96@@ -8,7 +8,7 @@
97 msgstr ""
98 "Project-Id-Version: address-book-app\n"
99 "Report-Msgid-Bugs-To: \n"
100-"POT-Creation-Date: 2014-06-30 15:01-0300\n"
101+"POT-Creation-Date: 2014-07-16 09:55-0300\n"
102 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
103 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
104 "Language-Team: LANGUAGE <LL@li.org>\n"
105@@ -22,10 +22,18 @@
106 msgid "%1 vCards imported"
107 msgstr ""
108
109+#: src/imports/ContactList/ContactListPage.qml:202
110+msgid "+ New Contact"
111+msgstr ""
112+
113 #: src/imports/ContactEdit/ContactEditor.qml:322
114 msgid "Add Field"
115 msgstr ""
116
117+#: src/imports/ContactList/ContactListPage.qml:462
118+msgid "Add contact"
119+msgstr ""
120+
121 #: src/imports/ContactEdit/AddFieldDialog.qml:59
122 #: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:23
123 #: src/imports/ContactView/ContactDetailAddressesView.qml:24
124@@ -55,12 +63,12 @@
125
126 #: src/imports/ContactEdit/AddFieldDialog.qml:133
127 #: src/imports/ContactEdit/ContactEditor.qml:372
128-#: src/imports/ContactList/ContactListPage.qml:314
129+#: src/imports/ContactList/ContactListPage.qml:418
130 #: src/imports/Ubuntu/Contacts/DialogButtons.qml:37
131 msgid "Cancel"
132 msgstr ""
133
134-#: src/imports/ContactList/ContactListPage.qml:242
135+#: src/imports/ContactList/ContactListPage.qml:330
136 msgid "Cancel selection"
137 msgstr ""
138
139@@ -72,22 +80,17 @@
140 msgid "Contact not found"
141 msgstr ""
142
143-#: data/address-book-app.desktop.in:6 data/address-book-app.desktop.in:7
144-#: src/imports/ContactList/ContactListPage.qml:75
145+#: src/imports/ContactList/ContactListPage.qml:146
146 msgid "Contacts"
147 msgstr ""
148
149-#: data/address-book-app.desktop.in:8
150-msgid "Contacts Address Book"
151-msgstr ""
152-
153 #: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:35
154 msgid "Country"
155 msgstr ""
156
157 #: src/imports/ContactEdit/ContactEditor.qml:337
158-#: src/imports/ContactList/ContactListPage.qml:146
159-#: src/imports/ContactList/ContactListPage.qml:267
160+#: src/imports/ContactList/ContactListPage.qml:235
161+#: src/imports/ContactList/ContactListPage.qml:355
162 msgid "Delete"
163 msgstr ""
164
165@@ -120,7 +123,7 @@
166 msgstr ""
167
168 #: src/imports/ContactView/ContactFetchError.qml:25
169-#: src/imports/MainWindow.qml:98
170+#: src/imports/MainWindow.qml:112
171 msgid "Error"
172 msgstr ""
173
174@@ -136,12 +139,12 @@
175 msgid "First name"
176 msgstr ""
177
178-#: src/imports/Ubuntu/Contacts/ContactListView.qml:427
179+#: src/imports/Ubuntu/Contacts/ContactListView.qml:442
180 msgid "Frequently called"
181 msgstr ""
182
183 #: src/imports/Common/ContactDetailGroupWithTypeBase.qml:116
184-#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:94
185+#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:99
186 msgid "Home"
187 msgstr ""
188
189@@ -173,7 +176,7 @@
190 msgid "Loading"
191 msgstr ""
192
193-#: src/imports/ContactList/ContactListPage.qml:232
194+#: src/imports/ContactList/ContactListPage.qml:320
195 msgid "Loading..."
196 msgstr ""
197
198@@ -185,7 +188,7 @@
199 msgid "MSN"
200 msgstr ""
201
202-#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:98
203+#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:103
204 msgid "Mobile"
205 msgstr ""
206
207@@ -193,7 +196,7 @@
208 msgid "Multiple contacts"
209 msgstr ""
210
211-#: src/imports/ContactEdit/TextInputDetail.qml:77
212+#: src/imports/ContactEdit/TextInputDetail.qml:74
213 msgid "Next"
214 msgstr ""
215
216@@ -211,7 +214,7 @@
217 msgstr ""
218
219 #: src/imports/Common/ContactDetailGroupWithTypeBase.qml:118
220-#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:102
221+#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:107
222 msgid "Other"
223 msgstr ""
224
225@@ -234,6 +237,10 @@
226 msgid "Professional details"
227 msgstr ""
228
229+#: src/imports/ContactList/ContactListPage.qml:372
230+msgid "Quit"
231+msgstr ""
232+
233 #: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:33
234 msgid "Region"
235 msgstr ""
236@@ -246,19 +253,19 @@
237 msgid "Save"
238 msgstr ""
239
240-#: src/imports/ContactList/ContactListPage.qml:292
241+#: src/imports/ContactList/ContactListPage.qml:396
242 msgid "Search"
243 msgstr ""
244
245-#: src/imports/ContactList/ContactListPage.qml:267
246+#: src/imports/ContactList/ContactListPage.qml:355
247 msgid "Select"
248 msgstr ""
249
250-#: src/imports/ContactList/ContactListPage.qml:251
251+#: src/imports/ContactList/ContactListPage.qml:339
252 msgid "Select All"
253 msgstr ""
254
255-#: src/imports/ContactList/ContactListPage.qml:75
256+#: src/imports/ContactList/ContactListPage.qml:512
257 msgid "Select Contacts"
258 msgstr ""
259
260@@ -283,15 +290,15 @@
261 msgid "Street"
262 msgstr ""
263
264-#: src/imports/ContactList/ContactListPage.qml:283
265+#: src/imports/ContactList/ContactListPage.qml:387
266 msgid "Sync"
267 msgstr ""
268
269-#: src/imports/ContactList/ContactListPage.qml:283
270+#: src/imports/ContactList/ContactListPage.qml:387
271 msgid "Syncing"
272 msgstr ""
273
274-#: src/imports/ContactList/ContactListPage.qml:232
275+#: src/imports/ContactList/ContactListPage.qml:320
276 msgid "Syncing..."
277 msgstr ""
278
279@@ -303,18 +310,12 @@
280 msgid "Touch"
281 msgstr ""
282
283-#. TRANSLATORS: This value is used as default value for phone number format, when no coutry code is provided
284-#. the supported values can be found in: https://www.iso.org/obp/ui/#search
285-#: src/imports/ContactEdit/TextInputDetail.qml:73
286-msgid "US"
287-msgstr ""
288-
289 #: src/imports/Common/ContactDetailGroupWithTypeBase.qml:117
290-#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:96
291+#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:101
292 msgid "Work"
293 msgstr ""
294
295-#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:100
296+#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:105
297 msgid "Work Mobile"
298 msgstr ""
299
300
301=== modified file 'po/pt_BR.po'
302--- po/pt_BR.po 2014-07-05 05:59:02 +0000
303+++ po/pt_BR.po 2014-07-16 12:56:44 +0000
304@@ -307,7 +307,7 @@
305 #. the supported values can be found in: https://www.iso.org/obp/ui/#search
306 #: src/imports/ContactEdit/TextInputDetail.qml:73
307 msgid "US"
308-msgstr ""
309+msgstr "BR"
310
311 #: src/imports/Common/ContactDetailGroupWithTypeBase.qml:117
312 #: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:96
313
314=== modified file 'src/app/addressbookapp.cpp'
315--- src/app/addressbookapp.cpp 2014-07-04 23:10:37 +0000
316+++ src/app/addressbookapp.cpp 2014-07-16 12:56:44 +0000
317@@ -22,6 +22,7 @@
318 #include <QUrl>
319 #include <QUrlQuery>
320 #include <QDebug>
321+#include <QDesktopServices>
322 #include <QStringList>
323 #include <QQuickItem>
324 #include <QQmlComponent>
325@@ -30,6 +31,8 @@
326 #include <QLibrary>
327 #include <QIcon>
328 #include <QSettings>
329+#include <QTimer>
330+
331
332 #include <QQmlEngine>
333
334@@ -39,11 +42,12 @@
335 {
336 qDebug() << "usage:"
337 << arguments.at(0).toUtf8().constData()
338- << "[addressbook:///addphone?id=<contact-id>&phone=<phone-number>"
339- << "[addressbook:///contact?id=<contact-id>"
340- << "[addressbook:///create?phone=<phone-number>"
341- << "[addressbook:///pick?single=<true/false>"
342- << "[addressbook:///importvcard?url=<vcard-file>"
343+ << "[addressbook:///addphone?id=<contact-id>&phone=<phone-number>]"
344+ << "[addressbook:///addnewphone?phone=<phone-number>]"
345+ << "[addressbook:///contact?id=<contact-id>]"
346+ << "[addressbook:///create?phone=<phone-number>]"
347+ << "[addressbook:///pick?single=<true/false>]"
348+ << "[addressbook:///importvcard?url=<vcard-file>]"
349 << "[--fullscreen]"
350 << "[--help]"
351 << "[-testability]";
352@@ -266,6 +270,15 @@
353 sendEvent(m_view, &keyReleaseEvent);
354 }
355
356+void AddressBookApp::exit()
357+{
358+ if (!m_callbackApplication.isEmpty()) {
359+ QDesktopServices::openUrl(QUrl(QString("application:///%1").arg(m_callbackApplication)));
360+ }
361+ // quit after a delay to avoid problems with unity task manager.
362+ QTimer::singleShot(1000, this, SLOT(quit()));
363+}
364+
365 void AddressBookApp::parseUrl(const QString &arg)
366 {
367 QUrl url = QUrl::fromPercentEncoding(arg.toUtf8());
368@@ -305,6 +318,11 @@
369 args << "url";
370 methodsMetaData.insert("importvcard", args);
371 args.clear();
372+
373+ //addnewphone
374+ args << "phone";
375+ methodsMetaData.insert("addnewphone", args);
376+ args.clear();
377 }
378
379 QUrlQuery query(url);
380@@ -316,6 +334,8 @@
381 QPair<QString, QString> item = queryItemsPair[i];
382 queryItems.insert(item.first, item.second);
383 }
384+ // keep callback arg
385+ setCallbackApplication(queryItems.take("callback"));
386
387 if (methodsMetaData.contains(methodName)) {
388 QStringList argsNames = methodsMetaData[methodName];
389@@ -450,3 +470,16 @@
390 }
391 return false;
392 }
393+
394+QString AddressBookApp::callbackApplication() const
395+{
396+ return m_callbackApplication;
397+}
398+
399+void AddressBookApp::setCallbackApplication(const QString &application)
400+{
401+ if (m_callbackApplication != application) {
402+ m_callbackApplication = application;
403+ Q_EMIT callbackApplicationChanged();
404+ }
405+}
406
407=== modified file 'src/app/addressbookapp.h'
408--- src/app/addressbookapp.h 2014-06-11 21:25:08 +0000
409+++ src/app/addressbookapp.h 2014-07-16 12:56:44 +0000
410@@ -28,6 +28,7 @@
411 Q_PROPERTY(bool firstRun READ isFirstRun CONSTANT)
412 Q_PROPERTY(bool syncing READ isSyncing NOTIFY syncingChanged)
413 Q_PROPERTY(bool syncEnabled READ syncEnabled NOTIFY syncEnabledChanged)
414+ Q_PROPERTY(QString callbackApplication READ callbackApplication WRITE setCallbackApplication NOTIFY callbackApplicationChanged)
415
416 public:
417 AddressBookApp(int &argc, char **argv);
418@@ -37,9 +38,13 @@
419 bool isSyncing() const;
420 bool syncEnabled() const;
421
422+ QString callbackApplication() const;
423+ void setCallbackApplication(const QString &application);
424+
425 Q_SIGNALS:
426 void syncingChanged();
427 void syncEnabledChanged();
428+ void callbackApplicationChanged();
429
430 public Q_SLOTS:
431 void activateWindow();
432@@ -50,6 +55,7 @@
433 bool isFirstRun() const;
434 void unsetFirstRun() const;
435 void sendTabEvent() const;
436+ void exit();
437
438 // sync monitor
439 void startSync() const;
440@@ -62,6 +68,7 @@
441 QQuickView *m_view;
442 QDBusInterface *m_syncMonitor;
443 QString m_initialArg;
444+ QString m_callbackApplication;
445 bool m_viewReady;
446 bool m_pickingMode;
447 bool m_testMode;
448
449=== modified file 'src/imports/ContactEdit/ContactEditor.qml'
450--- src/imports/ContactEdit/ContactEditor.qml 2014-06-17 17:30:40 +0000
451+++ src/imports/ContactEdit/ContactEditor.qml 2014-07-16 12:56:44 +0000
452@@ -82,8 +82,8 @@
453 // backend error will be handled by the root page (contact list)
454 var newContact = (contact.model == null)
455 contactEditor.model.saveContact(contact)
456- if (newContact) {
457- pageStack.contactCreated(contact)
458+ if (newContact && pageStack.contactListPage) {
459+ pageStack.contactListPage.moveListToContact(contact)
460 }
461 }
462 pageStack.pop()
463
464=== modified file 'src/imports/ContactEdit/TextInputDetail.qml'
465--- src/imports/ContactEdit/TextInputDetail.qml 2014-06-12 22:55:20 +0000
466+++ src/imports/ContactEdit/TextInputDetail.qml 2014-07-16 12:56:44 +0000
467@@ -67,10 +67,7 @@
468 id: field
469
470 anchors.fill: parent
471-
472- // TRANSLATORS: This value is used as default value for phone number format, when no coutry code is provided
473- // the supported values can be found in: https://www.iso.org/obp/ui/#search
474- defaultRegion: i18n.tr("US")
475+ defaultRegion: PhoneUtils.defaultRegion
476 autoFormat: false
477
478 // Ubuntu.Keyboard
479
480=== modified file 'src/imports/ContactList/ContactListPage.qml'
481--- src/imports/ContactList/ContactListPage.qml 2014-07-02 23:23:19 +0000
482+++ src/imports/ContactList/ContactListPage.qml 2014-07-16 12:56:44 +0000
483@@ -35,12 +35,28 @@
484 property var onlineAccountsMessageDialog: null
485 property QtObject contactIndex: null
486 property bool contactsLoaded: false
487+ property string newPhoneToAdd: ""
488
489+ readonly property bool allowToQuit: (application.callbackApplication.length > 0)
490 readonly property bool syncEnabled: application.syncEnabled
491 readonly property var contactModel: contactList.listModel ? contactList.listModel : null
492- readonly property bool searching: (state === "searching")
493-
494- function createEmptyContact(phoneNumber) {
495+ readonly property bool searching: (state === "searching" || state === "newphoneSearching")
496+
497+ // this function is used to reset the contact list page to the default state if it was called
498+ // from the uri. For example when called to add a new contact
499+ function returnToNormalState()
500+ {
501+ // these two states are the only state that need to be reset
502+ if (state == "newphoneSearching" || state == "newphone") {
503+ pageStack.resetStack()
504+ state = ""
505+ newPhoneToAdd = ""
506+ application.callbackApplication = ""
507+ }
508+ }
509+
510+ function createEmptyContact(phoneNumber)
511+ {
512 var details = [ {detail: "PhoneNumber", field: "number", value: phoneNumber},
513 {detail: "EmailAddress", field: "emailAddress", value: ""},
514 {detail: "Name", field: "firstName", value: ""}
515@@ -63,16 +79,71 @@
516 var newContact = mainPage.createEmptyContact(phoneNumber)
517 //WORKAROUND: SKD changes the page header as soon as the page get created
518 // setting active false will avoid that
519- mainPage.showBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
520- {model: contactList.listModel,
521- contact: newContact,
522- active: false,
523- enabled: false,
524- initialFocusSection: "name"})
525-
526- }
527-
528- title: contactList.isInSelectionMode ? i18n.tr("Select Contacts") : i18n.tr("Contacts")
529+ if (bottomEdgeEnabled) {
530+ mainPage.showBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
531+ {model: contactList.listModel,
532+ contact: newContact,
533+ active: false,
534+ enabled: false,
535+ initialFocusSection: "name"})
536+ } else {
537+ pageStack.push(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
538+ {model: contactList.listModel,
539+ contact: newContact,
540+ initialFocusSection: "name"})
541+ }
542+ }
543+
544+ function showContact(contactId)
545+ {
546+ pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
547+ {model: contactList.listModel, contactId: contactId})
548+ }
549+
550+ function addPhoneToContact(contactId, phoneNumber)
551+ {
552+ pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
553+ {model: contactList.listModel,
554+ contactId: contactId,
555+ addPhoneToContact: phoneNumber})
556+ }
557+
558+ function importContact(urls)
559+ {
560+ if (urls.length > 0) {
561+ var importDialog = Qt.createQmlObject("VCardImportDialog{}",
562+ mainPage,
563+ "VCardImportDialog")
564+ if (importDialog) {
565+ importDialog.importVCards(contactList.listModel, urls)
566+ }
567+ }
568+ }
569+
570+ function startPickMode(isSingleSelection)
571+ {
572+ pickMode = true
573+ pickMultipleContacts = !isSingleSelection
574+ contactList.startSelection()
575+ }
576+
577+ function moveListToContact(contact)
578+ {
579+ contactIndex = contact
580+ mainPage.state = ""
581+ // this means a new contact was created
582+ if (mainPage.allowToQuit) {
583+ application.exit()
584+ }
585+ }
586+
587+ function addNewPhone(phoneNumber)
588+ {
589+ newPhoneToAdd = phoneNumber
590+ state = "newphone"
591+ }
592+
593+ title: i18n.tr("Contacts")
594
595 //bottom edge page
596 bottomEdgePageComponent: ContactEditor {
597@@ -124,13 +195,30 @@
598 }
599 }
600
601+ Button {
602+ id: addNewContactButton
603+ objectName: "addNewContact"
604+
605+ text: i18n.tr("+ New Contact")
606+ anchors {
607+ top: parent.top
608+ left: parent.left
609+ right: parent.right
610+ margins: visible ? units.gu(2) : 0
611+ }
612+ height: visible ? units.gu(4) : 0
613+ visible: false
614+ onClicked: mainPage.createContactWithPhoneNumber(mainPage.newPhoneToAdd)
615+ }
616+
617 flickable: null //contactList.fastScrolling ? null : contactList.view
618 ContactsUI.ContactListView {
619 id: contactList
620 objectName: "contactListView"
621
622 anchors {
623- top: parent.top
624+ top: addNewContactButton.bottom
625+ topMargin: addNewContactButton.visible ? units.gu(2) : 0
626 left: parent.left
627 bottom: keyboard.top
628 right: parent.right
629@@ -139,7 +227,8 @@
630 detailToPick: ContactDetail.PhoneNumber
631 multiSelectionEnabled: true
632 multipleSelection: !pickMode ||
633- mainPage.pickMultipleContacts || (contactExporter.active && contactExporter.isMultiple)
634+ mainPage.pickMultipleContacts ||
635+ (contactExporter.active && contactExporter.isMultiple)
636
637 leftSideAction: Action {
638 iconName: "delete"
639@@ -174,6 +263,9 @@
640 Qt.openUrlExternally("tel:///" + encodeURIComponent(detail.number))
641 else if (action == "message")
642 Qt.openUrlExternally("message:///" + encodeURIComponent(detail.number))
643+ else if ((mainPage.state === "newphone") || (mainPage.state === "newphoneSearching")) {
644+ mainPage.addPhoneToContact(contact.contactId, mainPage.newPhoneToAdd)
645+ }
646 }
647
648 onSelectionDone: {
649@@ -247,7 +339,7 @@
650 text: i18n.tr("Select All")
651 iconName: "filter"
652 onTriggered: {
653- if (contactList.selectedItems.count == contactList.count) {
654+ if (contactList.selectedItems.count === contactList.count) {
655 contactList.clearSelection()
656 } else {
657 contactList.selectAll()
658@@ -268,10 +360,26 @@
659 }
660 }
661
662+ ToolbarButton {
663+ id: quitButton
664+
665+ visible: false
666+ action: Action {
667+ objectName: "quitApp"
668+
669+ visible: mainPage.allowToQuit
670+ iconName: "back"
671+ text: i18n.tr("Quit")
672+ onTriggered: application.exit()
673+ }
674+ }
675+
676 ToolbarItems {
677 id: toolbarItemsNormalMode
678
679 visible: false
680+ back: mainPage.allowToQuit ? quitButton : null
681+
682 ToolbarButton {
683 objectName: "Sync"
684 action: Action {
685@@ -289,7 +397,7 @@
686 visible: !mainPage.searching
687 iconName: "search"
688 onTriggered: {
689- mainPage.state = "searching"
690+ mainPage.state = (mainPage.state === "newphone" ? "newphoneSearching" : "searching")
691 searchField.forceActiveFocus()
692 }
693 }
694@@ -306,9 +414,9 @@
695 objectName: "cancelSearch"
696
697 visible: mainPage.searching
698- iconName: "back"
699+ iconName: "close"
700 text: i18n.tr("Cancel")
701- onTriggered: mainPage.state = ""
702+ onTriggered: mainPage.state = (mainPage.state === "newphoneSearching" ? "newphone" : "")
703 }
704 }
705 }
706@@ -329,13 +437,57 @@
707 onTextChanged: contactList.currentIndex = -1
708 inputMethodHints: Qt.ImhNoPredictiveText
709 }
710-
711 states: [
712 State {
713 name: ""
714 PropertyChanges {
715 target: searchField
716 text: ""
717+ newPhoneToAdd: ""
718+ }
719+ },
720+ State {
721+ name: "newphone"
722+ PropertyChanges {
723+ target: searchField
724+ text: ""
725+ }
726+ PropertyChanges {
727+ target: addNewContactButton
728+ visible: true
729+ }
730+ PropertyChanges {
731+ target: mainPage
732+ bottomEdgeEnabled: false
733+ title: i18n.tr("Add contact")
734+ }
735+ PropertyChanges {
736+ target: contactList
737+ detailToPick: -1
738+ }
739+ },
740+ State {
741+ name: "newphoneSearching"
742+ PropertyChanges {
743+ target: addNewContactButton
744+ visible: true
745+ }
746+ PropertyChanges {
747+ target: mainPage
748+ bottomEdgeEnabled: false
749+ }
750+ PropertyChanges {
751+ target: contactList
752+ detailToPick: -1
753+ }
754+ PropertyChanges {
755+ target: mainPage
756+ __customHeaderContents: searchField
757+ tools: toolbarItemsSearch
758+ }
759+ PropertyChanges {
760+ target: contactList
761+ showFavourites: false
762 }
763 },
764 State {
765@@ -356,10 +508,11 @@
766 PropertyChanges {
767 target: mainPage
768 tools: toolbarItemsSelectionMode
769+ bottomEdgeEnabled: false
770+ title: i18n.tr("Select Contacts")
771 }
772 }
773 ]
774-
775 tools: toolbarItemsNormalMode
776
777 // WORKAROUND: Avoid the gap btw the header and the contact list when the list moves
778@@ -392,35 +545,6 @@
779 initialFocusSection: "name"})
780 }
781
782- Connections {
783- target: pageStack
784- onCreateContactRequested: mainPage.createContactWithPhoneNumber(phoneNumber)
785- onContactRequested: {
786- pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
787- {model: contactList.listModel, contactId: contactId})
788- }
789- onEditContatRequested: {
790- pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
791- {model: contactList.listModel,
792- contactId: contactId,
793- addPhoneToContact: phoneNumber})
794- }
795- onContactCreated: {
796- mainPage.contactIndex = contact
797- }
798-
799- onImportContactRequested: {
800- if (urls.length > 0) {
801- var importDialog = Qt.createQmlObject("VCardImportDialog{}",
802- mainPage,
803- "VCardImportDialog")
804- if (importDialog) {
805- importDialog.importVCards(contactList.listModel, urls)
806- }
807- }
808- }
809- }
810-
811 KeyboardRectangle {
812 id: keyboard
813 }
814@@ -435,7 +559,6 @@
815 }
816 }
817
818-
819 QtObject {
820 id: contactExporter
821
822@@ -470,25 +593,22 @@
823 }
824
825 Component.onCompleted: {
826- if (pickMode) {
827- contactList.startSelection()
828- } else if ((contactList.count === 0) &&
829+ if ((contactList.count === 0) &&
830 application.firstRun &&
831 !mainPage.syncEnabled) {
832 mainPage.onlineAccountsMessageDialog = PopupUtils.open(onlineAccountsDialog, null)
833 }
834
835- if (TEST_DATA != "") {
836+ if (TEST_DATA !== "") {
837 contactList.listModel.importContacts("file://" + TEST_DATA)
838 }
839
840- if (!pickMode) {
841- mainPage.setBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
842- {model: contactList.listModel,
843- contact: mainPage.createEmptyContact(""),
844- active: false,
845- enabled: false,
846- initialFocusSection: "name"})
847- }
848+ mainPage.setBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
849+ {model: contactList.listModel,
850+ contact: mainPage.createEmptyContact(""),
851+ active: false,
852+ enabled: false,
853+ initialFocusSection: "name"})
854+ pageStack.contactListPage = mainPage
855 }
856 }
857
858=== modified file 'src/imports/ContactView/ContactDetailAvatarView.qml'
859--- src/imports/ContactView/ContactDetailAvatarView.qml 2014-07-08 14:20:01 +0000
860+++ src/imports/ContactView/ContactDetailAvatarView.qml 2014-07-16 12:56:44 +0000
861@@ -28,7 +28,8 @@
862 implicitWidth: units.gu(10)
863
864 Connections {
865- target: root.contact.avatar
866+ target: root.contact ? root.contact.detail(ContactDetail.Avatar) : null
867+ ignoreUnknownSignals: true
868 onDetailChanged: avatar.reload()
869 }
870
871
872=== modified file 'src/imports/MainWindow.qml'
873--- src/imports/MainWindow.qml 2014-06-26 15:46:45 +0000
874+++ src/imports/MainWindow.qml 2014-07-16 12:56:44 +0000
875@@ -24,6 +24,7 @@
876 id: mainWindow
877
878 property string modelErrorMessage: ""
879+ readonly property bool appActive: Qt.application.active
880
881 width: units.gu(40)
882 height: units.gu(71)
883@@ -32,54 +33,67 @@
884
885 signal applicationReady()
886
887- function contact(contactId) {
888- mainStack.contactRequested(contactId)
889- }
890-
891- function create(phoneNumber) {
892- mainStack.createContactRequested(phoneNumber)
893- }
894-
895- function addphone(contactId, phoneNumber) {
896- mainStack.newPhoneNumber = phoneNumber
897- mainStack.editContatRequested(contactId, phoneNumber)
898- }
899-
900- function pick(single) {
901- var isSingle = (single == "true")
902- mainStack.push(Qt.createComponent("ContactList/ContactListPage.qml"), { pickMode: true, pickMultipleContacts: !isSingle})
903- }
904-
905- function importvcard(_url) {
906- mainStack.importContactRequested([_url])
907+ function contact(contactId)
908+ {
909+ mainStack.resetStack()
910+ if (mainStack.contactListPage) {
911+ mainStack.contactListPage.showContact(contactId)
912+ }
913+ }
914+
915+ function create(phoneNumber)
916+ {
917+ mainStack.resetStack()
918+ if (mainStack.contactListPage) {
919+ mainStack.contactListPage.createContactWithPhoneNumber(phoneNumber)
920+ }
921+ }
922+
923+ function addphone(contactId, phoneNumber)
924+ {
925+ mainStack.resetStack()
926+ if (mainStack.contactListPage) {
927+ mainStack.contactListPage.addPhoneToContact(contactId, phoneNumber)
928+ }
929+ }
930+
931+ function pick(single)
932+ {
933+ mainStack.resetStack()
934+ if (mainStack.contactListPage) {
935+ mainStack.contactListPage.startPickMode(single == "true")
936+ }
937+ }
938+
939+ function importvcard(_url)
940+ {
941+ mainStack.resetStack()
942+ if (mainStack.contactListPage) {
943+ mainStack.contactListPage.importContactRequested([_url])
944+ }
945+ }
946+
947+ function addnewphone(phoneNumer)
948+ {
949+ mainStack.resetStack()
950+ if (mainStack.contactListPage) {
951+ mainStack.contactListPage.addNewPhone(phoneNumer)
952+ }
953 }
954
955 PageStack {
956 id: mainStack
957
958- property string newPhoneNumber: ""
959-
960- signal contactRequested(string contactId)
961- signal createContactRequested(string phoneNumber)
962- signal editContatRequested(string contactId, string phoneNumber)
963- signal contactCreated(QtObject contact)
964- signal contactModelError(string errorMessage)
965- signal importContactRequested(var urls)
966-
967- anchors {
968- fill: parent
969- Behavior on bottomMargin {
970- NumberAnimation {
971- duration: 175
972- easing.type: Easing.OutQuad
973- }
974+ property var contactListPage: null
975+
976+ function resetStack()
977+ {
978+ while(depth > 1) {
979+ pop()
980 }
981- }
982+ }
983
984- onContactModelError: {
985- modelErrorMessage = errorMessage
986- PopupUtils.open(errorDialog, null)
987- }
988+ anchors.fill: parent
989 }
990
991 Component.onCompleted: {
992@@ -133,4 +147,12 @@
993 }
994 }
995 }
996+
997+
998+ // If application was called from uri handler and lost the focus reset the app to normal state
999+ onAppActiveChanged: {
1000+ if (!appActive && mainStack.contactListPage) {
1001+ mainStack.contactListPage.returnToNormalState()
1002+ }
1003+ }
1004 }
1005
1006=== modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml'
1007--- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2014-07-09 15:30:13 +0000
1008+++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2014-07-16 12:56:44 +0000
1009@@ -138,13 +138,16 @@
1010 id: pickerLoader
1011
1012 source: {
1013+ if (!root.detailsShown) {
1014+ return "";
1015+ }
1016+
1017 switch(root.detailToPick) {
1018 case ContactDetail.PhoneNumber:
1019 default:
1020 return Qt.resolvedUrl("ContactDetailPickerPhoneNumberDelegate.qml")
1021 }
1022 }
1023- active: contact && root.detailsShown
1024 asynchronous: true
1025 anchors {
1026 top: delegate.bottom
1027@@ -158,11 +161,21 @@
1028 }
1029
1030 onStatusChanged: {
1031- if ((status == Loader.Ready) && contact) {
1032+ if (status == Loader.Ready) {
1033 pickerLoader.item.updateDetails(contact)
1034 pickerLoader.item.detailClicked.connect(root._onDetailClicked)
1035 }
1036 }
1037+
1038+ // update delegate if contact update
1039+ Connections {
1040+ target: contact
1041+ onContactChanged: {
1042+ if (pickerLoader.item) {
1043+ pickerLoader.item.updateDetails(contact)
1044+ }
1045+ }
1046+ }
1047 }
1048
1049 Behavior on height {
1050
1051=== modified file 'src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml'
1052--- src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml 2014-07-07 22:20:38 +0000
1053+++ src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml 2014-07-16 12:56:44 +0000
1054@@ -17,6 +17,7 @@
1055 import QtQuick 2.2
1056 import Ubuntu.Components.ListItems 0.1 as ListItem
1057 import Ubuntu.Components 0.1
1058+import QtContacts 5.0 as QtContacts
1059
1060 Item {
1061 id: root
1062@@ -31,7 +32,9 @@
1063
1064 function updateDetails(contact)
1065 {
1066- phoneNumberEntries.model = contact.phoneNumbers
1067+ if (contact) {
1068+ phoneNumberEntries.model = contact.details(QtContacts.ContactDetail.PhoneNumber)
1069+ }
1070 }
1071
1072 height: detailItems.height + units.gu(2)
1073@@ -56,7 +59,6 @@
1074 Repeater {
1075 id: phoneNumberEntries
1076
1077- model: contact.phoneNumbers
1078 ListItem.Subtitled {
1079 anchors {
1080 left: parent.left
1081@@ -66,7 +68,7 @@
1082 showDivider: false
1083 // TODO: change text font color to UbuntuColors.lightAubergine
1084 // see bug #1324128
1085- text: number
1086+ text: modelData.number
1087 subText: phoneTypeModel.get(phoneTypeModel.getTypeIndex(modelData)).label
1088 onClicked: root.detailClicked(modelData, "")
1089
1090
1091=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
1092--- src/imports/Ubuntu/Contacts/ContactListView.qml 2014-07-09 22:24:55 +0000
1093+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2014-07-16 12:56:44 +0000
1094@@ -401,6 +401,7 @@
1095 var areaY = view.contentY
1096 if (itemY < areaY) {
1097 view.contentY = itemY
1098+ view.returnToBounds()
1099 }
1100 }
1101
1102@@ -411,16 +412,22 @@
1103 height: visible ? childrenRect.height : 0
1104 visible: view.favouritesIsSelected && (callerRepeat.count > 0)
1105 onHeightChanged: {
1106- // make selected item fully visible
1107 if (calledModel.currentIndex != -1) {
1108 mostCalledView.makeItemVisible(callerRepeat.itemAt(calledModel.currentIndex))
1109- } else {
1110- // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
1111- // this should fix the Y position (630 is the header height)
1112- view.contentY = -630
1113 }
1114 }
1115
1116+ // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
1117+ // calling the positionViewAtBeginning after the list created fix that
1118+ Timer {
1119+ id: moveToBegining
1120+
1121+ interval: 100
1122+ running: false
1123+ repeat: false
1124+ onTriggered: view.positionViewAtBeginning()
1125+ }
1126+
1127 Rectangle {
1128 color: Theme.palette.normal.background
1129 anchors {
1130@@ -453,6 +460,7 @@
1131
1132 onVisibleChanged: {
1133 // update the model every time that it became visible
1134+ // in fact calling update only reloads the model data if it has changed
1135 if (visible) {
1136 model.update()
1137 }
1138@@ -465,6 +473,10 @@
1139 view.currentIndex = -1
1140 }
1141 }
1142+
1143+ // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
1144+ // calling the positionViewAtBeginning after the list created fix that
1145+ onLoaded: moveToBegining.restart()
1146 }
1147 }
1148
1149@@ -624,8 +636,8 @@
1150 id: fastScroll
1151
1152 listView: view
1153- // only enable FastScroll if the we have more than 2 pages of content
1154- enabled: view.contentHeight > (view.height * 2)
1155+ // only enable FastScroll if the we have more than 2 pages of content and sections is enabled
1156+ enabled: showSections && (view.contentHeight > (view.height * 2))
1157
1158 anchors {
1159 top: view.top
1160
1161=== modified file 'src/imports/Ubuntu/Contacts/ContactSimpleListView.qml'
1162--- src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-07-09 15:30:13 +0000
1163+++ src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-07-16 12:56:44 +0000
1164@@ -134,7 +134,7 @@
1165
1166 This property holds the detail type to be picked
1167 */
1168- property int detailToPick: 0
1169+ property int detailToPick: -1
1170 /*!
1171 \qmlproperty bool showSections
1172
1173@@ -358,10 +358,10 @@
1174 contactListView.currentIndex = -1
1175 return
1176 // check if we should expand and display the details picker
1177- } else if (detailToPick !== 0) {
1178+ } else if (detailToPick !== -1) {
1179 contactListView.currentIndex = index
1180 return
1181- } else if (detailToPick == 0) {
1182+ } else if (detailToPick == -1) {
1183 contactListView.detailClicked(contact, null, "")
1184 }
1185 }
1186
1187=== modified file 'src/imports/Ubuntu/Contacts/ListItemWithActions.qml'
1188--- src/imports/Ubuntu/Contacts/ListItemWithActions.qml 2014-07-05 01:00:05 +0000
1189+++ src/imports/Ubuntu/Contacts/ListItemWithActions.qml 2014-07-16 12:56:44 +0000
1190@@ -31,6 +31,8 @@
1191 default property alias contents: main.children
1192
1193 readonly property double actionWidth: units.gu(5)
1194+ readonly property double leftActionWidth: units.gu(10)
1195+ readonly property double actionThreshold: actionWidth * 0.4
1196 readonly property double threshold: 0.4
1197 readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
1198 readonly property alias swipping: mainItemMoving.running
1199@@ -40,27 +42,20 @@
1200
1201 function returnToBoundsRTL()
1202 {
1203+ var actionFullWidth = actionWidth + units.gu(2)
1204 var xOffset = Math.abs(main.x)
1205- var actionFullWidth = actionWidth + units.gu(1)
1206+ var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
1207
1208- if (xOffset < actionFullWidth) {
1209+ if (index < 1) {
1210 main.x = 0
1211- } else if (xOffset > (actionFullWidth * rightActionsRepeater.count)) {
1212- main.x = - (actionFullWidth * rightActionsRepeater.count)
1213 } else {
1214- for (var i = rightActionsRepeater.count; i >= 2; i--) {
1215- if (xOffset >= (actionFullWidth * i)) {
1216- main.x = -(actionWidth * i)
1217- return
1218- }
1219- }
1220- main.x = -actionWidth
1221+ main.x = -(actionFullWidth * index)
1222 }
1223 }
1224
1225 function returnToBoundsLTR()
1226 {
1227- var finalX = leftActionView.width
1228+ var finalX = leftActionWidth
1229 if (main.x > (finalX * root.threshold))
1230 main.x = finalX
1231 else
1232@@ -99,16 +94,14 @@
1233
1234 function updateActiveAction()
1235 {
1236- var xOffset = Math.abs(main.x)
1237- if (main.x < 0) {
1238- for (var i = rightActionsRepeater.count - 1; i >= 0; i--) {
1239- var child = rightActionsRepeater.itemAt(i)
1240- var childOffset = rightActionsView.width - child.x
1241- if (xOffset <= childOffset) {
1242- root.activeItem = child
1243- root.activeAction = root.rightSideActions[i]
1244- return
1245- }
1246+ if (main.x <= -root.actionWidth) {
1247+ var actionFullWidth = actionWidth + units.gu(2)
1248+ var xOffset = Math.abs(main.x)
1249+ var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
1250+ index = index - 1
1251+ if (index > -1) {
1252+ root.activeItem = rightActionsRepeater.itemAt(index)
1253+ root.activeAction = root.rightSideActions[index]
1254 }
1255 } else {
1256 root.activeAction = null
1257@@ -129,14 +122,17 @@
1258 anchors {
1259 top: parent.top
1260 bottom: parent.bottom
1261- left: parent.left
1262+ right: main.left
1263 }
1264- width: height
1265+ width: root.leftActionWidth + actionThreshold
1266 visible: leftSideAction
1267 color: "red"
1268
1269 Icon {
1270- anchors.centerIn: parent
1271+ anchors {
1272+ centerIn: parent
1273+ horizontalCenterOffset: actionThreshold / 2
1274+ }
1275 name: leftSideAction ? leftSideAction.iconName : ""
1276 color: Theme.palette.selected.field
1277 height: units.gu(3)
1278@@ -149,13 +145,14 @@
1279
1280 anchors {
1281 top: main.top
1282- right: parent.right
1283+ left: main.right
1284+ leftMargin: units.gu(1)
1285 bottom: main.bottom
1286 }
1287- width: rightActionsRepeater.count * (root.actionWidth + units.gu(1))
1288+ width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + actionThreshold : 0
1289 Row {
1290 anchors.fill: parent
1291- spacing: units.gu(1)
1292+ spacing: units.gu(2)
1293 Repeater {
1294 id: rightActionsRepeater
1295
1296@@ -227,11 +224,6 @@
1297 easing {type: Easing.InOutBack; }
1298 }
1299 }
1300- ScriptAction {
1301- script: {
1302- root.activeAction.triggered(root)
1303- }
1304- }
1305 PropertyAction {
1306 target: triggerAction.currentItem
1307 properties: "width, height"
1308@@ -249,6 +241,11 @@
1309 easing.type: Easing.OutElastic
1310 duration: UbuntuAnimation.SlowDuration
1311 }
1312+ ScriptAction {
1313+ script: {
1314+ root.activeAction.triggered(root)
1315+ }
1316+ }
1317 }
1318
1319 MouseArea {
1320
1321=== modified file 'src/imports/Ubuntu/Contacts/MostCalledModel.qml'
1322--- src/imports/Ubuntu/Contacts/MostCalledModel.qml 2014-07-03 19:35:30 +0000
1323+++ src/imports/Ubuntu/Contacts/MostCalledModel.qml 2014-07-16 12:56:44 +0000
1324@@ -25,14 +25,18 @@
1325
1326 property var contactModel: null
1327 property int currentIndex: -1
1328+ property alias callAverage: mostCalledModel.callAverage
1329
1330 signal clicked(int index, QtObject contact)
1331 signal detailClicked(QtObject contact, QtObject detail, string action)
1332 signal infoRequested(int index, QtObject contact)
1333 signal addContactClicked(string label)
1334+ signal loaded()
1335
1336
1337 model: MostCalledContactsModel {
1338+ id: mostCalledModel
1339+
1340 startInterval: new Date((new Date().getTime() - 2592000000)) // one month ago
1341 sourceModel: HistoryEventModel {
1342 type: HistoryThreadModel.EventTypeVoice
1343@@ -46,6 +50,7 @@
1344 matchFlags: HistoryFilter.MatchCaseSensitive
1345 }
1346 }
1347+ onLoaded: root.loaded()
1348 }
1349
1350 delegate: ContactDelegate {
1351@@ -79,12 +84,10 @@
1352 onClicked: {
1353 if (root.currentIndex === index) {
1354 root.currentIndex = -1
1355- return
1356- } else if (detailToPick !== 0) {
1357+ } else if (detailToPick !== -1) {
1358 root.currentIndex = index
1359- return
1360- } else if (detailToPick == 0) {
1361- contactListView.detailClicked(contact, null, "")
1362+ } else if (detailToPick === -1) {
1363+ detailClicked(contact, null, "")
1364 }
1365 }
1366
1367
1368=== modified file 'src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp'
1369--- src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp 2014-07-02 01:43:06 +0000
1370+++ src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp 2014-07-16 12:56:44 +0000
1371@@ -272,8 +272,7 @@
1372 qSort(data.begin(), data.end(), mostCalledContactsModelDataLessThan);
1373
1374 // average
1375- m_average = totalCalls / contactsData.size();
1376-
1377+ m_average = qRound(((qreal) (totalCalls)) / contactsData.size());
1378 Q_FOREACH(const MostCalledContactsModelData &d, data) {
1379 if (d.callCount >= m_average) {
1380 m_data << d;
1381@@ -286,6 +285,8 @@
1382
1383 Q_EMIT endResetModel();
1384 m_reloadingModel = false;
1385+ Q_EMIT callAverageChanged(m_average);
1386+ Q_EMIT loaded();
1387 }
1388
1389 void MostCalledContactsModel::markAsOutdated()
1390
1391=== modified file 'src/imports/Ubuntu/Contacts/mostcalledproxymodel.h'
1392--- src/imports/Ubuntu/Contacts/mostcalledproxymodel.h 2014-07-02 01:43:06 +0000
1393+++ src/imports/Ubuntu/Contacts/mostcalledproxymodel.h 2014-07-16 12:56:44 +0000
1394@@ -73,6 +73,7 @@
1395 void startIntervalChanged(const QDateTime &value);
1396 void sourceModelChanged(QAbstractItemModel *value);
1397 void outdatedChange(bool value);
1398+ void loaded();
1399
1400 private Q_SLOTS:
1401 void markAsOutdated();

Subscribers

People subscribed via source and target branches

to all changes: