diff --git a/src/akonadi/akonadicontextqueries.h b/src/akonadi/akonadicontextqueries.h --- a/src/akonadi/akonadicontextqueries.h +++ b/src/akonadi/akonadicontextqueries.h @@ -43,7 +43,6 @@ typedef Domain::QueryResult TaskResult; typedef Domain::QueryResultProvider TaskProvider; - typedef Domain::LiveQueryInput TagInputQuery; typedef Domain::LiveQueryOutput ContextQueryOutput; typedef Domain::QueryResult ContextResult; typedef Domain::QueryResultProvider ContextProvider; diff --git a/src/akonadi/akonadilivequeryhelpers.h b/src/akonadi/akonadilivequeryhelpers.h --- a/src/akonadi/akonadilivequeryhelpers.h +++ b/src/akonadi/akonadilivequeryhelpers.h @@ -39,7 +39,6 @@ typedef Domain::LiveQueryInput::FetchFunction CollectionFetchFunction; typedef Domain::LiveQueryInput::FetchFunction ItemFetchFunction; - typedef Domain::LiveQueryInput::FetchFunction TagFetchFunction; LiveQueryHelpers(const SerializerInterface::Ptr &serializer, const StorageInterface::Ptr &storage); diff --git a/src/akonadi/akonadilivequeryintegrator.h b/src/akonadi/akonadilivequeryintegrator.h --- a/src/akonadi/akonadilivequeryintegrator.h +++ b/src/akonadi/akonadilivequeryintegrator.h @@ -29,7 +29,6 @@ #include #include -#include #include @@ -89,7 +88,6 @@ typedef QSharedPointer Ptr; typedef std::function CollectionRemoveHandler; typedef std::function ItemRemoveHandler; - typedef std::function TagRemoveHandler; LiveQueryIntegrator(const SerializerInterface::Ptr &serializer, const MonitorInterface::Ptr &monitor, @@ -184,7 +182,6 @@ void addRemoveHandler(const CollectionRemoveHandler &handler); void addRemoveHandler(const ItemRemoveHandler &handler); - void addRemoveHandler(const TagRemoveHandler &handler); private slots: void onCollectionSelectionChanged(); @@ -197,10 +194,6 @@ void onItemRemoved(const Akonadi::Item &item); void onItemChanged(const Akonadi::Item &item); - void onTagAdded(const Akonadi::Tag &tag); - void onTagRemoved(const Akonadi::Tag &tag); - void onTagChanged(const Akonadi::Tag &tag); - private: void cleanupQueries(); @@ -216,11 +209,9 @@ Domain::LiveQueryInput::WeakList m_collectionInputQueries; Domain::LiveQueryInput::WeakList m_itemInputQueries; - Domain::LiveQueryInput::WeakList m_tagInputQueries; QList m_collectionRemoveHandlers; QList m_itemRemoveHandlers; - QList m_tagRemoveHandlers; SerializerInterface::Ptr m_serializer; MonitorInterface::Ptr m_monitor; @@ -244,24 +235,6 @@ return m_serializer->itemRepresentsContext(output, input); } -template<> -inline Domain::Context::Ptr LiveQueryIntegrator::create(const Tag &input) -{ - return m_serializer->createContextFromTag(input); -} - -template<> -inline void LiveQueryIntegrator::update(const Tag &input, Domain::Context::Ptr &output) -{ - m_serializer->updateContextFromTag(output, input); -} - -template<> -inline bool LiveQueryIntegrator::represents(const Tag &input, const Domain::Context::Ptr &output) -{ - return m_serializer->isContextTag(output, input); -} - template<> inline Domain::DataSource::Ptr LiveQueryIntegrator::create(const Collection &input) { @@ -358,11 +331,6 @@ { return m_itemInputQueries; } -template<> -inline typename Domain::LiveQueryInput::WeakList &LiveQueryIntegrator::inputQueries() -{ - return m_tagInputQueries; -} } diff --git a/src/akonadi/akonadilivequeryintegrator.cpp b/src/akonadi/akonadilivequeryintegrator.cpp --- a/src/akonadi/akonadilivequeryintegrator.cpp +++ b/src/akonadi/akonadilivequeryintegrator.cpp @@ -43,10 +43,6 @@ connect(m_monitor.data(), &MonitorInterface::itemAdded, this, &LiveQueryIntegrator::onItemAdded); connect(m_monitor.data(), &MonitorInterface::itemRemoved, this, &LiveQueryIntegrator::onItemRemoved); connect(m_monitor.data(), &MonitorInterface::itemChanged, this, &LiveQueryIntegrator::onItemChanged); - - connect(m_monitor.data(), &MonitorInterface::tagAdded, this, &LiveQueryIntegrator::onTagAdded); - connect(m_monitor.data(), &MonitorInterface::tagRemoved, this, &LiveQueryIntegrator::onTagRemoved); - connect(m_monitor.data(), &MonitorInterface::tagChanged, this, &LiveQueryIntegrator::onTagChanged); } void LiveQueryIntegrator::addRemoveHandler(const LiveQueryIntegrator::CollectionRemoveHandler &handler) @@ -59,11 +55,6 @@ m_itemRemoveHandlers << handler; } -void LiveQueryIntegrator::addRemoveHandler(const LiveQueryIntegrator::TagRemoveHandler &handler) -{ - m_tagRemoveHandlers << handler; -} - void LiveQueryIntegrator::onCollectionSelectionChanged() { foreach (const auto &weak, m_itemInputQueries) { @@ -137,41 +128,8 @@ } } -void LiveQueryIntegrator::onTagAdded(const Tag &tag) -{ - foreach (const auto &weak, m_tagInputQueries) { - auto query = weak.toStrongRef(); - if (query) - query->onAdded(tag); - } -} - -void LiveQueryIntegrator::onTagRemoved(const Tag &tag) -{ - foreach (const auto &weak, m_tagInputQueries) { - auto query = weak.toStrongRef(); - if (query) - query->onRemoved(tag); - } - - foreach (const auto &handler, m_tagRemoveHandlers) - handler(tag); - - cleanupQueries(); -} - -void LiveQueryIntegrator::onTagChanged(const Tag &tag) -{ - foreach (const auto &weak, m_tagInputQueries) { - auto query = weak.toStrongRef(); - if (query) - query->onChanged(tag); - } -} - void LiveQueryIntegrator::cleanupQueries() { m_collectionInputQueries.removeAll(Domain::LiveQueryInput::WeakPtr()); m_itemInputQueries.removeAll(Domain::LiveQueryInput::WeakPtr()); - m_tagInputQueries.removeAll(Domain::LiveQueryInput::WeakPtr()); } diff --git a/src/akonadi/akonadimonitorimpl.h b/src/akonadi/akonadimonitorimpl.h --- a/src/akonadi/akonadimonitorimpl.h +++ b/src/akonadi/akonadimonitorimpl.h @@ -40,7 +40,6 @@ private slots: void onCollectionChanged(const Akonadi::Collection &collection, const QSet &parts); - void onItemsTagsChanged(const Akonadi::Item::List &items, const QSet &addedTags, const QSet &removedTags); private: bool hasSupportedMimeTypes(const Collection &collection); diff --git a/src/akonadi/akonadimonitorimpl.cpp b/src/akonadi/akonadimonitorimpl.cpp --- a/src/akonadi/akonadimonitorimpl.cpp +++ b/src/akonadi/akonadimonitorimpl.cpp @@ -30,8 +30,6 @@ #include #include #include -#include -#include #include "akonadi/akonadiapplicationselectedattribute.h" #include "akonadi/akonaditimestampattribute.h" @@ -43,7 +41,6 @@ { AttributeFactory::registerAttribute(); AttributeFactory::registerAttribute(); - AttributeFactory::registerAttribute(); m_monitor->fetchCollection(true); m_monitor->setCollectionMonitored(Akonadi::Collection::root()); @@ -64,25 +61,14 @@ auto itemScope = m_monitor->itemFetchScope(); itemScope.fetchFullPayload(); itemScope.fetchAllAttributes(); - itemScope.setFetchTags(true); - itemScope.tagFetchScope().setFetchIdOnly(false); - itemScope.tagFetchScope().fetchAttribute(); + itemScope.setFetchTags(false); itemScope.setAncestorRetrieval(ItemFetchScope::All); m_monitor->setItemFetchScope(itemScope); - auto tagFetchScope = m_monitor->tagFetchScope(); - tagFetchScope.setFetchIdOnly(false); - tagFetchScope.fetchAttribute(); - m_monitor->setTagFetchScope(tagFetchScope); connect(m_monitor, &Akonadi::Monitor::itemAdded, this, &MonitorImpl::itemAdded); connect(m_monitor, &Akonadi::Monitor::itemRemoved, this, &MonitorImpl::itemRemoved); connect(m_monitor, &Akonadi::Monitor::itemChanged, this, &MonitorImpl::itemChanged); connect(m_monitor, &Akonadi::Monitor::itemMoved, this, &MonitorImpl::itemMoved); - connect(m_monitor, &Akonadi::Monitor::itemsTagsChanged, this, &MonitorImpl::onItemsTagsChanged); - - connect(m_monitor, &Akonadi::Monitor::tagAdded, this, &MonitorImpl::tagAdded); - connect(m_monitor, &Akonadi::Monitor::tagRemoved, this, &MonitorImpl::tagRemoved); - connect(m_monitor, &Akonadi::Monitor::tagChanged, this, &MonitorImpl::tagChanged); } MonitorImpl::~MonitorImpl() @@ -110,17 +96,6 @@ } } -void MonitorImpl::onItemsTagsChanged(const Akonadi::Item::List &items, const QSet &addedTags, const QSet &removedTags) -{ - // Because itemChanged is not emitted on tag removal, we need to listen to itemsTagsChanged and - // emit the itemChanged only in this case (avoid double emits in case of tag dissociation / association) - // So if both list are empty it means we are just seeing a tag being removed so we update its related items - if (addedTags.isEmpty() && removedTags.isEmpty()) { - foreach (const Item &item, items) - emit itemChanged(item); - } -} - bool MonitorImpl::hasSupportedMimeTypes(const Collection &collection) { QSet mimeIntersection = m_monitor->mimeTypesMonitored().toSet(); diff --git a/src/akonadi/akonadimonitorinterface.h b/src/akonadi/akonadimonitorinterface.h --- a/src/akonadi/akonadimonitorinterface.h +++ b/src/akonadi/akonadimonitorinterface.h @@ -31,7 +31,6 @@ class Collection; class Item; -class Tag; class MonitorInterface : public QObject { @@ -52,10 +51,6 @@ void itemRemoved(const Akonadi::Item &item); void itemChanged(const Akonadi::Item &items); void itemMoved(const Akonadi::Item &item); - - void tagAdded(const Akonadi::Tag &tag); - void tagRemoved(const Akonadi::Tag &tag); - void tagChanged(const Akonadi::Tag &tag); }; } diff --git a/src/akonadi/akonadiserializer.h b/src/akonadi/akonadiserializer.h --- a/src/akonadi/akonadiserializer.h +++ b/src/akonadi/akonadiserializer.h @@ -30,7 +30,6 @@ namespace Akonadi { class Item; -class Tag; class Serializer : public SerializerInterface { @@ -68,23 +67,15 @@ Akonadi::Item createItemFromProject(Domain::Project::Ptr project) override; bool isProjectChild(Domain::Project::Ptr project, Akonadi::Item item) override; - Domain::Context::Ptr createContextFromTag(Akonadi::Tag tag) override; - void updateContextFromTag(Domain::Context::Ptr context, Akonadi::Tag tag) override; - Akonadi::Tag createTagFromContext(Domain::Context::Ptr context) override; - bool isContextTag(const Domain::Context::Ptr &context, const Akonadi::Tag &tag) const override; bool isContextChild(Domain::Context::Ptr context, Akonadi::Item item) const override; - bool isContext(Akonadi::Item item) override; bool itemRepresentsContext(const Domain::Context::Ptr &context, Akonadi::Item item) const override; Domain::Context::Ptr createContextFromItem(Akonadi::Item item) override; Akonadi::Item createItemFromContext(Domain::Context::Ptr context) override; void updateContextFromItem(Domain::Context::Ptr context, Akonadi::Item item) override; void addContextToTask(Domain::Context::Ptr context, Akonadi::Item item) override; void removeContextFromTask(Domain::Context::Ptr context, Akonadi::Item item) override; QString contextUid(Akonadi::Item item) override; - -private: - bool isContext(const Akonadi::Tag &tag) const; }; } diff --git a/src/akonadi/akonadiserializer.cpp b/src/akonadi/akonadiserializer.cpp --- a/src/akonadi/akonadiserializer.cpp +++ b/src/akonadi/akonadiserializer.cpp @@ -458,48 +458,6 @@ && todoUid == relatedUid; } -Domain::Context::Ptr Serializer::createContextFromTag(Akonadi::Tag tag) -{ - if (!isContext(tag)) - return Domain::Context::Ptr(); - - auto context = Domain::Context::Ptr::create(); - updateContextFromTag(context, tag); - return context; -} - -Akonadi::Tag Serializer::createTagFromContext(Domain::Context::Ptr context) -{ - auto tag = Akonadi::Tag(); - tag.setName(context->name()); - tag.setType(Akonadi::SerializerInterface::contextTagType()); - tag.setGid(QByteArray(context->name().toLatin1())); - - if (context->property("tagId").isValid()) - tag.setId(context->property("tagId").value()); - - return tag; -} - -void Serializer::updateContextFromTag(Domain::Context::Ptr context, Akonadi::Tag tag) -{ - if (!isContext(tag)) - return; - - context->setProperty("tagId", tag.id()); - context->setName(tag.name()); -} - -bool Serializer::isContext(const Akonadi::Tag &tag) const -{ - return (tag.type() == Akonadi::SerializerInterface::contextTagType()); -} - -bool Serializer::isContextTag(const Domain::Context::Ptr &context, const Akonadi::Tag &tag) const -{ - return (context->property("tagId").value() == tag.id()); -} - static QStringList extractContexts(KCalCore::Todo::Ptr todo) { const auto contexts = todo->customProperty(s_appName, s_contextListProperty); diff --git a/src/akonadi/akonadiserializerinterface.h b/src/akonadi/akonadiserializerinterface.h --- a/src/akonadi/akonadiserializerinterface.h +++ b/src/akonadi/akonadiserializerinterface.h @@ -35,7 +35,6 @@ class Collection; class Item; -class Tag; class SerializerInterface { @@ -85,22 +84,15 @@ virtual Akonadi::Item createItemFromProject(Domain::Project::Ptr project) = 0; virtual bool isProjectChild(Domain::Project::Ptr project, Akonadi::Item item) = 0; - virtual Domain::Context::Ptr createContextFromTag(Akonadi::Tag tag) = 0; - virtual void updateContextFromTag(Domain::Context::Ptr context, Akonadi::Tag tag) = 0; - virtual Akonadi::Tag createTagFromContext(Domain::Context::Ptr context) = 0; - virtual bool isContextTag(const Domain::Context::Ptr &context, const Akonadi::Tag &tag) const = 0; virtual bool isContextChild(Domain::Context::Ptr context, Akonadi::Item item) const = 0; - virtual bool isContext(Akonadi::Item item) = 0; virtual bool itemRepresentsContext(const Domain::Context::Ptr &context, Akonadi::Item item) const = 0; virtual Domain::Context::Ptr createContextFromItem(Akonadi::Item item) = 0; virtual Akonadi::Item createItemFromContext(Domain::Context::Ptr project) = 0; virtual void updateContextFromItem(Domain::Context::Ptr context, Akonadi::Item item) = 0; virtual void addContextToTask(Domain::Context::Ptr context, Akonadi::Item item) = 0; virtual void removeContextFromTask(Domain::Context::Ptr context, Akonadi::Item item) = 0; virtual QString contextUid(Akonadi::Item item) = 0; - - static QByteArray contextTagType(); // TODO REMOVE ONCE UNUSED }; } diff --git a/src/akonadi/akonadiserializerinterface.cpp b/src/akonadi/akonadiserializerinterface.cpp --- a/src/akonadi/akonadiserializerinterface.cpp +++ b/src/akonadi/akonadiserializerinterface.cpp @@ -34,8 +34,3 @@ SerializerInterface::~SerializerInterface() { } - -QByteArray SerializerInterface::contextTagType() -{ - return QByteArray("Zanshin-Context"); -} diff --git a/src/akonadi/akonadistorage.cpp b/src/akonadi/akonadistorage.cpp --- a/src/akonadi/akonadistorage.cpp +++ b/src/akonadi/akonadistorage.cpp @@ -251,7 +251,7 @@ auto scope = job->fetchScope(); scope.fetchFullPayload(); scope.fetchAllAttributes(); - scope.setFetchTags(true); + scope.setFetchTags(false); scope.setAncestorRetrieval(ItemFetchScope::All); job->setFetchScope(scope); } diff --git a/src/akonadi/akonadistorageinterface.h b/src/akonadi/akonadistorageinterface.h --- a/src/akonadi/akonadistorageinterface.h +++ b/src/akonadi/akonadistorageinterface.h @@ -26,7 +26,6 @@ #include #include -#include class KJob; class QObject; @@ -37,7 +36,6 @@ class Collection; class CollectionFetchJobInterface; class ItemFetchJobInterface; -class TagFetchJobInterface; class StorageInterface diff --git a/tests/features/pages/pagesdisplayfeature.cpp b/tests/features/pages/pagesdisplayfeature.cpp --- a/tests/features/pages/pagesdisplayfeature.cpp +++ b/tests/features/pages/pagesdisplayfeature.cpp @@ -35,7 +35,7 @@ { Q_OBJECT private slots: - void Inbox_projects_contexts_and_tags_appear_in_the_list() + void Inbox_projects_and_contexts_appear_in_the_list() { ZanshinContext c; Given(c.I_display_the_available_pages()); diff --git a/tests/testlib/CMakeLists.txt b/tests/testlib/CMakeLists.txt --- a/tests/testlib/CMakeLists.txt +++ b/tests/testlib/CMakeLists.txt @@ -9,7 +9,6 @@ akonadistoragetestbase.cpp fakejob.cpp gencollection.cpp - gentag.cpp gentodo.cpp modeltest.cpp monitorspy.cpp diff --git a/tests/testlib/akonadifakemonitor.h b/tests/testlib/akonadifakemonitor.h --- a/tests/testlib/akonadifakemonitor.h +++ b/tests/testlib/akonadifakemonitor.h @@ -46,10 +46,6 @@ void removeItem(const Akonadi::Item &item); void changeItem(const Akonadi::Item &item); void moveItem(const Akonadi::Item &item); - - void addTag(const Akonadi::Tag &tag); - void removeTag(const Akonadi::Tag &tag); - void changeTag(const Akonadi::Tag &tag); }; } diff --git a/tests/testlib/akonadifakemonitor.cpp b/tests/testlib/akonadifakemonitor.cpp --- a/tests/testlib/akonadifakemonitor.cpp +++ b/tests/testlib/akonadifakemonitor.cpp @@ -70,18 +70,4 @@ emit itemMoved(item); } -void AkonadiFakeMonitor::addTag(const Akonadi::Tag &tag) -{ - emit tagAdded(tag); -} - -void AkonadiFakeMonitor::removeTag(const Akonadi::Tag &tag) -{ - emit tagRemoved(tag); -} - -void AkonadiFakeMonitor::changeTag(const Akonadi::Tag &tag) -{ - emit tagChanged(tag); -} diff --git a/tests/testlib/akonadifakestoragebehavior.h b/tests/testlib/akonadifakestoragebehavior.h --- a/tests/testlib/akonadifakestoragebehavior.h +++ b/tests/testlib/akonadifakestoragebehavior.h @@ -28,7 +28,6 @@ #include #include -#include namespace Testlib { @@ -63,16 +62,6 @@ void setFetchItemBehavior(Akonadi::Item::Id id, FetchBehavior behavior); FetchBehavior fetchItemBehavior(Akonadi::Item::Id id) const; - void setFetchTagItemsErrorCode(Akonadi::Tag::Id id, int errorCode); - int fetchTagItemsErrorCode(Akonadi::Tag::Id id) const; - void setFetchTagItemsBehavior(Akonadi::Tag::Id id, FetchBehavior behavior); - FetchBehavior fetchTagItemsBehavior(Akonadi::Tag::Id id) const; - - void setFetchTagsErrorCode(int errorCode); - int fetchTagsErrorCode() const; - void setFetchTagsBehavior(FetchBehavior behavior); - FetchBehavior fetchTagsBehavior() const; - private: QHash m_fetchCollectionsErrorCode; QHash m_fetchCollectionsBehavior; @@ -85,12 +74,6 @@ QHash m_fetchItemErrorCode; QHash m_fetchItemBehavior; - - QHash m_fetchTagItemsErrorCode; - QHash m_fetchTagItemsBehavior; - - int m_fetchTagsErrorCode; - FetchBehavior m_fetchTagsBehavior; }; } diff --git a/tests/testlib/akonadifakestoragebehavior.cpp b/tests/testlib/akonadifakestoragebehavior.cpp --- a/tests/testlib/akonadifakestoragebehavior.cpp +++ b/tests/testlib/akonadifakestoragebehavior.cpp @@ -26,8 +26,6 @@ using namespace Testlib; AkonadiFakeStorageBehavior::AkonadiFakeStorageBehavior() - : m_fetchTagsErrorCode(KJob::NoError), - m_fetchTagsBehavior(NormalFetch) { } @@ -114,43 +112,3 @@ { return m_fetchItemBehavior.value(id, NormalFetch); } - -void AkonadiFakeStorageBehavior::setFetchTagItemsErrorCode(Akonadi::Tag::Id id, int errorCode) -{ - m_fetchTagItemsErrorCode[id] = errorCode; -} - -int AkonadiFakeStorageBehavior::fetchTagItemsErrorCode(Akonadi::Tag::Id id) const -{ - return m_fetchTagItemsErrorCode.value(id, KJob::NoError); -} - -void AkonadiFakeStorageBehavior::setFetchTagItemsBehavior(Akonadi::Tag::Id id, FetchBehavior behavior) -{ - m_fetchTagItemsBehavior[id] = behavior; -} - -AkonadiFakeStorageBehavior::FetchBehavior AkonadiFakeStorageBehavior::fetchTagItemsBehavior(Akonadi::Tag::Id id) const -{ - return m_fetchTagItemsBehavior.value(id, NormalFetch); -} - -void AkonadiFakeStorageBehavior::setFetchTagsErrorCode(int errorCode) -{ - m_fetchTagsErrorCode = errorCode; -} - -int AkonadiFakeStorageBehavior::fetchTagsErrorCode() const -{ - return m_fetchTagsErrorCode; -} - -void AkonadiFakeStorageBehavior::setFetchTagsBehavior(FetchBehavior behavior) -{ - m_fetchTagsBehavior = behavior; -} - -AkonadiFakeStorageBehavior::FetchBehavior AkonadiFakeStorageBehavior::fetchTagsBehavior() const -{ - return m_fetchTagsBehavior; -} diff --git a/tests/testlib/akonadistoragetestbase.cpp b/tests/testlib/akonadistoragetestbase.cpp --- a/tests/testlib/akonadistoragetestbase.cpp +++ b/tests/testlib/akonadistoragetestbase.cpp @@ -53,7 +53,6 @@ { qRegisterMetaType(); qRegisterMetaType(); - qRegisterMetaType(); } void AkonadiStorageTestBase::cleanupTestCase() diff --git a/tests/testlib/gentag.h b/tests/testlib/gentag.h deleted file mode 100644 --- a/tests/testlib/gentag.h +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of Zanshin - - Copyright 2015 Kevin Ottens - - 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 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef TESTLIB_GENTAG_H -#define TESTLIB_GENTAG_H - -#include - -#include - -namespace Testlib { - -class GenTag -{ -public: - explicit GenTag(const Akonadi::Tag &tag = Akonadi::Tag()); - - operator Akonadi::Tag(); - - GenTag &withId(Akonadi::Tag::Id id); - GenTag &withName(const QString &name); - GenTag &asContext(); - GenTag &asPlain(); - -private: - Akonadi::Tag m_tag; -}; - -} - -#endif // TESTLIB_GENTAG_H diff --git a/tests/testlib/gentag.cpp b/tests/testlib/gentag.cpp deleted file mode 100644 --- a/tests/testlib/gentag.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* This file is part of Zanshin - - Copyright 2015 Kevin Ottens - - 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 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "gentag.h" - -#include "akonadi/akonadiserializerinterface.h" - -using namespace Testlib; - -GenTag::GenTag(const Akonadi::Tag &tag) - : m_tag(tag) -{ -} - -GenTag::operator Akonadi::Tag() -{ - return m_tag; -} - -GenTag &GenTag::withId(Akonadi::Tag::Id id) -{ - m_tag.setId(id); - return *this; -} - -GenTag &GenTag::withName(const QString &name) -{ - m_tag.setName(name); - m_tag.setGid(name.toLatin1()); - return *this; -} - -GenTag &GenTag::asContext() -{ - m_tag.setType(Akonadi::SerializerInterface::contextTagType()); - return *this; -} - -GenTag &GenTag::asPlain() -{ - m_tag.setType(Akonadi::Tag::PLAIN); - return *this; -} diff --git a/tests/testlib/monitorspy.cpp b/tests/testlib/monitorspy.cpp --- a/tests/testlib/monitorspy.cpp +++ b/tests/testlib/monitorspy.cpp @@ -54,10 +54,6 @@ connect(m_monitor, &Akonadi::MonitorInterface::itemChanged, this, &MonitorSpy::restartTimer); connect(m_monitor, &Akonadi::MonitorInterface::itemMoved, this, &MonitorSpy::restartTimer); - connect(m_monitor, &Akonadi::MonitorInterface::tagAdded, this, &MonitorSpy::restartTimer); - connect(m_monitor, &Akonadi::MonitorInterface::tagRemoved, this, &MonitorSpy::restartTimer); - connect(m_monitor, &Akonadi::MonitorInterface::tagChanged, this, &MonitorSpy::restartTimer); - connect(m_timer, &QTimer::timeout, this, &MonitorSpy::onDelayExpired); } diff --git a/tests/units/akonadi/akonadicontextrepositorytest.cpp b/tests/units/akonadi/akonadicontextrepositorytest.cpp --- a/tests/units/akonadi/akonadicontextrepositorytest.cpp +++ b/tests/units/akonadi/akonadicontextrepositorytest.cpp @@ -115,7 +115,7 @@ // A mock job auto contextItemDeleteJob = new FakeJob(this); - // Storage mock returning the tagCreatejob + // Storage mock returning the mock job Utils::MockObject storageMock; storageMock(&Akonadi::StorageInterface::removeItem).when(contextItem) .thenReturn(contextItemDeleteJob); diff --git a/tests/units/akonadi/akonadilivequeryhelperstest.cpp b/tests/units/akonadi/akonadilivequeryhelperstest.cpp --- a/tests/units/akonadi/akonadilivequeryhelperstest.cpp +++ b/tests/units/akonadi/akonadilivequeryhelperstest.cpp @@ -380,8 +380,8 @@ data.createItem(GenTodo().withId(142).withUid("ctx-42").asContext()); data.createItem(GenTodo().withId(143).withUid("ctx-43").asContext()); - // Four items in each collection, one with no tag, one with the first tag, - // one with the second tag, last one with both tags + // Four items in each collection, one with no context, one with the first context, + // one with the second context, last one with both contexts data.createItem(GenTodo().withId(42).withParent(42).withContexts({}).withTitle(QStringLiteral("42"))); data.createItem(GenTodo().withId(43).withParent(42).withContexts({"ctx-42"}).withTitle(QStringLiteral("43"))); data.createItem(GenTodo().withId(44).withParent(42).withContexts({"ctx-43"}).withTitle(QStringLiteral("44"))); diff --git a/tests/units/akonadi/akonadilivequeryintegratortest.cpp b/tests/units/akonadi/akonadilivequeryintegratortest.cpp --- a/tests/units/akonadi/akonadilivequeryintegratortest.cpp +++ b/tests/units/akonadi/akonadilivequeryintegratortest.cpp @@ -246,7 +246,7 @@ const auto collection = Akonadi::Collection(GenCollection().withId(42).withRootAsParent().withName(QStringLiteral("folder")).withTaskContent()); data.createCollection(collection); - // One context tag which shows in one query not the other + // One context which shows in one query not the other data.createItem(GenTodo().withParent(42).withId(42).withUid("ctx-42").asContext().withTitle(QStringLiteral("42-in"))); auto integrator = createIntegrator(data); diff --git a/tests/units/migrator/zanshin021migrationtest.cpp b/tests/units/migrator/zanshin021migrationtest.cpp --- a/tests/units/migrator/zanshin021migrationtest.cpp +++ b/tests/units/migrator/zanshin021migrationtest.cpp @@ -53,7 +53,6 @@ { qRegisterMetaType(); qRegisterMetaType(); - qRegisterMetaType(); } private slots: diff --git a/tests/units/testlib/CMakeLists.txt b/tests/units/testlib/CMakeLists.txt --- a/tests/units/testlib/CMakeLists.txt +++ b/tests/units/testlib/CMakeLists.txt @@ -5,7 +5,6 @@ akonadifakedataxmlloadertest akonadifakestoragetest gencollectiontest - gentagtest gentodotest monitorspytest ) diff --git a/tests/units/testlib/akonadifakedatatest.cpp b/tests/units/testlib/akonadifakedatatest.cpp --- a/tests/units/testlib/akonadifakedatatest.cpp +++ b/tests/units/testlib/akonadifakedatatest.cpp @@ -550,7 +550,7 @@ QCOMPARE(spy.takeFirst().at(0).value(), i1); } - void shouldListTagItems() + void shouldListContextItems() { // GIVEN auto data = Testlib::AkonadiFakeData(); diff --git a/tests/units/testlib/gentagtest.cpp b/tests/units/testlib/gentagtest.cpp deleted file mode 100644 --- a/tests/units/testlib/gentagtest.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* This file is part of Zanshin - - Copyright 2015 Kevin Ottens - - 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 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "testlib/gentag.h" - -#include - -#include "akonadi/akonadiserializerinterface.h" - -using namespace Testlib; - -class GenTagTest : public QObject -{ - Q_OBJECT -private slots: - void shouldImplicitlyConvertBackToTag() - { - // GIVEN - auto tag = Akonadi::Tag(42); - auto gen = GenTag(tag); - - // WHEN - Akonadi::Tag newTag = gen; - - // THEN - QCOMPARE(newTag, tag); - } - - void shouldAllowToSetId() - { - // GIVEN - Akonadi::Tag tag = GenTag().withId(42); - - // THEN - QCOMPARE(tag.id(), 42LL); - } - - void shouldAllowToSetName() - { - // GIVEN - Akonadi::Tag tag = GenTag().withName(QStringLiteral("42")); - - // THEN - QCOMPARE(tag.name(), QStringLiteral("42")); - QCOMPARE(tag.gid(), tag.name().toLatin1()); - } - - void shouldAllowToSetContextType() - { - // GIVEN - Akonadi::Tag tag = GenTag().asContext(); - - // THEN - QCOMPARE(tag.type(), Akonadi::SerializerInterface::contextTagType()); - } - - void shouldAllowToSetPlainType() - { - // GIVEN - Akonadi::Tag tag = GenTag().asPlain(); - - // THEN - QCOMPARE(tag.type(), QByteArray(Akonadi::Tag::PLAIN)); - } -}; - -ZANSHIN_TEST_MAIN(GenTagTest) - -#include "gentagtest.moc" diff --git a/tests/units/testlib/gentodotest.cpp b/tests/units/testlib/gentodotest.cpp --- a/tests/units/testlib/gentodotest.cpp +++ b/tests/units/testlib/gentodotest.cpp @@ -66,7 +66,7 @@ QCOMPARE(item.parentCollection().id(), 42LL); } - void shouldAllowToSetTags() + void shouldAllowToSetContexts() { // GIVEN Akonadi::Item item = GenTodo().withContexts({"42", "43", "44"}); diff --git a/tests/units/widgets/availablepagesviewtest.cpp b/tests/units/widgets/availablepagesviewtest.cpp --- a/tests/units/widgets/availablepagesviewtest.cpp +++ b/tests/units/widgets/availablepagesviewtest.cpp @@ -145,11 +145,6 @@ sources << source; } - void addTag(const QString &name) - { - tagNames << name; - } - void removeItem(const QModelIndex &index) { projectRemoved = index.data().toString(); @@ -161,7 +156,6 @@ public: QStringList projectNames; QStringList contextNames; - QStringList tagNames; QList sources; QString projectRemoved; };