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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-07-07 19:46:23 +0000
+++ CMakeLists.txt 2014-07-16 12:56:44 +0000
@@ -18,9 +18,13 @@
18find_package(Qt5DBus)18find_package(Qt5DBus)
19find_package(PkgConfig REQUIRED)19find_package(PkgConfig REQUIRED)
2020
21find_program(INTLTOOL_MERGE intltool-merge)
22find_program(INTLTOOL_EXTRACT intltool-extract)
23
21set(ADDRESS_BOOK_APP_DIR ${CMAKE_INSTALL_DATADIR}/address-book-app)24set(ADDRESS_BOOK_APP_DIR ${CMAKE_INSTALL_DATADIR}/address-book-app)
22set(ADDRESS_BOOK_APP_FULL_DIR ${CMAKE_INSTALL_FULL_DATADIR}/address-book-app)25set(ADDRESS_BOOK_APP_FULL_DIR ${CMAKE_INSTALL_FULL_DATADIR}/address-book-app)
23set(ADDRESS_BOOK_APP_NAME "Address Book")26set(ADDRESS_BOOK_APP_NAME "Address Book")
27set(DESKTOP_FILE address-book-app.desktop)
24set(API_VERSION 0.1)28set(API_VERSION 0.1)
2529
26# for dh_translations to extract the domain30# for dh_translations to extract the domain
2731
=== modified file 'data/CMakeLists.txt'
--- data/CMakeLists.txt 2014-07-07 19:46:23 +0000
+++ data/CMakeLists.txt 2014-07-16 12:56:44 +0000
@@ -5,13 +5,11 @@
5 set(ADDRESS_BOOK_APP_ICON "address-book-app.svg")5 set(ADDRESS_BOOK_APP_ICON "address-book-app.svg")
6endif()6endif()
77
8file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${ADDRESS_BOOK_APP_DESKTOP_FILE})8configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in)
9file(STRINGS ${ADDRESS_BOOK_APP_DESKTOP_FILE}.in DESKTOP_FILE_CONTENTS)9add_custom_target(${DESKTOP_FILE} ALL
10foreach(LINE ${DESKTOP_FILE_CONTENTS})10 COMMENT "Merging translations into ${DESKTOP_FILE}"
11 string(REGEX REPLACE "tr\\\(\"(.*)\"\\\)" "\\1" LINE "${LINE}")11 COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${DESKTOP_FILE}.in ${DESKTOP_FILE} >/dev/null
12 string(CONFIGURE "${LINE}" LINE)12)
13 file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${ADDRESS_BOOK_APP_DESKTOP_FILE} "${LINE}\n")
14endforeach(LINE)
1513
16if(CLICK_MODE)14if(CLICK_MODE)
17 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ADDRESS_BOOK_APP_DESKTOP_FILE}15 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ADDRESS_BOOK_APP_DESKTOP_FILE}
1816
=== renamed file 'data/address-book-app.desktop.in' => 'data/address-book-app.desktop.in.in'
--- data/address-book-app.desktop.in 2014-07-07 19:46:23 +0000
+++ data/address-book-app.desktop.in.in 2014-07-16 12:56:44 +0000
@@ -3,13 +3,13 @@
3Version=1.03Version=1.0
4Terminal=false4Terminal=false
5Type=Application5Type=Application
6Name=tr("Contacts")6_Name=Contacts
7GenericName=tr("Contacts")7_GenericName=Contacts
8Comment=tr("Contacts Address Book")8_Comment=Contacts Address Book
9_Keywords=Contacts;People;Numbers
9Exec=@DESKTOP_EXEC@ %u10Exec=@DESKTOP_EXEC@ %u
10Icon=@ADDRESS_BOOK_APP_ICON@11Icon=@ADDRESS_BOOK_APP_ICON@
11X-Ubuntu-Touch=true12X-Ubuntu-Touch=true
12X-Ubuntu-StageHint=SideStage13X-Ubuntu-StageHint=SideStage
13X-Ubuntu-Gettext-Domain=address-book-app
14X-Ubuntu-Single-Instance=true14X-Ubuntu-Single-Instance=true
15@XSCREENSHOT@15@XSCREENSHOT@
1616
=== modified file 'po/CMakeLists.txt'
--- po/CMakeLists.txt 2014-05-28 19:56:00 +0000
+++ po/CMakeLists.txt 2014-07-16 12:56:44 +0000
@@ -4,8 +4,8 @@
4set(POT_FILE ${DOMAIN}.pot)4set(POT_FILE ${DOMAIN}.pot)
5file(GLOB PO_FILES *.po)5file(GLOB PO_FILES *.po)
6file(GLOB_RECURSE I18N_SRCS RELATIVE ${CMAKE_SOURCE_DIR}6file(GLOB_RECURSE I18N_SRCS RELATIVE ${CMAKE_SOURCE_DIR}
7 ${CMAKE_SOURCE_DIR}/src/*.qml7 ${CMAKE_SOURCE_DIR}/src/*.qml)
8 ${CMAKE_SOURCE_DIR}/data/*.desktop.in)8list(APPEND I18N_SRCS data/${DESKTOP_FILE}.in.in)
9list(SORT I18N_SRCS)9list(SORT I18N_SRCS)
1010
11foreach(PO_FILE ${PO_FILES})11foreach(PO_FILE ${PO_FILES})
@@ -19,8 +19,11 @@
1919
20find_program(XGETTEXT_EXECUTABLE xgettext)20find_program(XGETTEXT_EXECUTABLE xgettext)
21if(XGETTEXT_EXECUTABLE)21if(XGETTEXT_EXECUTABLE)
22 add_custom_target(${POT_FILE})22 add_custom_target(${POT_FILE} ALL
23 add_custom_command(TARGET ${POT_FILE}23 COMMENT "Generating translation template"
24 COMMAND ${INTLTOOL_EXTRACT} --update --type=gettext/ini
25 --srcdir=${CMAKE_SOURCE_DIR} data/${DESKTOP_FILE}.in.in
26
24 COMMAND ${XGETTEXT_EXECUTABLE} -o ${POT_FILE}27 COMMAND ${XGETTEXT_EXECUTABLE} -o ${POT_FILE}
25 --c++ --qt --add-comments=TRANSLATORS28 --c++ --qt --add-comments=TRANSLATORS
26 --keyword=tr --keyword=tr:1,229 --keyword=tr --keyword=tr:1,2
2730
=== modified file 'po/address-book-app.pot'
--- po/address-book-app.pot 2014-06-30 18:01:45 +0000
+++ po/address-book-app.pot 2014-07-16 12:56: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-06-30 15:01-0300\n"11"POT-Creation-Date: 2014-07-16 09:55-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"
@@ -22,10 +22,18 @@
22msgid "%1 vCards imported"22msgid "%1 vCards imported"
23msgstr ""23msgstr ""
2424
25#: src/imports/ContactList/ContactListPage.qml:202
26msgid "+ New Contact"
27msgstr ""
28
25#: src/imports/ContactEdit/ContactEditor.qml:32229#: src/imports/ContactEdit/ContactEditor.qml:322
26msgid "Add Field"30msgid "Add Field"
27msgstr ""31msgstr ""
2832
33#: src/imports/ContactList/ContactListPage.qml:462
34msgid "Add contact"
35msgstr ""
36
29#: src/imports/ContactEdit/AddFieldDialog.qml:5937#: src/imports/ContactEdit/AddFieldDialog.qml:59
30#: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:2338#: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:23
31#: src/imports/ContactView/ContactDetailAddressesView.qml:2439#: src/imports/ContactView/ContactDetailAddressesView.qml:24
@@ -55,12 +63,12 @@
5563
56#: src/imports/ContactEdit/AddFieldDialog.qml:13364#: src/imports/ContactEdit/AddFieldDialog.qml:133
57#: src/imports/ContactEdit/ContactEditor.qml:37265#: src/imports/ContactEdit/ContactEditor.qml:372
58#: src/imports/ContactList/ContactListPage.qml:31466#: src/imports/ContactList/ContactListPage.qml:418
59#: src/imports/Ubuntu/Contacts/DialogButtons.qml:3767#: src/imports/Ubuntu/Contacts/DialogButtons.qml:37
60msgid "Cancel"68msgid "Cancel"
61msgstr ""69msgstr ""
6270
63#: src/imports/ContactList/ContactListPage.qml:24271#: src/imports/ContactList/ContactListPage.qml:330
64msgid "Cancel selection"72msgid "Cancel selection"
65msgstr ""73msgstr ""
6674
@@ -72,22 +80,17 @@
72msgid "Contact not found"80msgid "Contact not found"
73msgstr ""81msgstr ""
7482
75#: data/address-book-app.desktop.in:6 data/address-book-app.desktop.in:783#: src/imports/ContactList/ContactListPage.qml:146
76#: src/imports/ContactList/ContactListPage.qml:75
77msgid "Contacts"84msgid "Contacts"
78msgstr ""85msgstr ""
7986
80#: data/address-book-app.desktop.in:8
81msgid "Contacts Address Book"
82msgstr ""
83
84#: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:3587#: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:35
85msgid "Country"88msgid "Country"
86msgstr ""89msgstr ""
8790
88#: src/imports/ContactEdit/ContactEditor.qml:33791#: src/imports/ContactEdit/ContactEditor.qml:337
89#: src/imports/ContactList/ContactListPage.qml:14692#: src/imports/ContactList/ContactListPage.qml:235
90#: src/imports/ContactList/ContactListPage.qml:26793#: src/imports/ContactList/ContactListPage.qml:355
91msgid "Delete"94msgid "Delete"
92msgstr ""95msgstr ""
9396
@@ -120,7 +123,7 @@
120msgstr ""123msgstr ""
121124
122#: src/imports/ContactView/ContactFetchError.qml:25125#: src/imports/ContactView/ContactFetchError.qml:25
123#: src/imports/MainWindow.qml:98126#: src/imports/MainWindow.qml:112
124msgid "Error"127msgid "Error"
125msgstr ""128msgstr ""
126129
@@ -136,12 +139,12 @@
136msgid "First name"139msgid "First name"
137msgstr ""140msgstr ""
138141
139#: src/imports/Ubuntu/Contacts/ContactListView.qml:427142#: src/imports/Ubuntu/Contacts/ContactListView.qml:442
140msgid "Frequently called"143msgid "Frequently called"
141msgstr ""144msgstr ""
142145
143#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:116146#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:116
144#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:94147#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:99
145msgid "Home"148msgid "Home"
146msgstr ""149msgstr ""
147150
@@ -173,7 +176,7 @@
173msgid "Loading"176msgid "Loading"
174msgstr ""177msgstr ""
175178
176#: src/imports/ContactList/ContactListPage.qml:232179#: src/imports/ContactList/ContactListPage.qml:320
177msgid "Loading..."180msgid "Loading..."
178msgstr ""181msgstr ""
179182
@@ -185,7 +188,7 @@
185msgid "MSN"188msgid "MSN"
186msgstr ""189msgstr ""
187190
188#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:98191#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:103
189msgid "Mobile"192msgid "Mobile"
190msgstr ""193msgstr ""
191194
@@ -193,7 +196,7 @@
193msgid "Multiple contacts"196msgid "Multiple contacts"
194msgstr ""197msgstr ""
195198
196#: src/imports/ContactEdit/TextInputDetail.qml:77199#: src/imports/ContactEdit/TextInputDetail.qml:74
197msgid "Next"200msgid "Next"
198msgstr ""201msgstr ""
199202
@@ -211,7 +214,7 @@
211msgstr ""214msgstr ""
212215
213#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:118216#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:118
214#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:102217#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:107
215msgid "Other"218msgid "Other"
216msgstr ""219msgstr ""
217220
@@ -234,6 +237,10 @@
234msgid "Professional details"237msgid "Professional details"
235msgstr ""238msgstr ""
236239
240#: src/imports/ContactList/ContactListPage.qml:372
241msgid "Quit"
242msgstr ""
243
237#: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:33244#: src/imports/ContactEdit/ContactDetailAddressesEditor.qml:33
238msgid "Region"245msgid "Region"
239msgstr ""246msgstr ""
@@ -246,19 +253,19 @@
246msgid "Save"253msgid "Save"
247msgstr ""254msgstr ""
248255
249#: src/imports/ContactList/ContactListPage.qml:292256#: src/imports/ContactList/ContactListPage.qml:396
250msgid "Search"257msgid "Search"
251msgstr ""258msgstr ""
252259
253#: src/imports/ContactList/ContactListPage.qml:267260#: src/imports/ContactList/ContactListPage.qml:355
254msgid "Select"261msgid "Select"
255msgstr ""262msgstr ""
256263
257#: src/imports/ContactList/ContactListPage.qml:251264#: src/imports/ContactList/ContactListPage.qml:339
258msgid "Select All"265msgid "Select All"
259msgstr ""266msgstr ""
260267
261#: src/imports/ContactList/ContactListPage.qml:75268#: src/imports/ContactList/ContactListPage.qml:512
262msgid "Select Contacts"269msgid "Select Contacts"
263msgstr ""270msgstr ""
264271
@@ -283,15 +290,15 @@
283msgid "Street"290msgid "Street"
284msgstr ""291msgstr ""
285292
286#: src/imports/ContactList/ContactListPage.qml:283293#: src/imports/ContactList/ContactListPage.qml:387
287msgid "Sync"294msgid "Sync"
288msgstr ""295msgstr ""
289296
290#: src/imports/ContactList/ContactListPage.qml:283297#: src/imports/ContactList/ContactListPage.qml:387
291msgid "Syncing"298msgid "Syncing"
292msgstr ""299msgstr ""
293300
294#: src/imports/ContactList/ContactListPage.qml:232301#: src/imports/ContactList/ContactListPage.qml:320
295msgid "Syncing..."302msgid "Syncing..."
296msgstr ""303msgstr ""
297304
@@ -303,18 +310,12 @@
303msgid "Touch"310msgid "Touch"
304msgstr ""311msgstr ""
305312
306#. TRANSLATORS: This value is used as default value for phone number format, when no coutry code is provided
307#. the supported values can be found in: https://www.iso.org/obp/ui/#search
308#: src/imports/ContactEdit/TextInputDetail.qml:73
309msgid "US"
310msgstr ""
311
312#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:117313#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:117
313#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:96314#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:101
314msgid "Work"315msgid "Work"
315msgstr ""316msgstr ""
316317
317#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:100318#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:105
318msgid "Work Mobile"319msgid "Work Mobile"
319msgstr ""320msgstr ""
320321
321322
=== modified file 'po/pt_BR.po'
--- po/pt_BR.po 2014-07-05 05:59:02 +0000
+++ po/pt_BR.po 2014-07-16 12:56:44 +0000
@@ -307,7 +307,7 @@
307#. the supported values can be found in: https://www.iso.org/obp/ui/#search307#. the supported values can be found in: https://www.iso.org/obp/ui/#search
308#: src/imports/ContactEdit/TextInputDetail.qml:73308#: src/imports/ContactEdit/TextInputDetail.qml:73
309msgid "US"309msgid "US"
310msgstr ""310msgstr "BR"
311311
312#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:117312#: src/imports/Common/ContactDetailGroupWithTypeBase.qml:117
313#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:96313#: src/imports/Ubuntu/Contacts/ContactDetailPhoneNumberTypeModel.qml:96
314314
=== modified file 'src/app/addressbookapp.cpp'
--- src/app/addressbookapp.cpp 2014-07-04 23:10:37 +0000
+++ src/app/addressbookapp.cpp 2014-07-16 12:56:44 +0000
@@ -22,6 +22,7 @@
22#include <QUrl>22#include <QUrl>
23#include <QUrlQuery>23#include <QUrlQuery>
24#include <QDebug>24#include <QDebug>
25#include <QDesktopServices>
25#include <QStringList>26#include <QStringList>
26#include <QQuickItem>27#include <QQuickItem>
27#include <QQmlComponent>28#include <QQmlComponent>
@@ -30,6 +31,8 @@
30#include <QLibrary>31#include <QLibrary>
31#include <QIcon>32#include <QIcon>
32#include <QSettings>33#include <QSettings>
34#include <QTimer>
35
3336
34#include <QQmlEngine>37#include <QQmlEngine>
3538
@@ -39,11 +42,12 @@
39{42{
40 qDebug() << "usage:"43 qDebug() << "usage:"
41 << arguments.at(0).toUtf8().constData()44 << arguments.at(0).toUtf8().constData()
42 << "[addressbook:///addphone?id=<contact-id>&phone=<phone-number>"45 << "[addressbook:///addphone?id=<contact-id>&phone=<phone-number>]"
43 << "[addressbook:///contact?id=<contact-id>"46 << "[addressbook:///addnewphone?phone=<phone-number>]"
44 << "[addressbook:///create?phone=<phone-number>"47 << "[addressbook:///contact?id=<contact-id>]"
45 << "[addressbook:///pick?single=<true/false>"48 << "[addressbook:///create?phone=<phone-number>]"
46 << "[addressbook:///importvcard?url=<vcard-file>"49 << "[addressbook:///pick?single=<true/false>]"
50 << "[addressbook:///importvcard?url=<vcard-file>]"
47 << "[--fullscreen]"51 << "[--fullscreen]"
48 << "[--help]"52 << "[--help]"
49 << "[-testability]";53 << "[-testability]";
@@ -266,6 +270,15 @@
266 sendEvent(m_view, &keyReleaseEvent);270 sendEvent(m_view, &keyReleaseEvent);
267}271}
268272
273void AddressBookApp::exit()
274{
275 if (!m_callbackApplication.isEmpty()) {
276 QDesktopServices::openUrl(QUrl(QString("application:///%1").arg(m_callbackApplication)));
277 }
278 // quit after a delay to avoid problems with unity task manager.
279 QTimer::singleShot(1000, this, SLOT(quit()));
280}
281
269void AddressBookApp::parseUrl(const QString &arg)282void AddressBookApp::parseUrl(const QString &arg)
270{283{
271 QUrl url = QUrl::fromPercentEncoding(arg.toUtf8());284 QUrl url = QUrl::fromPercentEncoding(arg.toUtf8());
@@ -305,6 +318,11 @@
305 args << "url";318 args << "url";
306 methodsMetaData.insert("importvcard", args);319 methodsMetaData.insert("importvcard", args);
307 args.clear();320 args.clear();
321
322 //addnewphone
323 args << "phone";
324 methodsMetaData.insert("addnewphone", args);
325 args.clear();
308 }326 }
309327
310 QUrlQuery query(url);328 QUrlQuery query(url);
@@ -316,6 +334,8 @@
316 QPair<QString, QString> item = queryItemsPair[i];334 QPair<QString, QString> item = queryItemsPair[i];
317 queryItems.insert(item.first, item.second);335 queryItems.insert(item.first, item.second);
318 }336 }
337 // keep callback arg
338 setCallbackApplication(queryItems.take("callback"));
319339
320 if (methodsMetaData.contains(methodName)) {340 if (methodsMetaData.contains(methodName)) {
321 QStringList argsNames = methodsMetaData[methodName];341 QStringList argsNames = methodsMetaData[methodName];
@@ -450,3 +470,16 @@
450 }470 }
451 return false;471 return false;
452}472}
473
474QString AddressBookApp::callbackApplication() const
475{
476 return m_callbackApplication;
477}
478
479void AddressBookApp::setCallbackApplication(const QString &application)
480{
481 if (m_callbackApplication != application) {
482 m_callbackApplication = application;
483 Q_EMIT callbackApplicationChanged();
484 }
485}
453486
=== modified file 'src/app/addressbookapp.h'
--- src/app/addressbookapp.h 2014-06-11 21:25:08 +0000
+++ src/app/addressbookapp.h 2014-07-16 12:56:44 +0000
@@ -28,6 +28,7 @@
28 Q_PROPERTY(bool firstRun READ isFirstRun CONSTANT)28 Q_PROPERTY(bool firstRun READ isFirstRun CONSTANT)
29 Q_PROPERTY(bool syncing READ isSyncing NOTIFY syncingChanged)29 Q_PROPERTY(bool syncing READ isSyncing NOTIFY syncingChanged)
30 Q_PROPERTY(bool syncEnabled READ syncEnabled NOTIFY syncEnabledChanged)30 Q_PROPERTY(bool syncEnabled READ syncEnabled NOTIFY syncEnabledChanged)
31 Q_PROPERTY(QString callbackApplication READ callbackApplication WRITE setCallbackApplication NOTIFY callbackApplicationChanged)
3132
32public:33public:
33 AddressBookApp(int &argc, char **argv);34 AddressBookApp(int &argc, char **argv);
@@ -37,9 +38,13 @@
37 bool isSyncing() const;38 bool isSyncing() const;
38 bool syncEnabled() const;39 bool syncEnabled() const;
3940
41 QString callbackApplication() const;
42 void setCallbackApplication(const QString &application);
43
40Q_SIGNALS:44Q_SIGNALS:
41 void syncingChanged();45 void syncingChanged();
42 void syncEnabledChanged();46 void syncEnabledChanged();
47 void callbackApplicationChanged();
4348
44public Q_SLOTS:49public Q_SLOTS:
45 void activateWindow();50 void activateWindow();
@@ -50,6 +55,7 @@
50 bool isFirstRun() const;55 bool isFirstRun() const;
51 void unsetFirstRun() const;56 void unsetFirstRun() const;
52 void sendTabEvent() const;57 void sendTabEvent() const;
58 void exit();
5359
54 // sync monitor60 // sync monitor
55 void startSync() const;61 void startSync() const;
@@ -62,6 +68,7 @@
62 QQuickView *m_view;68 QQuickView *m_view;
63 QDBusInterface *m_syncMonitor;69 QDBusInterface *m_syncMonitor;
64 QString m_initialArg;70 QString m_initialArg;
71 QString m_callbackApplication;
65 bool m_viewReady;72 bool m_viewReady;
66 bool m_pickingMode;73 bool m_pickingMode;
67 bool m_testMode;74 bool m_testMode;
6875
=== modified file 'src/imports/ContactEdit/ContactEditor.qml'
--- src/imports/ContactEdit/ContactEditor.qml 2014-06-17 17:30:40 +0000
+++ src/imports/ContactEdit/ContactEditor.qml 2014-07-16 12:56:44 +0000
@@ -82,8 +82,8 @@
82 // backend error will be handled by the root page (contact list)82 // backend error will be handled by the root page (contact list)
83 var newContact = (contact.model == null)83 var newContact = (contact.model == null)
84 contactEditor.model.saveContact(contact)84 contactEditor.model.saveContact(contact)
85 if (newContact) {85 if (newContact && pageStack.contactListPage) {
86 pageStack.contactCreated(contact)86 pageStack.contactListPage.moveListToContact(contact)
87 }87 }
88 }88 }
89 pageStack.pop()89 pageStack.pop()
9090
=== modified file 'src/imports/ContactEdit/TextInputDetail.qml'
--- src/imports/ContactEdit/TextInputDetail.qml 2014-06-12 22:55:20 +0000
+++ src/imports/ContactEdit/TextInputDetail.qml 2014-07-16 12:56:44 +0000
@@ -67,10 +67,7 @@
67 id: field67 id: field
6868
69 anchors.fill: parent69 anchors.fill: parent
7070 defaultRegion: PhoneUtils.defaultRegion
71 // TRANSLATORS: This value is used as default value for phone number format, when no coutry code is provided
72 // the supported values can be found in: https://www.iso.org/obp/ui/#search
73 defaultRegion: i18n.tr("US")
74 autoFormat: false71 autoFormat: false
7572
76 // Ubuntu.Keyboard73 // Ubuntu.Keyboard
7774
=== modified file 'src/imports/ContactList/ContactListPage.qml'
--- src/imports/ContactList/ContactListPage.qml 2014-07-02 23:23:19 +0000
+++ src/imports/ContactList/ContactListPage.qml 2014-07-16 12:56:44 +0000
@@ -35,12 +35,28 @@
35 property var onlineAccountsMessageDialog: null35 property var onlineAccountsMessageDialog: null
36 property QtObject contactIndex: null36 property QtObject contactIndex: null
37 property bool contactsLoaded: false37 property bool contactsLoaded: false
38 property string newPhoneToAdd: ""
3839
40 readonly property bool allowToQuit: (application.callbackApplication.length > 0)
39 readonly property bool syncEnabled: application.syncEnabled41 readonly property bool syncEnabled: application.syncEnabled
40 readonly property var contactModel: contactList.listModel ? contactList.listModel : null42 readonly property var contactModel: contactList.listModel ? contactList.listModel : null
41 readonly property bool searching: (state === "searching")43 readonly property bool searching: (state === "searching" || state === "newphoneSearching")
4244
43 function createEmptyContact(phoneNumber) {45 // this function is used to reset the contact list page to the default state if it was called
46 // from the uri. For example when called to add a new contact
47 function returnToNormalState()
48 {
49 // these two states are the only state that need to be reset
50 if (state == "newphoneSearching" || state == "newphone") {
51 pageStack.resetStack()
52 state = ""
53 newPhoneToAdd = ""
54 application.callbackApplication = ""
55 }
56 }
57
58 function createEmptyContact(phoneNumber)
59 {
44 var details = [ {detail: "PhoneNumber", field: "number", value: phoneNumber},60 var details = [ {detail: "PhoneNumber", field: "number", value: phoneNumber},
45 {detail: "EmailAddress", field: "emailAddress", value: ""},61 {detail: "EmailAddress", field: "emailAddress", value: ""},
46 {detail: "Name", field: "firstName", value: ""}62 {detail: "Name", field: "firstName", value: ""}
@@ -63,16 +79,71 @@
63 var newContact = mainPage.createEmptyContact(phoneNumber)79 var newContact = mainPage.createEmptyContact(phoneNumber)
64 //WORKAROUND: SKD changes the page header as soon as the page get created80 //WORKAROUND: SKD changes the page header as soon as the page get created
65 // setting active false will avoid that81 // setting active false will avoid that
66 mainPage.showBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),82 if (bottomEdgeEnabled) {
67 {model: contactList.listModel,83 mainPage.showBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
68 contact: newContact,84 {model: contactList.listModel,
69 active: false,85 contact: newContact,
70 enabled: false,86 active: false,
71 initialFocusSection: "name"})87 enabled: false,
7288 initialFocusSection: "name"})
73 }89 } else {
7490 pageStack.push(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
75 title: contactList.isInSelectionMode ? i18n.tr("Select Contacts") : i18n.tr("Contacts")91 {model: contactList.listModel,
92 contact: newContact,
93 initialFocusSection: "name"})
94 }
95 }
96
97 function showContact(contactId)
98 {
99 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
100 {model: contactList.listModel, contactId: contactId})
101 }
102
103 function addPhoneToContact(contactId, phoneNumber)
104 {
105 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
106 {model: contactList.listModel,
107 contactId: contactId,
108 addPhoneToContact: phoneNumber})
109 }
110
111 function importContact(urls)
112 {
113 if (urls.length > 0) {
114 var importDialog = Qt.createQmlObject("VCardImportDialog{}",
115 mainPage,
116 "VCardImportDialog")
117 if (importDialog) {
118 importDialog.importVCards(contactList.listModel, urls)
119 }
120 }
121 }
122
123 function startPickMode(isSingleSelection)
124 {
125 pickMode = true
126 pickMultipleContacts = !isSingleSelection
127 contactList.startSelection()
128 }
129
130 function moveListToContact(contact)
131 {
132 contactIndex = contact
133 mainPage.state = ""
134 // this means a new contact was created
135 if (mainPage.allowToQuit) {
136 application.exit()
137 }
138 }
139
140 function addNewPhone(phoneNumber)
141 {
142 newPhoneToAdd = phoneNumber
143 state = "newphone"
144 }
145
146 title: i18n.tr("Contacts")
76147
77 //bottom edge page148 //bottom edge page
78 bottomEdgePageComponent: ContactEditor {149 bottomEdgePageComponent: ContactEditor {
@@ -124,13 +195,30 @@
124 }195 }
125 }196 }
126197
198 Button {
199 id: addNewContactButton
200 objectName: "addNewContact"
201
202 text: i18n.tr("+ New Contact")
203 anchors {
204 top: parent.top
205 left: parent.left
206 right: parent.right
207 margins: visible ? units.gu(2) : 0
208 }
209 height: visible ? units.gu(4) : 0
210 visible: false
211 onClicked: mainPage.createContactWithPhoneNumber(mainPage.newPhoneToAdd)
212 }
213
127 flickable: null //contactList.fastScrolling ? null : contactList.view214 flickable: null //contactList.fastScrolling ? null : contactList.view
128 ContactsUI.ContactListView {215 ContactsUI.ContactListView {
129 id: contactList216 id: contactList
130 objectName: "contactListView"217 objectName: "contactListView"
131218
132 anchors {219 anchors {
133 top: parent.top220 top: addNewContactButton.bottom
221 topMargin: addNewContactButton.visible ? units.gu(2) : 0
134 left: parent.left222 left: parent.left
135 bottom: keyboard.top223 bottom: keyboard.top
136 right: parent.right224 right: parent.right
@@ -139,7 +227,8 @@
139 detailToPick: ContactDetail.PhoneNumber227 detailToPick: ContactDetail.PhoneNumber
140 multiSelectionEnabled: true228 multiSelectionEnabled: true
141 multipleSelection: !pickMode ||229 multipleSelection: !pickMode ||
142 mainPage.pickMultipleContacts || (contactExporter.active && contactExporter.isMultiple)230 mainPage.pickMultipleContacts ||
231 (contactExporter.active && contactExporter.isMultiple)
143232
144 leftSideAction: Action {233 leftSideAction: Action {
145 iconName: "delete"234 iconName: "delete"
@@ -174,6 +263,9 @@
174 Qt.openUrlExternally("tel:///" + encodeURIComponent(detail.number))263 Qt.openUrlExternally("tel:///" + encodeURIComponent(detail.number))
175 else if (action == "message")264 else if (action == "message")
176 Qt.openUrlExternally("message:///" + encodeURIComponent(detail.number))265 Qt.openUrlExternally("message:///" + encodeURIComponent(detail.number))
266 else if ((mainPage.state === "newphone") || (mainPage.state === "newphoneSearching")) {
267 mainPage.addPhoneToContact(contact.contactId, mainPage.newPhoneToAdd)
268 }
177 }269 }
178270
179 onSelectionDone: {271 onSelectionDone: {
@@ -247,7 +339,7 @@
247 text: i18n.tr("Select All")339 text: i18n.tr("Select All")
248 iconName: "filter"340 iconName: "filter"
249 onTriggered: {341 onTriggered: {
250 if (contactList.selectedItems.count == contactList.count) {342 if (contactList.selectedItems.count === contactList.count) {
251 contactList.clearSelection()343 contactList.clearSelection()
252 } else {344 } else {
253 contactList.selectAll()345 contactList.selectAll()
@@ -268,10 +360,26 @@
268 }360 }
269 }361 }
270362
363 ToolbarButton {
364 id: quitButton
365
366 visible: false
367 action: Action {
368 objectName: "quitApp"
369
370 visible: mainPage.allowToQuit
371 iconName: "back"
372 text: i18n.tr("Quit")
373 onTriggered: application.exit()
374 }
375 }
376
271 ToolbarItems {377 ToolbarItems {
272 id: toolbarItemsNormalMode378 id: toolbarItemsNormalMode
273379
274 visible: false380 visible: false
381 back: mainPage.allowToQuit ? quitButton : null
382
275 ToolbarButton {383 ToolbarButton {
276 objectName: "Sync"384 objectName: "Sync"
277 action: Action {385 action: Action {
@@ -289,7 +397,7 @@
289 visible: !mainPage.searching397 visible: !mainPage.searching
290 iconName: "search"398 iconName: "search"
291 onTriggered: {399 onTriggered: {
292 mainPage.state = "searching"400 mainPage.state = (mainPage.state === "newphone" ? "newphoneSearching" : "searching")
293 searchField.forceActiveFocus()401 searchField.forceActiveFocus()
294 }402 }
295 }403 }
@@ -306,9 +414,9 @@
306 objectName: "cancelSearch"414 objectName: "cancelSearch"
307415
308 visible: mainPage.searching416 visible: mainPage.searching
309 iconName: "back"417 iconName: "close"
310 text: i18n.tr("Cancel")418 text: i18n.tr("Cancel")
311 onTriggered: mainPage.state = ""419 onTriggered: mainPage.state = (mainPage.state === "newphoneSearching" ? "newphone" : "")
312 }420 }
313 }421 }
314 }422 }
@@ -329,13 +437,57 @@
329 onTextChanged: contactList.currentIndex = -1437 onTextChanged: contactList.currentIndex = -1
330 inputMethodHints: Qt.ImhNoPredictiveText438 inputMethodHints: Qt.ImhNoPredictiveText
331 }439 }
332
333 states: [440 states: [
334 State {441 State {
335 name: ""442 name: ""
336 PropertyChanges {443 PropertyChanges {
337 target: searchField444 target: searchField
338 text: ""445 text: ""
446 newPhoneToAdd: ""
447 }
448 },
449 State {
450 name: "newphone"
451 PropertyChanges {
452 target: searchField
453 text: ""
454 }
455 PropertyChanges {
456 target: addNewContactButton
457 visible: true
458 }
459 PropertyChanges {
460 target: mainPage
461 bottomEdgeEnabled: false
462 title: i18n.tr("Add contact")
463 }
464 PropertyChanges {
465 target: contactList
466 detailToPick: -1
467 }
468 },
469 State {
470 name: "newphoneSearching"
471 PropertyChanges {
472 target: addNewContactButton
473 visible: true
474 }
475 PropertyChanges {
476 target: mainPage
477 bottomEdgeEnabled: false
478 }
479 PropertyChanges {
480 target: contactList
481 detailToPick: -1
482 }
483 PropertyChanges {
484 target: mainPage
485 __customHeaderContents: searchField
486 tools: toolbarItemsSearch
487 }
488 PropertyChanges {
489 target: contactList
490 showFavourites: false
339 }491 }
340 },492 },
341 State {493 State {
@@ -356,10 +508,11 @@
356 PropertyChanges {508 PropertyChanges {
357 target: mainPage509 target: mainPage
358 tools: toolbarItemsSelectionMode510 tools: toolbarItemsSelectionMode
511 bottomEdgeEnabled: false
512 title: i18n.tr("Select Contacts")
359 }513 }
360 }514 }
361 ]515 ]
362
363 tools: toolbarItemsNormalMode516 tools: toolbarItemsNormalMode
364517
365 // WORKAROUND: Avoid the gap btw the header and the contact list when the list moves518 // WORKAROUND: Avoid the gap btw the header and the contact list when the list moves
@@ -392,35 +545,6 @@
392 initialFocusSection: "name"})545 initialFocusSection: "name"})
393 }546 }
394547
395 Connections {
396 target: pageStack
397 onCreateContactRequested: mainPage.createContactWithPhoneNumber(phoneNumber)
398 onContactRequested: {
399 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
400 {model: contactList.listModel, contactId: contactId})
401 }
402 onEditContatRequested: {
403 pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
404 {model: contactList.listModel,
405 contactId: contactId,
406 addPhoneToContact: phoneNumber})
407 }
408 onContactCreated: {
409 mainPage.contactIndex = contact
410 }
411
412 onImportContactRequested: {
413 if (urls.length > 0) {
414 var importDialog = Qt.createQmlObject("VCardImportDialog{}",
415 mainPage,
416 "VCardImportDialog")
417 if (importDialog) {
418 importDialog.importVCards(contactList.listModel, urls)
419 }
420 }
421 }
422 }
423
424 KeyboardRectangle {548 KeyboardRectangle {
425 id: keyboard549 id: keyboard
426 }550 }
@@ -435,7 +559,6 @@
435 }559 }
436 }560 }
437561
438
439 QtObject {562 QtObject {
440 id: contactExporter563 id: contactExporter
441564
@@ -470,25 +593,22 @@
470 }593 }
471594
472 Component.onCompleted: {595 Component.onCompleted: {
473 if (pickMode) {596 if ((contactList.count === 0) &&
474 contactList.startSelection()
475 } else if ((contactList.count === 0) &&
476 application.firstRun &&597 application.firstRun &&
477 !mainPage.syncEnabled) {598 !mainPage.syncEnabled) {
478 mainPage.onlineAccountsMessageDialog = PopupUtils.open(onlineAccountsDialog, null)599 mainPage.onlineAccountsMessageDialog = PopupUtils.open(onlineAccountsDialog, null)
479 }600 }
480601
481 if (TEST_DATA != "") {602 if (TEST_DATA !== "") {
482 contactList.listModel.importContacts("file://" + TEST_DATA)603 contactList.listModel.importContacts("file://" + TEST_DATA)
483 }604 }
484605
485 if (!pickMode) {606 mainPage.setBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),
486 mainPage.setBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"),607 {model: contactList.listModel,
487 {model: contactList.listModel,608 contact: mainPage.createEmptyContact(""),
488 contact: mainPage.createEmptyContact(""),609 active: false,
489 active: false,610 enabled: false,
490 enabled: false,611 initialFocusSection: "name"})
491 initialFocusSection: "name"})612 pageStack.contactListPage = mainPage
492 }
493 }613 }
494}614}
495615
=== modified file 'src/imports/ContactView/ContactDetailAvatarView.qml'
--- src/imports/ContactView/ContactDetailAvatarView.qml 2014-07-08 14:20:01 +0000
+++ src/imports/ContactView/ContactDetailAvatarView.qml 2014-07-16 12:56:44 +0000
@@ -28,7 +28,8 @@
28 implicitWidth: units.gu(10)28 implicitWidth: units.gu(10)
2929
30 Connections {30 Connections {
31 target: root.contact.avatar31 target: root.contact ? root.contact.detail(ContactDetail.Avatar) : null
32 ignoreUnknownSignals: true
32 onDetailChanged: avatar.reload()33 onDetailChanged: avatar.reload()
33 }34 }
3435
3536
=== modified file 'src/imports/MainWindow.qml'
--- src/imports/MainWindow.qml 2014-06-26 15:46:45 +0000
+++ src/imports/MainWindow.qml 2014-07-16 12:56:44 +0000
@@ -24,6 +24,7 @@
24 id: mainWindow24 id: mainWindow
2525
26 property string modelErrorMessage: ""26 property string modelErrorMessage: ""
27 readonly property bool appActive: Qt.application.active
2728
28 width: units.gu(40)29 width: units.gu(40)
29 height: units.gu(71)30 height: units.gu(71)
@@ -32,54 +33,67 @@
3233
33 signal applicationReady()34 signal applicationReady()
3435
35 function contact(contactId) {36 function contact(contactId)
36 mainStack.contactRequested(contactId)37 {
37 }38 mainStack.resetStack()
3839 if (mainStack.contactListPage) {
39 function create(phoneNumber) {40 mainStack.contactListPage.showContact(contactId)
40 mainStack.createContactRequested(phoneNumber)41 }
41 }42 }
4243
43 function addphone(contactId, phoneNumber) {44 function create(phoneNumber)
44 mainStack.newPhoneNumber = phoneNumber45 {
45 mainStack.editContatRequested(contactId, phoneNumber)46 mainStack.resetStack()
46 }47 if (mainStack.contactListPage) {
4748 mainStack.contactListPage.createContactWithPhoneNumber(phoneNumber)
48 function pick(single) {49 }
49 var isSingle = (single == "true")50 }
50 mainStack.push(Qt.createComponent("ContactList/ContactListPage.qml"), { pickMode: true, pickMultipleContacts: !isSingle})51
51 }52 function addphone(contactId, phoneNumber)
5253 {
53 function importvcard(_url) {54 mainStack.resetStack()
54 mainStack.importContactRequested([_url])55 if (mainStack.contactListPage) {
56 mainStack.contactListPage.addPhoneToContact(contactId, phoneNumber)
57 }
58 }
59
60 function pick(single)
61 {
62 mainStack.resetStack()
63 if (mainStack.contactListPage) {
64 mainStack.contactListPage.startPickMode(single == "true")
65 }
66 }
67
68 function importvcard(_url)
69 {
70 mainStack.resetStack()
71 if (mainStack.contactListPage) {
72 mainStack.contactListPage.importContactRequested([_url])
73 }
74 }
75
76 function addnewphone(phoneNumer)
77 {
78 mainStack.resetStack()
79 if (mainStack.contactListPage) {
80 mainStack.contactListPage.addNewPhone(phoneNumer)
81 }
55 }82 }
5683
57 PageStack {84 PageStack {
58 id: mainStack85 id: mainStack
5986
60 property string newPhoneNumber: ""87 property var contactListPage: null
6188
62 signal contactRequested(string contactId)89 function resetStack()
63 signal createContactRequested(string phoneNumber)90 {
64 signal editContatRequested(string contactId, string phoneNumber)91 while(depth > 1) {
65 signal contactCreated(QtObject contact)92 pop()
66 signal contactModelError(string errorMessage)
67 signal importContactRequested(var urls)
68
69 anchors {
70 fill: parent
71 Behavior on bottomMargin {
72 NumberAnimation {
73 duration: 175
74 easing.type: Easing.OutQuad
75 }
76 }93 }
77 }94 }
7895
79 onContactModelError: {96 anchors.fill: parent
80 modelErrorMessage = errorMessage
81 PopupUtils.open(errorDialog, null)
82 }
83 }97 }
8498
85 Component.onCompleted: {99 Component.onCompleted: {
@@ -133,4 +147,12 @@
133 }147 }
134 }148 }
135 }149 }
150
151
152 // If application was called from uri handler and lost the focus reset the app to normal state
153 onAppActiveChanged: {
154 if (!appActive && mainStack.contactListPage) {
155 mainStack.contactListPage.returnToNormalState()
156 }
157 }
136}158}
137159
=== modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml'
--- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2014-07-09 15:30:13 +0000
+++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2014-07-16 12:56:44 +0000
@@ -138,13 +138,16 @@
138 id: pickerLoader138 id: pickerLoader
139139
140 source: {140 source: {
141 if (!root.detailsShown) {
142 return "";
143 }
144
141 switch(root.detailToPick) {145 switch(root.detailToPick) {
142 case ContactDetail.PhoneNumber:146 case ContactDetail.PhoneNumber:
143 default:147 default:
144 return Qt.resolvedUrl("ContactDetailPickerPhoneNumberDelegate.qml")148 return Qt.resolvedUrl("ContactDetailPickerPhoneNumberDelegate.qml")
145 }149 }
146 }150 }
147 active: contact && root.detailsShown
148 asynchronous: true151 asynchronous: true
149 anchors {152 anchors {
150 top: delegate.bottom153 top: delegate.bottom
@@ -158,11 +161,21 @@
158 }161 }
159162
160 onStatusChanged: {163 onStatusChanged: {
161 if ((status == Loader.Ready) && contact) {164 if (status == Loader.Ready) {
162 pickerLoader.item.updateDetails(contact)165 pickerLoader.item.updateDetails(contact)
163 pickerLoader.item.detailClicked.connect(root._onDetailClicked)166 pickerLoader.item.detailClicked.connect(root._onDetailClicked)
164 }167 }
165 }168 }
169
170 // update delegate if contact update
171 Connections {
172 target: contact
173 onContactChanged: {
174 if (pickerLoader.item) {
175 pickerLoader.item.updateDetails(contact)
176 }
177 }
178 }
166 }179 }
167180
168 Behavior on height {181 Behavior on height {
169182
=== modified file 'src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml'
--- src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml 2014-07-07 22:20:38 +0000
+++ src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml 2014-07-16 12:56:44 +0000
@@ -17,6 +17,7 @@
17import QtQuick 2.217import QtQuick 2.2
18import Ubuntu.Components.ListItems 0.1 as ListItem18import Ubuntu.Components.ListItems 0.1 as ListItem
19import Ubuntu.Components 0.119import Ubuntu.Components 0.1
20import QtContacts 5.0 as QtContacts
2021
21Item {22Item {
22 id: root23 id: root
@@ -31,7 +32,9 @@
3132
32 function updateDetails(contact)33 function updateDetails(contact)
33 {34 {
34 phoneNumberEntries.model = contact.phoneNumbers35 if (contact) {
36 phoneNumberEntries.model = contact.details(QtContacts.ContactDetail.PhoneNumber)
37 }
35 }38 }
3639
37 height: detailItems.height + units.gu(2)40 height: detailItems.height + units.gu(2)
@@ -56,7 +59,6 @@
56 Repeater {59 Repeater {
57 id: phoneNumberEntries60 id: phoneNumberEntries
5861
59 model: contact.phoneNumbers
60 ListItem.Subtitled {62 ListItem.Subtitled {
61 anchors {63 anchors {
62 left: parent.left64 left: parent.left
@@ -66,7 +68,7 @@
66 showDivider: false68 showDivider: false
67 // TODO: change text font color to UbuntuColors.lightAubergine69 // TODO: change text font color to UbuntuColors.lightAubergine
68 // see bug #132412870 // see bug #1324128
69 text: number71 text: modelData.number
70 subText: phoneTypeModel.get(phoneTypeModel.getTypeIndex(modelData)).label72 subText: phoneTypeModel.get(phoneTypeModel.getTypeIndex(modelData)).label
71 onClicked: root.detailClicked(modelData, "")73 onClicked: root.detailClicked(modelData, "")
7274
7375
=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
--- src/imports/Ubuntu/Contacts/ContactListView.qml 2014-07-09 22:24:55 +0000
+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2014-07-16 12:56:44 +0000
@@ -401,6 +401,7 @@
401 var areaY = view.contentY401 var areaY = view.contentY
402 if (itemY < areaY) {402 if (itemY < areaY) {
403 view.contentY = itemY403 view.contentY = itemY
404 view.returnToBounds()
404 }405 }
405 }406 }
406407
@@ -411,16 +412,22 @@
411 height: visible ? childrenRect.height : 0412 height: visible ? childrenRect.height : 0
412 visible: view.favouritesIsSelected && (callerRepeat.count > 0)413 visible: view.favouritesIsSelected && (callerRepeat.count > 0)
413 onHeightChanged: {414 onHeightChanged: {
414 // make selected item fully visible
415 if (calledModel.currentIndex != -1) {415 if (calledModel.currentIndex != -1) {
416 mostCalledView.makeItemVisible(callerRepeat.itemAt(calledModel.currentIndex))416 mostCalledView.makeItemVisible(callerRepeat.itemAt(calledModel.currentIndex))
417 } else {
418 // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
419 // this should fix the Y position (630 is the header height)
420 view.contentY = -630
421 }417 }
422 }418 }
423419
420 // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
421 // calling the positionViewAtBeginning after the list created fix that
422 Timer {
423 id: moveToBegining
424
425 interval: 100
426 running: false
427 repeat: false
428 onTriggered: view.positionViewAtBeginning()
429 }
430
424 Rectangle {431 Rectangle {
425 color: Theme.palette.normal.background432 color: Theme.palette.normal.background
426 anchors {433 anchors {
@@ -453,6 +460,7 @@
453460
454 onVisibleChanged: {461 onVisibleChanged: {
455 // update the model every time that it became visible462 // update the model every time that it became visible
463 // in fact calling update only reloads the model data if it has changed
456 if (visible) {464 if (visible) {
457 model.update()465 model.update()
458 }466 }
@@ -465,6 +473,10 @@
465 view.currentIndex = -1473 view.currentIndex = -1
466 }474 }
467 }475 }
476
477 // WORKAROUND: The SDK header causes the contactY to move to a wrong postion
478 // calling the positionViewAtBeginning after the list created fix that
479 onLoaded: moveToBegining.restart()
468 }480 }
469 }481 }
470482
@@ -624,8 +636,8 @@
624 id: fastScroll636 id: fastScroll
625637
626 listView: view638 listView: view
627 // only enable FastScroll if the we have more than 2 pages of content639 // only enable FastScroll if the we have more than 2 pages of content and sections is enabled
628 enabled: view.contentHeight > (view.height * 2)640 enabled: showSections && (view.contentHeight > (view.height * 2))
629641
630 anchors {642 anchors {
631 top: view.top643 top: view.top
632644
=== modified file 'src/imports/Ubuntu/Contacts/ContactSimpleListView.qml'
--- src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-07-09 15:30:13 +0000
+++ src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-07-16 12:56:44 +0000
@@ -134,7 +134,7 @@
134134
135 This property holds the detail type to be picked135 This property holds the detail type to be picked
136 */136 */
137 property int detailToPick: 0137 property int detailToPick: -1
138 /*!138 /*!
139 \qmlproperty bool showSections139 \qmlproperty bool showSections
140140
@@ -358,10 +358,10 @@
358 contactListView.currentIndex = -1358 contactListView.currentIndex = -1
359 return359 return
360 // check if we should expand and display the details picker360 // check if we should expand and display the details picker
361 } else if (detailToPick !== 0) {361 } else if (detailToPick !== -1) {
362 contactListView.currentIndex = index362 contactListView.currentIndex = index
363 return363 return
364 } else if (detailToPick == 0) {364 } else if (detailToPick == -1) {
365 contactListView.detailClicked(contact, null, "")365 contactListView.detailClicked(contact, null, "")
366 }366 }
367 }367 }
368368
=== modified file 'src/imports/Ubuntu/Contacts/ListItemWithActions.qml'
--- src/imports/Ubuntu/Contacts/ListItemWithActions.qml 2014-07-05 01:00:05 +0000
+++ src/imports/Ubuntu/Contacts/ListItemWithActions.qml 2014-07-16 12:56:44 +0000
@@ -31,6 +31,8 @@
31 default property alias contents: main.children31 default property alias contents: main.children
3232
33 readonly property double actionWidth: units.gu(5)33 readonly property double actionWidth: units.gu(5)
34 readonly property double leftActionWidth: units.gu(10)
35 readonly property double actionThreshold: actionWidth * 0.4
34 readonly property double threshold: 0.436 readonly property double threshold: 0.4
35 readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"37 readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
36 readonly property alias swipping: mainItemMoving.running38 readonly property alias swipping: mainItemMoving.running
@@ -40,27 +42,20 @@
4042
41 function returnToBoundsRTL()43 function returnToBoundsRTL()
42 {44 {
45 var actionFullWidth = actionWidth + units.gu(2)
43 var xOffset = Math.abs(main.x)46 var xOffset = Math.abs(main.x)
44 var actionFullWidth = actionWidth + units.gu(1)47 var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
4548
46 if (xOffset < actionFullWidth) {49 if (index < 1) {
47 main.x = 050 main.x = 0
48 } else if (xOffset > (actionFullWidth * rightActionsRepeater.count)) {
49 main.x = - (actionFullWidth * rightActionsRepeater.count)
50 } else {51 } else {
51 for (var i = rightActionsRepeater.count; i >= 2; i--) {52 main.x = -(actionFullWidth * index)
52 if (xOffset >= (actionFullWidth * i)) {
53 main.x = -(actionWidth * i)
54 return
55 }
56 }
57 main.x = -actionWidth
58 }53 }
59 }54 }
6055
61 function returnToBoundsLTR()56 function returnToBoundsLTR()
62 {57 {
63 var finalX = leftActionView.width58 var finalX = leftActionWidth
64 if (main.x > (finalX * root.threshold))59 if (main.x > (finalX * root.threshold))
65 main.x = finalX60 main.x = finalX
66 else61 else
@@ -99,16 +94,14 @@
9994
100 function updateActiveAction()95 function updateActiveAction()
101 {96 {
102 var xOffset = Math.abs(main.x)97 if (main.x <= -root.actionWidth) {
103 if (main.x < 0) {98 var actionFullWidth = actionWidth + units.gu(2)
104 for (var i = rightActionsRepeater.count - 1; i >= 0; i--) {99 var xOffset = Math.abs(main.x)
105 var child = rightActionsRepeater.itemAt(i)100 var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
106 var childOffset = rightActionsView.width - child.x101 index = index - 1
107 if (xOffset <= childOffset) {102 if (index > -1) {
108 root.activeItem = child103 root.activeItem = rightActionsRepeater.itemAt(index)
109 root.activeAction = root.rightSideActions[i]104 root.activeAction = root.rightSideActions[index]
110 return
111 }
112 }105 }
113 } else {106 } else {
114 root.activeAction = null107 root.activeAction = null
@@ -129,14 +122,17 @@
129 anchors {122 anchors {
130 top: parent.top123 top: parent.top
131 bottom: parent.bottom124 bottom: parent.bottom
132 left: parent.left125 right: main.left
133 }126 }
134 width: height127 width: root.leftActionWidth + actionThreshold
135 visible: leftSideAction128 visible: leftSideAction
136 color: "red"129 color: "red"
137130
138 Icon {131 Icon {
139 anchors.centerIn: parent132 anchors {
133 centerIn: parent
134 horizontalCenterOffset: actionThreshold / 2
135 }
140 name: leftSideAction ? leftSideAction.iconName : ""136 name: leftSideAction ? leftSideAction.iconName : ""
141 color: Theme.palette.selected.field137 color: Theme.palette.selected.field
142 height: units.gu(3)138 height: units.gu(3)
@@ -149,13 +145,14 @@
149145
150 anchors {146 anchors {
151 top: main.top147 top: main.top
152 right: parent.right148 left: main.right
149 leftMargin: units.gu(1)
153 bottom: main.bottom150 bottom: main.bottom
154 }151 }
155 width: rightActionsRepeater.count * (root.actionWidth + units.gu(1))152 width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + actionThreshold : 0
156 Row {153 Row {
157 anchors.fill: parent154 anchors.fill: parent
158 spacing: units.gu(1)155 spacing: units.gu(2)
159 Repeater {156 Repeater {
160 id: rightActionsRepeater157 id: rightActionsRepeater
161158
@@ -227,11 +224,6 @@
227 easing {type: Easing.InOutBack; }224 easing {type: Easing.InOutBack; }
228 }225 }
229 }226 }
230 ScriptAction {
231 script: {
232 root.activeAction.triggered(root)
233 }
234 }
235 PropertyAction {227 PropertyAction {
236 target: triggerAction.currentItem228 target: triggerAction.currentItem
237 properties: "width, height"229 properties: "width, height"
@@ -249,6 +241,11 @@
249 easing.type: Easing.OutElastic241 easing.type: Easing.OutElastic
250 duration: UbuntuAnimation.SlowDuration242 duration: UbuntuAnimation.SlowDuration
251 }243 }
244 ScriptAction {
245 script: {
246 root.activeAction.triggered(root)
247 }
248 }
252 }249 }
253250
254 MouseArea {251 MouseArea {
255252
=== modified file 'src/imports/Ubuntu/Contacts/MostCalledModel.qml'
--- src/imports/Ubuntu/Contacts/MostCalledModel.qml 2014-07-03 19:35:30 +0000
+++ src/imports/Ubuntu/Contacts/MostCalledModel.qml 2014-07-16 12:56:44 +0000
@@ -25,14 +25,18 @@
2525
26 property var contactModel: null26 property var contactModel: null
27 property int currentIndex: -127 property int currentIndex: -1
28 property alias callAverage: mostCalledModel.callAverage
2829
29 signal clicked(int index, QtObject contact)30 signal clicked(int index, QtObject contact)
30 signal detailClicked(QtObject contact, QtObject detail, string action)31 signal detailClicked(QtObject contact, QtObject detail, string action)
31 signal infoRequested(int index, QtObject contact)32 signal infoRequested(int index, QtObject contact)
32 signal addContactClicked(string label)33 signal addContactClicked(string label)
34 signal loaded()
3335
3436
35 model: MostCalledContactsModel {37 model: MostCalledContactsModel {
38 id: mostCalledModel
39
36 startInterval: new Date((new Date().getTime() - 2592000000)) // one month ago40 startInterval: new Date((new Date().getTime() - 2592000000)) // one month ago
37 sourceModel: HistoryEventModel {41 sourceModel: HistoryEventModel {
38 type: HistoryThreadModel.EventTypeVoice42 type: HistoryThreadModel.EventTypeVoice
@@ -46,6 +50,7 @@
46 matchFlags: HistoryFilter.MatchCaseSensitive50 matchFlags: HistoryFilter.MatchCaseSensitive
47 }51 }
48 }52 }
53 onLoaded: root.loaded()
49 }54 }
5055
51 delegate: ContactDelegate {56 delegate: ContactDelegate {
@@ -79,12 +84,10 @@
79 onClicked: {84 onClicked: {
80 if (root.currentIndex === index) {85 if (root.currentIndex === index) {
81 root.currentIndex = -186 root.currentIndex = -1
82 return87 } else if (detailToPick !== -1) {
83 } else if (detailToPick !== 0) {
84 root.currentIndex = index88 root.currentIndex = index
85 return89 } else if (detailToPick === -1) {
86 } else if (detailToPick == 0) {90 detailClicked(contact, null, "")
87 contactListView.detailClicked(contact, null, "")
88 }91 }
89 }92 }
9093
9194
=== modified file 'src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp'
--- src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp 2014-07-02 01:43:06 +0000
+++ src/imports/Ubuntu/Contacts/mostcalledproxymodel.cpp 2014-07-16 12:56:44 +0000
@@ -272,8 +272,7 @@
272 qSort(data.begin(), data.end(), mostCalledContactsModelDataLessThan);272 qSort(data.begin(), data.end(), mostCalledContactsModelDataLessThan);
273273
274 // average274 // average
275 m_average = totalCalls / contactsData.size();275 m_average = qRound(((qreal) (totalCalls)) / contactsData.size());
276
277 Q_FOREACH(const MostCalledContactsModelData &d, data) {276 Q_FOREACH(const MostCalledContactsModelData &d, data) {
278 if (d.callCount >= m_average) {277 if (d.callCount >= m_average) {
279 m_data << d;278 m_data << d;
@@ -286,6 +285,8 @@
286285
287 Q_EMIT endResetModel();286 Q_EMIT endResetModel();
288 m_reloadingModel = false;287 m_reloadingModel = false;
288 Q_EMIT callAverageChanged(m_average);
289 Q_EMIT loaded();
289}290}
290291
291void MostCalledContactsModel::markAsOutdated()292void MostCalledContactsModel::markAsOutdated()
292293
=== modified file 'src/imports/Ubuntu/Contacts/mostcalledproxymodel.h'
--- src/imports/Ubuntu/Contacts/mostcalledproxymodel.h 2014-07-02 01:43:06 +0000
+++ src/imports/Ubuntu/Contacts/mostcalledproxymodel.h 2014-07-16 12:56:44 +0000
@@ -73,6 +73,7 @@
73 void startIntervalChanged(const QDateTime &value);73 void startIntervalChanged(const QDateTime &value);
74 void sourceModelChanged(QAbstractItemModel *value);74 void sourceModelChanged(QAbstractItemModel *value);
75 void outdatedChange(bool value);75 void outdatedChange(bool value);
76 void loaded();
7677
77private Q_SLOTS:78private Q_SLOTS:
78 void markAsOutdated();79 void markAsOutdated();

Subscribers

People subscribed via source and target branches

to all changes: