summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-04 19:19:41 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-04 19:19:41 +0200
commitd9295fc8f19e4005f8454e7f193f80316550ac0c (patch)
treef27c370d54bced09212b9c4a12b827d1cebb6110 /framework
parentd002eae7f8b443dd1bad914444c296088c2b6e85 (diff)
downloadkube-d9295fc8f19e4005f8454e7f193f80316550ac0c.tar.gz
kube-d9295fc8f19e4005f8454e7f193f80316550ac0c.zip
One framework plugin to rule them all
Diffstat (limited to 'framework')
-rw-r--r--framework/CMakeLists.txt3
-rw-r--r--framework/accounts/qmldir4
-rw-r--r--framework/actions/qmldir3
-rw-r--r--framework/domain/qmldir3
-rw-r--r--framework/notifications/qmldir3
-rw-r--r--framework/qml/AccountSwitcher.qml215
-rw-r--r--framework/qml/AttachmentDelegate.qml68
-rw-r--r--framework/qml/AutocompleteLineEdit.qml143
-rw-r--r--framework/qml/Avatar.qml57
-rw-r--r--framework/qml/Button.qml57
-rw-r--r--framework/qml/ConversationView.qml574
-rw-r--r--framework/qml/EditAccount.qml138
-rw-r--r--framework/qml/EditAccountDialog.qml38
-rw-r--r--framework/qml/FocusComposer.qml252
-rw-r--r--framework/qml/FolderListView.qml195
-rw-r--r--framework/qml/Icon.qml48
-rw-r--r--framework/qml/ListItem.qml64
-rw-r--r--framework/qml/MailListView.qml292
-rw-r--r--framework/qml/MailViewer.qml76
-rw-r--r--framework/qml/Notification.qml83
-rw-r--r--framework/qml/Outbox.qml151
-rw-r--r--framework/qml/OverlayDialog.qml64
-rw-r--r--framework/qml/People.qml435
-rw-r--r--framework/qml/PositiveButton.qml47
-rw-r--r--framework/qmldir23
-rw-r--r--framework/settings/qmldir3
26 files changed, 3023 insertions, 16 deletions
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
index d14360b4..f097f658 100644
--- a/framework/CMakeLists.txt
+++ b/framework/CMakeLists.txt
@@ -33,6 +33,9 @@ enable_testing()
33 33
34set(SINK_RESOURCE_PLUGINS_PATH ${QT_PLUGIN_INSTALL_DIR}/sink/resources) 34set(SINK_RESOURCE_PLUGINS_PATH ${QT_PLUGIN_INSTALL_DIR}/sink/resources)
35 35
36install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/framework)
37install(DIRECTORY qml DESTINATION ${QML_INSTALL_DIR}/org/kube/framework)
38
36# The actions framework 39# The actions framework
37add_subdirectory(actions) 40add_subdirectory(actions)
38# The settings framework 41# The settings framework
diff --git a/framework/accounts/qmldir b/framework/accounts/qmldir
deleted file mode 100644
index 662725de..00000000
--- a/framework/accounts/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
1module org.kube.framework.accounts
2
3plugin accountsplugin
4
diff --git a/framework/actions/qmldir b/framework/actions/qmldir
deleted file mode 100644
index f6dccbda..00000000
--- a/framework/actions/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
1module org.kube.framework.actions
2
3plugin actionplugin
diff --git a/framework/domain/qmldir b/framework/domain/qmldir
deleted file mode 100644
index 54a3a98b..00000000
--- a/framework/domain/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
1module org.kube.framework.domain
2
3plugin mailplugin
diff --git a/framework/notifications/qmldir b/framework/notifications/qmldir
deleted file mode 100644
index 4eaad10c..00000000
--- a/framework/notifications/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
1module org.kube.framework.notifications
2
3plugin notificationplugin
diff --git a/framework/qml/AccountSwitcher.qml b/framework/qml/AccountSwitcher.qml
new file mode 100644
index 00000000..0cd91adc
--- /dev/null
+++ b/framework/qml/AccountSwitcher.qml
@@ -0,0 +1,215 @@
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 2.0 as Controls2
22import QtQuick.Controls 1.4 as Controls
23
24import QtQml 2.2 as QtQml
25
26import org.kde.kirigami 1.0 as Kirigami
27
28import org.kube.framework.domain 1.0 as KubeFramework
29import org.kube.framework.accounts 1.0 as KubeAccounts
30import org.kube.components 1.0 as KubeComponents
31import org.kube.components.theme 1.0 as KubeTheme
32
33Controls.ToolButton {
34 id: accountSwitcher
35
36 property variant accountId
37 property variant accountName
38
39 width: parent.width
40
41 KubeFramework.FolderController {
42 id: folderController
43 accountId: accountId
44 }
45
46 KubeAccounts.AccountsModel {
47 id: accountsModel
48 }
49
50
51 onClicked: {
52 popup.open()
53 }
54
55 Controls2.Popup {
56 id: popup
57
58 height: listView.count == 0 ? Kirigami.Units.gridUnit * 4 : Kirigami.Units.gridUnit * 2 + listView.count * Kirigami.Units.gridUnit * 3
59 width: Kirigami.Units.gridUnit * 20
60
61 y: accountSwitcher.height
62
63 modal: true
64 focus: true
65 closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutsideParent
66
67 Item {
68 id: buttons
69 anchors {
70 bottom: parent.bottom
71 }
72
73 height: Kirigami.Units.gridUnit * 2
74 width: parent.width
75
76 Controls2.Button {
77 anchors {
78 left: parent.left
79 bottom: parent.bottom
80 }
81
82 //iconName: "view-refresh"
83 text: "Sync"
84 enabled: folderController.synchronizeAction.enabled
85 onClicked: {
86 folderController.synchronizeAction.execute()
87 popup.close()
88 }
89 }
90
91 KubeComponents.PositiveButton {
92 id: newAccountButton
93
94 anchors {
95 right: parent.right
96 bottom: parent.bottom
97 }
98
99 text: "Create new Account"
100
101 onClicked: {
102 accountWizard.open()
103 popup.close()
104 }
105 }
106 }
107
108 ListView {
109 id: listView
110
111 anchors {
112 top: parent.top
113 bottom: buttons.top
114 left: parent.left
115 right: parent.right
116 }
117
118 clip: true
119
120 model: accountsModel
121
122 delegate: Kirigami.AbstractListItem {
123 id: accountDelegate
124
125 height: Kirigami.Units.gridUnit * 2
126
127 enabled: true
128 supportsMouseEvents: true
129
130 checked: listView.currentIndex == index
131 onClicked: {
132 listView.currentIndex = model.index
133 popup.close()
134 }
135 Item {
136 height: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing * 1
137 width: listView.width
138
139 QtQml.Binding {
140 target: accountSwitcher
141 property: "accountId"
142 when: listView.currentIndex == index
143 value: model.accountId
144 }
145
146 QtQml.Binding {
147 target: accountSwitcher
148 property: "accountName"
149 when: listView.currentIndex == index
150 value: model.name
151 }
152
153 RowLayout {
154 anchors {
155 verticalCenter: parent.verticalCenter
156 left: parent.left
157 margins: Kirigami.Units.smallSpacing
158 }
159
160 Layout.fillHeight: true
161
162 Controls2.Label {
163 text: model.name
164 }
165
166 Controls.ToolButton {
167 id: statusIcon
168 visible: false
169 iconName: ""
170 enabled: false
171 states: [
172 State {
173 name: "busy"; when: model.status == KubeAccountsFramework.AccountsModel.BusyStatus
174 PropertyChanges { target: statusIcon; iconName: KubeTheme.Icons.busy; visible: true }
175 },
176 State {
177 name: "error"; when: model.status == KubeAccountsFramework.AccountsModel.ErrorStatus
178 PropertyChanges { target: statusIcon; iconName: KubeTheme.Icons.error; visible: true }
179 },
180 State {
181 name: "checkmark"; when: model.status == KubeAccountsFramework.AccountsModel.ConnectedStatus
182 PropertyChanges { target: statusIcon; iconName: KubeTheme.Icons.connected; visible: true }
183 }
184 ]
185 }
186 }
187 Controls2.Button {
188
189 anchors {
190 right: parent.right
191 rightMargin: Kirigami.Units.largeSpacing
192 verticalCenter: parent.verticalCenter
193 }
194
195 opacity: hovered ? 1 : 0.7
196 visible: accountDelegate.containsMouse
197 text: "edit"
198
199 onClicked: {
200 editAccountComponent.createObject(app, {accountId:model.accountId})
201 popup.close()
202 }
203
204 Component {
205 id: editAccountComponent
206 KubeComponents.EditAccountDialog {
207 anchors.fill: parent
208 }
209 }
210 }
211 }
212 }
213 }
214 }
215}
diff --git a/framework/qml/AttachmentDelegate.qml b/framework/qml/AttachmentDelegate.qml
new file mode 100644
index 00000000..a589c9f3
--- /dev/null
+++ b/framework/qml/AttachmentDelegate.qml
@@ -0,0 +1,68 @@
1/*
2 * Copyright (C) 2016 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.7
20import QtQuick.Layouts 1.1
21import org.kde.kirigami 1.0 as Kirigami
22import org.kube.components.theme 1.0 as KubeTheme
23
24Item {
25 id: root
26
27 property string name
28 property string icon
29
30 width: content.width + Kirigami.Units.gridUnit / 2
31 height: content.height + Kirigami.Units.gridUnit / 2
32
33 Rectangle {
34 anchors.fill: parent
35
36 id: background
37 color: KubeTheme.Colors.disabledTextColor
38 }
39
40 RowLayout {
41 id: content
42
43 anchors.centerIn: parent
44
45 spacing: Kirigami.Units.smallSpacing
46
47 Rectangle {
48 id: mimetype
49
50 height: Kirigami.Units.gridUnit
51 width: Kirigami.Units.gridUnit
52
53 color: KubeTheme.Colors.backgroundColor
54
55 Kirigami.Icon {
56 height: parent.height
57 width: height
58
59 source: root.icon
60 }
61 }
62
63 Text {
64 text: root.name
65 color: KubeTheme.Colors.backgroundColor
66 }
67 }
68}
diff --git a/framework/qml/AutocompleteLineEdit.qml b/framework/qml/AutocompleteLineEdit.qml
new file mode 100644
index 00000000..64e5940f
--- /dev/null
+++ b/framework/qml/AutocompleteLineEdit.qml
@@ -0,0 +1,143 @@
1/*
2 * Copyright (C) 2016 Christian Mollekopf, <mollekopf@kolabsys.com>
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.7
20import QtQuick.Controls 2.0 as Controls2
21import QtQuick.Layouts 1.1
22
23import org.kde.kirigami 1.0 as Kirigami
24import org.kube.components.theme 1.0 as KubeTheme
25
26Controls2.TextField {
27 id: textField
28
29 property string searchTerm
30 property variant model
31 onTextChanged: {
32 if (text.length >= 2) {
33 searchTerm = text
34 startCompleting()
35 } else {
36 searchTerm = ""
37 abort()
38 }
39 }
40 Keys.onDownPressed: {
41 listView.incrementCurrentIndex()
42 }
43 Keys.onUpPressed: {
44 listView.decrementCurrentIndex()
45 }
46 Keys.onRightPressed: {
47 startCompleting()
48 }
49 Keys.onTabPressed: {
50 if (popup.visible) {
51 listView.incrementCurrentIndex()
52 } else {
53 event.accepted = false
54 }
55 }
56 Keys.onReturnPressed: {
57 accept()
58 }
59 Keys.onEscapePressed: {
60 abort()
61 }
62
63 function startCompleting() {
64 if (!popup.visible) {
65 popup.open()
66 listView.currentIndex = -1
67 }
68 }
69
70 function accept() {
71 textField.text = listView.currentItem.text;
72 popup.close()
73 }
74
75 function abort() {
76 popup.close()
77 }
78
79 Controls2.Popup {
80 id: popup
81 x: 0
82 y: textField.y + textField.height
83 padding: 0
84 contentWidth: rect.width
85 contentHeight: rect.height
86
87 Rectangle {
88 id: rect
89
90 anchors.top: popup.top
91 anchors.left: popup.left
92
93 height: listView.contentHeight
94 width: textField.width
95
96 border.color: KubeTheme.Colors.textColor
97 color: KubeTheme.Colors.backgroundColor
98
99 radius: 5
100 ListView {
101 id: listView
102 height: childrenRect.height
103 width: parent.width
104 interactive: true
105 model: textField.model
106 delegate: Kirigami.AbstractListItem {
107 id: listDelegate
108 property string text: model.text
109
110 width: listView.width
111 height: textField.height
112
113 enabled: true
114 supportsMouseEvents: true
115
116 checked: listView.currentIndex == index
117 onClicked: {
118 listView.currentIndex = model.index
119 accept()
120 }
121
122 //Content
123 Item {
124 width: parent.width
125 height: parent.height
126
127 Column {
128 anchors {
129 verticalCenter: parent.verticalCenter
130 left: parent.left
131 }
132
133 Text{
134 text: model.text
135 color: listDelegate.checked ? KubeTheme.Colors.highlightedTextColor : KubeTheme.Colors.textColor
136 }
137 }
138 }
139 }
140 }
141 }
142 }
143}
diff --git a/framework/qml/Avatar.qml b/framework/qml/Avatar.qml
new file mode 100644
index 00000000..0a7c4c18
--- /dev/null
+++ b/framework/qml/Avatar.qml
@@ -0,0 +1,57 @@
1/*
2 Copyright (C) 2016 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.7
20import QtQuick.Layouts 1.1
21
22
23Rectangle {
24
25 property string name;
26
27 //colors taken from https://techbase.kde.org/Projects/Usability/HIG/Color
28 function calcColor(x)
29 {
30 switch (x % 5) {
31 case 0:
32 return "#16a085"
33 case 1:
34 return "#27ae60"
35 case 2:
36 return "#2980b9"
37 case 3:
38 return "#8e44ad"
39 case 4:
40 return "#c0392b"
41 }
42 }
43
44 radius: 100
45
46 color: calcColor(name.length)
47
48 Text {
49 anchors.centerIn: parent
50
51 text: name.charAt(0)
52
53 color: "#ecf0f1"
54
55 font.capitalization: Font.AllUppercase
56 }
57}
diff --git a/framework/qml/Button.qml b/framework/qml/Button.qml
new file mode 100644
index 00000000..948312b0
--- /dev/null
+++ b/framework/qml/Button.qml
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
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.7
20import org.kube.components.theme 1.0 as KubeTheme
21
22Rectangle {
23 id: root
24
25 signal clicked()
26 property alias text: text.text
27 property color textColor: KubeTheme.Colors.highlightedTextColor
28 property string iconName: ""
29 property alias implicitHeight: content.implicitHeight
30 property alias implicitWidth: content.implicitWidth
31 width: implicitWidth
32 height: implicitHeight
33
34 clip: true
35
36 Row {
37 id: content
38 anchors.centerIn: parent
39 spacing: KubeTheme.Units.smallSpacing
40 Text {
41 id: text
42 anchors.verticalCenter: parent.verticalCenter
43 color: root.textColor
44 }
45 Icon {
46 id: icon
47 anchors.verticalCenter: parent.verticalCenter
48 iconName: root.iconName
49 visible: iconName != ""
50 }
51 }
52
53 MouseArea {
54 anchors.fill: parent
55 onClicked: root.clicked()
56 }
57}
diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml
new file mode 100644
index 00000000..4196ebbd
--- /dev/null
+++ b/framework/qml/ConversationView.qml
@@ -0,0 +1,574 @@
1/*
2 * Copyright (C) 2016 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.7
20import QtQuick.Controls 1.3 as Controls1
21import QtQuick.Controls 2
22import QtQuick.Layouts 1.1
23import org.kde.kirigami 1.0 as Kirigami
24
25import QtQml 2.2 as QtQml
26
27import org.kube.framework.domain 1.0 as KubeFramework
28import org.kube.framework.actions 1.0 as KubeAction
29
30import org.kube.components.theme 1.0 as KubeTheme
31
32Rectangle {
33 id: root
34
35 property variant mail;
36 property int currentIndex: 0;
37 property bool scrollToEnd: true;
38 property variant currentMail: null;
39 onCurrentIndexChanged: {
40 markAsReadTimer.restart();
41 }
42 onMailChanged: {
43 scrollToEnd = true;
44 currentMail = null;
45 }
46
47 color: KubeTheme.Colors.backgroundColor
48
49 ListView {
50 id: listView
51 function setCurrentIndex()
52 {
53 /**
54 * This will detect the index at the "scrollbar-position" (visibleArea.yPosition).
55 * This ensures that the first and last entry can become the currentIndex,
56 * but in the middle of the list the item in the middle is set as the current item.
57 */
58 var yPos = 0.5;
59 if (listView.visibleArea.yPosition < 0.4) {
60 yPos = 0.2 + (0.2 * listView.visibleArea.yPosition);
61 }
62 if (listView.visibleArea.yPosition > 0.6) {
63 yPos = 0.6 + (0.2 * listView.visibleArea.yPosition)
64 }
65 var indexAtCenter = listView.indexAt(root.width / 2, contentY + root.height * yPos);
66 if (indexAtCenter >= 0) {
67 root.currentIndex = indexAtCenter;
68 } else {
69 root.currentIndex = count - 1;
70 }
71 }
72
73 anchors {
74 top: parent.top
75 left: parent.left
76 right: parent.right
77 bottom: parent.bottom
78 }
79
80 clip: true
81
82 model: KubeFramework.MailListModel {
83 mail: root.mail
84 }
85
86 header: Item {
87 height: KubeTheme.Units.gridUnit * 0.5
88 width: parent.width
89
90 }
91
92 footer: Item {
93 height: KubeTheme.Units.gridUnit
94 width: parent.width
95 }
96
97 delegate: mailDelegate
98
99 //Setting the currentIndex results in further lags. So we don't do that either.
100 // currentIndex: root.currentIndex
101
102 boundsBehavior: Flickable.StopAtBounds
103
104 //default is 1500, which is not usable with a mouse
105 flickDeceleration: 10000
106
107 //Optimize for view quality
108 pixelAligned: true
109
110 Timer {
111 id: scrollToEndTimer
112 interval: 10
113 running: false
114 repeat: false
115 onTriggered: {
116 //Only do this once per conversation
117 root.scrollToEnd = false;
118 root.currentIndex = listView.count - 1
119 //positionViewAtEnd/Index don't work
120 listView.contentY = Math.max(listView.contentHeight - listView.height, 0)
121 }
122 }
123
124 onCountChanged: {
125 if (root.scrollToEnd) {
126 scrollToEndTimer.restart()
127 }
128 }
129
130 onContentHeightChanged: {
131 //Initially it will resize a lot, so we keep waiting
132 if (root.scrollToEnd) {
133 scrollToEndTimer.restart()
134 }
135 }
136
137 onContentYChanged: {
138 //We have to track our current mail manually
139 setCurrentIndex();
140 }
141
142 //The cacheBuffer needs to be large enough to fit the whole thread.
143 //Otherwise the contentHeight will constantly increase and decrease,
144 //which will break lot's of things.
145 cacheBuffer: 100000
146
147 KubeFramework.MailController {
148 id: mailController
149 Binding on mail {
150 //!! checks for the availability of the type
151 when: !!root.currentMail
152 value: root.currentMail
153 }
154 }
155
156 Timer {
157 id: markAsReadTimer
158 interval: 2000
159 running: false
160 repeat: false
161 onTriggered: {
162 if (mailController.markAsReadAction.enabled) {
163 mailController.markAsReadAction.execute();
164 }
165 }
166 }
167
168 //Intercept all scroll events,
169 //necessary due to the webengineview
170 KubeFramework.MouseProxy {
171 anchors.fill: parent
172 target: listView
173 forwardWheelEvents: true
174 }
175 }
176 Component {
177 id: mailDelegate
178
179 Item {
180 id: wrapper
181 property bool isCurrent: root.currentIndex === index;
182 onIsCurrentChanged: {
183 if (isCurrent) {
184 root.currentMail = model.mail
185 }
186 }
187
188 height: sheet.height + KubeTheme.Units.gridUnit
189 width: parent.width
190
191 Rectangle {
192 id: sheet
193 anchors.centerIn: parent
194 implicitHeight: header.height + attachments.height + body.height + incompleteBody.height + footer.height + KubeTheme.Units.largeSpacing
195 width: parent.width - KubeTheme.Units.gridUnit * 2
196
197 //Overlay for non-active mails
198 Rectangle {
199 anchors.fill: parent
200 visible: !wrapper.isCurrent
201 color: "lightGrey"
202 z: 1
203 opacity: 0.2
204 }
205
206 color: KubeTheme.Colors.viewBackgroundColor
207
208 //BEGIN header
209 Item {
210 id: header
211
212 anchors {
213 top: parent.top
214 left: parent.left
215 right: parent.right
216 margins: KubeTheme.Units.largeSpacing
217 }
218
219 height: headerContent.height + KubeTheme.Units.smallSpacing
220
221 states: [
222 State {
223 name: "small"
224 PropertyChanges { target: subject; wrapMode: Text.NoWrap}
225 PropertyChanges { target: recipients; visible: true}
226 PropertyChanges { target: to; visible: false}
227 PropertyChanges { target: cc; visible: false}
228 PropertyChanges { target: bcc; visible: false}
229 },
230 State {
231 name: "details"
232 PropertyChanges { target: subject; wrapMode: Text.WrapAnywhere}
233 PropertyChanges { target: recipients; visible: false}
234 PropertyChanges { target: to; visible: true}
235 PropertyChanges { target: cc; visible: true}
236 PropertyChanges { target: bcc; visible: true}
237 }
238 ]
239
240 state: "small"
241
242 Text {
243 id: date_label
244
245 anchors {
246 right: seperator.right
247 top: parent.top
248 }
249
250 text: Qt.formatDateTime(model.date, "dd MMM yyyy hh:mm")
251
252 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.7
253 color: KubeTheme.Colors.textColor
254 opacity: 0.75
255 }
256
257 Column {
258 id: headerContent
259
260 anchors {
261 //left: to_l.right
262 horizontalCenter: parent.horizontalCenter
263 }
264
265 //spacing: KubeTheme.Units.smallSpacing
266
267 width: parent.width
268
269 Row{
270 id: from
271
272 width: parent.width
273
274 spacing: KubeTheme.Units.smallSpacing
275 clip: true
276
277 Text {
278 id: senderName
279
280 text: model.senderName
281
282 font.weight: Font.DemiBold
283 color: KubeTheme.Colors.textColor
284 opacity: 0.75
285 }
286
287 Text {
288
289 text: model.sender
290
291 width: parent.width - senderName.width - date_label.width - KubeTheme.Units.largeSpacing
292 elide: Text.ElideRight
293
294 color: KubeTheme.Colors.textColor
295 opacity: 0.75
296
297 clip: true
298 }
299 }
300
301 Text {
302 id: subject
303
304 width: to.width
305
306 text: model.subject
307
308 elide: Text.ElideRight
309
310 color: KubeTheme.Colors.textColor
311 opacity: 0.75
312 font.italic: true
313 }
314
315 Text {
316 id: recipients
317
318 width: parent.width - goDown.width - KubeTheme.Units.smallSpacing
319
320 text:"to: "+ model.to + " " + model.cc + " " + model.bcc
321
322 elide: Text.ElideRight
323
324 color: KubeTheme.Colors.textColor
325 opacity: 0.75
326 }
327
328 Text {
329 id: to
330
331 width: parent.width - goDown.width - KubeTheme.Units.smallSpacing
332
333 text:"to: " + model.to
334
335 wrapMode: Text.WordWrap
336 color: KubeTheme.Colors.textColor
337 opacity: 0.75
338 }
339
340 Text {
341 id: cc
342
343 width: parent.width - goDown.width - KubeTheme.Units.smallSpacing
344
345 text:"cc: " + model.cc
346
347 wrapMode: Text.WordWrap
348 color: KubeTheme.Colors.textColor
349 opacity: 0.75
350 }
351
352 Text {
353 id: bcc
354
355 width: parent.width - goDown.width - KubeTheme.Units.smallSpacing
356
357 text:"bcc: " + model.bcc
358
359 wrapMode: Text.WordWrap
360 color: KubeTheme.Colors.textColor
361 opacity: 0.75
362 }
363
364 }
365 Rectangle {
366 id: goDown
367 anchors {
368 bottom: seperator.top
369 right: seperator.right
370 }
371
372 height: KubeTheme.Units.gridUnit
373 width: height
374
375 color: KubeTheme.Colors.backgroundColor
376
377 Controls1.ToolButton {
378 anchors.fill: parent
379
380 iconName: KubeTheme.Icons.goDown
381 }
382 }
383
384 Rectangle {
385 anchors {
386 bottom: seperator.top
387 right: seperator.right
388 }
389
390 height: KubeTheme.Units.gridUnit
391 width: height
392
393 color: KubeTheme.Colors.backgroundColor
394
395 Controls1.ToolButton {
396 anchors.fill: parent
397
398 iconName: header.state === "details" ? KubeTheme.Icons.goUp : KubeTheme.Icons.goDown
399
400 onClicked: {
401 header.state === "details" ? header.state = "small" : header.state = "details"
402 }
403 }
404 }
405
406 Rectangle {
407 id: seperator
408
409 anchors {
410 left: parent.left
411 right: parent.right
412 bottom: parent.bottom
413 }
414
415 height: 1
416
417 color: KubeTheme.Colors.textColor
418 opacity: 0.5
419 }
420 }
421 //END header
422
423 Flow {
424 id: attachments
425
426 anchors {
427 top: header.bottom
428 topMargin: KubeTheme.Units.smallSpacing
429 right: header.right
430 }
431
432 width: header.width - KubeTheme.Units.largeSpacing
433
434 layoutDirection: Qt.RightToLeft
435 spacing: KubeTheme.Units.smallSpacing
436 clip: true
437
438 Repeater {
439 model: body.attachments
440
441 delegate: AttachmentDelegate {
442 name: model.name
443 icon: "mail-attachment"
444
445 clip: true
446
447 //TODO size encrypted signed type
448 }
449 }
450 }
451
452 MailViewer {
453 id: body
454
455 anchors {
456 top: header.bottom
457 left: header.left
458 right: header.right
459 leftMargin: KubeTheme.Units.largeSpacing
460 rightMargin: KubeTheme.Units.largeSpacing
461 topMargin: Math.max(attachments.height, KubeTheme.Units.largeSpacing)
462 }
463
464 width: header.width - KubeTheme.Units.largeSpacing * 2
465 height: desiredHeight
466
467 message: model.mimeMessage
468 visible: !model.incomplete
469 }
470
471 Label {
472 id: incompleteBody
473 anchors {
474 top: header.bottom
475 left: header.left
476 right: header.right
477 leftMargin: KubeTheme.Units.largeSpacing
478 rightMargin: KubeTheme.Units.largeSpacing
479 topMargin: Math.max(attachments.height, KubeTheme.Units.largeSpacing)
480 }
481 visible: model.incomplete
482 text: "Incomplete body..."
483 color: KubeTheme.Colors.textColor
484 enabled: false
485 states: [
486 State {
487 name: "inprogress"; when: model.status == KubeFramework.MailListModel.InProgressStatus
488 PropertyChanges { target: incompleteBody; text: "Downloading message..." }
489 },
490 State {
491 name: "error"; when: model.status == KubeFramework.MailListModel.ErrorStatus
492 PropertyChanges { target: incompleteBody; text: "Failed to download message..." }
493 }
494 ]
495 }
496 Item {
497 id: footer
498
499 anchors.bottom: parent.bottom
500
501 height: KubeTheme.Units.gridUnit * 2
502 width: parent.width
503
504 Text {
505 anchors{
506 verticalCenter: parent.verticalCenter
507 left: parent.left
508 leftMargin: KubeTheme.Units.largeSpacing
509 }
510
511 KubeFramework.MailController {
512 id: mailController
513 mail: model.mail
514 }
515
516 text: model.trash ? qsTr("Delete Mail") : qsTr("Move to trash")
517 color: KubeTheme.Colors.textColor
518 opacity: 0.5
519 enabled: model.trash ? mailController.removeAction.enabled : mailController.moveToTrashAction.enabled
520 MouseArea {
521 anchors.fill: parent
522 enabled: parent.enabled
523 onClicked: {
524 if (model.trash) {
525 mailController.removeAction.execute();
526 } else {
527 mailController.moveToTrashAction.execute();
528 }
529 }
530 }
531 }
532
533 Controls1.ToolButton {
534 visible: !model.trash
535 anchors{
536 verticalCenter: parent.verticalCenter
537 right: parent.right
538 rightMargin: KubeTheme.Units.largeSpacing
539 }
540
541 KubeAction.Context {
542 id: mailcontext
543 property variant mail
544 property bool isDraft
545 mail: model.mail
546 isDraft: model.draft
547 }
548
549 KubeAction.Action {
550 id: replyAction
551 actionId: "org.kde.kube.actions.reply"
552 context: maillistcontext
553 }
554
555 KubeAction.Action {
556 id: editAction
557 actionId: "org.kde.kube.actions.edit"
558 context: maillistcontext
559 }
560
561 iconName: model.draft ? KubeTheme.Icons.edit : KubeTheme.Icons.replyToSender
562 onClicked: {
563 if (model.draft) {
564 editAction.execute()
565 } else {
566 replyAction.execute()
567 }
568 }
569 }
570 }
571 }
572 }
573 }
574}
diff --git a/framework/qml/EditAccount.qml b/framework/qml/EditAccount.qml
new file mode 100644
index 00000000..8618ec91
--- /dev/null
+++ b/framework/qml/EditAccount.qml
@@ -0,0 +1,138 @@
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
20import QtQuick 2.7
21import QtQuick.Layouts 1.1
22import QtQuick.Controls 1.4 as Controls
23import QtQuick.Controls 2.0 as Controls2
24import org.kde.kirigami 1.0 as Kirigami
25
26import org.kube.framework.accounts 1.0 as KubeAccounts
27import org.kube.components.theme 1.0 as KubeTheme
28
29Item {
30 id: root
31 property string accountId
32
33 KubeAccounts.AccountFactory {
34 id: accountFactory
35 accountId: root.accountId
36 }
37
38 Item {
39
40 anchors {
41 fill: parent
42 margins: Kirigami.Units.largeSpacing * 2
43 }
44
45 Kirigami.Heading {
46 id: heading
47 text: loader.item.heading
48 color: KubeTheme.Colors.highlightColor
49 }
50
51 Kirigami.Label {
52 id: subHeadline
53
54 anchors {
55 left: heading.left
56 top: heading.bottom
57 }
58
59 width: parent.width
60 text: loader.item.subheadline
61 color: KubeTheme.Colors.disabledTextColor
62 wrapMode: Text.Wrap
63 }
64
65 Item {
66 id: accountEdit
67 anchors {
68 top:subHeadline.bottom
69 left: parent.left
70 right: parent.right
71 topMargin: Kirigami.Units.largeSpacing * 2
72 }
73
74 Loader {
75 id: loader
76 anchors.fill: parent
77 source: accountFactory.uiPath
78 onLoaded: item.accountId = root.accountId
79 }
80 }
81
82 Item {
83 id: spacer
84 Layout.fillHeight: true
85 anchors {
86 top:accountEdit.bottom
87 left: parent.left
88 right: parent.right
89 }
90 }
91
92 //This is where we should place the account wizard ui
93 GridLayout {
94 id: footer
95 anchors {
96 top:spacer.bottom
97 bottom: parent.bottom
98 left: parent.left
99 right: parent.right
100 topMargin: Kirigami.Units.largeSpacing * 2
101 }
102
103 columns: 2
104 columnSpacing: Kirigami.Units.largeSpacing
105 rowSpacing: Kirigami.Units.largeSpacing
106
107 Item {
108 Layout.fillHeight: true
109 }
110
111 Kirigami.Label {
112 text: ""
113 }
114
115 Item {
116 Layout.fillWidth: true
117
118 Controls.Button {
119 text: "Discard"
120
121 onClicked: {
122 loader.item.remove()
123 dialog.closeDialog()
124 }
125 }
126
127 Controls.Button {
128 anchors.right: parent.right
129 text: "Save"
130 onClicked: {
131 loader.item.save()
132 dialog.closeDialog()
133 }
134 }
135 }
136 }
137 }
138}
diff --git a/framework/qml/EditAccountDialog.qml b/framework/qml/EditAccountDialog.qml
new file mode 100644
index 00000000..a7461640
--- /dev/null
+++ b/framework/qml/EditAccountDialog.qml
@@ -0,0 +1,38 @@
1/*
2 Copyright (C) 2016 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
21
22import org.kde.kirigami 1.0 as Kirigami
23
24import org.kube.components 1.0 as KubeComponents
25
26KubeComponents.OverlayDialog {
27 id: dialog
28
29 property variant accountId
30 EditAccount {
31 accountId: dialog.accountId
32
33 anchors.centerIn: parent
34
35 height: dialog.height * 0.8
36 width: dialog.width * 0.8
37 }
38}
diff --git a/framework/qml/FocusComposer.qml b/framework/qml/FocusComposer.qml
new file mode 100644
index 00000000..902309a8
--- /dev/null
+++ b/framework/qml/FocusComposer.qml
@@ -0,0 +1,252 @@
1/*
2 * Copyright (C) 2016 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 2.0 as Controls2
22
23import org.kde.kirigami 1.0 as Kirigami
24
25import org.kube.framework.domain 1.0 as KubeFramework
26
27Controls2.Popup {
28 id: root
29
30 //Controller
31 KubeFramework.ComposerController {
32 id: composerController
33 onDone: {
34 clear();
35 root.close()
36 }
37 }
38
39 //actions
40 property variant sendAction: composerController.sendAction
41 property variant saveAsDraftAction: composerController.saveAsDraftAction
42
43 //BEGIN functions
44 function loadMessage(message, loadAsDraft) {
45 composerController.loadMessage(message, loadAsDraft)
46 }
47 //END functions
48
49 modal: true
50 focus: true
51 closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutsideParent
52
53 Item {
54
55 height: parent.height
56 width: parent.width
57
58 ColumnLayout {
59
60 anchors {
61 fill: parent
62 margins: Kirigami.Units.largeSpacing
63 }
64
65 ColumnLayout {
66
67 anchors.fill: parent
68
69 GridLayout {
70
71 columns: 2
72
73 Controls2.Label {
74 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
75 text: "To"
76 }
77
78 AutocompleteLineEdit {
79 id: to
80
81 Layout.fillWidth: true
82
83 text: composerController.to
84 onTextChanged: {
85 composerController.to = text;
86 }
87
88 model: composerController.recipientCompleter.model
89 onSearchTermChanged: {
90 composerController.recipientCompleter.searchString = searchTerm
91 }
92 }
93
94
95 Controls2.Label {
96 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
97 text: "Cc"
98 visible: cc.visible
99 }
100
101 AutocompleteLineEdit {
102 id: cc
103
104 Layout.fillWidth: true
105
106 visible: false
107
108 text: composerController.cc
109
110 onTextChanged: {
111 composerController.cc = text;
112 }
113
114 model: composerController.recipientCompleter.model
115 onSearchTermChanged: {
116 composerController.recipientCompleter.searchString = searchTerm
117 }
118 }
119
120 Controls2.Label {
121 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
122 text: "Bcc"
123 visible: bcc.visible
124 }
125
126 AutocompleteLineEdit {
127 id: bcc
128
129 Layout.fillWidth: true
130
131 visible : false
132
133 text: composerController.bcc
134
135 onTextChanged: {
136 composerController.bcc = text;
137 }
138
139 model: composerController.recipientCompleter.model
140 onSearchTermChanged: {
141 composerController.recipientCompleter.searchString = searchTerm
142 }
143 }
144
145 Controls2.Label {
146 text: "From"
147 }
148
149 RowLayout {
150
151 Controls2.ComboBox {
152 id: identityCombo
153 model: composerController.identitySelector.model
154 textRole: "displayName"
155
156 Layout.fillWidth: true
157
158 onCurrentIndexChanged: {
159 composerController.identitySelector.currentIndex = currentIndex
160 }
161 }
162
163 Controls2.Button {
164 id: ccButton
165
166 text: "Cc"
167 onClicked: {
168 cc.visible = true
169 ccButton.visible = false
170 }
171 }
172
173 Controls2.Button {
174 id: bccButton
175
176 text: "Bcc"
177
178 onClicked: {
179 bcc.visible = true
180 bccButton.visible = false
181 }
182 }
183 }
184 }
185
186 Controls2.TextField {
187 id: subject
188
189 Layout.fillWidth: true
190
191 placeholderText: "Enter Subject..."
192
193 text: composerController.subject
194
195 onTextChanged: {
196 composerController.subject = text;
197 }
198 }
199
200 Controls2.TextArea {
201 id: content
202
203 text: composerController.body
204
205 onTextChanged: {
206 composerController.body = text;
207 }
208
209 Layout.fillWidth: true
210 Layout.fillHeight: true
211 }
212
213 RowLayout {
214 id: bottomBar
215
216 width: parent.width
217
218 Controls2.Button {
219 text: "Discard"
220
221 onClicked: {
222 root.close()
223 }
224 }
225
226 Item {
227 Layout.fillWidth: true
228 }
229
230
231 Controls2.Button {
232 text: "Save as Draft"
233
234 enabled: saveAsDraftAction.enabled
235 onClicked: {
236 saveAsDraftAction.execute()
237 }
238 }
239
240 Controls2.Button {
241 text: "Send"
242
243 enabled: sendAction.enabled
244 onClicked: {
245 sendAction.execute()
246 }
247 }
248 }
249 }
250 }
251 }
252}
diff --git a/framework/qml/FolderListView.qml b/framework/qml/FolderListView.qml
new file mode 100644
index 00000000..b35b52ed
--- /dev/null
+++ b/framework/qml/FolderListView.qml
@@ -0,0 +1,195 @@
1/*
2 Copyright (C) 2016 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.Controls 1.4
21import QtQuick.Controls.Styles 1.4
22import QtQuick.Layouts 1.1
23
24import org.kde.kirigami 1.0 as Kirigami
25import org.kube.components 1.0 as KubeComponents
26import org.kube.components.theme 1.0 as KubeTheme
27import org.kube.framework.domain 1.0 as KubeFramework
28
29Rectangle {
30 id: root
31
32 property variant currentFolder: null
33 property variant accountId
34
35 color: KubeTheme.Colors.textColor
36
37 KubeFramework.FolderController {
38 id: folderController
39 Binding on folder {
40 //!! checks for the availability of the type
41 when: !!root.currentFolder
42 value: root.currentFolder
43 }
44 }
45
46 Menu {
47 id: contextMenu
48 title: "Edit"
49
50 MenuItem {
51 text: "Synchronize"
52 onTriggered: {
53 folderController.synchronizeAction.execute()
54 }
55 }
56 }
57
58 TreeView {
59 id: treeView
60
61 anchors {
62 top: parent.top
63 left: parent.left
64 right: parent.right
65 }
66
67 height: parent.height
68
69 TableViewColumn {
70 title: "Name"
71 role: "name"
72 }
73
74 model: KubeFramework.FolderListModel {
75 id: folderListModel
76 accountId: root.accountId
77 }
78
79 onCurrentIndexChanged: {
80 model.fetchMore(currentIndex)
81 root.currentFolder = model.data(currentIndex, KubeFramework.FolderListModel.DomainObject)
82 }
83
84 alternatingRowColors: false
85 headerVisible: false
86
87 MouseArea {
88 anchors.fill: parent
89 acceptedButtons: Qt.RightButton
90 onClicked: {
91 var index = parent.indexAt(mouse.x, mouse.y)
92 if (index.valid) {
93 folderController.folder = treeView.model.data(index, KubeFramework.FolderListModel.DomainObject)
94 contextMenu.popup()
95 }
96 }
97 }
98
99 style: TreeViewStyle {
100
101 rowDelegate: Rectangle {
102 color: styleData.selected ? KubeTheme.Colors.highlightColor : KubeTheme.Colors.textColor
103
104 height: Kirigami.Units.gridUnit * 1.5
105 width: 20
106
107 }
108
109 frame: Rectangle {
110 color: KubeTheme.Colors.textColor
111 }
112
113 branchDelegate: Item {
114
115 width: 16; height: 16
116
117 Text {
118
119 anchors.centerIn: parent
120
121 color: KubeTheme.Colors.viewBackgroundColor
122 text: styleData.isExpanded ? "-" : "+"
123 }
124
125 //radius: styleData.isExpanded ? 0 : 100
126 }
127
128 itemDelegate: Rectangle {
129
130 color: styleData.selected ? KubeTheme.Colors.highlightColor : KubeTheme.Colors.textColor
131
132 DropArea {
133 anchors.fill: parent
134
135 Rectangle {
136 anchors.fill: parent
137 color: KubeTheme.Colors.viewBackgroundColor
138
139 opacity: 0.3
140
141 visible: parent.containsDrag
142 }
143 onDropped: {
144 folderController.folder = model.domainObject
145 folderController.mail = drop.source.mail
146 folderController.moveToFolderAction.execute()
147 drop.accept(Qt.MoveAction)
148 drop.source.visible = false
149 }
150 }
151
152 Row {
153 anchors {
154 verticalCenter: parent.verticalCenter
155 left: parent.left
156 }
157 Text {
158 anchors {
159 verticalCenter: parent.verticalCenter
160 leftMargin: Kirigami.Units.smallSpacing
161 }
162
163 text: styleData.value
164
165 color: KubeTheme.Colors.viewBackgroundColor
166 }
167 KubeComponents.Icon {
168 id: statusIcon
169 visible: false
170 iconName: ""
171 states: [
172 State {
173 name: "busy"; when: model.status == KubeFramework.FolderListModel.InProgressStatus
174 PropertyChanges { target: statusIcon; iconName: KubeTheme.Icons.busy ; visible: styleData.selected }
175 },
176 State {
177 name: "error"; when: model.status == KubeFramework.FolderListModel.ErrorStatus
178 //The error status should only be visible for a moment, otherwise we'll eventually always show errors everywhere.
179 PropertyChanges { target: statusIcon; iconName: KubeTheme.Icons.error; visible: styleData.selected }
180 },
181 State {
182 name: "checkmark"; when: model.status == KubeFramework.FolderListModel.SuccessStatus
183 //The success status should only be visible for a moment, otherwise we'll eventually always show checkmarks everywhere.
184 PropertyChanges { target: statusIcon; iconName: KubeTheme.Icons.success; visible: styleData.selected }
185 }
186 ]
187 }
188 }
189 }
190
191 backgroundColor: KubeTheme.Colors.textColor
192 highlightedTextColor: KubeTheme.Colors.highlightedTextColor
193 }
194 }
195}
diff --git a/framework/qml/Icon.qml b/framework/qml/Icon.qml
new file mode 100644
index 00000000..74a4971a
--- /dev/null
+++ b/framework/qml/Icon.qml
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
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.7
20
21Item {
22 id: root
23 property string iconName
24 property url iconSource
25 property alias implicitHeight: image.implicitHeight
26 property alias implicitWidth: image.implicitWidth
27 property alias status: image.status
28 width: implicitWidth
29 height: implicitHeight
30
31 onIconNameChanged: setImageSource()
32
33 function setImageSource() {
34 if (root.iconName != "")
35 image.source = "image://kube/" + root.iconName;
36 else
37 image.source = "";
38 }
39
40 Image {
41 id: image
42 anchors.fill: parent
43 sourceSize.width: width
44 sourceSize.height: height
45 cache: true
46 smooth: true
47 }
48}
diff --git a/framework/qml/ListItem.qml b/framework/qml/ListItem.qml
new file mode 100644
index 00000000..165ac3ab
--- /dev/null
+++ b/framework/qml/ListItem.qml
@@ -0,0 +1,64 @@
1/*
2 Copyright (C) 2016 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
20
21Item {
22 id: delegateRoot
23
24 readonly property bool isCurrentItem: ListView.isCurrentItem
25
26 height: Unit.width * 25
27 width: parent.width
28
29 MouseArea {
30 id: mouseArea
31
32 anchors.fill: parent
33 }
34
35 Rectangle {
36 anchors.fill: parent
37
38 color: colorPalette.background
39
40 //clickColor
41 Rectangle {
42 id: clickColor
43
44 anchors.fill: parent
45
46 color: colorPalette.selected
47 opacity: 0.4
48
49 visible: mouseArea.pressed
50 }
51
52 //border
53 Rectangle {
54
55 anchors.bottom: parent.bottom
56
57 height: 1
58 width: parent.width
59
60 color: colorPalette.border
61 opacity: 0.2
62 }
63 }
64}
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml
new file mode 100644
index 00000000..2d5d6601
--- /dev/null
+++ b/framework/qml/MailListView.qml
@@ -0,0 +1,292 @@
1/*
2 Copyright (C) 2016 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.7
20import QtQuick.Controls 2.0
21import QtQuick.Controls 1.4 as Controls
22import QtQuick.Layouts 1.1
23
24import org.kube.components.theme 1.0 as KubeTheme
25import org.kube.framework.domain 1.0 as KubeFramework
26
27Item {
28 id: root
29 property variant parentFolder
30 property variant currentMail: null
31 property bool isDraft : false
32 property int currentIndex
33 property string filterString: searchBar.text;
34
35 onParentFolderChanged: {
36 currentMail = null
37 }
38
39 ToolBar {
40 id: toolbar
41
42 width: parent.width
43
44 Row {
45 anchors.centerIn: parent
46
47 spacing: KubeTheme.Units.smallSpacing
48
49 Controls.ToolButton {
50 iconName: KubeTheme.Icons.markAsRead
51 text: qsTr("Mark As Read")
52 enabled: mailController.markAsReadAction.enabled
53 tooltip: qsTr("mark mail as read")
54 onClicked: {
55 mailController.markAsReadAction.execute()
56 }
57 }
58
59 Controls.ToolButton {
60 iconName: KubeTheme.Icons.markImportant
61 text: qsTr("Mark Important")
62 enabled: mailController.markAsImportantAction.enabled
63 tooltip: qsTr("mark mail as important")
64 onClicked: {
65 mailController.markAsImportantAction.execute()
66 }
67 }
68
69 Controls.ToolButton {
70 iconName: KubeTheme.Icons.moveToTrash
71 text: qsTr("Delete Mail")
72 enabled: mailController.moveToTrashAction.enabled
73 tooltip: qsTr("delete email")
74 onClicked: {
75 mailController.moveToTrashAction.execute()
76 }
77 }
78
79 Controls.ToolButton {
80 iconName: KubeTheme.Icons.undo
81 text: qsTr("Restore Mail")
82 enabled: mailController.restoreFromTrashAction.enabled
83 tooltip: qsTr("restore email")
84 onClicked: {
85 mailController.restoreFromTrashAction.execute()
86 }
87 }
88 }
89 }
90
91 TextField {
92 id: searchBar
93 anchors.top: toolbar.bottom
94 width: parent.width
95 placeholderText: qsTr("Filter...")
96 }
97
98 Label {
99 anchors.top: searchBar.bottom
100 visible: listView.count === 0
101 //TODO depending on whether we synchronized already or not the label should change.
102 text: "Nothing here..."
103 }
104
105 ListView {
106 id: listView
107
108 anchors.top: searchBar.bottom
109
110 width: parent.width
111 height: parent.height - toolbar.height
112
113 focus: true
114 clip: true
115
116 ScrollBar.vertical: ScrollBar{
117 id: scrollbar
118 }
119
120 //BEGIN keyboard nav
121 Keys.onDownPressed: {
122 incrementCurrentIndex()
123 }
124 Keys.onUpPressed: {
125 decrementCurrentIndex()
126 }
127 //END keyboard nav
128
129 currentIndex: root.currentIndex
130 onCurrentItemChanged: {
131 root.currentMail = currentItem.currentData.domainObject;
132 root.isDraft = currentItem.currentData.draft;
133 }
134
135 model: KubeFramework.MailListModel {
136 parentFolder: root.parentFolder
137 filter: root.filterString
138 }
139
140 delegate: Item {
141 id: origin
142
143 property variant currentData: model
144
145 width: delegateRoot.width
146 height: delegateRoot.height
147
148 Item {
149 id: delegateRoot
150
151 property variant mail : model.domainObject
152
153 width: scrollbar.visible ? listView.width - scrollbar.width : listView.width
154 height: KubeTheme.Units.gridUnit * 5
155
156 states: [
157 State {
158 name: "dnd"
159 when: mouseArea.drag.active
160
161 PropertyChanges {target: mouseArea; cursorShape: Qt.ClosedHandCursor}
162 PropertyChanges {target: delegateRoot; x: x; y:y}
163 PropertyChanges {target: delegateRoot; parent: root}
164
165 PropertyChanges {target: delegateRoot; opacity: 0.7}
166 PropertyChanges {target: background; color: KubeTheme.Colors.highlightColor}
167 PropertyChanges {target: subject; color: KubeTheme.Colors.highlightedTextColor}
168 PropertyChanges {target: sender; color: KubeTheme.Colors.highlightedTextColor}
169 PropertyChanges {target: date; color: KubeTheme.Colors.highlightedTextColor}
170 PropertyChanges {target: threadCounter; color: KubeTheme.Colors.highlightedTextColor}
171 },
172 State {
173 name: "selected"
174 when: listView.currentIndex == index && !mouseArea.drag.active
175
176 PropertyChanges {target: background; color: KubeTheme.Colors.highlightColor}
177 PropertyChanges {target: subject; color: KubeTheme.Colors.highlightedTextColor}
178 PropertyChanges {target: sender; color: KubeTheme.Colors.highlightedTextColor}
179 PropertyChanges {target: date; color: KubeTheme.Colors.highlightedTextColor}
180 PropertyChanges {target: threadCounter; color: KubeTheme.Colors.highlightedTextColor}
181 },
182 State {
183 name: "hovered"
184 when: mouseArea.containsMouse && !mouseArea.drag.active
185
186 PropertyChanges {target: background; color: KubeTheme.Colors.highlightColor; opacity: 0.7}
187 PropertyChanges {target: subject; color: KubeTheme.Colors.highlightedTextColor}
188 PropertyChanges {target: sender; color: KubeTheme.Colors.highlightedTextColor}
189 PropertyChanges {target: date; color: KubeTheme.Colors.highlightedTextColor}
190 PropertyChanges {target: threadCounter; color: KubeTheme.Colors.highlightedTextColor}
191 }
192 ]
193
194 Drag.active: mouseArea.drag.active
195 Drag.hotSpot.x: mouseArea.mouseX
196 Drag.hotSpot.y: mouseArea.mouseY
197 Drag.source: delegateRoot
198
199 MouseArea {
200 id: mouseArea
201
202 anchors.fill: parent
203
204 hoverEnabled: true
205 drag.target: parent
206
207 onClicked: {
208 listView.currentIndex = index
209 }
210 onReleased: parent.Drag.drop()
211 }
212
213 Rectangle {
214 id: background
215
216 anchors.fill: parent
217
218 color: KubeTheme.Colors.viewBackgroundColor
219
220 border.color: KubeTheme.Colors.backgroundColor
221 border.width: 1
222 }
223
224 Item {
225 id: content
226
227 anchors {
228 top: parent.top
229 bottom: parent.bottom
230 left: parent.left
231 right: parent.right
232 margins: KubeTheme.Units.smallSpacing
233 }
234
235 Column {
236 anchors {
237 verticalCenter: parent.verticalCenter
238 left: parent.left
239 leftMargin: KubeTheme.Units.largeSpacing
240 }
241
242 Text{
243 id: subject
244
245 text: model.subject
246 color: model.unread ? KubeTheme.Colors.highlightColor : KubeTheme.Colors.textColor
247
248 maximumLineCount: 2
249 width: content.width - KubeTheme.Units.gridUnit * 3
250 wrapMode: Text.WrapAnywhere
251 elide: Text.ElideRight
252 }
253
254 Text {
255 id: sender
256
257 text: model.senderName
258 font.italic: true
259 color: KubeTheme.Colors.textColor
260 width: delegateRoot.width - KubeTheme.Units.gridUnit * 3
261 elide: Text.ElideRight
262 }
263 }
264
265 Text {
266 id: date
267
268 anchors {
269 right: parent.right
270 bottom: parent.bottom
271 }
272 text: Qt.formatDateTime(model.date, "dd MMM yyyy")
273 font.italic: true
274 color: KubeTheme.Colors.disabledTextColor
275 font.pointSize: 9
276 }
277
278 Text {
279 id: threadCounter
280
281 anchors {
282 right: parent.right
283 }
284 text: model.threadSize
285 color: model.unread ? KubeTheme.Colors.highlightColor : KubeTheme.Colors.disabledTextColor
286 visible: model.threadSize > 1
287 }
288 }
289 }
290 }
291 }
292}
diff --git a/framework/qml/MailViewer.qml b/framework/qml/MailViewer.qml
new file mode 100644
index 00000000..4ee170bd
--- /dev/null
+++ b/framework/qml/MailViewer.qml
@@ -0,0 +1,76 @@
1/*
2 * Copyright (C) 2016 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.Controls 1.4 as Controls1
21import QtQuick.Layouts 1.1
22
23import org.kube.framework.domain 1.0 as KubeFramework
24import org.kube.components.mailviewer 1.0 as MV
25
26Item {
27 id: root
28 property variant message;
29 property string html;
30 property int desiredHeight: mailViewer.height + 20
31 property variant attachments
32
33 clip: true
34
35 MV.MailViewer {
36 id: mailViewer
37 debug: false
38 width: parent.width
39 }
40
41 Controls1.TreeView {
42 id: mailStructure
43 anchors.top: messageParser.attachments.rowCount() > 0 ? attachments.bottom : mailViewer.bottom
44 visible: mailViewer.debug
45 width: parent.width
46 height: 400
47 Controls1.TableViewColumn {
48 role: "type"
49 title: "Type"
50 width: 300
51 }
52 Controls1.TableViewColumn {
53 role: "embeded"
54 title: "Embeded"
55 width: 60
56 }
57 Controls1.TableViewColumn {
58 role: "securityLevel"
59 title: "SecurityLevel"
60 width: 60
61 }
62 Controls1.TableViewColumn {
63 role: "content"
64 title: "Content"
65 width: 200
66 }
67 model: messageParser.newTree
68 }
69
70 KubeFramework.MessageParser {
71 id: messageParser
72 message: root.message
73 }
74 attachments: messageParser.attachments
75 html: messageParser.html
76}
diff --git a/framework/qml/Notification.qml b/framework/qml/Notification.qml
new file mode 100644
index 00000000..15291c43
--- /dev/null
+++ b/framework/qml/Notification.qml
@@ -0,0 +1,83 @@
1import QtQuick 2.0
2import QtQuick.Controls 2.0
3
4import org.kde.kirigami 1.0 as Kirigami
5import org.kube.components.theme 1.0 as KubeTheme
6
7
8MouseArea {
9 id: popup
10
11 property alias title: message.text
12 property alias timeout: hideTimer.interval
13 property alias background: bg.color
14
15 function hide() {
16 if (hideTimer.running)
17 hideTimer.stop()
18 popup.opacity = 0.0
19 }
20
21 function show() {
22 console.warn("Trying to show the notification", title);
23 popup.opacity = 1.0
24 hideTimer.restart()
25 }
26
27 function notify(text) {
28 popup.title = text
29 bg.color = KubeTheme.Colors.textColor
30 show()
31 }
32
33 Timer {
34 id: hideTimer
35 triggeredOnStart: false
36 repeat: false
37 interval: 5000
38 onTriggered: popup.hide()
39 }
40
41 width: Math.max(300, message.contentWidth + (Kirigami.Units.largeSpacing * 2))
42 height: Math.max(50, message.contentHeight + (Kirigami.Units.largeSpacing * 2))
43
44 visible: opacity > 0
45 opacity: 0.0
46
47 Behavior on opacity {
48 NumberAnimation {
49 duration: 200
50 easing.type: Easing.InOutQuad
51 property: "opacity"
52 }
53 }
54
55 Rectangle {
56 id: bg
57
58 anchors.fill: parent
59
60 opacity: 0.6
61 }
62
63 Label {
64 id: message
65
66 anchors {
67 verticalCenter: popup.verticalCenter
68 left: parent.left
69 leftMargin: Kirigami.Units.largeSpacing
70 right: parent.right
71 rightMargin: Kirigami.Units.largeSpacing
72 }
73
74 font.pixelSize: 16
75
76 color: KubeTheme.Colors.highlightedTextColor
77 horizontalAlignment: Text.AlignHCenter
78 elide: Text.ElideRight
79 wrapMode: Text.Wrap
80 }
81
82 onClicked: hide()
83}
diff --git a/framework/qml/Outbox.qml b/framework/qml/Outbox.qml
new file mode 100644
index 00000000..19646459
--- /dev/null
+++ b/framework/qml/Outbox.qml
@@ -0,0 +1,151 @@
1/*
2 Copyright (C) 2016 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 2.0
22import QtQuick.Controls 1.3 as Controls
23
24import org.kde.kirigami 1.0 as Kirigami
25
26import org.kube.framework.actions 1.0 as KubeAction
27import org.kube.framework.domain 1.0 as KubeFramework
28import org.kube.components 1.0 as KubeComponents
29import org.kube.components.theme 1.0 as KubeTheme
30
31KubeComponents.Button {
32 id: root
33
34 text: outboxModel.count > 0 ? "Outbox (" + outboxModel.count + ")" : "Outbox"
35 color: "transparent"
36 textColor: KubeTheme.Colors.highlightedTextColor
37 iconName: ""
38 states: [
39 State {
40 name: "busy"; when: outboxModel.status == KubeFramework.OutboxModel.InProgressStatus
41 PropertyChanges { target: root; iconName: KubeTheme.Icons.busy }
42 },
43 State {
44 name: "error"; when: outboxModel.status == KubeFramework.OutboxModel.ErrorStatus
45 PropertyChanges { target: root; iconName: KubeTheme.Icons.error }
46 }
47 ]
48
49 onClicked: {
50 dialog.visible = dialog.visible ? false : true
51 }
52
53 KubeFramework.OutboxController {
54 id: outboxController
55 }
56
57 KubeFramework.OutboxModel {
58 id: outboxModel
59 }
60
61 Popup {
62 id: dialog
63
64 height: content.height + Kirigami.Units.smallSpacing * 2
65 width: content.width + Kirigami.Units.smallSpacing * 2
66
67 y: - dialog.height + root.height
68 x: root.width
69
70 modal: true
71
72 Item {
73 id: content
74
75 anchors.centerIn: parent
76
77 width: Kirigami.Units.gridUnit * 17
78 height: listView.count * Kirigami.Units.gridUnit * 3 + sendNowButton.height + Kirigami.Units.smallSpacing
79
80 ListView {
81 id: listView
82
83 width: parent.width
84 height: count * Kirigami.Units.gridUnit * 3
85
86 model: outboxModel
87
88 delegate: Rectangle {
89 id: delegateRoot
90
91 height: Kirigami.Units.gridUnit * 3
92 width: listView.width
93
94 color: KubeTheme.Colors.viewBackgroundColor
95 border.color: KubeTheme.Colors.backgroundColor
96 border.width: 1
97
98 Label {
99 id: subjectLabel
100 anchors {
101 verticalCenter: parent.verticalCenter
102 left: parent.left
103 leftMargin: Kirigami.Units.largeSpacing
104 }
105 text: model.subject
106
107 color: KubeTheme.Colors.textColor
108 opacity: 1
109 states: [
110 State {
111 name: "inprogress"; when: model.status == KubeFramework.OutboxModel.InProgressStatus
112 PropertyChanges { target: subjectLabel; text: "Sending: " + model.subject }
113 },
114 State {
115 name: "error"; when: model.status == KubeFramework.OutboxModel.ErrorStatus
116 PropertyChanges { target: subjectLabel; color: KubeTheme.Colors.warningColor }
117 }
118 ]
119 }
120 }
121
122 clip: true
123 }
124
125 Button {
126 id: sendNowButton
127
128 anchors {
129 top: listView.bottom
130 topMargin: Kirigami.Units.smallSpacing
131 horizontalCenter: parent.horizontalCenter
132 }
133
134 visible: listView.count != 0
135
136 text: qsTr("Send now")
137 onClicked: {
138 outboxController.sendOutboxAction.execute()
139 }
140 }
141
142 Label {
143 anchors.centerIn: parent
144
145 visible: listView.count == 0
146
147 text: qsTr("No pending messages")
148 }
149 }
150 }
151}
diff --git a/framework/qml/OverlayDialog.qml b/framework/qml/OverlayDialog.qml
new file mode 100644
index 00000000..760fb12e
--- /dev/null
+++ b/framework/qml/OverlayDialog.qml
@@ -0,0 +1,64 @@
1/*
2 Copyright (C) 2016 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.Controls 1.4
21import QtQuick.Layouts 1.1
22
23import org.kde.kirigami 1.0 as Kirigami
24
25import org.kube.framework.settings 1.0 as KubeSettings
26import org.kube.framework.domain 1.0 as KubeFramework
27import org.kube.components.theme 1.0 as KubeTheme
28
29Item {
30 id: root
31
32 function closeDialog() {
33 root.destroy();
34 }
35
36 Rectangle {
37 id: background
38 anchors.fill: parent
39
40 color: "black"
41 opacity: 0.6
42 }
43
44 MouseArea {
45 anchors.fill: parent
46 onClicked: {
47 root.closeDialog()
48 }
49 }
50
51 Rectangle {
52 id: dialog
53 anchors.centerIn: parent
54
55 height: root.height * 0.8
56 width: root.width * 0.8
57
58 color: KubeTheme.Colors.backgroundColor
59
60 MouseArea {
61 anchors.fill: parent
62 }
63 }
64}
diff --git a/framework/qml/People.qml b/framework/qml/People.qml
new file mode 100644
index 00000000..182cce94
--- /dev/null
+++ b/framework/qml/People.qml
@@ -0,0 +1,435 @@
1 /*
2 Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com>
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
20import QtQuick 2.7
21import QtQuick.Controls 2.0
22import QtQuick.Controls 1.4 as Controls
23import QtQuick.Layouts 1.1
24
25import org.kde.kirigami 1.0 as Kirigami
26import org.kube.components.theme 1.0 as KubeTheme
27import org.kube.framework.domain 1.0 as KubeFramework
28
29
30
31Popup {
32 id: popup
33
34 property var currentContact
35
36 modal: true
37
38 Item {
39 id: peopleRoot
40
41 anchors.fill: parent
42
43 ToolBar {
44 id: toolbar
45
46 width: parent.width
47
48 Controls.ToolButton {
49
50 anchors.verticalCenter: parent.verticalCenter
51
52 iconName: KubeTheme.Icons.goBack
53
54 onClicked: stack.pop()
55
56 visible: stack. depth > 1
57 }
58
59 TextField {
60 id: searchBar
61 anchors.centerIn: parent
62
63 placeholderText: "Search..."
64
65 width: parent.width * 0.5
66 }
67
68 Controls.ToolButton {
69
70 anchors {
71 right: parent.right
72 rightMargin: KubeTheme.Units.smallSpacing
73 verticalCenter: parent.verticalCenter
74 }
75
76 iconName: KubeTheme.Icons.addNew
77 }
78 }
79
80 StackView {
81 id: stack
82
83 anchors {
84 top: toolbar.bottom
85 left: parent.left
86 right: parent.right
87 bottom: parent.bottom
88 }
89
90 initialItem: peoplePage
91
92 clip: true
93 }
94 }
95
96 Component {
97 id: peoplePage
98
99 Rectangle {
100 id: peoplePageRoot
101 color: KubeTheme.Colors.viewBackgroundColor
102
103 Flickable {
104
105 anchors.fill: parent
106
107 ScrollBar.vertical: ScrollBar { }
108 contentHeight: content.height
109 clip: true
110
111 Item {
112 id: content
113
114 height: childrenRect.height
115
116 Flow {
117
118 anchors {
119 top: parent.top
120 topMargin: KubeTheme.Units.largeSpacing
121 left: parent.left
122 leftMargin: KubeTheme.Units.largeSpacing
123 }
124
125 spacing: KubeTheme.Units.largeSpacing
126 width: peoplePageRoot.width - KubeTheme.Units.largeSpacing * 2
127
128 Repeater {
129
130 model: KubeFramework.PeopleModel {
131 filter: searchBar.text
132 }
133
134 delegate: Rectangle {
135 id: delegateRoot
136
137 height: KubeTheme.Units.gridUnit * 3
138 width: KubeTheme.Units.gridUnit * 10
139
140 border.width: 1
141 border.color: "lightgrey"
142
143 MouseArea {
144 anchors.fill: parent
145
146 onClicked: {
147 popup.currentContact = model.domainObject
148 stack.push(personPage)
149 }
150 }
151
152 Rectangle {
153 id: avatarPlaceholder
154
155 height: parent.height
156 width: height
157
158 color: "lightgrey"
159 }
160
161 Column {
162
163 width: parent.width
164
165 anchors {
166 left: avatarPlaceholder.right
167 margins: KubeTheme.Units.smallSpacing
168 verticalCenter: parent.verticalCenter
169 }
170
171 Text {
172 width: delegateRoot.width - avatarPlaceholder.width - KubeTheme.Units.smallSpacing * 2
173
174 text: model.firstName
175 elide: Text.ElideRight
176 color: KubeTheme.Colors.textColor
177 }
178
179 Text {
180 width: delegateRoot.width - avatarPlaceholder.width - KubeTheme.Units.smallSpacing * 2
181
182 text: model.lastName
183 elide: Text.ElideRight
184 color: KubeTheme.Colors.textColor
185 }
186 }
187 }
188 }
189 }
190 }
191 }
192 }
193 }
194
195 Component {
196 id: personPage
197
198 Rectangle {
199 id: personPageRoot
200
201 KubeFramework.ContactController {
202 id: contactController
203 contact: popup.currentContact
204 }
205
206 color: KubeTheme.Colors.viewBackgroundColor
207
208 Item {
209
210 anchors {
211 top: parent.top
212 left: parent.left
213 leftMargin: KubeTheme.Units.largeSpacing
214 }
215
216 width: parent.width
217 height: parent.height
218
219
220 Flickable {
221
222 anchors.fill: parent
223
224 ScrollBar.vertical: ScrollBar { }
225 contentHeight: contentColumn.height
226
227 clip: true
228
229 ColumnLayout {
230 id: contentColumn
231
232 width: personPageRoot.width
233
234 spacing: KubeTheme.Units.largeSpacing
235
236 Item {
237 width: parent.width
238 height: KubeTheme.Units.smallSpacing
239 }
240
241 Item {
242
243 height: KubeTheme.Units.gridUnit * 8
244 width: personPageRoot.width - KubeTheme.Units.largeSpacing
245
246 Rectangle {
247 id: avatar
248
249 height: parent.height
250 width: height
251
252 color: "lightgrey"
253 }
254
255 Kirigami.Heading {
256 id: nameLabel
257
258 anchors {
259 top: avatar.top
260 left: avatar.right
261 leftMargin: KubeTheme.Units.largeSpacing
262 }
263
264 text: contactController.name //"Michael Tester"
265 }
266
267 Text {
268 id: jobTitle
269
270 anchors {
271 top: nameLabel.bottom
272 left: avatar.right
273 leftMargin: KubeTheme.Units.largeSpacing
274 }
275
276 text: "CIO"
277 }
278
279 Rectangle {
280 id: company
281
282 anchors {
283 bottom: avatar.bottom
284 left: avatar.right
285 leftMargin: KubeTheme.Units.largeSpacing
286 }
287
288 height: KubeTheme.Units.gridUnit * 3
289 width: KubeTheme.Units.gridUnit * 10
290
291 border.width: 1
292 border.color: "lightgrey"
293
294 Rectangle {
295 id: av
296
297 height: parent.height
298 width: height
299
300 color: "lightgrey"
301 }
302
303 Text {
304 anchors {
305 verticalCenter: av.verticalCenter
306 left: av.right
307 leftMargin: KubeTheme.Units.smallSpacing
308 }
309
310 text: "Sauerkraut AG"
311
312 color: KubeTheme.Colors.textColor
313 }
314 }
315 }
316
317 Flow {
318 id: emails
319
320 width: personPageRoot.width - KubeTheme.Units.largeSpacing
321
322 Repeater {
323
324 model: contactController.emails
325
326 Row {
327 spacing: KubeTheme.Units.smallSpacing
328 Text { text: "(main)" }
329 Text { text: modelData ; color: KubeTheme.Colors.highlightColor }
330 Item { width: KubeTheme.Units.smallSpacing; height: 1 }
331 }
332 }
333
334 Row {
335 spacing: KubeTheme.Units.smallSpacing
336 Text { text: "(alias)"}
337 Text { text: "test.testerson@gmail.com"; color: KubeTheme.Colors.highlightColor }
338 Item { width: KubeTheme.Units.smallSpacing; height: 1 }
339 }
340
341 Row {
342 spacing: KubeTheme.Units.smallSpacing
343 Text { text: "(private)"}
344 Text { text: "test@gmail.com"; color: KubeTheme.Colors.highlightColor }
345 Item { width: KubeTheme.Units.smallSpacing; height: 1 }
346 }
347 }
348
349 Flow {
350 id: phone
351
352 width: personPageRoot.width - KubeTheme.Units.largeSpacing
353 spacing: KubeTheme.Units.smallSpacing
354
355 Row {
356 spacing: KubeTheme.Units.smallSpacing
357 Text { text: "(inhouse)"}
358 Text { text: "+49812324932"; opacity: 0.6 }
359 Item { width: KubeTheme.Units.smallSpacing; height: 1 }
360 }
361 Row {
362 spacing: KubeTheme.Units.smallSpacing
363 Text { text: "(mobile)"}
364 Text { text: "+49812324932"; opacity: 0.6 }
365 Item { width: KubeTheme.Units.smallSpacing; height: 1 }
366 }
367 Row {
368 spacing: KubeTheme.Units.smallSpacing
369 Text { text: "(private)"}
370 Text { text: "+49812324932"; opacity: 0.6 }
371 Item { width: KubeTheme.Units.smallSpacing; height: 1 }
372 }
373 }
374
375 Column {
376 id: address
377
378 width: personPageRoot.width - KubeTheme.Units.largeSpacing
379
380 Text { text: "Albertstrasse 35a"}
381 Text { text: "81767 Teststadt"}
382 Text { text: "GERMANY" }
383 }
384
385// Column {
386//
387// width: parent.width
388//
389// spacing: KubeTheme.Units.smallSpacing
390//
391// Text {
392//
393// text: root.firstname + " is part of these groups:"
394// }
395//
396// GroupGrid {
397// id: groups
398//
399// width: root.width - KubeTheme.Units.largeSpacing
400//
401// model: GroupModel1 {}
402// }
403// }
404
405// Column {
406//
407// width: parent.width
408//
409// spacing: KubeTheme.Units.smallSpacing
410//
411// Text {
412// id: commonPeopleLabel
413//
414// text: root.firstname + " is associated with:"
415// }
416//
417// PeopleGrid {
418// id: commonPeople
419//
420// width: root.width - KubeTheme.Units.largeSpacing
421//
422// model: PeopleModel2 {}
423// }
424// }
425
426 Item {
427 width: parent.width
428 height: KubeTheme.Units.largeSpacing
429 }
430 }
431 }
432 }
433 }
434 }
435}
diff --git a/framework/qml/PositiveButton.qml b/framework/qml/PositiveButton.qml
new file mode 100644
index 00000000..83063668
--- /dev/null
+++ b/framework/qml/PositiveButton.qml
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com>
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.7
20import QtQuick.Controls 2.1 as Controls
21import org.kube.components.theme 1.0 as KubeTheme
22
23Controls.AbstractButton {
24 id: root
25
26 width: mainText.implicitWidth + KubeTheme.Units.largeSpacing * 2
27 height: mainText.implicitHeight + KubeTheme.Units.smallSpacing * 2
28
29 clip: true
30
31 Rectangle {
32 id: background
33
34 anchors.fill: parent
35
36 color: KubeTheme.Colors.positveColor
37 }
38
39 Text {
40 id: mainText
41
42 anchors.centerIn: parent
43
44 color: KubeTheme.Colors.highlightedTextColor
45 text: root.text
46 }
47}
diff --git a/framework/qmldir b/framework/qmldir
new file mode 100644
index 00000000..f258f5cc
--- /dev/null
+++ b/framework/qmldir
@@ -0,0 +1,23 @@
1module org.kube.framework
2
3Avatar 1.0 Avatar.qml
4FocusComposer 1.0 FocusComposer.qml
5ConversationView 1.0 ConversationView.qml
6FolderListView 1.0 FolderListView.qml
7MailListView 1.0 MailListView.qml
8AccountSwitcher 1.0 AccountSwitcher.qml
9NewAccountDialog 1.0 NewAccountDialog.qml
10EditAccountDialog 1.0 EditAccountDialog.qml
11OverlayDialog 1.0 OverlayDialog.qml
12Outbox 1.0 Outbox.qml
13People 1.0 People.qml
14Notification 1.0 Notification.qml
15Icon 1.0 Icon.qml
16Button 1.0 Button.qml
17PositiveButton 1.0 PositiveButton.qml
18
19plugin mailplugin
20plugin actionplugin
21plugin notificationplugin
22plugin settingsplugin
23plugin accountsplugin
diff --git a/framework/settings/qmldir b/framework/settings/qmldir
deleted file mode 100644
index 22fec334..00000000
--- a/framework/settings/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
1module org.kube.framework.settings
2
3plugin settingsplugin