From 2dac72ae43f627340694d89db68184cb07e68650 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 9 Mar 2016 15:13:00 +0100 Subject: Moved application to components --- components/package/contents/ui/Avatar.qml | 55 ++++++ components/package/contents/ui/ColorPalette.qml | 26 +++ components/package/contents/ui/Composer.qml | 221 ++++++++++++++++++++++ components/package/contents/ui/FocusComposer.qml | 81 ++++++++ components/package/contents/ui/FolderListView.qml | 116 ++++++++++++ components/package/contents/ui/FolderModel.qml | 36 ++++ components/package/contents/ui/ListItem.qml | 63 ++++++ components/package/contents/ui/MailListModel.qml | 149 +++++++++++++++ components/package/contents/ui/MailListView.qml | 155 +++++++++++++++ components/package/contents/ui/MailViewer.qml | 43 +++++ components/package/contents/ui/Settings.qml | 74 ++++++++ components/package/contents/ui/SingleMailView.qml | 74 ++++++++ components/package/contents/ui/example.qml | 64 +++++++ components/package/contents/ui/main.qml | 200 ++++++++++++++++++++ 14 files changed, 1357 insertions(+) create mode 100644 components/package/contents/ui/Avatar.qml create mode 100644 components/package/contents/ui/ColorPalette.qml create mode 100644 components/package/contents/ui/Composer.qml create mode 100644 components/package/contents/ui/FocusComposer.qml create mode 100644 components/package/contents/ui/FolderListView.qml create mode 100644 components/package/contents/ui/FolderModel.qml create mode 100644 components/package/contents/ui/ListItem.qml create mode 100644 components/package/contents/ui/MailListModel.qml create mode 100644 components/package/contents/ui/MailListView.qml create mode 100644 components/package/contents/ui/MailViewer.qml create mode 100644 components/package/contents/ui/Settings.qml create mode 100644 components/package/contents/ui/SingleMailView.qml create mode 100644 components/package/contents/ui/example.qml create mode 100644 components/package/contents/ui/main.qml (limited to 'components/package/contents') diff --git a/components/package/contents/ui/Avatar.qml b/components/package/contents/ui/Avatar.qml new file mode 100644 index 00000000..33d6733c --- /dev/null +++ b/components/package/contents/ui/Avatar.qml @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2015 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + + +Rectangle { + + property string name; + + //colors taken from https://techbase.kde.org/Projects/Usability/HIG/Color + function calcColor(x) + { + switch (x % 5) { + case 0: + return "#16a085" + case 1: + return "#27ae60" + case 2: + return "#2980b9" + case 3: + return "#8e44ad" + case 4: + return "#c0392b" + } + } + + radius: 2 + + color: calcColor(name.length) + + Text { + anchors.centerIn: parent + + text: name.charAt(0) + + color: "#ecf0f1" + } +} diff --git a/components/package/contents/ui/ColorPalette.qml b/components/package/contents/ui/ColorPalette.qml new file mode 100644 index 00000000..db85cac6 --- /dev/null +++ b/components/package/contents/ui/ColorPalette.qml @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2015 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 + +//TODO probably expose it from the Cpp side +Item { + property string background: "#fcfcfc" + property string selected: "#3daee9" + property string read: "#232629" + property string border: "#232629" +} \ No newline at end of file diff --git a/components/package/contents/ui/Composer.qml b/components/package/contents/ui/Composer.qml new file mode 100644 index 00000000..1a6a4cc4 --- /dev/null +++ b/components/package/contents/ui/Composer.qml @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2016 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.1 +import org.kde.plasma.components 2.0 as PlasmaComponents + +import org.kde.kube.mail 1.0 as Mail + + +Item { + id: root + property variant originalMessage + + function send() { + composer.send() + } + + function saveAsDraft() { + composer.saveAsDraft() + } + + function clear() { + composer.clear(); + } + + Mail.Retriever { + id: retriever + propertyName: "mimeMessage" + model: Mail.MailListModel { + id: mailListModel + mail: root.originalMessage + } + } + + Mail.Composer { + id: composer + originalMessage: retriever.value + } + + ColumnLayout { + + anchors.fill: parent + + GridLayout { + + columns: 2 + + Label { + text: "From" + } + + ComboBox { + model: composer.identityModel + + Layout.fillWidth: true + + currentIndex: composer.fromIndex + + onCurrentIndexChanged: { + composer.fromIndex = currentIndex + } + } + + Label { + text: "To" + } + + RowLayout { + Layout.fillWidth: true + + TextField { + id: to + + Layout.fillWidth: true + + text: composer.to + + onTextChanged: { + composer.to = text; + } + } + + PlasmaComponents.Button { + id: ccButton + + text: "Cc" + + onClicked: { + cc.visible = true + ccButton.visible = false + } + } + + PlasmaComponents.Button { + id: bccButton + + text: "Bcc" + + onClicked: { + bcc.visible = true + bccButton.visible = false + } + } + } + + Label { + text: "Cc" + + visible: cc.visible + } + + TextField { + id: cc + + Layout.fillWidth: true + + visible: false + + text: composer.cc + + onTextChanged: { + composer.cc = text; + } + } + + Label { + text: "Bcc" + + visible: bcc.visible + } + + TextField { + id: bcc + + Layout.fillWidth: true + + visible : false + + text: composer.bcc + + onTextChanged: { + composer.bcc = text; + } + } + } + + TextField { + id: subject + + Layout.fillWidth: true + + placeholderText: "Enter Subject" + + text: composer.subject + + onTextChanged: { + composer.subject = text; + } + } + + Item { + + Layout.fillWidth: true + + height: subject.height * 1.5 + + PlasmaComponents.Button { + + anchors { + bottom: parent.bottom + } + + text: "Save as Draft" + + onClicked: { + composer.saveAsDraft() + } + } + + PlasmaComponents.Button { + + anchors { + bottom: parent.bottom + right: parent.right + } + + text: "Attach" + } + } + + TextArea { + id: content + + text: composer.body + + onTextChanged: { + composer.body = text; + } + + Layout.fillWidth: true + Layout.fillHeight: true + + } + } +} diff --git a/components/package/contents/ui/FocusComposer.qml b/components/package/contents/ui/FocusComposer.qml new file mode 100644 index 00000000..8ec01cc9 --- /dev/null +++ b/components/package/contents/ui/FocusComposer.qml @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2016 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.1 + +Rectangle { + id: root + property variant originalMessage + + visible: false + + color: colorPalette.border + + opacity: 0.9 + + MouseArea { + anchors.fill: parent + + onClicked: { + root.visible = false + } + } + + Rectangle { + anchors.centerIn: parent + + height: root.height * 0.8 + width: root.width * 0.8 + + color: colorPalette.background + + MouseArea { + anchors.fill: parent + } + + ColumnLayout { + + anchors { + fill: parent + margins: unit.size * 3 + } + + Composer { + id: composer + + Layout.fillWidth: true + Layout.fillHeight: true + originalMessage: root.originalMessage + } + + RowLayout { + Layout.alignment: Qt.AlignRight + + Button { + text: "Send" + + onClicked: { + composer.send() + root.visible = false + } + } + } + } + } +} \ No newline at end of file diff --git a/components/package/contents/ui/FolderListView.qml b/components/package/contents/ui/FolderListView.qml new file mode 100644 index 00000000..1934932c --- /dev/null +++ b/components/package/contents/ui/FolderListView.qml @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2015 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.1 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import org.kde.kube.mail 1.0 as Mail + +Item { + id: root + property variant currentFolder + SystemPalette { id: colorPalette; colorGroup: SystemPalette.Active } + + Item { + id: searchBox + + width: root.width + height: unit.size * 10 + + TextField { + anchors. centerIn: parent + + width: parent.width * 0.9 + + placeholderText: "Search all email..." + } + } + + TreeView { + id: treeView + anchors { + top: searchBox.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + TableViewColumn { + title: "Name" + role: "name" + width: treeView.width - 5 + } + model: Mail.FolderListModel { id: folderListModel } + onCurrentIndexChanged: { + model.fetchMore(currentIndex) + root.currentFolder = model.data(currentIndex, Mail.FolderListModel.DomainObject) + } + backgroundVisible: false + headerVisible: false + style: TreeViewStyle { + activateItemOnSingleClick: true + rowDelegate: Rectangle { + height: unit.size * 10 + color: "transparent" + } + itemDelegate: Rectangle { + radius: 5 + border.width: 1 + border.color: "lightgrey" + color: styleData.selected ? colorPalette.highlight : colorPalette.button + PlasmaCore.IconItem { + id: iconItem + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: unit.size * 3 + } + source: model.icon + } + Label { + anchors { + verticalCenter: parent.verticalCenter + left: iconItem.right + leftMargin: unit.size * 3 + } + renderType: Text.NativeRendering + text: styleData.value + font.pixelSize: 16 + font.bold: true + color: styleData.selected ? colorPalette.highlightedText : colorPalette.text + } + } + branchDelegate: Item { + width: 16 + height: 16 + Text { + visible: styleData.column === 0 && styleData.hasChildren + text: styleData.isExpanded ? "\u25bc" : "\u25b6" + color: !control.activeFocus || styleData.selected ? styleData.textColor : "#666" + font.pointSize: 10 + renderType: Text.NativeRendering + anchors.centerIn: parent + anchors.verticalCenterOffset: styleData.isExpanded ? 2 : 0 + } + } + } + } +} diff --git a/components/package/contents/ui/FolderModel.qml b/components/package/contents/ui/FolderModel.qml new file mode 100644 index 00000000..b20a1606 --- /dev/null +++ b/components/package/contents/ui/FolderModel.qml @@ -0,0 +1,36 @@ +import QtQuick 2.4 + +ListModel { + ListElement { + icon: "mail-folder-inbox" + name: "Inbox" + } + ListElement { + icon: "mail-folder-sent" + name: "Sent" + } + ListElement { + icon: "user-trash" + name: "Trash" + } + ListElement { + icon: "document-edit" + name: "Drafts" + } + ListElement { + icon: "folder" + name: "cats" + } + ListElement { + icon: "folder" + name: "dogs" + } + ListElement { + icon: "folder" + name: "dragons" + } + ListElement { + icon: "folder" + name: "long tailed dragons" + } +} \ No newline at end of file diff --git a/components/package/contents/ui/ListItem.qml b/components/package/contents/ui/ListItem.qml new file mode 100644 index 00000000..5396645d --- /dev/null +++ b/components/package/contents/ui/ListItem.qml @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2015 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 + +Item { + id: delegateRoot + + readonly property bool isCurrentItem: ListView.isCurrentItem + + height: unit.width * 25 + width: parent.width + + MouseArea { + id: mouseArea + + anchors.fill: parent + } + + Rectangle { + anchors.fill: parent + + color: colorPalette.background + + //clickColor + Rectangle { + id: clickColor + + anchors.fill: parent + + color: colorPalette.selected + opacity: 0.4 + + visible: mouseArea.pressed + } + + //border + Rectangle { + + anchors.bottom: parent.bottom + + height: 1 + width: parent.width + + color: colorPalette.border + opacity: 0.2 + } + } +} \ No newline at end of file diff --git a/components/package/contents/ui/MailListModel.qml b/components/package/contents/ui/MailListModel.qml new file mode 100644 index 00000000..bf0f70a2 --- /dev/null +++ b/components/package/contents/ui/MailListModel.qml @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2015 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 + +ListModel { + ListElement { + sender: "mighty@mail.com" + senderName: "Mighty Monkey" + subject: "I feel weak without my bananas" + date: "19:21" + unread: true + } + ListElement { + sender: "benni@bandana.org" + senderName: "Ben Bandana" + subject: "Check this out" + date: "16:01" + unread: true + } + ListElement { + sender: "alice@mail.com" + senderName: "Alice Cheng" + subject: "Re: We need more food" + date: "12:55" + unread: false + } + ListElement { + sender: "bob@bandana.org" + senderName: "Bob Ross" + subject: "KDE Rocks" + date: "Sat" + unread: true + } + ListElement { + sender: "tiny@mail.com" + senderName: "Tiny" + subject: "Huge success!!" + date: "Sat" + unread: false + } + ListElement { + sender: "bob@bandana.org" + senderName: "Bob Ross" + subject: "KDE Rocks" + date: "Fr" + unread: false + } + ListElement { + sender: "Laura@mail.com" + senderName: "Laura B" + subject: ":)" + date: "Thu" + unread: false + } + ListElement { + sender: "Andreas@stars.org" + senderName: "Andreas Rockstar" + subject: "KDE Rocks" + date: "Wed" + unread: false + } + ListElement { + sender: "alice@mail.com" + senderName: "Alice Cheng" + subject: "Re: We need more food" + date: "Wed" + } + ListElement { + sender: "bob@bandana.org" + senderName: "Bob Ross" + subject: "KDE Rocks" + date: "Mon" + } + ListElement { + sender: "mighty@mail.com" + senderName: "Mighty Monkey" + subject: "I feel weak without my bananas" + date: "Nov 20" + } + ListElement { + sender: "benni@bandana.org" + senderName: "Ben Bandana" + subject: "Check this out" + date: "Nov 15" + } + ListElement { + sender: "alice@mail.com" + senderName: "Alice Cheng" + subject: "Re: We need more food" + date: "Sep 29" + } + ListElement { + sender: "bob@bandana.org" + senderName: "Bob Ross" + subject: "KDE Rocks" + date: "Sep 14" + } + ListElement { + sender: "tiny@mail.com" + senderName: "Tiny" + subject: "Huge success!!" + date: "Sep 14" + } + ListElement { + sender: "bob@bandana.org" + senderName: "Bob Ross" + subject: "KDE Rocks" + date: "Sep 5" + } + ListElement { + sender: "Laura@mail.com" + senderName: "Laura B" + subject: ":)" + date: "Sep 4" + } + ListElement { + sender: "Andreas@stars.org" + senderName: "Andreas Rockstar" + subject: "KDE Rocks" + date: "May 25" + } + ListElement { + sender: "alice@mail.com" + senderName: "Alice Cheng" + subject: "Re: We need more food" + date: "May 3" + } + ListElement { + sender: "bob@bandana.org" + senderName: "Bob Ross" + subject: "Board Task: Write draft email to people with KDE accounts commiting to Qt repositories" + date: "Dec 2014" + } +} \ No newline at end of file diff --git a/components/package/contents/ui/MailListView.qml b/components/package/contents/ui/MailListView.qml new file mode 100644 index 00000000..ff773e0e --- /dev/null +++ b/components/package/contents/ui/MailListView.qml @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2015 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.1 + +import QtQml 2.2 + +import org.kde.plasma.components 2.0 as PlasmaComponents + +import org.kde.kube.mail 1.0 as Mail + +ScrollView { + id: root + property variant parentFolder + property variant currentMail + + ListView { + id: listView + + model: Mail.MailListModel { + parentFolder: root.parentFolder + } + + Keys.onDownPressed: { + incrementCurrentIndex() + } + Keys.onUpPressed: { + decrementCurrentIndex() + } + focus: true + + delegate: PlasmaComponents.ListItem { + width: listView.width + height: unit.size * 12 + + enabled: true + checked: listView.currentIndex == index + + Binding { + target: root + property: "currentMail" + when: listView.currentIndex == index + value: model.domainObject + } + + MouseArea { + anchors.fill: parent + + onClicked: { + listView.currentIndex = model.index + } + } + + Rectangle { + id: unread + + anchors.fill: parent + + // color: colorPalette.read + color: "steelblue" + opacity: 0.1 + + visible: model.unread + } + + Avatar { + id: avatar + + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: unit.size * 2 + } + + height: unit.size * 9 + width: height + + name: model.senderName + } + + Label { + id: senderName + + anchors { + top: avatar.top + left: avatar.right + leftMargin: unit.size * 3 + } + + text: model.senderName + + font.weight: Font.DemiBold + } + + //The name currently contains both name and address + // Label { + // id: sender + // + // anchors { + // top: avatar.top + // left: senderName.right + // leftMargin: unit.size + // right: date.left + // rightMargin: unit.size + // } + // + // text: "(" + model.sender +")" + // + // clip: true + // } + + Label { + id: date + + anchors { + top: avatar.top + right: parent.right + rightMargin: unit.size * 2 + } + + text: Qt.formatDateTime(model.date) + + font.weight: Font.Light + } + + Label { + id: subject + + anchors { + bottom: avatar.bottom + left: avatar.right + leftMargin: unit.size * 3 + } + + text: model.subject + } + } + } +} diff --git a/components/package/contents/ui/MailViewer.qml b/components/package/contents/ui/MailViewer.qml new file mode 100644 index 00000000..1d305297 --- /dev/null +++ b/components/package/contents/ui/MailViewer.qml @@ -0,0 +1,43 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 +import QtWebKit 3.0 + +import org.kde.kube.mail 1.0 as Mail + +Item { + id: root + property variant message; + property string html; + + WebView { + id: webview + anchors.fill: parent + onNavigationRequested: { + // detect URL scheme prefix, most likely an external link + var schemaRE = /^\w+:/; + if (schemaRE.test(request.url)) { + request.action = WebView.AcceptRequest; + } else { + request.action = WebView.IgnoreRequest; + // delegate request.url here + } + } + onLoadingChanged: { + console.warn("Error is ", loadRequest.errorString); + console.warn("Status is ", loadRequest.status); + } + } + + onHtmlChanged: { + // console.warn("HTML is ", html); + // The file:/// argument is necessary so local icons are found + webview.loadHtml(html, "file:///"); + } + + Mail.MessageParser { + id: messageParser + message: root.message + } + html: messageParser.html +} diff --git a/components/package/contents/ui/Settings.qml b/components/package/contents/ui/Settings.qml new file mode 100644 index 00000000..da44d331 --- /dev/null +++ b/components/package/contents/ui/Settings.qml @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2016 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.1 + +import org.kde.kube.settings 1.0 as KubeSettings +import org.kde.kube.accounts.maildir 1.0 as Maildir + +Rectangle { + id: root + + visible: false + + color: colorPalette.border + + opacity: 0.9 + + MouseArea { + anchors.fill: parent + + onClicked: { + root.visible = false + } + } + + Rectangle { + anchors.centerIn: parent + + height: root.height * 0.8 + width: root.width * 0.8 + + color: colorPalette.background + + MouseArea { + anchors.fill: parent + } + + KubeSettings.Settings { + id: contextSettings + identifier: "applicationcontext" + property string currentAccountId: "current" + property var availableAccountTypes: ["maildir"] + property var accounts: ["current"] + } + + Column { + spacing: 5 + Repeater { + model: contextSettings.accounts + delegate: Maildir.AccountSettings { //This should be retrieved from the accounts plugin: KubeAccounts { identifier: modelData }.settingsUi + accountId: modelData + } + } + } + + //TODO: Add possibility to add more accounts + } +} diff --git a/components/package/contents/ui/SingleMailView.qml b/components/package/contents/ui/SingleMailView.qml new file mode 100644 index 00000000..d6ae4bfa --- /dev/null +++ b/components/package/contents/ui/SingleMailView.qml @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2015 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + +import org.kde.kube.mail 1.0 as Mail + +Item { + id: root + property variant mail; + + Rectangle { + id: background + + anchors.fill: parent + + color: colorPalette.background + } + + Repeater { + anchors.fill: parent + + model: Mail.MailListModel { + mail: root.mail + } + + delegate: Item { + anchors.fill: parent + + ColumnLayout { + anchors.fill: parent + + Label { + text: model.id + } + + Label { + text: model.sender + } + + Label { + text: model.senderName + } + + Label { + text: model.subject + } + + MailViewer { + message: model.mimeMessage + Layout.fillHeight: true + Layout.fillWidth: true + } + + } + } + } +} diff --git a/components/package/contents/ui/example.qml b/components/package/contents/ui/example.qml new file mode 100644 index 00000000..e0c0a077 --- /dev/null +++ b/components/package/contents/ui/example.qml @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2015 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + +import org.kde.sink.mail 1.0 + +Item { + id: root + + MailList { + id: mailList + + query: "Some Query" + + } + + Button { + id: button + + anchors { + top: parent.top + right: parent.right + left: parent.left + } + + text: "add mail" + + onClicked: mailList.addMail("test test test"); + } + + ListView { + + anchors { + top: button.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + + model: mailList.model + + delegate: Label { + + text: model.subject + } + } +} \ No newline at end of file diff --git a/components/package/contents/ui/main.qml b/components/package/contents/ui/main.qml new file mode 100644 index 00000000..cf983dee --- /dev/null +++ b/components/package/contents/ui/main.qml @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2015 Michael Bohlender + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 +import org.kde.plasma.components 2.0 as PlasmaComponents + +import org.kde.kube.actions 1.0 as KubeAction +import org.kde.kube.settings 1.0 as KubeSettings + +ApplicationWindow { + id: app + + //FIXME remove fixed pixel hight + //for now just convinience during testing + height: 1080 * 0.7 + width: 1920 * 0.7 + + visible: true + + // Action.ActionHandler { + // actionId: "org.kde.kube.actions.mark-as-read" + // function isReady(context) { + // return context.mail ? true : false; + // } + // + // function handler(context) { + // console.warn("Got message:", context.mail) + // } + // } + + KubeAction.Context { + id: maillistcontext + property variant mail + mail: mailListView.currentMail + } + + KubeAction.Action { + id: markAsReadAction + actionId: "org.kde.kube.actions.mark-as-read" + context: maillistcontext + } + + KubeAction.Action { + id: deleteAction + actionId: "org.kde.kube.actions.delete" + context: maillistcontext + } + + //UI + toolBar: ToolBar { + + Row { + anchors.fill: parent + + PlasmaComponents.ToolButton { + height: parent.height + text: "Settings" + onClicked: { + settings.visible = true + } + } + + PlasmaComponents.ToolButton { + height: parent.height + iconName: "mail-message-new" + text: "Compose" + onClicked: { + composer.visible = true + } + } + + PlasmaComponents.ToolButton { + height: parent.height + iconName: "mail-message-reply" + text: "Reply" + onClicked: { + composer.originalMessage = mailListView.currentMail + composer.visible = true + } + } + + PlasmaComponents.ToolButton { + height: parent.height + iconName: "mail-mark-unread" + text: "Mark As Read" + enabled: markAsReadAction.ready + onClicked: { + markAsReadAction.execute() + } + } + + PlasmaComponents.ToolButton { + height: parent.height + iconName: "mail-mark-important" + text: "Mark Important" + enabled: false + onClicked: { + } + } + + PlasmaComponents.ToolButton { + height: parent.height + iconName: "edit-delete" + text: "Delete Mail" + enabled: deleteAction.ready + onClicked: { + deleteAction.execute() + } + } + + + } + Rectangle { + anchors { + right: parent.right + } + height: parent.height + color: "transparent" + Image { + id: img + height: parent.height + fillMode: Image.PreserveAspectCrop + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: -20 + } + source: "image://kube/kube_logo" + sourceSize.height: parent.height * 2.5 + } + width: img.width * 0.7 + } + } + + SplitView { + anchors.fill: parent + + FolderListView { + id: folderListView + width: unit.size * 55 + Layout.maximumWidth: unit.size * 150 + Layout.minimumWidth: unit.size * 30 + } + + MailListView { + id: mailListView + parentFolder: folderListView.currentFolder + width: unit.size * 80 + Layout.maximumWidth: unit.size * 250 + Layout.minimumWidth: unit.size * 50 + focus: true + } + + SingleMailView { + id: mailView + mail: mailListView.currentMail + Layout.fillWidth: true + } + + } + + Settings { + id: settings + + anchors.fill: parent + } + + FocusComposer { + id: composer + + anchors.fill: parent + } + + //TODO find a better way to scale UI + Item { + id: unit + property int size: 5 + } + + ColorPalette { + id: colorPalette + } +} + -- cgit v1.2.3