From ad39a0aa4852b09318a1a0e557dd7eaed12c4e95 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Thu, 31 Dec 2015 19:03:58 +0100 Subject: kmail-quick -> kube-mail --- .../kube-mail/package/contents/ui/Avatar.qml | 55 ++++++++ .../kube-mail/package/contents/ui/ColorPalette.qml | 26 ++++ .../package/contents/ui/FolderListView.qml | 102 ++++++++++++++ .../kube-mail/package/contents/ui/FolderModel.qml | 36 +++++ .../kube-mail/package/contents/ui/ListItem.qml | 63 +++++++++ .../package/contents/ui/MailListModel.qml | 149 +++++++++++++++++++++ .../kube-mail/package/contents/ui/MailListView.qml | 131 ++++++++++++++++++ .../package/contents/ui/SingleMailView.qml | 64 +++++++++ .../kube-mail/package/contents/ui/example.qml | 64 +++++++++ .../kube-mail/package/contents/ui/main.qml | 138 +++++++++++++++++++ 10 files changed, 828 insertions(+) create mode 100644 applications/kube-mail/package/contents/ui/Avatar.qml create mode 100644 applications/kube-mail/package/contents/ui/ColorPalette.qml create mode 100644 applications/kube-mail/package/contents/ui/FolderListView.qml create mode 100644 applications/kube-mail/package/contents/ui/FolderModel.qml create mode 100644 applications/kube-mail/package/contents/ui/ListItem.qml create mode 100644 applications/kube-mail/package/contents/ui/MailListModel.qml create mode 100644 applications/kube-mail/package/contents/ui/MailListView.qml create mode 100644 applications/kube-mail/package/contents/ui/SingleMailView.qml create mode 100644 applications/kube-mail/package/contents/ui/example.qml create mode 100644 applications/kube-mail/package/contents/ui/main.qml (limited to 'applications/kube-mail/package/contents/ui') diff --git a/applications/kube-mail/package/contents/ui/Avatar.qml b/applications/kube-mail/package/contents/ui/Avatar.qml new file mode 100644 index 00000000..33d6733c --- /dev/null +++ b/applications/kube-mail/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/applications/kube-mail/package/contents/ui/ColorPalette.qml b/applications/kube-mail/package/contents/ui/ColorPalette.qml new file mode 100644 index 00000000..db85cac6 --- /dev/null +++ b/applications/kube-mail/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/applications/kube-mail/package/contents/ui/FolderListView.qml b/applications/kube-mail/package/contents/ui/FolderListView.qml new file mode 100644 index 00000000..f0ce7da2 --- /dev/null +++ b/applications/kube-mail/package/contents/ui/FolderListView.qml @@ -0,0 +1,102 @@ +/* + * 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.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import org.kde.akonadi2.mail 1.0 as Mail + +Item { + id: root + + Item { + id: searchBox + + width: root.width + height: unit.size * 10 + + TextField { + anchors. centerIn: parent + + width: parent.width * 0.9 + + placeholderText: "Search all email..." + } + } + + ScrollView { + + anchors { + top: searchBox.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + + ListView { + id: listView + + currentIndex: -1 + + clip: true + + model: folderList.model //FolderModel {} + + delegate: PlasmaComponents.ListItem { + + width: root.width + height: unit.size * 10 + + enabled: true + checked: listView.currentIndex == index + + onClicked: { + mailList.loadMailFolder(model.id) + listView.currentIndex = model.index + } + + PlasmaCore.IconItem { + id: iconItem + + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: unit.size * 3 + } + + source: model.icon + } + + Label { + id: label + + anchors { + verticalCenter: parent.verticalCenter + left: iconItem.right + leftMargin: unit.size * 3 + } + + text: model.name + } + } + } + } +} \ No newline at end of file diff --git a/applications/kube-mail/package/contents/ui/FolderModel.qml b/applications/kube-mail/package/contents/ui/FolderModel.qml new file mode 100644 index 00000000..b20a1606 --- /dev/null +++ b/applications/kube-mail/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/applications/kube-mail/package/contents/ui/ListItem.qml b/applications/kube-mail/package/contents/ui/ListItem.qml new file mode 100644 index 00000000..5396645d --- /dev/null +++ b/applications/kube-mail/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/applications/kube-mail/package/contents/ui/MailListModel.qml b/applications/kube-mail/package/contents/ui/MailListModel.qml new file mode 100644 index 00000000..bf0f70a2 --- /dev/null +++ b/applications/kube-mail/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/applications/kube-mail/package/contents/ui/MailListView.qml b/applications/kube-mail/package/contents/ui/MailListView.qml new file mode 100644 index 00000000..f6ded917 --- /dev/null +++ b/applications/kube-mail/package/contents/ui/MailListView.qml @@ -0,0 +1,131 @@ +/* + * 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 + +ScrollView { + id: root + ListView { + id: listView + + model: mailList.model //MailListModel {} + + delegate: PlasmaComponents.ListItem { + + width: listView.width + height: unit.size * 12 + + enabled: true + checked: listView.currentIndex == index + + MouseArea { + anchors.fill: parent + + onClicked: { + listView.currentIndex = model.index + singleMail.loadMail(model.id) + } + } + + Rectangle { + id: unread + + anchors.fill: parent + + color: colorPalette.read + opacity: 0.1 + + visible: model.unread == false + } + + 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 + } + + 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: model.date + + font.weight: Font.Light + } + + Label { + id: subject + + anchors { + bottom: avatar.bottom + left: avatar.right + leftMargin: unit.size * 3 + } + + text: model.subject + } + } + } +} \ No newline at end of file diff --git a/applications/kube-mail/package/contents/ui/SingleMailView.qml b/applications/kube-mail/package/contents/ui/SingleMailView.qml new file mode 100644 index 00000000..e307ccfd --- /dev/null +++ b/applications/kube-mail/package/contents/ui/SingleMailView.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 + +Item { + id: root + + Rectangle { + id: background + + anchors.fill: parent + + color: colorPalette.background + } + + Repeater { + anchors.fill: parent + + model: singleMail.model + + delegate: Item { + height: root.height + width: root.widht + + ColumnLayout { + + Label { + text: model.id + } + Label { + text: model.sender + } + Label { + text: model.senderName + } + + Label { + text: model.subject + } + + Label { + text: model.mimeMessage + } + } + } + } +} \ No newline at end of file diff --git a/applications/kube-mail/package/contents/ui/example.qml b/applications/kube-mail/package/contents/ui/example.qml new file mode 100644 index 00000000..a968bc72 --- /dev/null +++ b/applications/kube-mail/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.akonadi2.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/applications/kube-mail/package/contents/ui/main.qml b/applications/kube-mail/package/contents/ui/main.qml new file mode 100644 index 00000000..88d2edde --- /dev/null +++ b/applications/kube-mail/package/contents/ui/main.qml @@ -0,0 +1,138 @@ +/* + * 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.akonadi2.mail 1.0 as Mail + +ApplicationWindow { + id: app + + //FIXME remove fixed pixel hight + //for now just convinience during testing + height: 1080 * 0.7 + width: 1920 * 0.7 + + visible: true + + //Controller: + Mail.FolderList { + id: folderList + } + + Mail.MailList { + id: mailList + } + + Mail.SingleMail{ + id: singleMail + } + + //UI + toolBar: ToolBar { + + Row { + anchors.fill: parent + + PlasmaComponents.ToolButton { + + height: parent.height + + iconName: "mail-message-new" + + text: "Compose" + } + + PlasmaComponents.ToolButton { + + height: parent.height + + iconName: "mail-mark-unread" + text: "Mark Unread" + + onClicked: { + mailList.markMailUnread(true) + } + } + + PlasmaComponents.ToolButton { + + height: parent.height + + iconName: "mail-mark-important" + text: "Mark Important" + + onClicked: { + mailList.markMailImportant(true) + } + } + + PlasmaComponents.ToolButton { + + height: parent.height + + iconName: "edit-delete" + text: "Delete Mail" + + onClicked: { + mailList.deleteMail() + } + } + } + } + + SplitView { + anchors.fill: parent + + FolderListView { + id: folderListView + + width: unit.size * 55 + Layout.maximumWidth: unit.size * 150 + Layout.minimumWidth: unit.size * 30 + } + + MailListView { + id: mailListView + + width: unit.size * 80 + Layout.maximumWidth: unit.size * 250 + Layout.minimumWidth: unit.size * 50 + } + + SingleMailView { + id: mailView + + Layout.fillWidth: true + } + } + + //TODO find a better way to scale UI + Item { + id: unit + + property int size: 5 + } + + ColorPalette { + id: colorPalette + } +} + -- cgit v1.2.3