Bug 261055 - Option delete trashcan after close doesn't have an effect
Summary: Option delete trashcan after close doesn't have an effect
Status: CLOSED FIXED
Alias: None
Product: KMail Mobile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Windows CE Microsoft Windows CE
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-23 10:54 UTC by Ludwig Reiter
Modified: 2011-01-18 12:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ludwig Reiter 2010-12-23 10:54:28 UTC
Version:           unspecified (using Devel) 
OS:                Windows CE

version 20101219 svn 1207720

Reproducible: Always

Steps to Reproduce:
1. Set option delete mails from trashcan after closing on.
2. Move some mails to the trashcan.
3. Close kmail mobile.
4. Restart it.

Actual Results:  
The mails are not deleted.

Expected Results:  
The mailss in the trashcan should be deleted

Used German as language. Here trashcan is named Mülleimer.
Comment 1 Tobias Koenig 2010-12-23 15:41:37 UTC
commit 4f43a240652fc3bfd93a212d9be059876f53cd94
branch master
Author: Tobias Koenig <tokoe@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 )
Comment 2 Ludwig Reiter 2011-01-18 12:59:48 UTC
test of description
version 2011-01-16 git-4d1bc61

test passed.
Closed.