Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > cf746698214707f972e669b661d0ae59 > files > 27

kdepim4-4.14.10-1.3.mga5.src.rpm

From 0daf5f4f81884a5f5b4b1529b785d0f29c60e2a9 Mon Sep 17 00:00:00 2001
From: Andre Heinecke <aheinecke@intevation.de>
Date: Mon, 5 Oct 2015 13:57:28 +0200
Subject: [PATCH 27/74] Improve kolab calendernaming

For folders in the inbox it is now <Foldername> (Kolab)
For shared folders it is now <Foldername> (Kolab/owner).

Break when parent collection is invalid and use the old name.
To avoid an endless loop in that case case the parent
collection is invalid for some reason.
---
 calendarsupport/utils.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/calendarsupport/utils.cpp b/calendarsupport/utils.cpp
index fe7239f696..b5688f89e5 100644
--- a/calendarsupport/utils.cpp
+++ b/calendarsupport/utils.cpp
@@ -505,7 +505,6 @@ QString CalendarSupport::displayName( Akonadi::ETMCalendar *calendar, const Akon
   } else {
     fullCollection = c;
   }
-
   QString cName = fullCollection.name();
   const QString resourceName = fullCollection.resource();
 
@@ -540,39 +539,46 @@ QString CalendarSupport::displayName( Akonadi::ETMCalendar *calendar, const Akon
           nameStr = cName;
           typeStr = QLatin1String("Notes");
           break;
+        } else if ( tName.toLower().startsWith( QLatin1String( "user" ) ) ||
+                    ownerStr.toUpper() == QLatin1String( "INBOX" ) ) {
+            break;
         } else if ( tName != i18n( "Calendar" ) &&
                     tName != i18n( "Tasks" ) &&
                     tName != i18n( "Journal" ) &&
                     tName != i18n( "Notes" ) ) {
           ownerStr = tName;
-          break;
         } else {
           nameStr = typeStr;
           typeStr = tName;
         }
         p = p.parentCollection();
+        if (!p.isValid()) {
+            kDebug() << "Invalid parent collection.";
+            ownerStr = QString();
+            break;
+        }
       }
     }
 
     if ( !ownerStr.isEmpty() ) {
       if ( ownerStr.toUpper() == QLatin1String( "INBOX" ) ) {
         return i18nc( "%1 is folder contents",
-                      "My Kolab %1", typeStr );
+                      "%1 (Kolab)", typeStr );
       } else if ( ownerStr.toUpper() == QLatin1String( "SHARED" ) ) {
         return i18nc( "%1 is folder name, %2 is folder contents",
                       "Shared Kolab %1 %2", nameStr, typeStr );
       } else {
         if ( nameStr.isEmpty() ) {
           return i18nc( "%1 is folder owner name, %2 is folder contents",
-                        "%1's Kolab %2", ownerStr, typeStr );
+                        "%2 (Kolab/%1)", ownerStr, typeStr );
         } else {
           return i18nc( "%1 is folder owner name, %2 is folder name, %3 is folder contents",
-                        "%1's %2 Kolab %3", ownerStr, nameStr, typeStr );
+                        "%3 (Kolab/%1/%2)", ownerStr, nameStr, typeStr );
         }
       }
     } else {
       return i18nc( "%1 is folder contents",
-                    "Kolab %1", typeStr );
+                    "%1 (Kolab)", typeStr );
     }
   } //end kolab section
 
-- 
2.14.1