[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kdab-post-4.0/kdepim
From:       Volker Krause <vkrause () kde ! org>
Date:       2008-01-08 17:08:44
Message-ID: 1199812124.427400.21796.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 758649 by vkrause:

these guys commit faster than I can merge...

Merged revisions 758643-758647 via svnmerge from 
https://vkrause@svn.kde.org/home/kde/trunk/KDE/kdepim

........
  r758646 | tmcguire | 2008-01-08 18:03:19 +0100 (Tue, 08 Jan 2008) | 5 lines
  
  When the user aborts a mail check while the pop filter 
  confirmation dialog is open, close that dialog instead
  of crashing.
........


 _M            . (directory)  
 M  +57 -40    kmail/popaccount.cpp  
 M  +2 -0      kmail/popaccount.h  


** branches/work/kdab-post-4.0/kdepim #property svnmerge-integrated
   - /branches/kdepim/enterprise/kdepim:1-708704,708706,708741,708749,709066,711604,71 \
1623,712056,714358,715112,717162,717727,723348-723367,723653,724153,724155,724546,7293 \
06,729611,731653,733159,733883,734242,734247,734273,735684,738629,739069,739670,743884,744689,747182,747318,747971,748016,748069,748416,750031,750914 \
/trunk/KDE/kdepim:1-758642  + \
/branches/kdepim/enterprise/kdepim:1-708704,708706,708741,708749,709066,711604,711623, \
712056,714358,715112,717162,717727,723348-723367,723653,724153,724155,724546,729306,72 \
9611,731653,733159,733883,734242,734247,734273,735684,738629,739069,739670,743884,744689,747182,747318,747971,748016,748069,748416,750031,750914 \
                /trunk/KDE/kdepim:1-758647
--- branches/work/kdab-post-4.0/kdepim/kmail/popaccount.cpp #758648:758649
@@ -52,6 +52,7 @@
 //-----------------------------------------------------------------------------
 PopAccount::PopAccount(AccountManager* aOwner, const QString& aAccountName, uint id)
   : NetworkAccount(aOwner, aAccountName, id),
+    mPopFilterConfirmationDialog( 0 ),
     mHeaderIndex( 0 )
 {
   init();
@@ -284,6 +285,12 @@
   processRemainingQueuedMessages();
   saveUidList();
   slotJobFinished();
+
+  // Close the pop filter confirmation dialog. Otherwise, KMail crashes because
+  // slotJobFinished(), which creates that dialog, will try to continue downloading
+  // when the user closes the dialog.
+  if ( mPopFilterConfirmationDialog )
+    mPopFilterConfirmationDialog->reject();
 }
 
 
@@ -590,54 +597,64 @@
     // show the dialog
     headers = true;
     if ( dlgPopup ) {
-      KMPopFilterCnfrmDlg dlg( mHeadersOnServer, this->name(),
-                               kmkernel->popFilterMgr()->showLaterMsgs() );
-      dlg.exec();
+      mPopFilterConfirmationDialog =
+          new KMPopFilterCnfrmDlg( mHeadersOnServer, this->name(),
+                                   kmkernel->popFilterMgr()->showLaterMsgs() );
+      mPopFilterConfirmationDialog->exec();
     }
 
-    for ( int i = 0; i < mHeadersOnServer.count(); ++i ) {
-      const KMPopHeaders *header = mHeadersOnServer[i];
-      if ( header->action() == Delete || header->action() == Later) {
-        //remove entries from the lists when the mails should not be downloaded
-        //(deleted or downloaded later)
-        mMsgsPendingDownload.remove( header->id() );
-        if ( header->action() == Delete ) {
-          mHeaderDeleteUids.insert( header->uid() );
-          mUidsOfNextSeenMsgsDict.insert( header->uid(), 1 );
-          idsOfMsgsToDelete.insert( header->id() );
-          mTimeOfNextSeenMsgsMap.insert( header->uid(), time(0) );
+    // The only case were the result code of the dialog is QDialog::Rejected
+    // should be when the mail check in canceled in slotCancel().
+    // This here would likely break if there is still a mail check active
+    // and Rejected is the result. But that shouldn't happen.
+    if ( mPopFilterConfirmationDialog->result() == QDialog::Accepted ) {
+
+      for ( int i = 0; i < mHeadersOnServer.count(); ++i ) {
+        const KMPopHeaders *header = mHeadersOnServer[i];
+        if ( header->action() == Delete || header->action() == Later) {
+          //remove entries from the lists when the mails should not be downloaded
+          //(deleted or downloaded later)
+          mMsgsPendingDownload.remove( header->id() );
+          if ( header->action() == Delete ) {
+            mHeaderDeleteUids.insert( header->uid() );
+            mUidsOfNextSeenMsgsDict.insert( header->uid(), 1 );
+            idsOfMsgsToDelete.insert( header->id() );
+            mTimeOfNextSeenMsgsMap.insert( header->uid(), time(0) );
+          }
+          else {
+            mHeaderLaterUids.insert( header->uid() );
+          }
         }
-        else {
-          mHeaderLaterUids.insert( header->uid() );
+        else if ( header->action() == Down ) {
+          mHeaderDownUids.insert( header->uid() );
         }
       }
-      else if ( header->action() == Down ) {
-        mHeaderDownUids.insert( header->uid() );
-      }
-    }
 
-    qDeleteAll( mHeadersOnServer );
-    mHeadersOnServer.clear();
-    stage = Retr;
-    numMsgs = mMsgsPendingDownload.count();
-    numBytesToRead = 0;
-    idsOfMsgs.clear();
-    QByteArray ids;
-    if ( numMsgs > 0 ) {
-      for ( QMap<QByteArray, int>::const_iterator it = mMsgsPendingDownload.begin();
-            it != mMsgsPendingDownload.end(); ++it ) {
-        numBytesToRead += it.value();
-        ids += it.key() + ',';
-        idsOfMsgs.append( it.key() );
+      qDeleteAll( mHeadersOnServer );
+      mHeadersOnServer.clear();
+      stage = Retr;
+      numMsgs = mMsgsPendingDownload.count();
+      numBytesToRead = 0;
+      idsOfMsgs.clear();
+      QByteArray ids;
+      if ( numMsgs > 0 ) {
+        for ( QMap<QByteArray, int>::const_iterator it = \
mMsgsPendingDownload.begin(); +              it != mMsgsPendingDownload.end(); ++it ) \
{ +          numBytesToRead += it.value();
+          ids += it.key() + ',';
+          idsOfMsgs.append( it.key() );
+        }
+        ids.chop( 1 ); // cut off the trailing ','
       }
-      ids.chop( 1 ); // cut off the trailing ','
+      KUrl url = getUrl();
+      url.setPath( "/download/" + ids );
+      job = KIO::get( url, KIO::NoReload, KIO::HideProgressInfo );
+      connectJob();
+      slotGetNextMsg();
+      processMsgsTimer.start(processingDelay);
     }
-    KUrl url = getUrl();
-    url.setPath( "/download/" + ids );
-    job = KIO::get( url, KIO::NoReload, KIO::HideProgressInfo );
-    connectJob();
-    slotGetNextMsg();
-    processMsgsTimer.start(processingDelay);
+    delete mPopFilterConfirmationDialog;
+    mPopFilterConfirmationDialog = 0;
   }
   else if (stage == Retr) {
     mMailCheckProgressItem->setProgress( 100 );
--- branches/work/kdab-post-4.0/kdepim/kmail/popaccount.h #758648:758649
@@ -8,6 +8,7 @@
 #include <QSet>
 #include <QQueue>
 
+class KMPopFilterCnfrmDlg;
 class KMPopHeaders;
 class KMMessage;
 
@@ -134,6 +135,7 @@
   // predictable
   QMap<QByteArray, int> mMsgsPendingDownload;
 
+  KMPopFilterCnfrmDlg *mPopFilterConfirmationDialog;
   QList<KMPopHeaders *> mHeadersOnServer;
   int mHeaderIndex;
   bool headers;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic