Merge lp:~cellsoftware/telegram-app/1592266 into lp:telegram-app

Proposed by Ash
Status: Merged
Approved by: Jin
Approved revision: 218
Merged at revision: 220
Proposed branch: lp:~cellsoftware/telegram-app/1592266
Merge into: lp:telegram-app
Diff against target: 196 lines (+92/-82)
1 file modified
telegram/app/qml/AccountDialogPage.qml (+92/-82)
To merge this branch: bzr merge lp:~cellsoftware/telegram-app/1592266
Reviewer Review Type Date Requested Status
Jin (community) Approve
Review via email: mp+300064@code.launchpad.net

Description of the change

There was a 'Connection' component missing from the 'AccountDialogPage' and just basically adds a function that navigates the user back and shows the 'Select Chat' option.

To post a comment you must log in.
Revision history for this message
Jin (jindallo) wrote :

The code looks good and verified pass locally,
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/AccountDialogPage.qml'
2--- telegram/app/qml/AccountDialogPage.qml 2016-06-17 13:55:02 +0000
3+++ telegram/app/qml/AccountDialogPage.qml 2016-07-14 12:47:51 +0000
4@@ -1,4 +1,5 @@
5 import QtQuick 2.4
6+import Ubuntu.Content 1.3
7 import Ubuntu.Components 1.3
8 import Ubuntu.Components.ListItems 1.3 as ListItem
9 import QtQuick.Window 2.2
10@@ -80,88 +81,85 @@
11 objectName: "dialogPage"
12
13 header: PageHeader {
14- id: dialog_page_header
15- trailingActionBar.actions: message_list.inSelectionMode ? selectionActions : defaultActions
16- leadingActionBar.actions: Action {
17- id: back_action
18- iconName: message_list.inSelectionMode ? "close" : "back"
19- onTriggered: {
20- if (message_list.inSelectionMode) {
21- message_list.cancelSelection()
22- } else {
23- if(mainView.width > units.gu(80)) {
24- dialogDidGoBack = true;
25- }
26- pageStack.removePages(dialog_page);
27- }
28- }
29- }
30- flickable: null
31-
32- //Adds components to the header
33- contents: Rectangle {
34- anchors {
35- top: parent.top
36- topMargin: units.dp(8)
37- left: parent.left
38- verticalCenter: parent
39- right: parent.right
40- rightMargin: units.gu(5)
41- bottom: parent.bottom
42- }
43-
44- //Text adjusts to the parent
45- Text {
46- anchors {
47- top: parent.top
48- topMargin: units.gu(0.2)
49- left: imgAvatar.right
50- leftMargin: units.gu(1)
51- }
52- width: parent.width
53-
54- text: {
55- if (!currentDialog) return "";
56- if (isChat) {
57- return chat ? chat.title : ""; //Shown if a group chat
58- } else {
59- return user ? user.firstName + " " + user.lastName : ""; //Shown if a scret chat
60- }
61- }
62- font.pixelSize: FontUtils.sizeToPixels("large")
63- //Word wraps text when text is too long for width
64- wrapMode: Text.WordWrap
65- //Enables the elipse to the end of the text
66- elide: Text.ElideRight
67- //Wraps text to 1 line
68- maximumLineCount: 1
69- }
70-
71- //Avatar component gets avatar for user as specified from 'dialog' parameter
72- Avatar {
73- id: imgAvatar
74-
75- width: height
76- telegram: dialog_page.telegramObject
77- dialog: dialog_page.currentDialog
78- }
79-
80- //'Lock' image that is overlayed ontop of the Avatar conponent
81- Image {
82- anchors {
83- left: imgAvatar.right
84- leftMargin: -width-5
85- top: imgAvatar.top
86- topMargin: units.dp(2)
87- }
88- width: units.gu(1)
89- height: units.gu(1.5)
90- source: "qrc:/qml/files/lock.png"
91- sourceSize: Qt.size(width, height)
92- visible: currentDialog.encrypted
93- }
94- }
95- }
96+ id: dialog_page_header
97+ trailingActionBar.actions: message_list.inSelectionMode ? selectionActions : defaultActions
98+ leadingActionBar.actions: Action {
99+ id: back_action
100+ iconName: message_list.inSelectionMode ? "close" : "back"
101+ onTriggered: {
102+ if (message_list.inSelectionMode) {
103+ message_list.cancelSelection()
104+ } else {
105+ backToChatList();
106+ }
107+ }
108+ }
109+ flickable: null
110+
111+ //Adds components to the header
112+ contents: Rectangle {
113+ anchors {
114+ top: parent.top
115+ topMargin: units.dp(8)
116+ left: parent.left
117+ verticalCenter: parent
118+ right: parent.right
119+ rightMargin: units.gu(5)
120+ bottom: parent.bottom
121+ }
122+
123+ //Text adjusts to the parent
124+ Text {
125+ anchors {
126+ top: parent.top
127+ topMargin: units.gu(0.2)
128+ left: imgAvatar.right
129+ leftMargin: units.gu(1)
130+ }
131+ width: parent.width
132+
133+ text: {
134+ if (!currentDialog) return "";
135+ if (isChat) {
136+ return chat ? chat.title : ""; //Shown if a group chat
137+ } else {
138+ return user ? user.firstName + " " + user.lastName : ""; //Shown if a scret chat
139+ }
140+ }
141+ font.pixelSize: FontUtils.sizeToPixels("large")
142+ //Word wraps text when text is too long for width
143+ wrapMode: Text.WordWrap
144+ //Enables the elipse to the end of the text
145+ elide: Text.ElideRight
146+ //Wraps text to 1 line
147+ maximumLineCount: 1
148+ }
149+
150+ //Avatar component gets avatar for user as specified from 'dialog' parameter
151+ Avatar {
152+ id: imgAvatar
153+
154+ width: height
155+ telegram: dialog_page.telegramObject
156+ dialog: dialog_page.currentDialog
157+ }
158+
159+ //'Lock' image that is overlayed ontop of the Avatar conponent
160+ Image {
161+ anchors {
162+ left: imgAvatar.right
163+ leftMargin: -width-5
164+ top: imgAvatar.top
165+ topMargin: units.dp(2)
166+ }
167+ width: units.gu(1)
168+ height: units.gu(1.5)
169+ source: "qrc:/qml/files/lock.png"
170+ sourceSize: Qt.size(width, height)
171+ visible: currentDialog.encrypted
172+ }
173+ }
174+ }
175
176 signal forwardRequest(var messageIds);
177 signal tagSearchRequest(string tag);
178@@ -176,6 +174,18 @@
179 });
180 }
181
182+ function backToChatList() {
183+ if(mainView.width > units.gu(80)) {
184+ dialogDidGoBack = true;
185+ }
186+ pageStack.removePages(dialog_page);
187+ }
188+
189+ Connections {
190+ target: ContentHub
191+ onShareRequested: backToChatList()
192+ }
193+
194 Component.onCompleted: {
195 // This is needed to have the username list ready for @ completion
196 // CuteGram upstream calls this implicitly because of the items in the top bar.

Subscribers

People subscribed via source and target branches

to status/vote changes: