diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/qml/FolderListView.qml | 30 | ||||
-rw-r--r-- | framework/qml/InlineAccountSwitcher.qml | 120 | ||||
-rw-r--r-- | framework/qmldir | 2 |
3 files changed, 124 insertions, 28 deletions
diff --git a/framework/qml/FolderListView.qml b/framework/qml/FolderListView.qml index 11e29662..4082e08d 100644 --- a/framework/qml/FolderListView.qml +++ b/framework/qml/FolderListView.qml | |||
@@ -21,7 +21,6 @@ import QtQuick.Controls 1.4 | |||
21 | import QtQuick.Controls.Styles 1.4 | 21 | import QtQuick.Controls.Styles 1.4 |
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 |
23 | 23 | ||
24 | import org.kde.kirigami 1.0 as Kirigami | ||
25 | import org.kube.framework 1.0 as Kube | 24 | import org.kube.framework 1.0 as Kube |
26 | 25 | ||
27 | Rectangle { | 26 | Rectangle { |
@@ -42,18 +41,6 @@ Rectangle { | |||
42 | } | 41 | } |
43 | } | 42 | } |
44 | 43 | ||
45 | Menu { | ||
46 | id: contextMenu | ||
47 | title: "Edit" | ||
48 | |||
49 | MenuItem { | ||
50 | text: "Synchronize" | ||
51 | onTriggered: { | ||
52 | folderController.synchronizeAction.execute() | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | |||
57 | TreeView { | 44 | TreeView { |
58 | id: treeView | 45 | id: treeView |
59 | 46 | ||
@@ -80,29 +67,18 @@ Rectangle { | |||
80 | root.currentFolder = model.data(currentIndex, Kube.FolderListModel.DomainObject) | 67 | root.currentFolder = model.data(currentIndex, Kube.FolderListModel.DomainObject) |
81 | root.isTrashFolder = model.data(currentIndex, Kube.FolderListModel.Trash) | 68 | root.isTrashFolder = model.data(currentIndex, Kube.FolderListModel.Trash) |
82 | folderController.synchronizeAction.execute() | 69 | folderController.synchronizeAction.execute() |
70 | console.error(model.data) | ||
83 | } | 71 | } |
84 | 72 | ||
85 | alternatingRowColors: false | 73 | alternatingRowColors: false |
86 | headerVisible: false | 74 | headerVisible: false |
87 | 75 | ||
88 | MouseArea { | ||
89 | anchors.fill: parent | ||
90 | acceptedButtons: Qt.RightButton | ||
91 | onClicked: { | ||
92 | var index = parent.indexAt(mouse.x, mouse.y) | ||
93 | if (index.valid) { | ||
94 | folderController.folder = treeView.model.data(index, Kube.FolderListModel.DomainObject) | ||
95 | contextMenu.popup() | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | |||
100 | style: TreeViewStyle { | 76 | style: TreeViewStyle { |
101 | 77 | ||
102 | rowDelegate: Rectangle { | 78 | rowDelegate: Rectangle { |
103 | color: styleData.selected ? Kube.Colors.highlightColor : Kube.Colors.textColor | 79 | color: styleData.selected ? Kube.Colors.highlightColor : Kube.Colors.textColor |
104 | 80 | ||
105 | height: Kirigami.Units.gridUnit * 1.5 | 81 | height: Kube.Units.gridUnit * 1.5 |
106 | width: 20 | 82 | width: 20 |
107 | 83 | ||
108 | } | 84 | } |
@@ -157,7 +133,7 @@ Rectangle { | |||
157 | Kube.Label { | 133 | Kube.Label { |
158 | anchors { | 134 | anchors { |
159 | verticalCenter: parent.verticalCenter | 135 | verticalCenter: parent.verticalCenter |
160 | leftMargin: Kirigami.Units.smallSpacing | 136 | leftMargin: Kube.Units.smallSpacing |
161 | } | 137 | } |
162 | 138 | ||
163 | text: styleData.value | 139 | text: styleData.value |
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 | |||
19 | import QtQuick 2.4 | ||
20 | import QtQuick.Layouts 1.1 | ||
21 | import org.kube.framework 1.0 as Kube | ||
22 | |||
23 | Rectangle { | ||
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 | } | ||
diff --git a/framework/qmldir b/framework/qmldir index 1cc25b18..35d1cb62 100644 --- a/framework/qmldir +++ b/framework/qmldir | |||
@@ -6,6 +6,7 @@ ConversationView 1.0 ConversationView.qml | |||
6 | FolderListView 1.0 FolderListView.qml | 6 | FolderListView 1.0 FolderListView.qml |
7 | MailListView 1.0 MailListView.qml | 7 | MailListView 1.0 MailListView.qml |
8 | AccountSwitcher 1.0 AccountSwitcher.qml | 8 | AccountSwitcher 1.0 AccountSwitcher.qml |
9 | InlineAccountSwitcher 1.0 InlineAccountSwitcher.qml | ||
9 | NewAccountDialog 1.0 NewAccountDialog.qml | 10 | NewAccountDialog 1.0 NewAccountDialog.qml |
10 | EditAccountDialog 1.0 EditAccountDialog.qml | 11 | EditAccountDialog 1.0 EditAccountDialog.qml |
11 | OverlayDialog 1.0 OverlayDialog.qml | 12 | OverlayDialog 1.0 OverlayDialog.qml |
@@ -24,5 +25,4 @@ singleton Icons 1.0 Icons.qml | |||
24 | singleton Units 1.0 Units.qml | 25 | singleton Units 1.0 Units.qml |
25 | singleton Font 1.0 Font.qml | 26 | singleton Font 1.0 Font.qml |
26 | 27 | ||
27 | |||
28 | plugin frameworkplugin | 28 | plugin frameworkplugin |