From ec48ea0cf01d306c0a9283e485f8c37d7d4d1ebd Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 16 Apr 2017 22:18:02 +0200 Subject: Hide trash from non-trash conversations. ...and indicate in the conversation view if a mail has been sent or is a draft. --- framework/qml/ConversationView.qml | 18 ++++++++++++++++++ framework/qml/FolderListView.qml | 2 ++ framework/src/domain/folderlistmodel.cpp | 6 ++++++ framework/src/domain/folderlistmodel.h | 3 ++- 4 files changed, 28 insertions(+), 1 deletion(-) (limited to 'framework') diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index 83771925..0d71dde9 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml @@ -34,6 +34,9 @@ Rectangle { property int currentIndex: 0; property bool scrollToEnd: true; property variant currentMail: null; + property bool hideTrash: true; + property bool hideNonTrash: false; + onCurrentIndexChanged: { markAsReadTimer.restart(); } @@ -186,6 +189,7 @@ Rectangle { height: sheet.height + Kube.Units.gridUnit width: parent.width + visible: !((root.hideTrash && model.trash) || (root.hideNonTrash && !model.trash)) MouseArea { anchors.fill: parent @@ -321,6 +325,20 @@ Rectangle { color: Kube.Colors.textColor opacity: 0.75 font.italic: true + states: [ + State { + name: "trash"; when: model.trash + PropertyChanges { target: subject; text: "Trash: " + model.subject } + }, + State { + name: "draft"; when: model.draft + PropertyChanges { target: subject; text: "Draft: " + model.subject } + }, + State { + name: "sent"; when: model.sent + PropertyChanges { target: subject; text: "Sent: " + model.subject } + } + ] } Text { diff --git a/framework/qml/FolderListView.qml b/framework/qml/FolderListView.qml index 1455be21..734e6e10 100644 --- a/framework/qml/FolderListView.qml +++ b/framework/qml/FolderListView.qml @@ -29,6 +29,7 @@ Rectangle { property variant currentFolder: null property variant accountId + property bool isTrashFolder: false color: Kube.Colors.textColor @@ -77,6 +78,7 @@ Rectangle { onCurrentIndexChanged: { model.fetchMore(currentIndex) root.currentFolder = model.data(currentIndex, Kube.FolderListModel.DomainObject) + root.isTrashFolder = model.data(currentIndex, Kube.FolderListModel.Trash) folderController.synchronizeAction.execute() } diff --git a/framework/src/domain/folderlistmodel.cpp b/framework/src/domain/folderlistmodel.cpp index 14405beb..4437e75b 100644 --- a/framework/src/domain/folderlistmodel.cpp +++ b/framework/src/domain/folderlistmodel.cpp @@ -53,6 +53,7 @@ QHash< int, QByteArray > FolderListModel::roleNames() const roles[Id] = "id"; roles[DomainObject] = "domainObject"; roles[Status] = "status"; + roles[Trash] = "trash"; return roles; } @@ -81,6 +82,11 @@ QVariant FolderListModel::data(const QModelIndex &idx, int role) const } return NoStatus; } + case Trash: + if (folder) { + return folder->getSpecialPurpose().contains(Sink::ApplicationDomain::SpecialPurpose::Mail::trash); + } + return false; } return QSortFilterProxyModel::data(idx, role); } diff --git a/framework/src/domain/folderlistmodel.h b/framework/src/domain/folderlistmodel.h index 17645bb5..8f157ca2 100644 --- a/framework/src/domain/folderlistmodel.h +++ b/framework/src/domain/folderlistmodel.h @@ -54,7 +54,8 @@ public: Icon, Id, DomainObject, - Status + Status, + Trash }; Q_ENUMS(Roles) -- cgit v1.2.3