Merge lp:~tpeeters/telegram-app/new-header into lp:telegram-app

Proposed by Tim Peeters
Status: Merged
Approved by: Jin
Approved revision: 223
Merged at revision: 210
Proposed branch: lp:~tpeeters/telegram-app/new-header
Merge into: lp:telegram-app
Diff against target: 1025 lines (+437/-318)
12 files modified
telegram/app/qml/AccountContactsPage.qml (+129/-94)
telegram/app/qml/AccountDialogPage.qml (+80/-75)
telegram/app/qml/AccountNamePage.qml (+12/-13)
telegram/app/qml/AccountPage.qml (+88/-57)
telegram/app/qml/AccountSettings.qml (+18/-16)
telegram/app/qml/AccountUsernamePage.qml (+5/-3)
telegram/app/qml/AddContactPage.qml (+18/-12)
telegram/app/qml/AuthCodePage.qml (+4/-2)
telegram/app/qml/AuthCountriesPage.qml (+70/-42)
telegram/app/qml/AuthNumberPage.qml (+5/-2)
telegram/app/qml/IntroPage.qml (+3/-0)
telegram/app/qml/ProfilePage.qml (+5/-2)
To merge this branch: bzr merge lp:~tpeeters/telegram-app/new-header
Reviewer Review Type Date Requested Status
Jin (community) Approve
Review via email: mp+297787@code.launchpad.net

Commit message

Use the new header.

To post a comment you must log in.
lp:~tpeeters/telegram-app/new-header updated
220. By Tim Peeters

clean

221. By Tim Peeters

Hide the old header in IntroPage.

Revision history for this message
Jin (jindallo) wrote :

A regression found in testing,
after below folders deleted:
    .config/com.ubuntu.telegram
    .cache/com.ubuntu.telegram

We could re-login the account,
in the page "Choose a country",
the first item(country) will be overlapped by the header,
for example, input "Tai",
the candidate "Taiwan" will be put on the back of the header.

review: Needs Fixing
lp:~tpeeters/telegram-app/new-header updated
222. By Tim Peeters

Fix anchors countries list.

223. By Tim Peeters

fix share header

Revision history for this message
Jin (jindallo) wrote :

The code looks good to me,
and verified from my local,
I approve.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'telegram/app/qml/AccountContactsPage.qml'
2--- telegram/app/qml/AccountContactsPage.qml 2016-05-13 12:44:58 +0000
3+++ telegram/app/qml/AccountContactsPage.qml 2016-06-22 09:40:14 +0000
4@@ -17,119 +17,154 @@
5 Page {
6 id: page
7 flickable: null
8- title: {
9- if (page.state == "new-group-chat") {
10- return i18n.tr("New Group");
11- } else if (page.state == "add-to-group") {
12- return i18n.tr("Add to group");
13- } else if (page.state == "new-secret-chat") {
14- return i18n.tr("New Secret Chat");
15- } else {
16- return i18n.tr("Contacts");
17+
18+ header: default_header
19+
20+ PageHeader {
21+ id: default_header
22+ visible: page.header === default_header
23+ title: i18n.tr("Contacts")
24+ trailingActionBar.actions: [
25+ Action {
26+ iconName: "search"
27+ text: i18n.tr("Search")
28+ onTriggered: page.state = "search"
29+ },
30+ Action {
31+ iconName: "contact-new"
32+ // TRANSLATORS: As in: add new contact
33+ text: i18n.tr("Add")
34+ onTriggered: addPressed()
35+ }
36+ ]
37+ }
38+
39+ PageHeader {
40+ id: search_header
41+ visible: page.header === search_header
42+ title: i18n.tr("Contacts")
43+ trailingActionBar.actions: []
44+ leadingActionBar.actions: Action {
45+ // TRANSLATORS: As in, back out of contacts page.
46+ text: i18n.tr("Back")
47+ iconName: "back"
48+ onTriggered: {
49+ search_text_field.text = "";
50+ page.state = "default";
51+ }
52+ }
53+ contents: TextField {
54+ id: search_text_field
55+ anchors {
56+ right: parent ? parent.right : undefined
57+ rightMargin: units.gu(2)
58+ left: parent ? parent.left : undefined
59+ leftMargin: units.gu(2)
60+ verticalCenter: parent ? parent.verticalCenter : undefined
61+ }
62+ focus: true
63+ inputMethodHints: Qt.ImhNoPredictiveText
64+ onTextChanged: searchChanged(text)
65+ // TRANSLATORS: Placeholder for contacts search field.
66+ placeholderText: i18n.tr("Search contacts...")
67+
68+ onTriggered: {
69+ // TODO No worky.
70+ page.state = "default";
71+ }
72+ }
73+ }
74+
75+ PageHeader {
76+ id: new_secret_chat_header
77+ visible: page.header === new_secret_chat_header
78+ title: i18n.tr("New Secret Chat")
79+ }
80+
81+ PageHeader {
82+ id: add_to_group_header
83+ visible: page.header === add_to_group_header
84+ title: i18n.tr("Add to group")
85+ trailingActionBar.actions: [
86+ Action {
87+ iconName: "search"
88+ text: i18n.tr("Search")
89+ onTriggered: {
90+ page.state = "search";
91+ }
92+ },
93+ Action {
94+ iconName: "contact-new"
95+ text: i18n.tr("Add")
96+ onTriggered: addPressed()
97+ }
98+ ]
99+ }
100+
101+ PageHeader {
102+ id: new_group_chat_header
103+ visible: page.header === new_group_chat_header
104+ title: i18n.tr("New Group")
105+ leadingActionBar.actions: new_group_chat_header.cancel
106+ trailingActionBar.actions: hasGroupCount
107+ ? new_group_chat_header.confirm
108+ : new_group_chat_header.none
109+
110+ property var none: []
111+ property list<Action> confirm: [
112+ Action {
113+ iconName: "ok"
114+ text: i18n.tr("OK")
115+ enabled: hasGroupTitle
116+ onTriggered: createChatPressed()
117+ }
118+ ]
119+ property Action cancel: Action {
120+ iconName: "back"
121+ text: i18n.tr("Back")
122+ onTriggered: {
123+ page.state = "default"
124+ pageStack.removePages(page);
125+ }
126 }
127 }
128
129 state: "default"
130 states: [
131- PageHeadState {
132+ State {
133 name: "default"
134- head: page.head
135- actions: [
136- Action {
137- iconName: "search"
138- text: i18n.tr("Search")
139- onTriggered: page.state = "search"
140- },
141- Action {
142- iconName: "contact-new"
143- // TRANSLATORS: As in: add new contact
144- text: i18n.tr("Add")
145- onTriggered: addPressed()
146- }
147- ]
148+ PropertyChanges {
149+ target: page
150+ header: default_header
151+ }
152 },
153 PageHeadState {
154 name: "search"
155- head: page.head
156- actions: []
157- backAction: Action {
158- // TRANSLATORS: As in, back out of contacts page.
159- text: i18n.tr("Back")
160- iconName: "back"
161- onTriggered: {
162- search_text_field.text = "";
163- page.state = "default";
164- }
165- }
166- contents: TextField {
167- id: search_text_field
168- anchors {
169- right: parent ? parent.right : undefined
170- rightMargin: units.gu(2)
171- }
172- focus: true
173- inputMethodHints: Qt.ImhNoPredictiveText
174- onTextChanged: searchChanged(text)
175- // TRANSLATORS: Placeholder for contacts search field.
176- placeholderText: i18n.tr("Search contacts...")
177-
178- onTriggered: {
179- // TODO No worky.
180- page.state = "default";
181- }
182+ PropertyChanges {
183+ target: page
184+ header: search_header
185 }
186 },
187 PageHeadState {
188 name: "new-secret-chat"
189- head: page.head
190+ PropertyChanges {
191+ target: page
192+ header: new_secret_chat_header
193+ }
194 },
195 PageHeadState {
196 name: "add-to-group"
197- head: page.head
198- actions: [
199- Action {
200- iconName: "search"
201- text: i18n.tr("Search")
202- onTriggered: {
203- page.state = "search";
204- }
205- },
206- Action {
207- iconName: "contact-new"
208- text: i18n.tr("Add")
209- onTriggered: addPressed()
210- }
211- ]
212+ PropertyChanges {
213+ target: page
214+ header: add_to_group_header
215+ }
216+
217 },
218 PageHeadState {
219- id: new_group_chat_state
220 name: "new-group-chat"
221- head: page.head
222-
223 PropertyChanges {
224- target: page.head
225- backAction: new_group_chat_state.cancel
226- actions: hasGroupCount
227- ? new_group_chat_state.confirm
228- : new_group_chat_state.none
229- }
230-
231- property var none: []
232- property list<Action> confirm: [
233- Action {
234- iconName: "ok"
235- text: i18n.tr("OK")
236- enabled: hasGroupTitle
237- onTriggered: createChatPressed()
238- }
239- ]
240- property Action cancel: Action {
241- iconName: "back"
242- text: i18n.tr("Back")
243- onTriggered: {
244- page.state = "default"
245- pageStack.removePages(page);
246- }
247+ target: page
248+ header: new_group_chat_header
249 }
250 }
251 ]
252@@ -191,7 +226,7 @@
253 TextField {
254 id: group_chat_title_text_field
255 anchors {
256- top: parent.top
257+ top: page.header.bottom
258 topMargin: isVisible ? units.gu(1) : 0
259 left: parent.left
260 leftMargin: units.gu(1)
261
262=== modified file 'telegram/app/qml/AccountDialogPage.qml'
263--- telegram/app/qml/AccountDialogPage.qml 2016-05-20 09:26:54 +0000
264+++ telegram/app/qml/AccountDialogPage.qml 2016-06-22 09:40:14 +0000
265@@ -79,85 +79,87 @@
266
267 objectName: "dialogPage"
268
269- head.actions: message_list.inSelectionMode ? selectionActions : defaultActions
270- head.backAction: Action {
271- id: back_action
272- iconName: message_list.inSelectionMode ? "close" : "back"
273- onTriggered: {
274- if (message_list.inSelectionMode) {
275- message_list.cancelSelection()
276- } else {
277- if(mainView.width > units.gu(80)) {
278- dialogDidGoBack = true;
279+ header: PageHeader {
280+ id: dialog_page_header
281+ trailingActionBar.actions: message_list.inSelectionMode ? selectionActions : defaultActions
282+ leadingActionBar.actions: Action {
283+ id: back_action
284+ iconName: message_list.inSelectionMode ? "close" : "back"
285+ onTriggered: {
286+ if (message_list.inSelectionMode) {
287+ message_list.cancelSelection()
288+ } else {
289+ if(mainView.width > units.gu(80)) {
290+ dialogDidGoBack = true;
291+ }
292+ pageStack.removePages(dialog_page);
293 }
294- pageStack.removePages(dialog_page);
295 }
296 }
297- }
298-
299- flickable: null
300-
301- //Adds components to the header
302- head.contents: Rectangle {
303- anchors {
304- top: parent.top
305- topMargin: units.dp(8)
306- left: parent.left
307- verticalCenter: parent
308- right: parent.right
309- rightMargin: units.gu(5)
310- bottom: parent.bottom
311- }
312-
313- //Text adjusts to the parent
314- Text {
315+ flickable: null
316+
317+ //Adds components to the header
318+ contents: Rectangle {
319 anchors {
320 top: parent.top
321- topMargin: units.gu(0.2)
322- left: imgAvatar.right
323- leftMargin: units.gu(1)
324- }
325- width: parent.width
326-
327- text: {
328- if (!currentDialog) return "";
329- if (isChat) {
330- return chat ? chat.title : ""; //Shown if a group chat
331- } else {
332- return user ? user.firstName + " " + user.lastName : ""; //Shown if a scret chat
333- }
334- }
335- font.pixelSize: FontUtils.sizeToPixels("large")
336- //Word wraps text when text is too long for width
337- wrapMode: Text.WordWrap
338- //Enables the elipse to the end of the text
339- elide: Text.ElideRight
340- //Wraps text to 1 line
341- maximumLineCount: 1
342- }
343-
344- //Avatar component gets avatar for user as specified from 'dialog' parameter
345- Avatar {
346- id: imgAvatar
347-
348- width: height
349- telegram: dialog_page.telegramObject
350- dialog: dialog_page.currentDialog
351- }
352-
353- //'Lock' image that is overlayed ontop of the Avatar conponent
354- Image {
355- anchors {
356- left: imgAvatar.right
357- leftMargin: -width-5
358- top: imgAvatar.top
359- topMargin: units.dp(2)
360- }
361- width: units.gu(1)
362- height: units.gu(1.5)
363- source: "qrc:/qml/files/lock.png"
364- sourceSize: Qt.size(width, height)
365- visible: currentDialog.encrypted
366+ topMargin: units.dp(8)
367+ left: parent.left
368+ verticalCenter: parent
369+ right: parent.right
370+ rightMargin: units.gu(5)
371+ bottom: parent.bottom
372+ }
373+
374+ //Text adjusts to the parent
375+ Text {
376+ anchors {
377+ top: parent.top
378+ topMargin: units.gu(0.2)
379+ left: imgAvatar.right
380+ leftMargin: units.gu(1)
381+ }
382+ width: parent.width
383+
384+ text: {
385+ if (!currentDialog) return "";
386+ if (isChat) {
387+ return chat ? chat.title : ""; //Shown if a group chat
388+ } else {
389+ return user ? user.firstName + " " + user.lastName : ""; //Shown if a scret chat
390+ }
391+ }
392+ font.pixelSize: FontUtils.sizeToPixels("large")
393+ //Word wraps text when text is too long for width
394+ wrapMode: Text.WordWrap
395+ //Enables the elipse to the end of the text
396+ elide: Text.ElideRight
397+ //Wraps text to 1 line
398+ maximumLineCount: 1
399+ }
400+
401+ //Avatar component gets avatar for user as specified from 'dialog' parameter
402+ Avatar {
403+ id: imgAvatar
404+
405+ width: height
406+ telegram: dialog_page.telegramObject
407+ dialog: dialog_page.currentDialog
408+ }
409+
410+ //'Lock' image that is overlayed ontop of the Avatar conponent
411+ Image {
412+ anchors {
413+ left: imgAvatar.right
414+ leftMargin: -width-5
415+ top: imgAvatar.top
416+ topMargin: units.dp(2)
417+ }
418+ width: units.gu(1)
419+ height: units.gu(1.5)
420+ source: "qrc:/qml/files/lock.png"
421+ sourceSize: Qt.size(width, height)
422+ visible: currentDialog.encrypted
423+ }
424 }
425 }
426
427@@ -189,7 +191,10 @@
428 Item {
429 id: message_box
430 anchors {
431- fill: parent
432+ left: parent.left
433+ right: parent.right
434+ bottom: parent.bottom
435+ top: dialog_page_header.bottom
436 }
437
438 DelegateUtils {
439
440=== modified file 'telegram/app/qml/AccountNamePage.qml'
441--- telegram/app/qml/AccountNamePage.qml 2016-02-23 18:25:36 +0000
442+++ telegram/app/qml/AccountNamePage.qml 2016-06-22 09:40:14 +0000
443@@ -12,17 +12,16 @@
444 property alias lastName: last_name_text_field.text
445 property alias error: error_text_field.text
446
447- property list<Action> actions: [
448- Action {
449- iconName: "ok"
450- text: i18n.tr("Save")
451- onTriggered: updateProfile();
452- }
453- ]
454-
455- title: i18n.tr("Edit name");
456- head.actions: actions
457-
458+ header: PageHeader {
459+ title: i18n.tr("Edit name");
460+ trailingActionBar.actions: [
461+ Action {
462+ iconName: "ok"
463+ text: i18n.tr("Save")
464+ onTriggered: updateProfile();
465+ }
466+ ]
467+ }
468 function updateProfile() {
469 Qt.inputMethod.commit();
470 error = "";
471@@ -38,7 +37,7 @@
472 TextField {
473 id: first_name_text_field
474 anchors {
475- top: parent.top
476+ top: page.header.bottom
477 topMargin: units.gu(4)
478 left: parent.left
479 leftMargin: units.gu(2)
480@@ -84,4 +83,4 @@
481 horizontalAlignment: Text.AlignHCenter
482 color: "red"
483 }
484-}
485\ No newline at end of file
486+}
487
488=== modified file 'telegram/app/qml/AccountPage.qml'
489--- telegram/app/qml/AccountPage.qml 2016-05-19 16:15:11 +0000
490+++ telegram/app/qml/AccountPage.qml 2016-06-22 09:40:14 +0000
491@@ -63,7 +63,6 @@
492
493 objectName: "accountPage"
494 flickable: null
495- head.sections.model: profiles.count > 1 ? [ telegramObject.phoneNumber ] : []
496
497 Component.onCompleted: {
498 open_chat_timer.start();
499@@ -81,6 +80,7 @@
500 anchors {
501 left: parent.left
502 top: parent.top
503+ topMargin: account_page.header.height
504 }
505 maxHeight: parent.height - units.gu(7)
506 z: 10
507@@ -170,7 +170,10 @@
508
509 AccountDialogList {
510 id: dialogs
511- anchors.fill: parent
512+ anchors{
513+ fill: parent
514+ topMargin: account_page.header.height
515+ }
516 clip: true
517 //visible: search_frame.text.length == 0
518
519@@ -279,73 +282,101 @@
520 // }
521 // bottomEdgeTitle: i18n.tr("Contacts")
522
523+ Sections {
524+ id: sections
525+ model: profiles.count > 1 ? [ telegramObject.phoneNumber ] : []
526+ visible: profiles.count > 1
527+ }
528+
529+ header: default_header
530+ PageHeader {
531+ id: default_header
532+ visible: account_page.header === default_header
533+ title: {
534+ if (NetworkingStatus.online) {
535+ if (telegramObject.connected) {
536+ // TRANSLATORS: Default app header title. Application name.
537+ return i18n.tr("Telegram")
538+ } else {
539+ // TRANSLATORS: App header title when connecting to Telegram.
540+ return i18n.tr("Connecting...")
541+ }
542+ } else {
543+ // TRANSLATORS: Shown in app header when network is unavailable.
544+ return i18n.tr("Waiting for network...")
545+ }
546+ }
547+ leadingActionBar.actions: Action {
548+ iconName: "navigation-menu"
549+ onTriggered: {
550+ account_panel.opened ? account_panel.close() : account_panel.open()
551+ }
552+ }
553+ extension: profiles.count > 1 ? sections : null
554+ }
555+
556+ PageHeader {
557+ id: forward_header
558+ visible: account_page.header === forward_header
559+ title: {
560+ if (NetworkingStatus.online) {
561+ // TRANSLATORS: Page title when forwarding messages.
562+ return i18n.tr("Select Chat")
563+ } else {
564+ // TRANSLATORS: Shown in app header when network is unavailable.
565+ return i18n.tr("Waiting for network...")
566+ }
567+ }
568+ leadingActionBar.actions: Action {
569+ iconName: "go-previous"
570+ onTriggered: clearForwardedMessages()
571+ }
572+ extension: profiles.count > 1 ? sections : null
573+ }
574+
575+ PageHeader {
576+ id: share_header
577+ visible: account_page.header === share_header
578+ title: {
579+ if (NetworkingStatus.online) {
580+ // TRANSLATORS: Page title when sharing files.
581+ return i18n.tr("Select Chat")
582+ } else {
583+ // TRANSLATORS: Shown in app header when network is unavailable.
584+ return i18n.tr("Waiting for network...")
585+ }
586+ }
587+ leadingActionBar.actions: Action {
588+ iconName: "go-previous"
589+ onTriggered: cancelSharedContent()
590+ }
591+ extension: profiles.count > 1 ? sections : null
592+ }
593+
594 state: "default"
595 states: [
596- PageHeadState {
597+ State {
598 name: "default"
599 when: dialogs.messageIdsToForward.length == 0 && !transfer_helper.hasContent
600- head: account_page.head
601- contents: Label {
602- text: {
603- if (NetworkingStatus.online) {
604- if (telegramObject.connected) {
605- // TRANSLATORS: Default app header title. Application name.
606- return i18n.tr("Telegram")
607- } else {
608- // TRANSLATORS: App header title when connecting to Telegram.
609- return i18n.tr("Connecting...")
610- }
611- } else {
612- // TRANSLATORS: Shown in app header when network is unavailable.
613- return i18n.tr("Waiting for network...")
614- }
615- }
616- }
617- backAction: Action {
618- iconName: "navigation-menu"
619- onTriggered: {
620- account_panel.opened ? account_panel.close() : account_panel.open()
621- }
622+ PropertyChanges {
623+ target: account_page
624+ header: default_header
625 }
626 },
627- PageHeadState {
628+ State {
629 name: "forward"
630 when: dialogs.messageIdsToForward.length > 0
631- head: account_page.head
632- contents: Label {
633- text: {
634- if (NetworkingStatus.online) {
635- // TRANSLATORS: Page title when forwarding messages.
636- return i18n.tr("Select Chat")
637- } else {
638- // TRANSLATORS: Shown in app header when network is unavailable.
639- return i18n.tr("Waiting for network...")
640- }
641- }
642- }
643- backAction: Action {
644- iconName: "go-previous"
645- onTriggered: clearForwardedMessages()
646+ PropertyChanges {
647+ target: account_page
648+ header: forward_header
649 }
650 },
651- PageHeadState {
652+ State {
653 name: "share"
654 when: transfer_helper.hasContent
655- head: account_page.head
656- contents: Label {
657- text: {
658- if (NetworkingStatus.online) {
659- // TRANSLATORS: Page title when sharing files.
660- return i18n.tr("Select Chat")
661- } else {
662- // TRANSLATORS: Shown in app header when network is unavailable.
663- return i18n.tr("Waiting for network...")
664- }
665- }
666- }
667- backAction: Action {
668- iconName: "go-previous"
669- onTriggered: cancelSharedContent()
670+ PropertyChanges {
671+ target: account_page
672+ header: share_header
673 }
674 }
675 ]
676
677=== modified file 'telegram/app/qml/AccountSettings.qml'
678--- telegram/app/qml/AccountSettings.qml 2016-06-08 12:06:55 +0000
679+++ telegram/app/qml/AccountSettings.qml 2016-06-22 09:40:14 +0000
680@@ -16,25 +16,27 @@
681 property Telegram telegram
682 property User user: telegram.user(telegram.me)
683
684- property list<Action> actions: [
685- Action {
686- iconName: "stock_image"
687- // TRANSLATORS: Action text to change profile photo.
688- text: i18n.tr("Change photo")
689- onTriggered: changeUserPhoto()
690+ header: PageHeader {
691+ title: settings_page.title
692+ trailingActionBar.actions: [
693+ Action {
694+ iconName: "stock_image"
695+ // TRANSLATORS: Action text to change profile photo.
696+ text: i18n.tr("Change photo")
697+ onTriggered: changeUserPhoto()
698
699- },
700- Action {
701- iconName: "edit"
702- // TRANSLATORS: Edit your profile first and last name.
703- text: i18n.tr("Edit name")
704- onTriggered: changeFullName()
705- }
706- ]
707+ },
708+ Action {
709+ iconName: "edit"
710+ // TRANSLATORS: Edit your profile first and last name.
711+ text: i18n.tr("Edit name")
712+ onTriggered: changeFullName()
713+ }
714+ ]
715+ }
716
717 objectName: "settingsPage"
718 title: i18n.tr("Settings")
719- head.actions: actions
720
721 function changeFullName() {
722 var properties = { "telegram": telegram, "firstName": user.firstName, "lastName": user.lastName };
723@@ -222,7 +224,7 @@
724 ClickableContactImage {
725 id: profile_image
726 anchors {
727- top: parent.top
728+ top: settings_page.header.bottom
729 topMargin: units.gu(2)
730 left: parent.left
731 leftMargin: units.gu(2)
732
733=== modified file 'telegram/app/qml/AccountUsernamePage.qml'
734--- telegram/app/qml/AccountUsernamePage.qml 2016-02-23 18:25:36 +0000
735+++ telegram/app/qml/AccountUsernamePage.qml 2016-06-22 09:40:14 +0000
736@@ -58,8 +58,10 @@
737 telegram.accountUsernameChecked.disconnect(page.accountUsernameChecked);
738 }
739
740- title: i18n.tr("Username");
741- head.actions: actions
742+ header: PageHeader {
743+ title: i18n.tr("Username")
744+ trailingActionBar.actions: page.actions
745+ }
746
747 function checkUsername() {
748 checking = true;
749@@ -81,7 +83,7 @@
750 Column {
751 spacing: units.gu(2)
752 anchors {
753- top: parent.top
754+ top: page.header.bottom
755 topMargin: units.gu(4)
756 left: parent.left
757 leftMargin: units.gu(2)
758
759=== modified file 'telegram/app/qml/AddContactPage.qml'
760--- telegram/app/qml/AddContactPage.qml 2016-02-23 18:25:36 +0000
761+++ telegram/app/qml/AddContactPage.qml 2016-06-22 09:40:14 +0000
762@@ -27,20 +27,26 @@
763 signal error(var id, int ecode, string etext, string fname)
764
765 id: page
766- title: i18n.tr("Add Contact")
767-
768- head.actions: [
769- Action {
770- iconName: "ok"
771- text: i18n.tr("Done")
772- enabled: (phone.length > 0 || enteredPhone.length > 0) && firstName.length > 0
773- onTriggered: addContact()
774- }
775- ]
776+ header: PageHeader {
777+ title: i18n.tr("Add Contact")
778+ trailingActionBar.actions: [
779+ Action {
780+ iconName: "ok"
781+ text: i18n.tr("Done")
782+ enabled: (phone.length > 0 || enteredPhone.length > 0) && firstName.length > 0
783+ onTriggered: addContact()
784+ }
785+ ]
786+ }
787
788 Item {
789- anchors.fill: parent
790- anchors.margins: units.gu(2)
791+ anchors {
792+ top: page.header.bottom
793+ left: parent.left
794+ right: parent.right
795+ bottom: parent.bottom
796+ margins: units.gu(2)
797+ }
798
799 Item {
800 id: contact_header
801
802=== modified file 'telegram/app/qml/AuthCodePage.qml'
803--- telegram/app/qml/AuthCodePage.qml 2016-06-03 10:25:33 +0000
804+++ telegram/app/qml/AuthCodePage.qml 2016-06-22 09:40:14 +0000
805@@ -21,7 +21,9 @@
806 signal codeRequest()
807 signal callRequest()
808
809- title: phoneRegistered ? i18n.tr("Sign In") : i18n.tr("Sign Up")
810+ header: PageHeader {
811+ title: phoneRegistered ? i18n.tr("Sign In") : i18n.tr("Sign Up")
812+ }
813
814 onError: {
815 console.log("ui: " + errorText + " error");
816@@ -76,7 +78,7 @@
817 Label {
818 id: timer
819 anchors {
820- top: parent.top
821+ top: auth_code_page.header.bottom
822 topMargin: units.gu(2)
823 left: parent.left
824 leftMargin: units.gu(4)
825
826=== modified file 'telegram/app/qml/AuthCountriesPage.qml'
827--- telegram/app/qml/AuthCountriesPage.qml 2016-05-18 13:59:12 +0000
828+++ telegram/app/qml/AuthCountriesPage.qml 2016-06-22 09:40:14 +0000
829@@ -15,54 +15,76 @@
830
831 focus: true
832 flickable: null
833- title: i18n.tr("Choose a country")
834+
835+ header: PageHeader {
836+ id: choose_header
837+ title: i18n.tr("Choose a country")
838+ property bool searchMode: false
839+ Action {
840+ id: searchAction
841+ iconName: "search";
842+ text: i18n.tr("Search");
843+ onTriggered:{
844+ page.state = "search";
845+ search_text_field.forceActiveFocus();
846+ }
847+ }
848+ Action {
849+ id: backFromSearchAction
850+ // TRANSLATORS: As in, back out of contacts page.
851+ text: i18n.tr("Back")
852+ iconName: "back"
853+ onTriggered: {
854+ search_text_field.text = "";
855+ page.state = "default";
856+ }
857+ }
858+ trailingActionBar.actions: choose_header.searchMode ?
859+ [] : searchAction
860+ leadingActionBar.actions: choose_header.searchMode ?
861+ backFromSearchAction :
862+ choose_header.navigationActions
863+
864+
865+ TextField {
866+ id: search_text_field
867+ visible: choose_header.searchMode
868+ anchors {
869+ right: parent ? parent.right : undefined
870+ rightMargin: units.gu(2)
871+ left: parent ? parent.left : undefined
872+ leftMargin: units.gu(2)
873+ verticalCenter: parent ? parent.verticalCenter : undefined
874+ }
875+ focus: true
876+ inputMethodHints: Qt.ImhNoPredictiveText
877+ onTextChanged: country_list_delegateModel.searchChanged(text)
878+ // TRANSLATORS: Placeholder for contacts search field.
879+ placeholderText: i18n.tr("Search countries...")
880+
881+ onTriggered: {
882+ // TODO No worky.
883+ page.state = "default";
884+ }
885+ }
886+ contents: choose_header.searchMode ? search_text_field : null
887+ }
888
889 // Page states
890 state: "default"
891 states: [
892- PageHeadState {
893+ State {
894 name: "default"
895- head: page.head
896- actions: [
897- Action {
898- iconName: "search";
899- text: i18n.tr("Search");
900- onTriggered:{
901- page.state = "search";
902- search_text_field.forceActiveFocus();
903- }
904- }
905- ]
906+ PropertyChanges {
907+ target: choose_header
908+ searchMode: false
909+ }
910 },
911- PageHeadState {
912+ State {
913 name: "search"
914- head: page.head
915- actions: []
916- backAction: Action {
917- // TRANSLATORS: As in, back out of contacts page.
918- text: i18n.tr("Back")
919- iconName: "back"
920- onTriggered: {
921- search_text_field.text = "";
922- page.state = "default";
923- }
924- }
925- contents: TextField {
926- id: search_text_field
927- anchors {
928- right: parent ? parent.right : undefined
929- rightMargin: units.gu(2)
930- }
931- focus: true
932- inputMethodHints: Qt.ImhNoPredictiveText
933- onTextChanged: country_list_delegateModel.searchChanged(text)
934- // TRANSLATORS: Placeholder for contacts search field.
935- placeholderText: i18n.tr("Search countries...")
936-
937- onTriggered: {
938- // TODO No worky.
939- page.state = "default";
940- }
941+ PropertyChanges {
942+ target: choose_header
943+ searchMode: true
944 }
945 }
946 ]
947@@ -143,7 +165,13 @@
948 id: country_list
949 objectName: "countriesList"
950
951- anchors.fill: parent
952+ anchors {
953+ left: parent.left
954+ right: parent.right
955+ bottom: parent.bottom
956+ top: choose_header.bottom
957+ }
958+
959 currentIndex: -1
960 clip: true
961 cacheBuffer: units.gu(8)*20
962
963=== modified file 'telegram/app/qml/AuthNumberPage.qml'
964--- telegram/app/qml/AuthNumberPage.qml 2016-06-17 13:50:21 +0000
965+++ telegram/app/qml/AuthNumberPage.qml 2016-06-22 09:40:14 +0000
966@@ -20,7 +20,10 @@
967
968 focus: true
969 flickable: null
970- title: i18n.tr("Phone Number")
971+
972+ header: PageHeader {
973+ title: i18n.tr("Phone Number")
974+ }
975
976 onError: {
977 auth_phone_page.isBusy = false;
978@@ -38,7 +41,7 @@
979 id: country_code
980 objectName: "countryCode"
981 anchors {
982- top: parent.top
983+ top: auth_phone_page.header.bottom
984 topMargin: units.gu(4)
985 left: parent.left
986 leftMargin: units.gu(4)
987
988=== modified file 'telegram/app/qml/IntroPage.qml'
989--- telegram/app/qml/IntroPage.qml 2016-05-03 05:17:47 +0000
990+++ telegram/app/qml/IntroPage.qml 2016-06-22 09:40:14 +0000
991@@ -9,6 +9,9 @@
992 id: page
993 objectName: "introPage"
994
995+ // hide the old page header
996+ header: Item { }
997+
998 property bool isWide: page.width > units.gu(70)
999 property alias startMessagingButton: startMessagingButton
1000 property alias currentIndex: slider.currentIndex
1001
1002=== modified file 'telegram/app/qml/ProfilePage.qml'
1003--- telegram/app/qml/ProfilePage.qml 2016-06-03 12:18:56 +0000
1004+++ telegram/app/qml/ProfilePage.qml 2016-06-22 09:40:14 +0000
1005@@ -56,7 +56,10 @@
1006 }
1007 ]
1008
1009- head.actions: isChat ? groupActions : noActions
1010+ header: PageHeader {
1011+ title: profile_page.title
1012+ trailingActionBar.actions: isChat ? groupActions : noActions
1013+ }
1014
1015 signal openDialog(var dialogId)
1016
1017@@ -234,7 +237,7 @@
1018 id: profile_image
1019 anchors {
1020 top: parent.top
1021- topMargin: units.gu(2)
1022+ topMargin: units.gu(2) + profile_page.header.height
1023 left: parent.left
1024 leftMargin: units.gu(2)
1025 }

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: