summaryrefslogtreecommitdiffstats
path: root/framework/qml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/qml')
-rw-r--r--framework/qml/FolderListView.qml209
-rw-r--r--framework/qml/InlineAccountSwitcher.qml27
-rw-r--r--framework/qml/MailListView.qml1
-rw-r--r--framework/qml/Popup.qml1
4 files changed, 124 insertions, 114 deletions
diff --git a/framework/qml/FolderListView.qml b/framework/qml/FolderListView.qml
index c2e7f052..bda3683c 100644
--- a/framework/qml/FolderListView.qml
+++ b/framework/qml/FolderListView.qml
@@ -20,141 +20,156 @@ import QtQuick 2.4
20import QtQuick.Controls 1.4 20import QtQuick.Controls 1.4
21import QtQuick.Controls.Styles 1.4 21import QtQuick.Controls.Styles 1.4
22import QtQuick.Layouts 1.1 22import QtQuick.Layouts 1.1
23import QtQml.Models 2.2
23 24
24import org.kube.framework 1.0 as Kube 25import org.kube.framework 1.0 as Kube
25 26
26Rectangle { 27TreeView {
27 id: root 28 id: treeView
28
29 property variant accountId 29 property variant accountId
30 visible: true
30 31
31 color: Kube.Colors.textColor 32 TableViewColumn {
33 title: "Name"
34 role: "name"
35 }
32 36
33 TreeView { 37 model: Kube.FolderListModel {
34 id: treeView 38 id: folderListModel
39 accountId: treeView.accountId
40 }
41 selection: ItemSelectionModel {
42 model: treeView.model
43 //TODO once we don't loose focus to the next view
44 // onCurrentChanged: {
45 // treeView.activated(selection.currentIndex)
46 // }
47 }
35 48
36 anchors { 49 onActiveFocusChanged: {
37 top: parent.top 50 //Set an initially focused item when the list view receives focus
38 left: parent.left 51 if (activeFocus && !selection.hasSelection) {
39 right: parent.right 52 treeView.selection.setCurrentIndex(model.index(0, 0), ItemSelectionModel.ClearAndSelect)
40 } 53 }
54 }
41 55
42 height: parent.height 56 Keys.onDownPressed: {
43 57 if (!selection.hasSelection) {
44 TableViewColumn { 58 treeView.selection.setCurrentIndex(model.index(0, 0), ItemSelectionModel.ClearAndSelect)
45 title: "Name" 59 } else {
46 role: "name" 60 treeView.selection.setCurrentIndex(model.sibling(selection.currentIndex.row + 1, 0, selection.currentIndex), ItemSelectionModel.ClearAndSelect)
47 } 61 }
62 }
63 Keys.onUpPressed: {
64 treeView.selection.setCurrentIndex(model.sibling(selection.currentIndex.row - 1, 0, selection.currentIndex), ItemSelectionModel.ClearAndSelect)
65 }
66 Keys.onReturnPressed: {
67 treeView.activated(selection.currentIndex)
68 }
48 69
49 model: Kube.FolderListModel { 70 onActivated: {
50 id: folderListModel 71 //TODO do some event compression in case of double clicks
51 accountId: root.accountId 72 model.fetchMore(currentIndex);
52 } 73 Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder": model.data(index, Kube.FolderListModel.DomainObject),
74 "trash": model.data(index, Kube.FolderListModel.Trash)});
75 Kube.Fabric.postMessage(Kube.Messages.synchronize, {"folder": model.data(index, Kube.FolderListModel.DomainObject)});
76 }
77 //Forward the signal because on a desktopsystem activated is only triggerd by double clicks
78 onClicked: treeView.activated(index)
53 79
54 onActivated: { 80 alternatingRowColors: false
55 //TODO do some event compression in case of double clicks 81 headerVisible: false
56 model.fetchMore(currentIndex);
57 Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder": model.data(index, Kube.FolderListModel.DomainObject),
58 "trash": model.data(index, Kube.FolderListModel.Trash)});
59 Kube.Fabric.postMessage(Kube.Messages.synchronize, {"folder": model.data(index, Kube.FolderListModel.DomainObject)});
60 }
61 //Forward the signal because on a desktopsystem activated is only triggerd by double clicks
62 onClicked: treeView.activated(index)
63 82
64 alternatingRowColors: false 83 style: TreeViewStyle {
65 headerVisible: false
66 84
67 style: TreeViewStyle { 85 rowDelegate: Rectangle {
86 color: styleData.selected ? Kube.Colors.highlightColor : Kube.Colors.textColor
68 87
69 rowDelegate: Rectangle { 88 height: Kube.Units.gridUnit * 1.5
70 color: styleData.selected ? Kube.Colors.highlightColor : Kube.Colors.textColor 89 width: 20
71 90
72 height: Kube.Units.gridUnit * 1.5 91 }
73 width: 20
74 92
75 } 93 frame: Rectangle {
94 color: Kube.Colors.textColor
95 }
76 96
77 frame: Rectangle { 97 branchDelegate: Item {
78 color: Kube.Colors.textColor
79 }
80 98
81 branchDelegate: Item { 99 width: 16; height: 16
82 100
83 width: 16; height: 16 101 Kube.Label {
102 anchors.centerIn: parent
84 103
85 Kube.Label { 104 color: Kube.Colors.viewBackgroundColor
86 anchors.centerIn: parent 105 text: styleData.isExpanded ? "-" : "+"
106 }
87 107
88 color: Kube.Colors.viewBackgroundColor 108 //radius: styleData.isExpanded ? 0 : 100
89 text: styleData.isExpanded ? "-" : "+" 109 }
90 }
91 110
92 //radius: styleData.isExpanded ? 0 : 100 111 itemDelegate: Rectangle {
93 }
94 112
95 itemDelegate: Rectangle { 113 color: styleData.selected ? Kube.Colors.highlightColor : Kube.Colors.textColor
96 114
97 color: styleData.selected ? Kube.Colors.highlightColor : Kube.Colors.textColor 115 DropArea {
116 anchors.fill: parent
98 117
99 DropArea { 118 Rectangle {
100 anchors.fill: parent 119 anchors.fill: parent
120 color: Kube.Colors.viewBackgroundColor
101 121
102 Rectangle { 122 opacity: 0.3
103 anchors.fill: parent
104 color: Kube.Colors.viewBackgroundColor
105
106 opacity: 0.3
107 123
108 visible: parent.containsDrag 124 visible: parent.containsDrag
109 }
110 onDropped: {
111 Kube.Fabric.postMessage(Kube.Messages.moveToFolder, {"mail": drop.source.mail, "folder":model.domainObject})
112 drop.accept(Qt.MoveAction)
113 drop.source.visible = false
114 }
115 } 125 }
126 onDropped: {
127 Kube.Fabric.postMessage(Kube.Messages.moveToFolder, {"mail": drop.source.mail, "folder":model.domainObject})
128 drop.accept(Qt.MoveAction)
129 drop.source.visible = false
130 }
131 }
116 132
117 Row { 133 Row {
134 anchors {
135 verticalCenter: parent.verticalCenter
136 left: parent.left
137 }
138 Kube.Label {
118 anchors { 139 anchors {
119 verticalCenter: parent.verticalCenter 140 verticalCenter: parent.verticalCenter
120 left: parent.left 141 leftMargin: Kube.Units.smallSpacing
121 } 142 }
122 Kube.Label {
123 anchors {
124 verticalCenter: parent.verticalCenter
125 leftMargin: Kube.Units.smallSpacing
126 }
127 143
128 text: styleData.value 144 text: styleData.value
129 145
130 color: Kube.Colors.viewBackgroundColor 146 color: Kube.Colors.viewBackgroundColor
131 } 147 }
132 Kube.Icon { 148 Kube.Icon {
133 id: statusIcon 149 id: statusIcon
134 visible: false 150 visible: false
135 iconName: "" 151 iconName: ""
136 states: [ 152 states: [
137 State { 153 State {
138 name: "busy"; when: model.status == Kube.FolderListModel.InProgressStatus 154 name: "busy"; when: model.status == Kube.FolderListModel.InProgressStatus
139 PropertyChanges { target: statusIcon; iconName: Kube.Icons.busy_inverted ; visible: styleData.selected } 155 PropertyChanges { target: statusIcon; iconName: Kube.Icons.busy_inverted ; visible: styleData.selected }
140 }, 156 },
141 State { 157 State {
142 name: "error"; when: model.status == Kube.FolderListModel.ErrorStatus 158 name: "error"; when: model.status == Kube.FolderListModel.ErrorStatus
143 //The error status should only be visible for a moment, otherwise we'll eventually always show errors everywhere. 159 //The error status should only be visible for a moment, otherwise we'll eventually always show errors everywhere.
144 PropertyChanges { target: statusIcon; iconName: Kube.Icons.error_inverted; visible: styleData.selected } 160 PropertyChanges { target: statusIcon; iconName: Kube.Icons.error_inverted; visible: styleData.selected }
145 }, 161 },
146 State { 162 State {
147 name: "checkmark"; when: model.status == Kube.FolderListModel.SuccessStatus 163 name: "checkmark"; when: model.status == Kube.FolderListModel.SuccessStatus
148 //The success status should only be visible for a moment, otherwise we'll eventually always show checkmarks everywhere. 164 //The success status should only be visible for a moment, otherwise we'll eventually always show checkmarks everywhere.
149 PropertyChanges { target: statusIcon; iconName: Kube.Icons.success_inverted; visible: styleData.selected} 165 PropertyChanges { target: statusIcon; iconName: Kube.Icons.success_inverted; visible: styleData.selected}
150 } 166 }
151 ] 167 ]
152 }
153 } 168 }
154 } 169 }
155
156 backgroundColor: Kube.Colors.textColor
157 highlightedTextColor: Kube.Colors.highlightedTextColor
158 } 170 }
171
172 backgroundColor: Kube.Colors.textColor
173 highlightedTextColor: Kube.Colors.highlightedTextColor
159 } 174 }
160} 175}
diff --git a/framework/qml/InlineAccountSwitcher.qml b/framework/qml/InlineAccountSwitcher.qml
index d87dac9a..4131b971 100644
--- a/framework/qml/InlineAccountSwitcher.qml
+++ b/framework/qml/InlineAccountSwitcher.qml
@@ -20,23 +20,15 @@ import QtQuick 2.4
20import QtQuick.Layouts 1.1 20import QtQuick.Layouts 1.1
21import org.kube.framework 1.0 as Kube 21import org.kube.framework 1.0 as Kube
22 22
23Rectangle { 23FocusScope {
24 id: root 24 id: root
25
26 property string currentAccount: null 25 property string currentAccount: null
27 26
28 Kube.AccountsModel {
29 id: accountsModel
30 }
31
32 color: Kube.Colors.textColor
33 clip: true
34
35 ColumnLayout { 27 ColumnLayout {
36 anchors.fill: parent 28 anchors.fill: parent
37 29
38 Repeater { 30 Repeater {
39 model: accountsModel 31 model: Kube.AccountsModel {}
40 onItemAdded: { 32 onItemAdded: {
41 //Autoselect the first account to appear 33 //Autoselect the first account to appear
42 if (!currentAccount) { 34 if (!currentAccount) {
@@ -45,12 +37,13 @@ Rectangle {
45 } 37 }
46 38
47 delegate: Item { 39 delegate: Item {
48 id: accountDelagte 40 id: accountDelegate
49 property variant currentData: model 41 property variant currentData: model
42 property bool isCurrent: (model.accountId == root.currentAccount)
50 43
51 height: Kube.Units.gridUnit 44 height: Kube.Units.gridUnit
52 width: root.width 45 width: root.width
53 Layout.fillHeight: model.accountId == root.currentAccount 46 Layout.fillHeight: isCurrent
54 47
55 Rectangle { 48 Rectangle {
56 id: accountLabel 49 id: accountLabel
@@ -59,6 +52,10 @@ Rectangle {
59 width: parent.width 52 width: parent.width
60 53
61 color: Kube.Colors.textColor 54 color: Kube.Colors.textColor
55 activeFocusOnTab: !isCurrent
56 Keys.onReturnPressed: {
57 root.currentAccount = model.accountId
58 }
62 59
63 MouseArea { 60 MouseArea {
64 anchors.fill: parent 61 anchors.fill: parent
@@ -111,10 +108,10 @@ Rectangle {
111 right: parent.right 108 right: parent.right
112 bottom: parent.bottom 109 bottom: parent.bottom
113 } 110 }
111 activeFocusOnTab: true
114 112
115 accountId: model.accountId 113 accountId: currentData.accountId
116 visible: model.accountId == root.currentAccount 114 visible: isCurrent
117
118 } 115 }
119 } 116 }
120 } 117 }
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml
index 80d18256..b7b09d61 100644
--- a/framework/qml/MailListView.qml
+++ b/framework/qml/MailListView.qml
@@ -67,7 +67,6 @@ Item {
67 id: listView 67 id: listView
68 68
69 anchors.fill: parent 69 anchors.fill: parent
70 focus: true
71 clip: true 70 clip: true
72 71
73 ScrollBar.vertical: ScrollBar{ 72 ScrollBar.vertical: ScrollBar{
diff --git a/framework/qml/Popup.qml b/framework/qml/Popup.qml
index baba4933..dc3bd349 100644
--- a/framework/qml/Popup.qml
+++ b/framework/qml/Popup.qml
@@ -29,6 +29,5 @@ T.Popup {
29 background: Rectangle { 29 background: Rectangle {
30 color: Colors.backgroundColor 30 color: Colors.backgroundColor
31 } 31 }
32 focus: true
33 modal: true 32 modal: true
34} 33}