summaryrefslogtreecommitdiffstats
path: root/framework/qml/InlineAccountSwitcher.qml
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2017-04-21 13:05:40 +0200
committerMichael Bohlender <michael.bohlender@kdemail.net>2017-04-21 13:05:40 +0200
commit1f0bc11f4fe1fb96d25f88fc01c7300e700a82b8 (patch)
treeb58e132f94789ec7744e6c4993307af39be914ce /framework/qml/InlineAccountSwitcher.qml
parent4a04da5998ee2748659d54ea3a5781d167e66808 (diff)
downloadkube-1f0bc11f4fe1fb96d25f88fc01c7300e700a82b8.tar.gz
kube-1f0bc11f4fe1fb96d25f88fc01c7300e700a82b8.zip
initial inline account switcher
Diffstat (limited to 'framework/qml/InlineAccountSwitcher.qml')
-rw-r--r--framework/qml/InlineAccountSwitcher.qml120
1 files changed, 120 insertions, 0 deletions
diff --git a/framework/qml/InlineAccountSwitcher.qml b/framework/qml/InlineAccountSwitcher.qml
new file mode 100644
index 00000000..b7e70746
--- /dev/null
+++ b/framework/qml/InlineAccountSwitcher.qml
@@ -0,0 +1,120 @@
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 org.kube.framework 1.0 as Kube
22
23Rectangle {
24 id: root
25
26 property string currentAccount: null
27 property var currentFolder: null
28 property bool isTrashFolder: false
29
30 Kube.AccountsModel {
31 id: accountsModel
32 }
33
34 color: Kube.Colors.textColor
35
36 ColumnLayout {
37 anchors.fill: parent
38
39 Repeater {
40 model: accountsModel
41
42 delegate: Item {
43 id: accountDelagte
44
45 height: Kube.Units.gridUnit
46 width: root.width
47 Layout.fillHeight: model.accountId == root.currentAccount
48
49 Rectangle {
50 id: accountLabel
51
52 height: Kube.Units.gridUnit
53 width: parent.width
54
55 color: Kube.Colors.textColor
56
57 MouseArea {
58 anchors.fill: parent
59 onClicked: {
60 root.currentAccount = model.accountId
61 }
62 }
63
64 Row {
65 spacing: Kube.Units.smallSpacing
66 anchors.verticalCenter: parent.verticalCenter
67 Layout.fillHeight: true
68
69 Kube.Label{
70 text: model.name
71 font.weight: Font.Bold
72 color: Kube.Colors.highlightedTextColor
73 }
74
75 Kube.Icon {
76 id: statusIcon
77 visible: false
78 iconName: ""
79 states: [
80 State {
81 name: "busy"; when: model.status == Kube.AccountsModel.BusyStatus
82 PropertyChanges { target: statusIcon; iconName: Kube.Icons.busy_inverted; visible: true }
83 },
84 State {
85 name: "error"; when: model.status == Kube.AccountsModel.ErrorStatus
86 PropertyChanges { target: statusIcon; iconName: Kube.Icons.error_inverted; visible: true }
87 },
88 State {
89 name: "checkmark"; when: model.status == Kube.AccountsModel.ConnectedStatus
90 PropertyChanges { target: statusIcon; iconName: Kube.Icons.connected_inverted; visible: true }
91 },
92 State {
93 name: "disconnected"; when: model.status == Kube.AccountsModel.OfflineStatus
94 PropertyChanges { target: statusIcon; iconName: Kube.Icons.noNetworkConnection_inverted; visible: true }
95 }
96 ]
97 }
98 }
99 }
100
101 Kube.FolderListView {
102 anchors {
103 top: accountLabel.bottom
104 left: parent.left
105 right: parent.right
106 bottom: parent.bottom
107 }
108
109 accountId: model.accountId
110 visible: model.accountId == root.currentAccount
111
112 onCurrentFolderChanged: {
113 root.currentFolder = currentFolder
114 root.isTrashFolder = isTrashFolder
115 }
116 }
117 }
118 }
119 }
120}