Commit e666c1ea authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add clear folder akonadi cache

parent de3d9714
Pipeline #200752 passed with stage
in 7 minutes and 25 seconds
......@@ -2,7 +2,7 @@
the same menu entries at the same place in KMail and Kontact -->
<!DOCTYPE gui>
<gui version="553" name="kmmainwin" translationDomain="kmail">
<gui version="554" name="kmmainwin" translationDomain="kmail">
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&amp;File</text>
......@@ -146,6 +146,8 @@
<Action name="folder_mailinglist_properties" />
<Action name="folder_shortcut_command" />
<Separator/>
<Action name="folder_clear_akonadi_cache" />
<Separator/>
<ActionList name="kmail_plugins_folder"/>
</Menu>
<Menu noMerge="1" name="message" >
......
......@@ -105,6 +105,7 @@
#include <Akonadi/AttributeFactory>
#include <Akonadi/CachePolicy>
#include <Akonadi/ChangeRecorder>
#include <Akonadi/ClearCacheJob>
#include <Akonadi/CollectionAttributesSynchronizationJob>
#include <Akonadi/CollectionDialog>
#include <Akonadi/CollectionFetchJob>
......@@ -3010,6 +3011,10 @@ void KMMainWidget::setupActions()
&ManageShowCollectionProperties::slotFolderMailingListProperties);
// mFolderMailingListPropertiesAction->setIcon(QIcon::fromTheme("document-properties-mailing-list"));
mClearFolderCacheAction = new QAction(i18n("&Clear Akonadi Cache..."), this);
actionCollection()->addAction(QStringLiteral("folder_clear_akonadi_cache"), mClearFolderCacheAction);
connect(mClearFolderCacheAction, &QAction::triggered, this, &KMMainWidget::slotClearFolder);
mShowFolderShortcutDialogAction = new QAction(QIcon::fromTheme(QStringLiteral("configure-shortcuts")), i18n("&Assign Shortcut..."), this);
actionCollection()->addAction(QStringLiteral("folder_shortcut_command"), mShowFolderShortcutDialogAction);
connect(mShowFolderShortcutDialogAction,
......@@ -4903,3 +4908,21 @@ void KMMainWidget::setupUnifiedMailboxChecker()
// Wait for a bit before asking so we at least have the window on screen
QTimer::singleShot(500ms, this, ask);
}
void KMMainWidget::slotClearFolder()
{
auto job = new Akonadi::ClearCacheJob(this);
job->setCollection(mCurrentCollection);
job->setParentWidget(this);
connect(job, &ClearCacheJob::clearCacheDone, this, &KMMainWidget::slotClearCacheDone);
job->start();
}
void KMMainWidget::slotClearCacheDone()
{
const QString akonadictlPath = QStandardPaths::findExecutable(QStringLiteral("akonadictl"));
if (!akonadictlPath.isEmpty()) {
} else {
}
// TODO
}
......@@ -537,6 +537,8 @@ private:
void updateMoveAllToTrash();
void slotShowMdnInfo(const QPair<QString, bool> &mdnInfo);
void sendMdnInfo(const Akonadi::Item &item);
void slotClearFolder();
void slotClearCacheDone();
// Message actions
QAction *mDeleteAction = nullptr;
......@@ -661,4 +663,5 @@ private:
#endif
KMailPluginCheckBeforeDeletingManagerInterface *mPluginCheckBeforeDeletingManagerInterface = nullptr;
CollectionSwitcherTreeViewManager *const mCollectionSwitcherTreeViewManager;
QAction *mClearFolderCacheAction = nullptr;
};
......@@ -2,7 +2,7 @@
the same menu entries at the same place in KMail and Kontact -->
<!DOCTYPE gui>
<gui version="553" name="kmmainwin" translationDomain="kmail">
<gui version="554" name="kmmainwin" translationDomain="kmail">
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&amp;File</text>
......@@ -127,6 +127,8 @@
<Action name="akonadi_remove_duplicates" />
<Action name="remove_duplicate_recursive" />
<Separator/>
<Action name="folder_clear_akonadi_cache" />
<Separator/>
<Menu name="apply_filters_folder_actions">
<text>Apply Filters on Folder</text>
<Action name="apply_filters_folder" />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment