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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/kresources/kolab
From:       Allen Winter <winter () kde ! org>
Date:       2010-05-14 15:01:12
Message-ID: 20100514150112.8EA52AC8B5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1126657 by winterz:

Add the ability to determine if the folder selector returned empty
because 1) there were no writable folders or 2) the user pressed cancel.
set a proper KCal exception in either case.

now we know more accurately why the folder selector returned empty
and can make a more informed decision in the invitation scheduling.

part of the fix for kolab/issue4359
MERGE: trunk


 M  +9 -0      kcal/resourcekolab.cpp  
 M  +7 -1      shared/resourcekolabbase.cpp  
 M  +7 -0      shared/resourcekolabbase.h  


--- branches/kdepim/enterprise/kdepim/kresources/kolab/kcal/resourcekolab.cpp #1126656:1126657
@@ -555,9 +555,18 @@
       }
       subResource = findWritableResource( type, *map, text );
       if ( subResource.isEmpty() ) {
+        switch( mErrorCode ) {
+        case NoWritableFound:
         setException( new ErrorFormat( ErrorFormat::NoWritableFound ) );
+          break;
+        case UserCancel:
+          setException( new ErrorFormat( ErrorFormat::UserCancel ) );
+          break;
+        case NoError:
+          break;
       }
     }
+    }
 
     if ( subResource.isEmpty() )
       return false;
--- branches/kdepim/enterprise/kdepim/kresources/kolab/shared/resourcekolabbase.cpp #1126656:1126657
@@ -214,6 +214,8 @@
                                                  const ResourceMap& resources,
                                                  const QString& text )
 {
+  mErrorCode = NoError;
+
   // I have to use the label (shown in the dialog) as key here. But given how the
   // label is made up, it should be unique. If it's not, well the dialog would suck anyway...
   QMap<QString, QString> possible;
@@ -254,6 +256,7 @@
     }
 
     KMessageBox::error( 0, errorText );
+    mErrorCode = NoWritableFound;
     return QString::null;
   }
   if ( possible.count() == 1 )
@@ -268,8 +271,11 @@
   // Several found, ask the user
   QString chosenLabel = KPIM::FolderSelectDialog::getItem( i18n( "Select Resource Folder" ),
                                                            t, possible.keys() );
-  if ( chosenLabel.isEmpty() ) // cancelled
+  if ( chosenLabel.isEmpty() ) {
+    // cancelled
+    mErrorCode = UserCancel;
     return QString::null;
+  }
   return possible[chosenLabel];
 }
 
--- branches/kdepim/enterprise/kdepim/kresources/kolab/shared/resourcekolabbase.h #1126656:1126657
@@ -174,6 +174,13 @@
                                 const ResourceMap& resources,
                                 const QString& text = QString::null );
 
+  enum ErrorCode {
+    NoError,
+    NoWritableFound,   /**< No writable resource is available */
+    UserCancel         /**< User canceled the operation */
+  };
+  ErrorCode mErrorCode;
+
   bool mSilent;
 
   /**

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

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