Merge lp:~renatofilho/messaging-app/settings-create-account into lp:~phablet-team/messaging-app/irc-service

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Merged at revision: 618
Proposed branch: lp:~renatofilho/messaging-app/settings-create-account
Merge into: lp:~phablet-team/messaging-app/irc-service
Diff against target: 173 lines (+134/-5)
2 files modified
src/qml/OnlineAccountsHelper.qml (+91/-0)
src/qml/SettingsPage.qml (+43/-5)
To merge this branch: bzr merge lp:~renatofilho/messaging-app/settings-create-account
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+314530@code.launchpad.net

Commit message

Allow create online accounts from settings page.

To post a comment you must log in.
621. By Renato Araujo Oliveira Filho

Update settings item visual.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'src/qml/OnlineAccountsHelper.qml'
2--- src/qml/OnlineAccountsHelper.qml 1970-01-01 00:00:00 +0000
3+++ src/qml/OnlineAccountsHelper.qml 2017-01-11 14:12:19 +0000
4@@ -0,0 +1,91 @@
5+/*
6+ * Copyright (C) 2014 Canonical, Ltd.
7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License as published by
10+ * the Free Software Foundation; version 3.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+
21+import QtQuick 2.4
22+import Ubuntu.Components 1.3
23+import Ubuntu.OnlineAccounts 0.1
24+import Ubuntu.OnlineAccounts.Client 0.1
25+import Ubuntu.Components.Popups 1.3
26+
27+Item {
28+ id: root
29+
30+ property var dialogInstance: null
31+
32+ function run(){
33+ if (!root.dialogInstance) {
34+ root.dialogInstance = PopupUtils.open(dialog)
35+ }
36+ }
37+
38+ Component {
39+ id: dialog
40+ Dialog {
41+ id: dialogue
42+ title: "Online Accounts"
43+ text: i18n.tr("Pick an account to create.")
44+
45+ ScrollView {
46+ width: dialog.width
47+ height: Math.min(listView.count, 3) * units.gu(7)
48+
49+ ListView {
50+ id: listView
51+
52+ anchors.fill: parent
53+ clip: true
54+ model: ProviderModel {
55+ applicationId: "messaging-app"
56+ }
57+ delegate: ListItem {
58+ ListItemLayout {
59+ title.text: model.displayName
60+
61+ Image {
62+ SlotsLayout.position: SlotsLayout.First
63+ source: "image://theme/" + model.iconName
64+ width: units.gu(5)
65+ height: width
66+ }
67+ }
68+ onClicked: {
69+ listView.enabled = false
70+ setup.providerId = model.providerId
71+ setup.exec()
72+ }
73+ }
74+ }
75+ }
76+ Button {
77+ text: i18n.tr("Cancel")
78+ onClicked: PopupUtils.close(dialogue)
79+ }
80+
81+ Component.onDestruction: {
82+ root.dialogInstance = null
83+ }
84+ }
85+ }
86+
87+ Setup {
88+ id: setup
89+ applicationId: "messaging-app"
90+ providerId: "irc"
91+ onFinished: {
92+ PopupUtils.close(root.dialogInstance)
93+ }
94+ }
95+}
96
97=== modified file 'src/qml/SettingsPage.qml'
98--- src/qml/SettingsPage.qml 2016-11-10 01:36:05 +0000
99+++ src/qml/SettingsPage.qml 2017-01-11 14:12:19 +0000
100@@ -19,6 +19,7 @@
101 import QtQuick 2.2
102 import Ubuntu.Components 1.3
103 import Ubuntu.Components.ListItems 1.3 as ListItem
104+import Ubuntu.OnlineAccounts.Client 0.1
105
106 Page {
107 id: settingsPage
108@@ -85,18 +86,46 @@
109 }
110 }
111 }
112+ ListItem.ThinDivider {
113+ anchors {
114+ left: parent.left
115+ right: parent.right
116+ bottom: parent.bottom
117+ }
118+ }
119 }
120 }
121
122- ListView {
123+ Column {
124 anchors {
125 top: pageHeader.bottom
126 left: parent.left
127 right: parent.right
128- bottom: parent.bottom
129- }
130- model: settingsModel
131- delegate: settingDelegate
132+ }
133+ height: childrenRect.height
134+
135+ Repeater {
136+ anchors {
137+ left: parent.left
138+ right: parent.right
139+ }
140+ model: settingsModel
141+ delegate: settingDelegate
142+ }
143+
144+ ListItem.Standard {
145+ id: addAccount
146+
147+ anchors {
148+ left: parent.left
149+ right: parent.right
150+ }
151+
152+ text: i18n.tr("Add an online account")
153+ progression: true
154+ onClicked: onlineAccountHelper.item.run()
155+ enabled: onlineAccountHelper.status == Loader.Ready
156+ }
157 }
158
159 Loader {
160@@ -114,4 +143,13 @@
161 hint.height: 0
162 }
163 }
164+
165+ Loader {
166+ id: onlineAccountHelper
167+
168+ anchors.fill: parent
169+ asynchronous: true
170+ source: Qt.resolvedUrl("OnlineAccountsHelper.qml")
171+ }
172+
173 }

Subscribers

People subscribed via source and target branches