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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/kresources/kolab/kabc
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2010-05-28 14:25:07
Message-ID: 20100528142507.293BBAC8C6 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1131612 by tmcguire:

When the resource is locked, also cache if the user cancels 
the subresource selection dialog.

This fixes multiple dialogs appearing when the user saves a
dist list but cancels the subresource dialog.

kolab/issue4281
MERGE: trunk?


 M  +10 -3     resourcekolab.cpp  
 M  +1 -0      resourcekolab.h  


--- branches/kdepim/enterprise/kdepim/kresources/kolab/kabc/resourcekolab.cpp #1131611:1131612
@@ -79,7 +79,7 @@
 KABC::ResourceKolab::ResourceKolab( const KConfig *config )
   : KPIM::ResourceABC( config ),
     Kolab::ResourceKolabBase( "ResourceKolab-KABC" ),
-    mCachedSubresource( QString::null ), mLocked( false )
+    mCachedSubresource( QString::null ), mCachedSubresourceNotFound( false ), mLocked( false )
 {
   setType( "imap" );
   if ( !config ) {
@@ -145,6 +145,7 @@
 {
   mLocked = false;
   mCachedSubresource = QString::null;
+  mCachedSubresourceNotFound = false;
   delete ticket;
 }
 
@@ -338,15 +339,21 @@
     }
     sernum = mUidMap[ uid ].serialNumber();
   } else {
-    if ( !mCachedSubresource.isNull() ) {
+    if ( !mCachedSubresource.isNull() || mCachedSubresourceNotFound ) {
       subResource = mCachedSubresource;
     } else {
       subResource = findWritableResource( Kolab::Contacts, mSubResources );
       // We were locked, remember the subresource we are working with until
       // we are unlocked
-      if ( mLocked )
+      if ( mLocked ) {
         mCachedSubresource = subResource;
+
+        // If the subresource is empty here, it means findWritableResource() failed, for example
+        // because the user cancelled the resource selection dialog. Remember that, so we avoid
+        // asking multiple times when locked.
+        mCachedSubresourceNotFound = subResource.isEmpty();
     }
+    }
     if ( subResource.isEmpty() )
       return false;
     sernum = 0;
--- branches/kdepim/enterprise/kdepim/kresources/kolab/kabc/resourcekolab.h #1131611:1131612
@@ -169,6 +169,7 @@
   // The list of subresources
   Kolab::ResourceMap mSubResources;
   QString mCachedSubresource;
+  bool mCachedSubresourceNotFound;
   bool mLocked;
 };
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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