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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/kresources/kolab
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2010-03-05 10:13:37
Message-ID: 1267784017.943714.22543.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1099227 by tmcguire:

"You have no writable %1 folder" with %1 = { task, event, notes, contact } will not \
work in languages other than English.

For example, in German, the translation of "no" depends on %1.


 M  +1 -1      kabc/resourcekolab.cpp  
 M  +3 -2      kcal/resourcekolab.cpp  
 M  +2 -2      knotes/resourcekolab.cpp  
 M  +27 -6     shared/resourcekolabbase.cpp  
 M  +3 -1      shared/resourcekolabbase.h  


--- branches/kdepim/enterprise/kdepim/kresources/kolab/kabc/resourcekolab.cpp \
#1099226:1099227 @@ -338,7 +338,7 @@
     if ( !mCachedSubresource.isNull() ) {
       subResource = mCachedSubresource;
     } else {
-      subResource = findWritableResource( i18n( "Contact" ), mSubResources );
+      subResource = findWritableResource( Kolab::Contacts, mSubResources );
       // We were locked, remember the subresource we are working with until
       // we are unlocked
       if ( mLocked )
--- branches/kdepim/enterprise/kdepim/kresources/kolab/kcal/resourcekolab.cpp \
#1099226:1099227 @@ -515,13 +515,14 @@
     // Find out if this event was previously stored in KMail
     bool newIncidence = _subresource.isEmpty();
     if ( newIncidence ) {
-      QString type = incidence->type();
+      ResourceType type = Incidences;
       // Add a description of the incidence
       QString text = "<b><font size=\"+1\">";
       if ( incidence->type() == "Event" ) {
+        type = Events;
         text += i18n( "Choose the folder where you want to store this event" );
       } else if ( incidence->type() == "Todo" ) {
-        type = i18n( "Task" );
+        type = Tasks;
         text += i18n( "Choose the folder where you want to store this task" );
       } else {
         text += i18n( "Choose the folder where you want to store this incidence" );
--- branches/kdepim/enterprise/kdepim/kresources/kolab/knotes/resourcekolab.cpp \
#1099226:1099227 @@ -199,7 +199,7 @@
   mCalendar.addJournal( journal );
 
   QString resource =
-    newNote ? findWritableResource( i18n( "Note" ), mSubResources ) : subresource;
+    newNote ? findWritableResource( Kolab::Notes, mSubResources ) : subresource;
   if ( resource.isEmpty() ) // canceled
   {
     return false;
@@ -268,7 +268,7 @@
     subResource = mUidMap[ i->uid() ].resource();
     sernum = mUidMap[ i->uid() ].serialNumber();
   } else { // can this happen?
-    subResource = findWritableResource( i18n( i->type() ), mSubResources );
+    subResource = findWritableResource( Kolab::Notes, mSubResources );
     if ( subResource.isEmpty() ) // canceled
       return;
     sernum = 0;
--- branches/kdepim/enterprise/kdepim/kresources/kolab/shared/resourcekolabbase.cpp \
#1099226:1099227 @@ -210,7 +210,7 @@
   return mConnection->kmailRemoveSubresource( resource );
 }
 
-QString ResourceKolabBase::findWritableResource( const QString &type,
+QString ResourceKolabBase::findWritableResource( const ResourceType &type,
                                                  const ResourceMap& resources,
                                                  const QString& text )
 {
@@ -228,11 +228,32 @@
 
   if ( possible.isEmpty() ) { // None found!!
     kdWarning(5650) << "No writable resource found!" << endl;
-    KMessageBox::error(
-      0,
-      i18n( "You have no writable %1 folders so saving will not be possible.\n"
-            "Please create or activate at least 1 writable %2 folder and try again." \
                ).
-      arg( type, type ) );
+
+    QString errorText;
+    switch( type ) {
+      case Events:
+        errorText = "You have no writable event folders so saving will not be \
possible.\n" +                    "Please create or activate at least one writable \
event folder and try again."; +        break;
+      case Tasks:
+        errorText = "You have no writable task folders so saving will not be \
possible.\n" +                    "Please create or activate at least one writable \
task folder and try again."; +        break;
+      case Incidences:
+        errorText = "You have no writable calendar folder so saving will not be \
possible.\n" +                    "Please create or activate at least one writable \
calendar folder and try again."; +        break;
+      case Notes:
+        errorText = "You have no writable notes folders so saving will not be \
possible.\n" +                    "Please create or activate at least one writable \
notes folder and try again."; +        break;
+      case Contacts:
+        errorText = "You have no writable addressbook folder so saving will not be \
possible.\n" +                    "Please create or activate at least one writable \
addressbook folder and try again."; +        break;
+    }
+
+    KMessageBox::error( 0, errorText );
     return QString::null;
   }
   if ( possible.count() == 1 )
--- branches/kdepim/enterprise/kdepim/kresources/kolab/shared/resourcekolabbase.h \
#1099226:1099227 @@ -46,6 +46,8 @@
 
 namespace Kolab {
 
+enum ResourceType { Tasks, Events, Incidences, Contacts, Notes };
+
 class KMailConnection;
 
 /**
@@ -168,7 +170,7 @@
   QString configFile( const QString& type ) const;
 
   /// If only one of these is writable, return that. Otherwise return null.
-  QString findWritableResource( const QString &type,
+  QString findWritableResource( const ResourceType &type,
                                 const ResourceMap& resources,
                                 const QString& text = QString::null );
 


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

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