From 331f75d4da056ddb235be45a3784d2c19e545211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Nicole?= Date: Mon, 26 Feb 2018 18:19:43 +0100 Subject: Improvements of the log view Summary: - Add a test view for the log view - Allow passing the `entities` part of Sink messages - That allowed getting information about which mail could not be sent in sink transmission errors Reviewers: cmollekopf Reviewed By: cmollekopf Differential Revision: https://phabricator.kde.org/D10861 --- tests/teststore.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/teststore.cpp b/tests/teststore.cpp index e5a3ea88..9d56dd33 100644 --- a/tests/teststore.cpp +++ b/tests/teststore.cpp @@ -160,11 +160,14 @@ QVariant TestStore::load(const QByteArray &type, const QVariantMap &filter) using namespace Sink::ApplicationDomain; const auto list = loadList(type, filter); if (!list.isEmpty()) { + if (list.size() > 1) { + qWarning() << "While loading" << type << "with filter" << filter + << "; got multiple elements, but returning the first one."; + } return list.first(); } return {}; } - template QVariantList toVariantList(const QList &list) { @@ -183,6 +186,17 @@ QVariantList TestStore::loadList(const QByteArray &type, const QVariantMap &filt if (filter.contains("resource")) { query.resourceFilter(filter.value("resource").toByteArray()); } + + for (QVariantMap::const_iterator it = filter.begin(); it != filter.end(); ++it) { + if (it.key() == "messageId") { + query.filter(it.value()); + } else if (it.key() == "draft") { + query.filter(it.value()); + } else if (it.key() == "subject") { + query.filter(it.value()); + } + } + if (type == "mail") { return toVariantList(Sink::Store::read(query)); } @@ -205,6 +219,7 @@ QVariantMap TestStore::read(const QVariant &object) using namespace Sink::ApplicationDomain; QVariantMap map; if (auto mail = object.value()) { + map.insert("uid", mail->identifier()); map.insert("subject", mail->getSubject()); map.insert("draft", mail->getDraft()); return map; -- cgit v1.2.3