From d40b8010f3450dc38b7b3f2f46c90d207a235a89 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Fri, 22 Jul 2016 23:03:28 +0200 Subject: [PATCH] Use mailfilter to expunge trash --- .../mailfilteragent/org.freedesktop.Akonadi.MailFilterAgent.xml | 3 +++ kmail/src/CMakeLists.txt | 3 +++ kmail/src/kmkernel.cpp | 8 +++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/kmail/agents/mailfilteragent/org.freedesktop.Akonadi.MailFilterAgent.xml b/kmail/agents/mailfilteragent/org.freedesktop.Akonadi.MailFilterAgent.xml index e51212e3e0..399b352079 100644 --- a/kmail/agents/mailfilteragent/org.freedesktop.Akonadi.MailFilterAgent.xml +++ b/kmail/agents/mailfilteragent/org.freedesktop.Akonadi.MailFilterAgent.xml @@ -33,6 +33,9 @@ + + + diff --git a/kmail/src/CMakeLists.txt b/kmail/src/CMakeLists.txt index 470a1ae508..3df422d731 100644 --- a/kmail/src/CMakeLists.txt +++ b/kmail/src/CMakeLists.txt @@ -231,6 +231,9 @@ qt5_add_dbus_interfaces(kmailprivate_LIB_SRCS ../agents/followupreminderagent/org.freedesktop.Akonadi.FollowUpReminder.xml ) +qt5_add_dbus_interfaces(kmailprivate_LIB_SRCS + ../agents/mailfilteragent/org.freedesktop.Akonadi.MailFilterAgent.xml + ) ki18n_wrap_ui(kmailprivate_LIB_SRCS ui/composercryptoconfiguration.ui diff --git a/kmail/src/kmkernel.cpp b/kmail/src/kmkernel.cpp index 8300069797..b54b3f3995 100644 --- a/kmail/src/kmkernel.cpp +++ b/kmail/src/kmkernel.cpp @@ -25,6 +25,7 @@ using KPIM::RecentAddresses; #include "MailCommon/FolderTreeView" #include "MailCommon/KMFilterDialog" #include "mailcommonsettings_base.h" +#include "mailfilteragentinterface.h" #include "PimCommon/PimUtil" #include "folderarchive/folderarchivemanager.h" // kdepim includes @@ -1414,7 +1415,12 @@ void KMKernel::cleanup(void) Akonadi::Collection trashCollection = CommonKernel->trashCollectionFolder(); if (trashCollection.isValid()) { if (KMailSettings::self()->emptyTrashOnExit()) { - mFolderCollectionMonitor->expunge(trashCollection, true /*sync*/); + OrgFreedesktopAkonadiMailFilterAgentInterface mailFilterInterface(QStringLiteral("org.freedesktop.Akonadi.MailFilterAgent"), QStringLiteral("/MailFilterAgent"), QDBusConnection::sessionBus(), this); + if (mailFilterInterface.isValid()) { + mailFilterInterface.expunge((qlonglong)trashCollection.id()); + } else { + qCWarning(KMAIL_LOG) << "Mailfilter is not actif"; + } } } } -- 2.11.4.GIT