diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-21 17:30:25 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-22 10:26:27 +0200 |
commit | 1b1e83aeb820df85ce7f10e81fe1f44deab2174e (patch) | |
tree | 8a137d8f286a3595d9171c24b45655c4b2b03427 /framework/qml | |
parent | 777cb40dae338e79e8f4160882b7c37900b42238 (diff) | |
download | kube-1b1e83aeb820df85ce7f10e81fe1f44deab2174e.tar.gz kube-1b1e83aeb820df85ce7f10e81fe1f44deab2174e.zip |
A login view
Diffstat (limited to 'framework/qml')
-rw-r--r-- | framework/qml/LoginAccount.qml | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/framework/qml/LoginAccount.qml b/framework/qml/LoginAccount.qml new file mode 100644 index 00000000..7eaa47f4 --- /dev/null +++ b/framework/qml/LoginAccount.qml | |||
@@ -0,0 +1,117 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | import QtQuick 2.7 | ||
21 | import QtQuick.Layouts 1.1 | ||
22 | import org.kube.framework 1.0 as Kube | ||
23 | |||
24 | Item { | ||
25 | id: root | ||
26 | property string accountId | ||
27 | property bool canRemove: true | ||
28 | |||
29 | function login() { | ||
30 | loader.item.login() | ||
31 | Kube.Fabric.postMessage(Kube.Messages.synchronize, {"accountId": loader.item.accountIdentifier}); | ||
32 | Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) | ||
33 | } | ||
34 | |||
35 | Kube.AccountFactory { | ||
36 | id: accountFactory | ||
37 | accountId: root.accountId | ||
38 | } | ||
39 | |||
40 | Item { | ||
41 | |||
42 | anchors { | ||
43 | fill: parent | ||
44 | margins: Kube.Units.largeSpacing * 2 | ||
45 | } | ||
46 | |||
47 | Kube.Heading { | ||
48 | id: heading | ||
49 | text: loader.item ? loader.item.heading : "" | ||
50 | color: Kube.Colors.highlightColor | ||
51 | } | ||
52 | |||
53 | Kube.Label { | ||
54 | id: subHeadline | ||
55 | |||
56 | anchors { | ||
57 | left: heading.left | ||
58 | top: heading.bottom | ||
59 | } | ||
60 | |||
61 | width: parent.width | ||
62 | text: loader.item ? loader.item.subheadline : "" | ||
63 | color: Kube.Colors.disabledTextColor | ||
64 | wrapMode: Text.Wrap | ||
65 | } | ||
66 | |||
67 | Item { | ||
68 | id: accountEdit | ||
69 | anchors { | ||
70 | top: subHeadline.bottom | ||
71 | left: parent.left | ||
72 | right: parent.right | ||
73 | bottom: footer.top | ||
74 | topMargin: Kube.Units.largeSpacing * 2 | ||
75 | } | ||
76 | |||
77 | Loader { | ||
78 | id: loader | ||
79 | anchors { | ||
80 | top: parent.top | ||
81 | left: parent.left | ||
82 | right: parent.right | ||
83 | } | ||
84 | //The initial size is somehow necessary so the loader is properly anchored | ||
85 | height: 10 | ||
86 | source: accountFactory.loginUi | ||
87 | onLoaded: item.accountId = root.accountId | ||
88 | } | ||
89 | Item { | ||
90 | id: spacer | ||
91 | anchors { | ||
92 | top: loader.bottom | ||
93 | left: parent.left | ||
94 | right: parent.right | ||
95 | bottom: parent.bottom | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | Keys.onReturnPressed: login() | ||
100 | |||
101 | Item { | ||
102 | id: footer | ||
103 | anchors { | ||
104 | bottom: parent.bottom | ||
105 | left: parent.left | ||
106 | right: parent.right | ||
107 | topMargin: Kube.Units.largeSpacing * 2 | ||
108 | } | ||
109 | |||
110 | Kube.Button { | ||
111 | anchors.right: parent.right | ||
112 | text: qsTr("Login") | ||
113 | onClicked: login() | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | } | ||