diff --git a/agents/unifiedmailboxagent/unifiedmailboxeditor.cpp b/agents/unifiedmailboxagent/unifiedmailboxeditor.cpp index 0679b1239..90eade9b2 100644 --- a/agents/unifiedmailboxagent/unifiedmailboxeditor.cpp +++ b/agents/unifiedmailboxagent/unifiedmailboxeditor.cpp @@ -1,184 +1,184 @@ /* Copyright (C) 2018 Daniel Vrátil 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) 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "unifiedmailboxeditor.h" #include "unifiedmailbox.h" #include "mailkernel.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace { static constexpr const char *EditorGroup = "__Editor"; class SelfFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: explicit SelfFilterProxyModel(QObject *parent = nullptr) : QSortFilterProxyModel(parent) {} QVariant data(const QModelIndex &index, int role) const override { if (role == Qt::CheckStateRole) { // Make top-level collections uncheckable const Akonadi::Collection col = data(index, Akonadi::EntityTreeModel::CollectionRole).value(); if (col.parentCollection() == Akonadi::Collection::root()) { return {}; } } return QSortFilterProxyModel::data(index, role); } Qt::ItemFlags flags(const QModelIndex &index) const override { // Make top-level collections uncheckable const Akonadi::Collection col = data(index, Akonadi::EntityTreeModel::CollectionRole).value(); if (col.parentCollection() == Akonadi::Collection::root()) { return QSortFilterProxyModel::flags(index) & ~Qt::ItemIsUserCheckable; } else { return QSortFilterProxyModel::flags(index); } } bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override { // Hide ourselves const auto sourceIndex = sourceModel()->index(source_row, 0, source_parent); const Akonadi::Collection col = sourceModel()->data(sourceIndex, Akonadi::EntityTreeModel::CollectionRole).value(); return !UnifiedMailboxManager::isUnifiedMailbox(col); } }; } -UnifiedMailboxEditor::UnifiedMailboxEditor(KSharedConfigPtr config, QWidget* parent) +UnifiedMailboxEditor::UnifiedMailboxEditor(const KSharedConfigPtr &config, QWidget* parent) : UnifiedMailboxEditor({}, config, parent) { } -UnifiedMailboxEditor::UnifiedMailboxEditor(UnifiedMailbox *mailbox, KSharedConfigPtr config, QWidget *parent) +UnifiedMailboxEditor::UnifiedMailboxEditor(UnifiedMailbox *mailbox, const KSharedConfigPtr &config, QWidget *parent) : QDialog(parent) , mMailbox(mailbox) , mConfig(config) { auto l = new QVBoxLayout; setLayout(l); auto f = new QFormLayout; l->addLayout(f); auto nameEdit = new QLineEdit(mMailbox->name()); f->addRow(i18n("Name:"), nameEdit); connect(nameEdit, &QLineEdit::textChanged, this, [this](const QString &name) { mMailbox->setName(name); }); auto iconButton = new QPushButton(QIcon::fromTheme(mMailbox->icon(), QIcon::fromTheme(QStringLiteral("folder-mail"))), i18n("Pick icon...")); f->addRow(i18n("Icon:"), iconButton); connect(iconButton, &QPushButton::clicked, this, [iconButton, this]() { const auto iconName = KIconDialog::getIcon(); if (!iconName.isEmpty()) { mMailbox->setIcon(iconName); iconButton->setIcon(QIcon::fromTheme(iconName)); } }); mMailbox->setIcon(iconButton->icon().name()); l->addSpacing(10); auto ftw = new MailCommon::FolderTreeWidget(nullptr, nullptr, MailCommon::FolderTreeWidget::TreeViewOptions(MailCommon::FolderTreeWidget::UseDistinctSelectionModel | MailCommon::FolderTreeWidget::HideStatistics)); l->addWidget(ftw); auto ftv = ftw->folderTreeView(); auto sourceModel = ftv->model(); auto selectionModel = ftw->selectionModel(); auto checkable = new KCheckableProxyModel(this); checkable->setSourceModel(sourceModel); checkable->setSelectionModel(selectionModel); const auto sources = mMailbox->sourceCollections(); for (const auto source : sources) { const auto index = Akonadi::EntityTreeModel::modelIndexForCollection(selectionModel->model(), Akonadi::Collection(source)); selectionModel->select(index, QItemSelectionModel::Select); } connect(checkable->selectionModel(), &QItemSelectionModel::selectionChanged, this, [this](const QItemSelection &selected, const QItemSelection &deselected) { auto indexes = selected.indexes(); for (const auto &index : indexes) { mMailbox->addSourceCollection(index.data(Akonadi::EntityTreeModel::CollectionIdRole).toLongLong()); } indexes = deselected.indexes(); for (const auto &index : indexes) { mMailbox->removeSourceCollection(index.data(Akonadi::EntityTreeModel::CollectionIdRole).toLongLong()); } }); auto selfFilter = new SelfFilterProxyModel(this); selfFilter->setSourceModel(checkable); ftv->setModel(selfFilter); ftv->expandAll(); auto box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); connect(box, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(nameEdit, &QLineEdit::textChanged, box, [box](const QString &name) { box->button(QDialogButtonBox::Ok)->setEnabled(!name.isEmpty()); }); box->button(QDialogButtonBox::Ok)->setEnabled(!nameEdit->text().isEmpty()); l->addWidget(box); const auto editorGroup = config->group(EditorGroup); if (editorGroup.hasKey("geometry")) { restoreGeometry(editorGroup.readEntry("geometry", QByteArray())); } else { resize(500, 900); } } UnifiedMailboxEditor::~UnifiedMailboxEditor() { auto editorGrp = mConfig->group(EditorGroup); editorGrp.writeEntry("geometry", saveGeometry()); } #include "unifiedmailboxeditor.moc" diff --git a/agents/unifiedmailboxagent/unifiedmailboxeditor.h b/agents/unifiedmailboxagent/unifiedmailboxeditor.h index 0b9e629cc..96aa8d832 100644 --- a/agents/unifiedmailboxagent/unifiedmailboxeditor.h +++ b/agents/unifiedmailboxagent/unifiedmailboxeditor.h @@ -1,36 +1,37 @@ /* Copyright (C) 2018 Daniel Vrátil 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) 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "unifiedmailboxmanager.h" class UnifiedMailbox; class UnifiedMailboxEditor : public QDialog { Q_OBJECT public: - explicit UnifiedMailboxEditor(KSharedConfigPtr config, QWidget *parent = nullptr); - explicit UnifiedMailboxEditor(UnifiedMailbox *mailbox, KSharedConfigPtr config, QWidget *parent = nullptr); + explicit UnifiedMailboxEditor(const KSharedConfigPtr &config, QWidget *parent = nullptr); + explicit UnifiedMailboxEditor(UnifiedMailbox *mailbox, const KSharedConfigPtr &config, + QWidget *parent = nullptr); ~UnifiedMailboxEditor() override; private: UnifiedMailbox *mMailbox = nullptr; KSharedConfigPtr mConfig; }; diff --git a/agents/unifiedmailboxagent/unifiedmailboxmanager.cpp b/agents/unifiedmailboxagent/unifiedmailboxmanager.cpp index 4f8422e31..734f87ca2 100644 --- a/agents/unifiedmailboxagent/unifiedmailboxmanager.cpp +++ b/agents/unifiedmailboxagent/unifiedmailboxmanager.cpp @@ -1,433 +1,433 @@ /* Copyright (C) 2018 Daniel Vrátil 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) 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "unifiedmailboxmanager.h" #include "unifiedmailbox.h" #include "unifiedmailboxagent_debug.h" #include "utils.h" #include "common.h" #include #include #include #include #include #include #include #include #include #include #include #include namespace { /** * A little RAII helper to make sure changeProcessed() and replayNext() gets * called on the ChangeRecorder whenever we are done with handling a change. */ class ReplayNextOnExit { public: ReplayNextOnExit(Akonadi::ChangeRecorder &recorder) : mRecorder(recorder) {} ~ReplayNextOnExit() { mRecorder.changeProcessed(); mRecorder.replayNext(); } private: Akonadi::ChangeRecorder &mRecorder; }; } // static bool UnifiedMailboxManager::isUnifiedMailbox(const Akonadi::Collection &col) { #ifdef UNIT_TESTS return col.parentCollection().name() == Common::AgentIdentifier; #else return col.resource() == Common::AgentIdentifier; #endif } -UnifiedMailboxManager::UnifiedMailboxManager(KSharedConfigPtr config, QObject* parent) +UnifiedMailboxManager::UnifiedMailboxManager(const KSharedConfigPtr &config, QObject* parent) : QObject(parent) - , mConfig(std::move(config)) + , mConfig(config) { mMonitor.setObjectName(QStringLiteral("UnifiedMailboxChangeRecorder")); mMonitor.setConfig(&mMonitorSettings); mMonitor.setChangeRecordingEnabled(true); mMonitor.setTypeMonitored(Akonadi::Monitor::Items); mMonitor.setTypeMonitored(Akonadi::Monitor::Collections); mMonitor.itemFetchScope().setCacheOnly(true); mMonitor.itemFetchScope().setFetchRemoteIdentification(false); mMonitor.itemFetchScope().setFetchModificationTime(false); mMonitor.collectionFetchScope().fetchAttribute(); connect(&mMonitor, &Akonadi::Monitor::itemAdded, this, [this](const Akonadi::Item &item, const Akonadi::Collection &collection) { ReplayNextOnExit replayNext(mMonitor); qCDebug(agent_log) << "Item" << item.id() << "added to collection" << collection.id(); const auto box = unifiedMailboxForSource(collection.id()); if (!box) { qCWarning(agent_log) << "Failed to find unified mailbox for source collection " << collection.id(); return; } if (!box->collectionId()) { qCWarning(agent_log) << "Missing box->collection mapping for unified mailbox" << box->id(); return; } new Akonadi::LinkJob(Akonadi::Collection{box->collectionId().value()}, {item}, this); }); connect(&mMonitor, &Akonadi::Monitor::itemsRemoved, this, [this](const Akonadi::Item::List &items) { ReplayNextOnExit replayNext(mMonitor); // Monitor did the heavy lifting for us and already figured out that // we only monitor the source collection of the Items and translated // it into REMOVE change. // This relies on Akonadi never mixing Items from different sources or // destination during batch-moves. const auto parentId = items.first().parentCollection().id(); const auto box = unifiedMailboxForSource(parentId); if (!box) { qCWarning(agent_log) << "Received Remove notification for Items belonging to" << parentId << "which we don't monitor"; return; } if (!box->collectionId()) { qCWarning(agent_log) << "Missing box->collection mapping for unified mailbox" << box->id(); return; } new Akonadi::UnlinkJob(Akonadi::Collection{box->collectionId().value()}, items, this); }); connect(&mMonitor, &Akonadi::Monitor::itemsMoved, this, [this](const Akonadi::Item::List &items, const Akonadi::Collection &srcCollection, const Akonadi::Collection &dstCollection) { ReplayNextOnExit replayNext(mMonitor); if (const auto srcBox = unifiedMailboxForSource(srcCollection.id())) { // Move source collection was our source, unlink the Item from a box new Akonadi::UnlinkJob(Akonadi::Collection{srcBox->collectionId().value()}, items, this); } if (const auto dstBox = unifiedMailboxForSource(dstCollection.id())) { // Move destination collection is our source, link the Item into a box new Akonadi::LinkJob(Akonadi::Collection{dstBox->collectionId().value()}, items, this); } }); connect(&mMonitor, &Akonadi::Monitor::collectionRemoved, this, [this](const Akonadi::Collection &col) { ReplayNextOnExit replayNext(mMonitor); if (auto box = unifiedMailboxForSource(col.id())) { box->removeSourceCollection(col.id()); mMonitor.setCollectionMonitored(col, false); if (box->sourceCollections().isEmpty()) { removeBox(box->id()); } saveBoxes(); // No need to resync the box collection, the linked Items got removed by Akonadi } else { qCWarning(agent_log) << "Received notification about removal of Collection" << col.id() << "which we don't monitor"; } }); connect(&mMonitor, qOverload &>(&Akonadi::Monitor::collectionChanged), this, [this](const Akonadi::Collection &col, const QSet &parts) { ReplayNextOnExit replayNext(mMonitor); qCDebug(agent_log) << "Collection changed:" << parts; if (!parts.contains(Akonadi::SpecialCollectionAttribute().type())) { return; } if (col.hasAttribute()) { const auto srcBox = unregisterSpecialSourceCollection(col.id()); const auto dstBox = registerSpecialSourceCollection(col); if (srcBox == dstBox) { return; } saveBoxes(); if (srcBox && srcBox->sourceCollections().isEmpty()) { removeBox(srcBox->id()); return; } if (srcBox) { Q_EMIT updateBox(srcBox); } if (dstBox) { Q_EMIT updateBox(dstBox); } } else { if (const auto box = unregisterSpecialSourceCollection(col.id())) { saveBoxes(); if (box->sourceCollections().isEmpty()) { removeBox(box->id()); } else { Q_EMIT updateBox(box); } } } }); } UnifiedMailboxManager::~UnifiedMailboxManager() { } Akonadi::ChangeRecorder &UnifiedMailboxManager::changeRecorder() { return mMonitor; } void UnifiedMailboxManager::loadBoxes(FinishedCallback &&finishedCb) { qCDebug(agent_log) << "loading boxes"; const auto group = mConfig->group("UnifiedMailboxes"); const auto boxGroups = group.groupList(); for (const auto &boxGroupName : boxGroups) { const auto boxGroup = group.group(boxGroupName); auto box = std::make_unique(); box->load(boxGroup); insertBox(std::move(box)); } const auto cb = [this, finishedCb = std::move(finishedCb)]() { qCDebug(agent_log) << "Finished callback: enabling change recorder"; // Only now start processing changes from change recorder connect(&mMonitor, &Akonadi::ChangeRecorder::changesAdded, &mMonitor, &Akonadi::ChangeRecorder::replayNext, Qt::QueuedConnection); // And start replaying any potentially pending notification QTimer::singleShot(0, &mMonitor, &Akonadi::ChangeRecorder::replayNext); if (finishedCb) { finishedCb(); } }; qCDebug(agent_log) << "Loaded" << mMailboxes.size() << "boxes from config"; if (mMailboxes.empty()) { createDefaultBoxes(std::move(cb)); } else { discoverBoxCollections(std::move(cb)); } } void UnifiedMailboxManager::saveBoxes() { auto group = mConfig->group("UnifiedMailboxes"); const auto currentGroups = group.groupList(); for (const auto &groupName : currentGroups) { group.deleteGroup(groupName); } for (const auto &boxIt : mMailboxes) { auto boxGroup = group.group(boxIt.second->id()); boxIt.second->save(boxGroup); } mConfig->sync(); } void UnifiedMailboxManager::insertBox(std::unique_ptr box) { auto it = mMailboxes.emplace(std::make_pair(box->id(), std::move(box))); it.first->second->attachManager(this); } void UnifiedMailboxManager::removeBox(const QString &id) { auto box = std::find_if(mMailboxes.begin(), mMailboxes.end(), [&id](const std::pair> &box) { return box.second->id() == id; }); if (box == mMailboxes.end()) { return; } box->second->attachManager(nullptr); mMailboxes.erase(box); } UnifiedMailbox *UnifiedMailboxManager::unifiedMailboxForSource(qint64 source) const { const auto box = mSourceToBoxMap.find(source); if (box == mSourceToBoxMap.cend()) { return {}; } return box->second; } UnifiedMailbox *UnifiedMailboxManager::unifiedMailboxFromCollection(const Akonadi::Collection &col) const { if (!isUnifiedMailbox(col)) { return nullptr; } const auto box = mMailboxes.find(col.name()); if (box == mMailboxes.cend()) { return {}; } return box->second.get(); } void UnifiedMailboxManager::createDefaultBoxes(FinishedCallback &&finishedCb) { // First build empty boxes auto inbox = std::make_unique(); inbox->attachManager(this); inbox->setId(Common::InboxBoxId); inbox->setName(i18n("Inbox")); inbox->setIcon(QStringLiteral("mail-folder-inbox")); insertBox(std::move(inbox)); auto sent = std::make_unique(); sent->attachManager(this); sent->setId(Common::SentBoxId); sent->setName(i18n("Sent")); sent->setIcon(QStringLiteral("mail-folder-sent")); insertBox(std::move(sent)); auto drafts = std::make_unique(); drafts->attachManager(this); drafts->setId(Common::DraftsBoxId); drafts->setName(i18n("Drafts")); drafts->setIcon(QStringLiteral("document-properties")); insertBox(std::move(drafts)); auto list = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive, this); list->fetchScope().fetchAttribute(); list->fetchScope().setContentMimeTypes({QStringLiteral("message/rfc822")}); #ifdef UNIT_TESTS list->fetchScope().setAncestorRetrieval(Akonadi::CollectionFetchScope::Parent); #else list->fetchScope().setAncestorRetrieval(Akonadi::CollectionFetchScope::None); #endif connect(list, &Akonadi::CollectionFetchJob::collectionsReceived, this, [this](const Akonadi::Collection::List &list) { for (const auto &col : list) { if (isUnifiedMailbox(col)) { continue; } try { switch (Akonadi::SpecialMailCollections::self()->specialCollectionType(col)) { case Akonadi::SpecialMailCollections::Inbox: mMailboxes.at(Common::InboxBoxId)->addSourceCollection(col.id()); break; case Akonadi::SpecialMailCollections::SentMail: mMailboxes.at(Common::SentBoxId)->addSourceCollection(col.id()); break; case Akonadi::SpecialMailCollections::Drafts: mMailboxes.at(Common::DraftsBoxId)->addSourceCollection(col.id()); break; default: continue; } } catch (const std::out_of_range &) { qCWarning(agent_log) << "Failed to find a special unified mailbox for source collection" << col.id(); continue; } } }); connect(list, &Akonadi::CollectionFetchJob::result, this, [this, finishedCb = std::move(finishedCb)]() { saveBoxes(); if (finishedCb) { finishedCb(); } }); } void UnifiedMailboxManager::discoverBoxCollections(FinishedCallback &&finishedCb) { auto list = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive, this); #ifdef UNIT_TESTS list->fetchScope().setAncestorRetrieval(Akonadi::CollectionFetchScope::Parent); #else list->fetchScope().setResource(Common::AgentIdentifier); #endif connect(list, &Akonadi::CollectionFetchJob::collectionsReceived, this, [this](const Akonadi::Collection::List &list) { for (const auto &col : list) { if (!isUnifiedMailbox(col) || col.parentCollection() == Akonadi::Collection::root()) { continue; } mMailboxes.at(col.name())->setCollectionId(col.id()); } }); if (finishedCb) { connect(list, &Akonadi::CollectionFetchJob::result, this, finishedCb); } } const UnifiedMailbox *UnifiedMailboxManager::registerSpecialSourceCollection(const Akonadi::Collection& col) { // This is slightly awkward, wold be better if we could use SpecialMailCollections, // but it also relies on Monitor internally, so there's a possible race condition // between our ChangeRecorder and SpecialMailCollections' Monitor auto attr = col.attribute(); Q_ASSERT(attr); if (!attr) { return {}; } decltype(mMailboxes)::iterator box; if (attr->collectionType() == Common::SpecialCollectionInbox) { box = mMailboxes.find(Common::InboxBoxId); } else if (attr->collectionType() == Common::SpecialCollectionSentMail) { box = mMailboxes.find(Common::SentBoxId); } else if (attr->collectionType() == Common::SpecialCollectionDrafts) { box = mMailboxes.find(Common::DraftsBoxId); } if (box == mMailboxes.end()) { return {}; } box->second->addSourceCollection(col.id()); return box->second.get(); } const UnifiedMailbox *UnifiedMailboxManager::unregisterSpecialSourceCollection(qint64 colId) { auto box = unifiedMailboxForSource(colId); if (!box) { return {}; } if (!box->isSpecial()) { - qDebug() << colId << "does not belong to a special unified box" << box->id(); + qCDebug(agent_log) << colId << "does not belong to a special unified box" << box->id(); return {}; } box->removeSourceCollection(colId); return box; } diff --git a/agents/unifiedmailboxagent/unifiedmailboxmanager.h b/agents/unifiedmailboxagent/unifiedmailboxmanager.h index 32be6241c..aea46e115 100644 --- a/agents/unifiedmailboxagent/unifiedmailboxmanager.h +++ b/agents/unifiedmailboxagent/unifiedmailboxmanager.h @@ -1,92 +1,92 @@ /* Copyright (C) 2018 Daniel Vrátil 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) 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef UNIFIEDBOXMANAGER_H #define UNIFIEDBOXMANAGER_H #include "utils.h" #include #include #include #include #include #include #include #include class UnifiedMailbox; class UnifiedMailboxManager : public QObject { Q_OBJECT friend class UnifiedMailbox; public: using FinishedCallback = std::function; using Entry = std::pair>; - explicit UnifiedMailboxManager(KSharedConfigPtr config, QObject *parent = nullptr); + explicit UnifiedMailboxManager(const KSharedConfigPtr &config, QObject *parent = nullptr); ~UnifiedMailboxManager() override; void loadBoxes(FinishedCallback &&cb = {}); void saveBoxes(); void discoverBoxCollections(FinishedCallback &&cb = {}); void insertBox(std::unique_ptr box); void removeBox(const QString &id); UnifiedMailbox *unifiedMailboxForSource(qint64 source) const; UnifiedMailbox *unifiedMailboxFromCollection(const Akonadi::Collection &col) const; inline auto begin() const { return mMailboxes.begin(); } inline auto end() const { return mMailboxes.end(); } static bool isUnifiedMailbox(const Akonadi::Collection &col); // Internal change recorder, for unittests Akonadi::ChangeRecorder &changeRecorder(); Q_SIGNALS: void updateBox(const UnifiedMailbox *box); private: void createDefaultBoxes(FinishedCallback &&cb); const UnifiedMailbox *unregisterSpecialSourceCollection(qint64 colId); const UnifiedMailbox *registerSpecialSourceCollection(const Akonadi::Collection &col); // Using std::unique_ptr because QScopedPointer is not movable // Using std::unordered_map because Qt containers do not support movable-only types, std::unordered_map> mMailboxes; std::unordered_map mSourceToBoxMap; Akonadi::ChangeRecorder mMonitor; QSettings mMonitorSettings; KSharedConfigPtr mConfig; }; #endif