summaryrefslogtreecommitdiffstats
path: root/components/kube/qml/AccountsView.qml
diff options
context:
space:
mode:
Diffstat (limited to 'components/kube/qml/AccountsView.qml')
-rw-r--r--components/kube/qml/AccountsView.qml143
1 files changed, 0 insertions, 143 deletions
diff --git a/components/kube/qml/AccountsView.qml b/components/kube/qml/AccountsView.qml
deleted file mode 100644
index 9b774907..00000000
--- a/components/kube/qml/AccountsView.qml
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19import QtQuick 2.4
20import QtQuick.Layouts 1.1
21import QtQuick.Controls 1.3 as Controls
22import QtQuick.Controls 2.0
23import org.kube.framework 1.0 as Kube
24import org.kube.components.accounts 1.0 as KubeAccounts
25
26FocusScope {
27 id: root
28 //Defines whether more than one account is supported.
29 property bool singleAccountMode: false
30 //Defines available account types.
31 property var availableAccountPlugins: ["kolabnow", "imap", "maildir", "gmail"]
32
33 Controls.SplitView {
34 height: parent.height
35 width: parent.width
36
37 Item {
38 id: accountList
39 width: Kube.Units.gridUnit * 12
40 Layout.fillHeight: true
41 visible: !root.singleAccountMode
42
43 Kube.PositiveButton {
44 id: newAccountButton
45 anchors {
46 top: parent.top
47 left: parent.left
48 right: parent.right
49 margins: Kube.Units.largeSpacing
50 }
51 text: qsTr("New Account")
52
53 onClicked: accountWizard.open()
54 }
55
56 Kube.ListView {
57 id: listView
58
59 anchors {
60 top: newAccountButton.bottom
61 left: parent.left
62 right: parent.right
63 bottom: parent.bottom
64 topMargin: Kube.Units.largeSpacing
65 }
66
67 clip: true
68
69 model: Kube.AccountsModel {}
70
71 onCurrentItemChanged: {
72 if (currentItem) {
73 edit.accountId = currentItem.currentData.accountId
74 }
75 }
76
77 delegate: Kube.ListDelegate {
78 id: delegateRoot
79
80 Kube.Label {
81 anchors {
82 verticalCenter: parent.verticalCenter
83 left: parent.left
84 leftMargin: Kube.Units.largeSpacing
85 }
86 width: parent.width - Kube.Units.largeSpacing * 2
87
88 text: model.name
89 color: delegateRoot.textColor
90 elide: Text.ElideRight
91 }
92 }
93 }
94 }
95
96 Item {
97 height: parent.height
98 width: Kube.Units.gridUnit * 20
99 Layout.fillWidth: true
100
101 Kube.EditAccount {
102 id: edit
103 anchors {
104 fill: parent
105 bottomMargin: Kube.Units.largeSpacing
106 }
107
108 canRemove: !root.singleAccountMode
109
110 Component.onCompleted: {
111 //We don't have any accounts setup if accountId is empty, so we trigger the accountWizard
112 //FIXME: this assumes we load accounts synchronously, which we do right now.
113 if (accountId == "") {
114 //Require the setup to be completed since it's the first account
115 accountWizard.requireSetup = true
116 //Launch account wizard
117 accountWizard.open()
118 }
119 }
120 }
121 }
122 }
123
124 onActiveFocusChanged: {
125 if (activeFocus && accountWizard.visible) {
126 accountWizard.forceActiveFocus()
127 }
128 }
129
130 //BEGIN AccountWizard
131 KubeAccounts.AccountWizard {
132 id: accountWizard
133
134 parent: ApplicationWindow.overlay
135 height: app.height
136 width: app.width - app.sidebarWidth
137 x: app.sidebarWidth
138 y: 0
139
140 availableAccountPlugins: root.availableAccountPlugins
141 }
142 //END AccountWizard
143}