Bug 102992

Summary: kmailcvt: problem with import of subfolders
Product: [Unmaintained] kmail Reporter: Danny Kukawka <danny.kukawka>
Component: kmailcvtAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: SVN (3.5 branch)   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Danny Kukawka 2005-04-01 12:32:53 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    SuSE RPMs
OS:                Linux

There is a problem with the naming of kmailfolder if you import from a mailarchiv with subfolders. The subfolders in the top level of subfolders miss the prefix currently. By this all messages in a subfolder are imported in one kmail mailfolder. 

-------------------------------
reproduce:
- import from evolution (2.x) or thunderbird mail archiv
Comment 1 Danny Kukawka 2005-04-03 04:07:16 UTC
CVS commit by dkukawka: 

fixed problem with import subfolder for thunderbird and evolution 2.x

BUGS: 102992


  M +8 -4      filter_evolution_v2.cxx   1.9
  M +7 -4      filter_thunderbird.cxx   1.9


--- kdepim/kmailcvt/filter_evolution_v2.cxx  #1.8:1.9
@@ -80,5 +80,5 @@ void FilterEvolution_v2::import(FilterIn
     int currentDir = 1, numSubDirs = rootSubDirs.size();
     for(QStringList::Iterator filename = rootSubDirs.begin() ; filename != rootSubDirs.end() ; ++filename, ++currentDir) {
-      importDirContents(info, dir.filePath(*filename), *filename, QString::null);
+      importDirContents(info, dir.filePath(*filename), *filename, *filename);
       info->setOverall((int) ((float) currentDir / numSubDirs * 100));
     }
@@ -185,12 +185,16 @@ void FilterEvolution_v2::importMBox(Filt
       tmp.close();
 
-      QString destFolder = rootDir;
+      QString destFolder = "";
       QString _targetDir = targetDir;
-      if(destFolder.contains(".sbd")) destFolder.remove(".sbd");
       if(!targetDir.isNull()){
          if(_targetDir.contains(".sbd")) _targetDir.remove(".sbd");
-         destFolder += ("-" + _targetDir);
+         destFolder += _targetDir;
          destFolder += "-" + filenameInfo.baseName(TRUE);// mboxName;
       }
+      else {
+        destFolder = rootDir;
+        if(destFolder.contains(".sbd")) destFolder.remove(".sbd");
+      }
+
       
       if(info->removeDupMsg) addMessage( info, destFolder, tmp.name() );

--- kdepim/kmailcvt/filter_thunderbird.cxx  #1.8:1.9
@@ -79,5 +79,5 @@ void FilterThunderbird::import(FilterInf
     int currentDir = 1, numSubDirs = rootSubDirs.size();
     for(QStringList::Iterator filename = rootSubDirs.begin() ; filename != rootSubDirs.end() ; ++filename, ++currentDir) {
-      importDirContents(info, dir.filePath(*filename), *filename, QString::null);
+      importDirContents(info, dir.filePath(*filename), *filename, *filename);
       info->setOverall((int) ((float) currentDir / numSubDirs * 100));
     }
@@ -181,12 +181,15 @@ void FilterThunderbird::importMBox(Filte
       }
       tmp.close();
-      QString destFolder = rootDir;
+      QString destFolder = "";
       QString _targetDir = targetDir;
-      if(destFolder.contains(".sbd")) destFolder.remove(".sbd");
       if(!targetDir.isNull()){
          if(_targetDir.contains(".sbd")) _targetDir.remove(".sbd");
-         destFolder += ("-" + _targetDir);
+         destFolder += _targetDir;
          destFolder += "-" + filenameInfo.baseName(TRUE);// mboxName;
       }
+      else {
+        destFolder = rootDir;
+        if(destFolder.contains(".sbd")) destFolder.remove(".sbd");
+      }
       
       if(info->removeDupMsg) addMessage( info, destFolder, tmp.name() );