From a5f38b6541fbab0bdf31d5a804ec644af09a6b1b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 10 Jan 2018 12:27:56 +0100 Subject: The Inbox crusher as a first experimental view. The extension itself is not really usable yet, but serves as a showcase. --- framework/qml/ModelIndexRetriever.qml | 9 ++++++-- framework/qmldir | 1 + framework/src/domain/maillistmodel.cpp | 40 ++++++++++++++++++++++++++++++++++ framework/src/domain/maillistmodel.h | 5 +++++ 4 files changed, 53 insertions(+), 2 deletions(-) (limited to 'framework') diff --git a/framework/qml/ModelIndexRetriever.qml b/framework/qml/ModelIndexRetriever.qml index fa3fb64b..d01ceb71 100644 --- a/framework/qml/ModelIndexRetriever.qml +++ b/framework/qml/ModelIndexRetriever.qml @@ -21,11 +21,16 @@ import QtQuick 2.4 Repeater { id: root property var currentData + property int currentIndex: 0 + onCurrentIndexChanged: { + currentData = itemAt(currentIndex).currentData + } Item { - id: delegate property var currentData: model onCurrentDataChanged: { - root.currentData = model + if (index == root.currentIndex) { + root.currentData = model + } } visible: false } diff --git a/framework/qmldir b/framework/qmldir index 748b77f7..b94abc28 100644 --- a/framework/qmldir +++ b/framework/qmldir @@ -4,6 +4,7 @@ ConversationView 1.0 ConversationView.qml ConversationListView 1.0 ConversationListView.qml FolderListView 1.0 FolderListView.qml MailListView 1.0 MailListView.qml +MailViewer 1.0 MailViewer.qml InlineAccountSwitcher 1.0 InlineAccountSwitcher.qml NewAccountDialog 1.0 NewAccountDialog.qml EditAccount 1.0 EditAccount.qml diff --git a/framework/src/domain/maillistmodel.cpp b/framework/src/domain/maillistmodel.cpp index 83fd37ff..4b70a10a 100644 --- a/framework/src/domain/maillistmodel.cpp +++ b/framework/src/domain/maillistmodel.cpp @@ -339,3 +339,43 @@ bool MailListModel::showDrafts() const { return false; } + +void MailListModel::setShowInbox(bool) +{ + using namespace Sink::ApplicationDomain; + + Sink::Query folderQuery{}; + folderQuery.containsFilter(Sink::ApplicationDomain::SpecialPurpose::Mail::inbox); + folderQuery.request(); + folderQuery.request(); + + Sink::Query query; + query.setFlags(Sink::Query::LiveQuery); + query.filter(folderQuery); + query.sort(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + query.request(); + mFetchMails = true; + mFetchedMails.clear(); + qDebug() << "Running mail query for drafts: "; + //Latest mail at the top + sort(0, Qt::DescendingOrder); + runQuery(query); +} + +bool MailListModel::showInbox() const +{ + return false; +} diff --git a/framework/src/domain/maillistmodel.h b/framework/src/domain/maillistmodel.h index 5f593700..ce0399f7 100644 --- a/framework/src/domain/maillistmodel.h +++ b/framework/src/domain/maillistmodel.h @@ -32,6 +32,8 @@ class MailListModel : public QSortFilterProxyModel Q_PROPERTY (QVariant parentFolder READ parentFolder WRITE setParentFolder) Q_PROPERTY (QVariant mail READ mail WRITE setMail) Q_PROPERTY (bool showDrafts READ showDrafts WRITE setShowDrafts) + Q_PROPERTY (bool showInbox READ showInbox WRITE setShowInbox) + Q_PROPERTY (QString filter READ filter WRITE setFilter) Q_PROPERTY (bool isThreaded READ isThreaded NOTIFY isThreadedChanged) @@ -91,6 +93,9 @@ public: void setShowDrafts(bool); bool showDrafts() const; + void setShowInbox(bool); + bool showInbox() const; + signals: void isThreadedChanged(); -- cgit v1.2.3