Bug 122531

Summary: [PATCH] Tries to acces localized IMAP groupware folder name
Product: [Applications] kmail Reporter: Christian Hammers <ch>
Component: IMAPAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ana, echidnaman
Priority: NOR    
Version: 1.9.1   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Christian's patch

Description Christian Hammers 2006-02-23 02:36:36 UTC
Version:           1.9.1 (using KDE KDE 3.5.1)
Installed from:    Debian testing/unstable Packages
OS:                Linux

kmail checks at startup for the localized names of groupware folders on IMAP servers, does not find them and
tries to create untranslated folder names. Those already exist from the previous creation though
and thus the error is displayed every time when kmail starts. Sometimes it even crashs.

Both happens inside kdepim/kmail/kmailicalifaceimpl.cpp

creating the folders uses:
   parentFolder->createFolder( localizedDefaultFolderName( contentsType ) );
which is
  static QString localizedDefaultFolderName( KMail::FolderContentsType type )
  {
    return i18n( s_folderContentsType[type].translatedName );
  }
where translatedName is something like:
  I18N_NOOP( "Mail" )
and thus probably prevents translation?


Folder checking went via:
  findStandardResourceFolder(..)
which uses
  folderParentDir->hasNamedFolder( folderName( itemType, folderLanguage ) );




The dialog was:
KMail found the following groupware folders in shared and needs to perform the following operations:
 * Calendar: no folder found. It will be created.
 * Contacts: no folder found. It will be created.
 * Notes: no folder found. It will be created.
 * Tasks: no folder found. It will be created.

To visualize I added some printfs:
#42#DEBUG# Looking for itemType 7 and folderLanguage 1 and thus folderName=Kalender getting node 0
#42#DEBUG# createFolder Calendar
#42#DEBUG# Looking for itemType 8 and folderLanguage 1 and thus folderName=Aufgaben getting node 0
#42#DEBUG# createFolder Tasks
#42#DEBUG# Looking for itemType 9 and folderLanguage 1 and thus folderName=Journal getting node 0x855db0
#42#DEBUG# Looking for itemType 10 and folderLanguage 1 and thus folderName=Kontakte getting node 0
#42#DEBUG# createFolder Contacts
#42#DEBUG# Looking for itemType 11 and folderLanguage 1 and thus folderName=Notizen getting node 0
#42#DEBUG# createFolder Notes                                               ^^^^^^^


The patch is:

--- kmailicalifaceimpl.cpp.orig 2006-01-19 17:55:47.000000000 +0100
+++ kmailicalifaceimpl.cpp      2006-02-23 02:06:39.000000000 +0100
@@ -1848,9 +1849,7 @@
   else // icalvcard: look up standard resource folders by name
   {
     KFolderTreeItem::Type itemType = s_folderContentsType[contentsType].treeItemType;
-    unsigned int folderLanguage = GlobalSettings::self()->theIMAPResourceFolderLanguage();
-    if( folderLanguage > 3 ) folderLanguage = 0;
-    KMFolderNode* node = folderParentDir->hasNamedFolder( folderName( itemType, folderLanguage ) );
+    KMFolderNode* node = folderParentDir->hasNamedFolder( localizedDefaultFolderName( contentsType ) );
     if ( !node || node->isDir() )
       return StandardFolderSearchResult( 0, StandardFolderSearchResult::NotFound );
     return StandardFolderSearchResult( static_cast<KMFolder*>( node ), StandardFolderSearchResult::FoundAndStandard );
Comment 1 Thomas McGuire 2007-02-22 20:12:42 UTC
Created attachment 19782 [details]
Christian's patch

I just attachted the patch Christian made so it can easily found later by
queries.

Christian: The developers of KMail are not monitoring the bug system very much,
so you should probably contact them at the kde-pim mailinglist or at #kontact
on IRC if you want your patch to be commited.

BTW, bug #122531 and bug #142061 look similar.
Comment 2 Fabrice Flore-Thebault 2007-08-15 11:28:27 UTC
Same probblem on debian etch, kmail + kdepim version 4:3.5.5.dfsg.1-6, exacly 
as described here for Ubuntu :

https://bugs.launchpad.net/ubuntu/+source/kdepim/+bug/128643
Comment 3 Jonathan Thomas 2010-07-13 21:20:47 UTC
Reported fixed in more recent KMail versions at the downstream bug in comment #2.