Merge lp:~renatofilho/address-book-app/fix-1450252 into lp:address-book-app
- fix-1450252
- Merge into trunk
Proposed by
Renato Araujo Oliveira Filho
Status: | Superseded |
---|---|
Proposed branch: | lp:~renatofilho/address-book-app/fix-1450252 |
Merge into: | lp:address-book-app |
Diff against target: |
444 lines (+161/-25) 17 files modified
src/imports/ABContactListPage.qml (+3/-0) src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml (+2/-1) src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml (+0/-1) src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml (+0/-1) src/imports/Ubuntu/Contacts/CMakeLists.txt (+1/-0) src/imports/Ubuntu/Contacts/ContactAvatar.qml (+19/-7) src/imports/Ubuntu/Contacts/ContactDelegate.qml (+1/-1) src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml (+0/-2) src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml (+0/-1) src/imports/Ubuntu/Contacts/Contacts.js (+7/-0) src/imports/Ubuntu/Contacts/FastScroll.qml (+20/-5) src/imports/Ubuntu/Contacts/ListItemWithActions.qml (+1/-1) src/imports/Ubuntu/Contacts/SIMCardImportPage.qml (+30/-4) src/imports/Ubuntu/Contacts/Triangle.qml (+52/-0) src/imports/Ubuntu/Contacts/contacts.cpp (+16/-0) src/imports/Ubuntu/Contacts/contacts.h (+2/-0) tests/qml/tst_ContactAvatar.qml (+7/-1) |
To merge this branch: | bzr merge lp:~renatofilho/address-book-app/fix-1450252 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phablet Team | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2016-02-03.
Commit message
Make sure the import page still visible while importing contacts from sim.
Description of the change
To post a comment you must log in.
- 536. By Renato Araujo Oliveira Filho
-
Add debug messages.
- 537. By Renato Araujo Oliveira Filho
-
Pop import contacts from sim page on import complet.
- 538. By Renato Araujo Oliveira Filho
-
Parent merged.
- 539. By Renato Araujo Oliveira Filho
-
Removed debug messages.
- 540. By Renato Araujo Oliveira Filho
-
Remove debug messages.
- 541. By Renato Araujo Oliveira Filho
-
Trunk merged.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/imports/ABContactListPage.qml' | |||
2 | --- src/imports/ABContactListPage.qml 2016-01-06 18:54:25 +0000 | |||
3 | +++ src/imports/ABContactListPage.qml 2016-02-03 14:15:56 +0000 | |||
4 | @@ -791,8 +791,11 @@ | |||
5 | 791 | mainPage.state = "vcardImported" | 791 | mainPage.state = "vcardImported" |
6 | 792 | 792 | ||
7 | 793 | if (mainPage._busyDialog) { | 793 | if (mainPage._busyDialog) { |
8 | 794 | console.debug("Closing import dialog") | ||
9 | 794 | PopupUtils.close(mainPage._busyDialog) | 795 | PopupUtils.close(mainPage._busyDialog) |
10 | 795 | mainPage._busyDialog = null | 796 | mainPage._busyDialog = null |
11 | 797 | } else { | ||
12 | 798 | console.debug("No import dialog") | ||
13 | 796 | } | 799 | } |
14 | 797 | } | 800 | } |
15 | 798 | } | 801 | } |
16 | 799 | 802 | ||
17 | === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml' | |||
18 | --- src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2016-01-07 12:21:49 +0000 | |||
19 | +++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2016-02-03 14:15:56 +0000 | |||
20 | @@ -118,7 +118,8 @@ | |||
21 | 118 | if (!item) | 118 | if (!item) |
22 | 119 | return | 119 | return |
23 | 120 | 120 | ||
25 | 121 | var position = activeItem.mapToItem(editEditor, item.x, item.y); | 121 | |
26 | 122 | var position = item.mapToItem(editEditor, item.x, item.y); | ||
27 | 122 | // check if the item is already visible | 123 | // check if the item is already visible |
28 | 123 | var bottomY = scrollArea.contentY + scrollArea.height | 124 | var bottomY = scrollArea.contentY + scrollArea.height |
29 | 124 | var itemBottom = position.y + (item.height * 3) // extra margin | 125 | var itemBottom = position.y + (item.height * 3) // extra margin |
30 | 125 | 126 | ||
31 | === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml' | |||
32 | --- src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml 2016-01-06 18:54:07 +0000 | |||
33 | +++ src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml 2016-02-03 14:15:56 +0000 | |||
34 | @@ -91,7 +91,6 @@ | |||
35 | 91 | overlaySpacing: 0 | 91 | overlaySpacing: 0 |
36 | 92 | frameSpacing: 0 | 92 | frameSpacing: 0 |
37 | 93 | background: Item {} | 93 | background: Item {} |
38 | 94 | color: UbuntuColors.lightAubergine | ||
39 | 95 | } | 94 | } |
40 | 96 | onActiveFocusChanged: { | 95 | onActiveFocusChanged: { |
41 | 97 | if (activeFocus) { | 96 | if (activeFocus) { |
42 | 98 | 97 | ||
43 | === modified file 'src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml' | |||
44 | --- src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml 2015-12-10 19:13:20 +0000 | |||
45 | +++ src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml 2016-02-03 14:15:56 +0000 | |||
46 | @@ -59,7 +59,6 @@ | |||
47 | 59 | 59 | ||
48 | 60 | // style | 60 | // style |
49 | 61 | fontSize: "medium" | 61 | fontSize: "medium" |
50 | 62 | color: UbuntuColors.lightAubergine | ||
51 | 63 | } | 62 | } |
52 | 64 | } | 63 | } |
53 | 65 | } | 64 | } |
54 | 66 | 65 | ||
55 | === modified file 'src/imports/Ubuntu/Contacts/CMakeLists.txt' | |||
56 | --- src/imports/Ubuntu/Contacts/CMakeLists.txt 2015-09-03 17:15:32 +0000 | |||
57 | +++ src/imports/Ubuntu/Contacts/CMakeLists.txt 2016-02-03 14:15:56 +0000 | |||
58 | @@ -31,6 +31,7 @@ | |||
59 | 31 | SIMList.qml | 31 | SIMList.qml |
60 | 32 | SIMCardImportPage.qml | 32 | SIMCardImportPage.qml |
61 | 33 | SubtitledWithColors.qml | 33 | SubtitledWithColors.qml |
62 | 34 | Triangle.qml | ||
63 | 34 | VCardParser.qml | 35 | VCardParser.qml |
64 | 35 | ) | 36 | ) |
65 | 36 | 37 | ||
66 | 37 | 38 | ||
67 | === modified file 'src/imports/Ubuntu/Contacts/ContactAvatar.qml' | |||
68 | --- src/imports/Ubuntu/Contacts/ContactAvatar.qml 2015-10-26 13:18:11 +0000 | |||
69 | +++ src/imports/Ubuntu/Contacts/ContactAvatar.qml 2016-02-03 14:15:56 +0000 | |||
70 | @@ -40,8 +40,9 @@ | |||
71 | 40 | initialsLabel.contactDisplayName = Qt.binding(function() { return ContactsJS.formatToDisplayWithDetails(contactElement, ContactDetail.Name, [Name.FirstName, Name.LastName], fallbackDisplayName) }) | 40 | initialsLabel.contactDisplayName = Qt.binding(function() { return ContactsJS.formatToDisplayWithDetails(contactElement, ContactDetail.Name, [Name.FirstName, Name.LastName], fallbackDisplayName) }) |
72 | 41 | } | 41 | } |
73 | 42 | 42 | ||
74 | 43 | aspect: UbuntuShape.Flat | ||
75 | 43 | radius: "medium" | 44 | radius: "medium" |
77 | 44 | backgroundColor: Theme.palette.normal.overlay | 45 | backgroundColor: ContactsJS.contactColor(displayName) |
78 | 45 | 46 | ||
79 | 46 | Label { | 47 | Label { |
80 | 47 | id: initialsLabel | 48 | id: initialsLabel |
81 | @@ -51,8 +52,8 @@ | |||
82 | 51 | 52 | ||
83 | 52 | anchors.centerIn: parent | 53 | anchors.centerIn: parent |
84 | 53 | text: Contacts.contactInitialsFromString(contactDisplayName) | 54 | text: Contacts.contactInitialsFromString(contactDisplayName) |
87 | 54 | color: UbuntuColors.lightAubergine | 55 | color: "white" |
88 | 55 | visible: (img.status != Image.Ready) | 56 | visible: (img.status != Image.Ready) && !fallbackIcon.visible |
89 | 56 | fontSize: "large" | 57 | fontSize: "large" |
90 | 57 | } | 58 | } |
91 | 58 | 59 | ||
92 | @@ -65,13 +66,24 @@ | |||
93 | 65 | 66 | ||
94 | 66 | property string avatarUrl: ContactsJS.getAvatar(contactElement, fallbackAvatarUrl) | 67 | property string avatarUrl: ContactsJS.getAvatar(contactElement, fallbackAvatarUrl) |
95 | 67 | 68 | ||
96 | 68 | anchors.centerIn: visible ? avatar : undefined | ||
97 | 69 | asynchronous: true | 69 | asynchronous: true |
100 | 70 | source: avatar.showAvatarPicture ? avatar.avatarUrl : "" | 70 | source: avatar.showAvatarPicture && (avatar.avatarUrl.indexOf("image://theme/") === -1) ? avatar.avatarUrl : "" |
101 | 71 | height: visible ? units.gu(3) : avatar.height | 71 | height: avatar.height |
102 | 72 | width: height | 72 | width: height |
104 | 73 | visible: avatar.avatarUrl.indexOf("image://theme/") === 0 | 73 | visible: false |
105 | 74 | sourceSize.width: avatar.width | 74 | sourceSize.width: avatar.width |
106 | 75 | sourceSize.height: avatar.height | 75 | sourceSize.height: avatar.height |
107 | 76 | } | 76 | } |
108 | 77 | |||
109 | 78 | Icon { | ||
110 | 79 | id: fallbackIcon | ||
111 | 80 | objectName: "fallbackIcon" | ||
112 | 81 | |||
113 | 82 | source: visible ? img.avatarUrl : "" | ||
114 | 83 | visible: avatar.showAvatarPicture && (avatar.avatarUrl.indexOf("image://theme/") === 0) | ||
115 | 84 | color: "white" | ||
116 | 85 | anchors.centerIn: avatar | ||
117 | 86 | height: units.gu(3) | ||
118 | 87 | width: height | ||
119 | 88 | } | ||
120 | 77 | } | 89 | } |
121 | 78 | 90 | ||
122 | === modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml' | |||
123 | --- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2015-12-10 19:13:20 +0000 | |||
124 | +++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2016-02-03 14:15:56 +0000 | |||
125 | @@ -76,7 +76,7 @@ | |||
126 | 76 | verticalCenter: parent.verticalCenter | 76 | verticalCenter: parent.verticalCenter |
127 | 77 | right: parent.right | 77 | right: parent.right |
128 | 78 | } | 78 | } |
130 | 79 | color: UbuntuColors.lightAubergine | 79 | color: selected ? "white" : UbuntuColors.darkGrey |
131 | 80 | text: root.displayLabel != "" ? root.displayLabel : i18n.dtr("address-book-app", "No name") | 80 | text: root.displayLabel != "" ? root.displayLabel : i18n.dtr("address-book-app", "No name") |
132 | 81 | elide: Text.ElideRight | 81 | elide: Text.ElideRight |
133 | 82 | } | 82 | } |
134 | 83 | 83 | ||
135 | === modified file 'src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml' | |||
136 | --- src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml 2015-10-26 13:18:11 +0000 | |||
137 | +++ src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml 2016-02-03 14:15:56 +0000 | |||
138 | @@ -80,7 +80,6 @@ | |||
139 | 80 | } | 80 | } |
140 | 81 | 81 | ||
141 | 82 | text: i18n.dtr("address-book-app", "Add number...") | 82 | text: i18n.dtr("address-book-app", "Add number...") |
142 | 83 | color: UbuntuColors.lightAubergine | ||
143 | 84 | } | 83 | } |
144 | 85 | visible: phoneNumberEntries.count == 0 | 84 | visible: phoneNumberEntries.count == 0 |
145 | 86 | MouseArea { | 85 | MouseArea { |
146 | @@ -104,7 +103,6 @@ | |||
147 | 104 | text: modelData.number | 103 | text: modelData.number |
148 | 105 | subText: phoneTypeModel.get(phoneTypeModel.getTypeIndex(modelData)).label | 104 | subText: phoneTypeModel.get(phoneTypeModel.getTypeIndex(modelData)).label |
149 | 106 | onClicked: root.detailClicked(modelData, "call") | 105 | onClicked: root.detailClicked(modelData, "call") |
150 | 107 | textColor: UbuntuColors.lightAubergine | ||
151 | 108 | 106 | ||
152 | 109 | MouseArea { | 107 | MouseArea { |
153 | 110 | anchors { | 108 | anchors { |
154 | 111 | 109 | ||
155 | === modified file 'src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml' | |||
156 | --- src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml 2015-10-26 13:18:11 +0000 | |||
157 | +++ src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml 2016-02-03 14:15:56 +0000 | |||
158 | @@ -73,7 +73,6 @@ | |||
159 | 73 | right: parent.right | 73 | right: parent.right |
160 | 74 | rightMargin: units.gu(2) | 74 | rightMargin: units.gu(2) |
161 | 75 | } | 75 | } |
162 | 76 | color: UbuntuColors.lightAubergine | ||
163 | 77 | elide: Text.ElideRight | 76 | elide: Text.ElideRight |
164 | 78 | visible: root.showContents | 77 | visible: root.showContents |
165 | 79 | } | 78 | } |
166 | 80 | 79 | ||
167 | === modified file 'src/imports/Ubuntu/Contacts/Contacts.js' | |||
168 | --- src/imports/Ubuntu/Contacts/Contacts.js 2015-06-01 18:26:26 +0000 | |||
169 | +++ src/imports/Ubuntu/Contacts/Contacts.js 2016-02-03 14:15:56 +0000 | |||
170 | @@ -1,5 +1,6 @@ | |||
171 | 1 | 1 | ||
172 | 2 | var phoneTypeModel = null | 2 | var phoneTypeModel = null |
173 | 3 | var contactColors = ["#DC3023", "#FF8936", "#FFB95A", "#8DB255", "#749F8D", "#48929B", "#A87CA0"] | ||
174 | 3 | 4 | ||
175 | 4 | // Format contact name to be displayed | 5 | // Format contact name to be displayed |
176 | 5 | function formatToDisplayWithDetails(contact, contactDetail, detailFields, defaultTitle) | 6 | function formatToDisplayWithDetails(contact, contactDetail, detailFields, defaultTitle) |
177 | @@ -145,3 +146,9 @@ | |||
178 | 145 | { | 146 | { |
179 | 146 | return (contact && (contact.contactId === "qtcontacts:::")) | 147 | return (contact && (contact.contactId === "qtcontacts:::")) |
180 | 147 | } | 148 | } |
181 | 149 | |||
182 | 150 | function contactColor(name) | ||
183 | 151 | { | ||
184 | 152 | var hash = Contacts.qHash(name) | ||
185 | 153 | return contactColors[(hash % contactColors.length)] | ||
186 | 154 | } | ||
187 | 148 | 155 | ||
188 | === modified file 'src/imports/Ubuntu/Contacts/FastScroll.qml' | |||
189 | --- src/imports/Ubuntu/Contacts/FastScroll.qml 2015-12-10 19:08:19 +0000 | |||
190 | +++ src/imports/Ubuntu/Contacts/FastScroll.qml 2016-02-03 14:15:56 +0000 | |||
191 | @@ -72,15 +72,16 @@ | |||
192 | 72 | } | 72 | } |
193 | 73 | 73 | ||
194 | 74 | 74 | ||
196 | 75 | Rectangle { | 75 | UbuntuShape { |
197 | 76 | id: magnified | 76 | id: magnified |
198 | 77 | 77 | ||
199 | 78 | aspect: UbuntuShape.Flat | ||
200 | 78 | color: Theme.palette.normal.foreground | 79 | color: Theme.palette.normal.foreground |
204 | 79 | radius: height * 0.3 | 80 | radius: "medium" |
205 | 80 | height: pinSize * 2 | 81 | height: units.gu(6) |
206 | 81 | width: height | 82 | width: units.gu(8) |
207 | 82 | opacity: internal.fastScrolling && root.enabled ? 1.0 : 0.0 | 83 | opacity: internal.fastScrolling && root.enabled ? 1.0 : 0.0 |
209 | 83 | x: -cursor.width - units.gu(3) | 84 | x: -magnified.width |
210 | 84 | y: { | 85 | y: { |
211 | 85 | if (internal.currentItem) { | 86 | if (internal.currentItem) { |
212 | 86 | var itemCenterY = rail.y + internal.currentItem.y + (internal.currentItem.height / 2) | 87 | var itemCenterY = rail.y + internal.currentItem.y + (internal.currentItem.height / 2) |
213 | @@ -90,6 +91,20 @@ | |||
214 | 90 | } | 91 | } |
215 | 91 | } | 92 | } |
216 | 92 | 93 | ||
217 | 94 | Triangle { | ||
218 | 95 | id: arrow | ||
219 | 96 | |||
220 | 97 | color: magnified.color | ||
221 | 98 | fill: true | ||
222 | 99 | height: units.gu(1.5) | ||
223 | 100 | width: units.gu(0.5) | ||
224 | 101 | anchors { | ||
225 | 102 | verticalCenter: parent.verticalCenter | ||
226 | 103 | right: parent.right | ||
227 | 104 | rightMargin: -width | ||
228 | 105 | } | ||
229 | 106 | } | ||
230 | 107 | |||
231 | 93 | Label { | 108 | Label { |
232 | 94 | color: Theme.palette.normal.foregroundText | 109 | color: Theme.palette.normal.foregroundText |
233 | 95 | anchors.fill: parent | 110 | anchors.fill: parent |
234 | 96 | 111 | ||
235 | === modified file 'src/imports/Ubuntu/Contacts/ListItemWithActions.qml' | |||
236 | --- src/imports/Ubuntu/Contacts/ListItemWithActions.qml 2016-01-06 15:09:18 +0000 | |||
237 | +++ src/imports/Ubuntu/Contacts/ListItemWithActions.qml 2016-02-03 14:15:56 +0000 | |||
238 | @@ -246,7 +246,7 @@ | |||
239 | 246 | width: units.gu(3) | 246 | width: units.gu(3) |
240 | 247 | height: units.gu(3) | 247 | height: units.gu(3) |
241 | 248 | name: modelData.iconName | 248 | name: modelData.iconName |
243 | 249 | color: root.activeAction === modelData ? UbuntuColors.lightAubergine : UbuntuColors.lightGrey | 249 | color: root.activeAction === modelData ? UbuntuColors.orange : UbuntuColors.lightGrey |
244 | 250 | } | 250 | } |
245 | 251 | } | 251 | } |
246 | 252 | } | 252 | } |
247 | 253 | 253 | ||
248 | === modified file 'src/imports/Ubuntu/Contacts/SIMCardImportPage.qml' | |||
249 | --- src/imports/Ubuntu/Contacts/SIMCardImportPage.qml 2015-12-02 13:36:03 +0000 | |||
250 | +++ src/imports/Ubuntu/Contacts/SIMCardImportPage.qml 2016-02-03 14:15:56 +0000 | |||
251 | @@ -26,7 +26,7 @@ | |||
252 | 26 | Page { | 26 | Page { |
253 | 27 | id: root | 27 | id: root |
254 | 28 | 28 | ||
256 | 29 | readonly property string exportFile: "file://%1/ubuntu_contacts_sim.vcf".arg(Contacts.tempPath) | 29 | readonly property string exportFile: Contacts.tempFile("ubuntu_contacts_XXXXXX.vcf") |
257 | 30 | readonly property alias hasContacts: simCardContacts.hasContacts | 30 | readonly property alias hasContacts: simCardContacts.hasContacts |
258 | 31 | property var targetModel: null | 31 | property var targetModel: null |
259 | 32 | property var sims: [] | 32 | property var sims: [] |
260 | @@ -98,7 +98,7 @@ | |||
261 | 98 | multiSelectionEnabled: true | 98 | multiSelectionEnabled: true |
262 | 99 | multipleSelection: true | 99 | multipleSelection: true |
263 | 100 | showSections: false | 100 | showSections: false |
265 | 101 | visible: !indicator.visible | 101 | visible: !indicator.visible && !statusMessage.visible |
266 | 102 | showBusyIndicator: false | 102 | showBusyIndicator: false |
267 | 103 | 103 | ||
268 | 104 | manager: "memory" | 104 | manager: "memory" |
269 | @@ -168,9 +168,26 @@ | |||
270 | 168 | 168 | ||
271 | 169 | onExportCompleted: { | 169 | onExportCompleted: { |
272 | 170 | if ((error === ContactModel.ExportNoError) && targetModel) { | 170 | if ((error === ContactModel.ExportNoError) && targetModel) { |
273 | 171 | root.state = "saving" | ||
274 | 171 | targetModel.importContacts(url) | 172 | targetModel.importContacts(url) |
275 | 173 | } else { | ||
276 | 174 | console.debug("Failt to export selected contacts") | ||
277 | 175 | root.state = "error" | ||
278 | 176 | } | ||
279 | 177 | } | ||
280 | 178 | } | ||
281 | 179 | |||
282 | 180 | Connections { | ||
283 | 181 | target: root.targetModel | ||
284 | 182 | onImportCompleted: { | ||
285 | 183 | if (error === ContactModel.ImportNoError) { | ||
286 | 184 | Contacts.removeFile(root.exportFile) | ||
287 | 185 | root.state = "" | ||
288 | 186 | root.importCompleted() | ||
289 | 187 | } else { | ||
290 | 188 | console.error("Fail to import contacts on device") | ||
291 | 189 | root.state = "error" | ||
292 | 172 | } | 190 | } |
293 | 173 | root.importCompleted() | ||
294 | 174 | } | 191 | } |
295 | 175 | } | 192 | } |
296 | 176 | 193 | ||
297 | @@ -235,7 +252,15 @@ | |||
298 | 235 | name: "importing" | 252 | name: "importing" |
299 | 236 | PropertyChanges { | 253 | PropertyChanges { |
300 | 237 | target: indicator | 254 | target: indicator |
302 | 238 | title: i18n.dtr("address-book-app", "Importing...") | 255 | title: i18n.dtr("address-book-app", "Reading contacts from SIM...") |
303 | 256 | visible: true | ||
304 | 257 | } | ||
305 | 258 | }, | ||
306 | 259 | State { | ||
307 | 260 | name: "saving" | ||
308 | 261 | PropertyChanges { | ||
309 | 262 | target: indicator | ||
310 | 263 | title: i18n.dtr("address-book-app", "Saving contacts on phone...") | ||
311 | 239 | visible: true | 264 | visible: true |
312 | 240 | } | 265 | } |
313 | 241 | }, | 266 | }, |
314 | @@ -249,6 +274,7 @@ | |||
315 | 249 | } | 274 | } |
316 | 250 | ] | 275 | ] |
317 | 251 | 276 | ||
318 | 277 | Component.onCompleted: console.debug("Temporary file:" + exportFile) | ||
319 | 252 | Component.onDestruction: { | 278 | Component.onDestruction: { |
320 | 253 | Contacts.removeFile(root.exportFile) | 279 | Contacts.removeFile(root.exportFile) |
321 | 254 | } | 280 | } |
322 | 255 | 281 | ||
323 | === added file 'src/imports/Ubuntu/Contacts/Triangle.qml' | |||
324 | --- src/imports/Ubuntu/Contacts/Triangle.qml 1970-01-01 00:00:00 +0000 | |||
325 | +++ src/imports/Ubuntu/Contacts/Triangle.qml 2016-02-03 14:15:56 +0000 | |||
326 | @@ -0,0 +1,52 @@ | |||
327 | 1 | /* | ||
328 | 2 | * Copyright (C) 2016 Canonical, Ltd. | ||
329 | 3 | * | ||
330 | 4 | * This program is free software; you can redistribute it and/or modify | ||
331 | 5 | * it under the terms of the GNU General Public License as published by | ||
332 | 6 | * the Free Software Foundation; version 3. | ||
333 | 7 | * | ||
334 | 8 | * This program is distributed in the hope that it will be useful, | ||
335 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
336 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
337 | 11 | * GNU General Public License for more details. | ||
338 | 12 | * | ||
339 | 13 | * You should have received a copy of the GNU General Public License | ||
340 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
341 | 15 | */ | ||
342 | 16 | |||
343 | 17 | import QtQuick 2.4 | ||
344 | 18 | |||
345 | 19 | Canvas { | ||
346 | 20 | id: triangle | ||
347 | 21 | antialiasing: true | ||
348 | 22 | |||
349 | 23 | property color color: "#ffffff" | ||
350 | 24 | property int lineWidth: 3 | ||
351 | 25 | property bool fill: false | ||
352 | 26 | |||
353 | 27 | onLineWidthChanged:requestPaint(); | ||
354 | 28 | onFillChanged:requestPaint(); | ||
355 | 29 | |||
356 | 30 | onPaint: { | ||
357 | 31 | var ctx = getContext("2d"); | ||
358 | 32 | ctx.save(); | ||
359 | 33 | ctx.clearRect(0,0,triangle.width, triangle.height); | ||
360 | 34 | ctx.strokeStyle = triangle.color; | ||
361 | 35 | ctx.lineWidth = triangle.lineWidth | ||
362 | 36 | ctx.fillStyle = triangle.color | ||
363 | 37 | ctx.globalAlpha = 1.0 | ||
364 | 38 | ctx.lineJoin = "round"; | ||
365 | 39 | ctx.beginPath(); | ||
366 | 40 | |||
367 | 41 | ctx.translate(0, 0); | ||
368 | 42 | ctx.lineTo(0, triangle.height); | ||
369 | 43 | ctx.lineTo(triangle.width, 0.5 * triangle.height); | ||
370 | 44 | ctx.lineTo(0, 0); | ||
371 | 45 | |||
372 | 46 | if (triangle.fill) | ||
373 | 47 | ctx.fill(); | ||
374 | 48 | if (triangle.stroke) | ||
375 | 49 | ctx.stroke(); | ||
376 | 50 | ctx.restore(); | ||
377 | 51 | } | ||
378 | 52 | } | ||
379 | 0 | 53 | ||
380 | === modified file 'src/imports/Ubuntu/Contacts/contacts.cpp' | |||
381 | --- src/imports/Ubuntu/Contacts/contacts.cpp 2015-10-28 19:42:30 +0000 | |||
382 | +++ src/imports/Ubuntu/Contacts/contacts.cpp 2016-02-03 14:15:56 +0000 | |||
383 | @@ -109,6 +109,22 @@ | |||
384 | 109 | return QFile::exists(updaterLockFile()); | 109 | return QFile::exists(updaterLockFile()); |
385 | 110 | } | 110 | } |
386 | 111 | 111 | ||
387 | 112 | |||
388 | 113 | QUrl UbuntuContacts::tempFile(const QString &templateName) | ||
389 | 114 | { | ||
390 | 115 | QTemporaryFile tmp(QString("%1/%2").arg(tempPath()).arg(templateName)); | ||
391 | 116 | tmp.setAutoRemove(false); | ||
392 | 117 | if (tmp.open()) | ||
393 | 118 | return QUrl::fromLocalFile(tmp.fileName()); | ||
394 | 119 | else | ||
395 | 120 | return QUrl(); | ||
396 | 121 | } | ||
397 | 122 | |||
398 | 123 | uint UbuntuContacts::qHash(const QString &str) | ||
399 | 124 | { | ||
400 | 125 | return ::qHash(str); | ||
401 | 126 | } | ||
402 | 127 | |||
403 | 112 | QString UbuntuContacts::updaterLockFile() | 128 | QString UbuntuContacts::updaterLockFile() |
404 | 113 | { | 129 | { |
405 | 114 | return QString("%1/%2").arg(QDir::tempPath()).arg("/address-book-updater.lock"); | 130 | return QString("%1/%2").arg(QDir::tempPath()).arg("/address-book-updater.lock"); |
406 | 115 | 131 | ||
407 | === modified file 'src/imports/Ubuntu/Contacts/contacts.h' | |||
408 | --- src/imports/Ubuntu/Contacts/contacts.h 2015-10-28 19:42:30 +0000 | |||
409 | +++ src/imports/Ubuntu/Contacts/contacts.h 2016-02-03 14:15:56 +0000 | |||
410 | @@ -40,6 +40,8 @@ | |||
411 | 40 | Q_INVOKABLE bool containsLetters(const QString &value); | 40 | Q_INVOKABLE bool containsLetters(const QString &value); |
412 | 41 | Q_INVOKABLE bool removeFile(const QUrl &file); | 41 | Q_INVOKABLE bool removeFile(const QUrl &file); |
413 | 42 | Q_INVOKABLE bool updateIsRunning() const; | 42 | Q_INVOKABLE bool updateIsRunning() const; |
414 | 43 | Q_INVOKABLE QUrl tempFile(const QString &suffix); | ||
415 | 44 | Q_INVOKABLE uint qHash(const QString &str); | ||
416 | 43 | 45 | ||
417 | 44 | Q_SIGNALS: | 46 | Q_SIGNALS: |
418 | 45 | void imageCopyDone(const QString &id, const QString &fileName); | 47 | void imageCopyDone(const QString &id, const QString &fileName); |
419 | 46 | 48 | ||
420 | === modified file 'tests/qml/tst_ContactAvatar.qml' | |||
421 | --- tests/qml/tst_ContactAvatar.qml 2015-10-26 13:18:11 +0000 | |||
422 | +++ tests/qml/tst_ContactAvatar.qml 2016-02-03 14:15:56 +0000 | |||
423 | @@ -151,14 +151,20 @@ | |||
424 | 151 | waitForRendering(avatarComponent); | 151 | waitForRendering(avatarComponent); |
425 | 152 | var avatarInitials = findChild(avatarComponent, "avatarInitials") | 152 | var avatarInitials = findChild(avatarComponent, "avatarInitials") |
426 | 153 | var avatarImage = findChild(avatarComponent, "avatarImage") | 153 | var avatarImage = findChild(avatarComponent, "avatarImage") |
427 | 154 | var avatarFallback = findChild(avatarComponent, "fallbackIcon") | ||
428 | 154 | 155 | ||
429 | 155 | avatarComponent.showAvatarPicture = true | 156 | avatarComponent.showAvatarPicture = true |
430 | 156 | tryCompare(avatarInitials, "visible", false) | 157 | tryCompare(avatarInitials, "visible", false) |
432 | 157 | tryCompare(avatarImage, "source", avatarComponent.fallbackAvatarUrl) | 158 | tryCompare(avatarImage, "source", "") |
433 | 159 | tryCompare(avatarFallback, "visible", true) | ||
434 | 160 | tryCompare(avatarFallback, "source", avatarComponent.fallbackAvatarUrl) | ||
435 | 158 | 161 | ||
436 | 159 | avatarComponent.showAvatarPicture = false | 162 | avatarComponent.showAvatarPicture = false |
437 | 160 | tryCompare(avatarImage, "source", "") | 163 | tryCompare(avatarImage, "source", "") |
438 | 161 | tryCompare(avatarImage, "status", Image.Null) | 164 | tryCompare(avatarImage, "status", Image.Null) |
439 | 165 | tryCompare(avatarFallback, "visible", false) | ||
440 | 166 | tryCompare(avatarFallback, "source", "") | ||
441 | 167 | |||
442 | 162 | tryCompare(avatarInitials, "visible", true) | 168 | tryCompare(avatarInitials, "visible", true) |
443 | 163 | } | 169 | } |
444 | 164 | } | 170 | } |