[Bug 261055] Option delete trashcan after close doesn't have an effect

Tobias Koenig tokoe at kde.org
Thu Dec 23 14:41:37 GMT 2010


https://bugs.kde.org/show_bug.cgi?id=261055


Tobias Koenig <tokoe at kde.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #1 from Tobias Koenig <tokoe kde org>  2010-12-23 15:41:37 ---
commit 4f43a240652fc3bfd93a212d9be059876f53cd94
branch master
Author: Tobias Koenig <tokoe at kde.org>
Date:   Thu Dec 23 15:44:31 2010 +0100

    Implement 'Empty trash on exit' functionality

    BUG: 261055

diff --git a/mobile/mail/mainview.cpp b/mobile/mail/mainview.cpp
index 6fd855a..5a2d07c 100644
--- a/mobile/mail/mainview.cpp
+++ b/mobile/mail/mainview.cpp
@@ -159,6 +159,24 @@ MainView::MainView(QWidget* parent)
 MainView::~MainView()
 {
   delete m_grouperComparator;
+
+  const Akonadi::Collection trashCollection =
CommonKernel->trashCollectionFolder();
+  if ( trashCollection.isValid() ) {
+    if ( Settings::self()->miscEmptyTrashAtExit() ) {
+      if ( trashCollection.statistics().count() > 0 ) {
+        qDebug( "Emptying trash..." );
+        Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(
trashCollection, this );
+        if ( job->exec() ) {
+          const Akonadi::Item::List items = job->items();
+          if ( !items.isEmpty() ) {
+            Akonadi::ItemDeleteJob *deleteJob = new Akonadi::ItemDeleteJob(
items, this );
+            deleteJob->exec();
+            qDebug( "done" );
+          }
+        }
+      }
+    }
+  }
 }

 void MainView::setConfigWidget( ConfigWidget *configWidget )

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kdepim-bugs mailing list