Bug 92710 - Wrong folder order in folder selection drop down boxes
Summary: Wrong folder order in folder selection drop down boxes
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.7
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-04 22:55 UTC by Ingo Klöcker
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Klöcker 2004-11-04 22:55:51 UTC
Version:           1.7 (using KDE KDE 3.3.0)
Installed from:    Unlisted Binary Package
Compiler:          gcc version 3.3.3 (SuSE Linux)
OS:                Linux (i686) release 2.6.5-7.111-default

Reported by Kai Gazmaga:

I've got several subfolders in my Inbox and moved them to a folder Backup right beyond "Local Folders"
The filters managed to readjust automatically, so they moved fitting mails to Local Folders / Backup / blabla.
Now I added the same range of folders to my Inbox again (all folders are Maildir) - in order to have the same structure as before. In the filter-dialog I now find the newly created subfoldes of my Inbox located under Backup while making the filter move specific mails to another folder. 
After renaming the subfolders of Backup to blabla_BU I found that the subfolders of Inbox were appended after the realy located in Backup ones by the dialogs listbox.

Trying to get that right i restarted KMail and moved folders from here to there. Analysing that, I believe that KMail has kind of randomized listing of newly created folders in filter-dialog.

Finally I tried to create a mbox-folder "Test" in my Inbox. The filter-dialog displays it as Local Folders / Friends / Test although it is located  /Local 
Folders / Inbox / Test.
Comment 1 Ingo Klöcker 2004-11-04 23:04:31 UTC
I can verify the problem. The problem is that KMFolderComboBox::createFolderList() assumes that the five local system folders can't have any subfolders. That's obviously no longer true. For KDE 3.3.x we have to come up with a fix, but for KDE 3.4 I think we should get rid of the folder selection drop down box and use the nice folder selection dialog which appears when moving/copying messages with 'm'/'c'. The drop down box simply doesn't work for large folder trees (cf. bug 74268).
Comment 2 Ingo Klöcker 2004-11-07 17:39:52 UTC
CVS commit by kloecker: 

Fix broken order of folders in the folder combobox. Since we now allow subfolders below the system folders we can't simply move the system folders to the begin of the list. Therefore we now leave the system folders where they are. Additionally, the local folders are now listed before the IMAP folders which should have always been the case.
BUG:92710


  M +15 -21    kmfoldercombobox.cpp   1.18.2.1


--- kdepim/kmail/kmfoldercombobox.cpp  #1.18:1.18.2.1
@@ -66,29 +66,23 @@ void KMFolderComboBox::createFolderList(
                                         QValueList<QGuardedPtr<KMFolder> > *folders)
 {
+  kmkernel->folderMgr()->createI18nFolderList( names, folders );
+  if ( !mOutboxShown ) {
+    QValueList< QGuardedPtr<KMFolder> >::iterator folderIt = folders->begin();
+    QStringList::iterator namesIt = names->begin();
+    for ( ; folderIt != folders->end(); ++folderIt, ++namesIt ) {
+      KMFolder *folder = *folderIt;
+      if ( folder == kmkernel->outboxFolder() )
+        break;
+    }
+    if ( folderIt != folders->end() ) {
+      folders->remove( folderIt );
+      names->remove( namesIt );
+    }
+  }
+
   if (mImapShown)
     kmkernel->imapFolderMgr()->createI18nFolderList( names, folders );
 
   kmkernel->dimapFolderMgr()->createI18nFolderList( names, folders );
-  kmkernel->folderMgr()->createFolderList( names, folders );
-  uint i = 0;
-  while (i < folders->count())
-  {
-    if ((*(folders->at(i)))->isSystemFolder()
-        && (*(folders->at(i)))->folderType() != KMFolderTypeImap
-        && (*(folders->at(i)))->folderType() != KMFolderTypeCachedImap)
-    {
-      folders->remove(folders->at(i));
-      names->remove(names->at(i));
-    }
-    else i++;
-  }
-
-  folders->prepend(kmkernel->draftsFolder());
-  folders->prepend(kmkernel->trashFolder());
-  folders->prepend(kmkernel->sentFolder());
-  if (mOutboxShown) folders->prepend(kmkernel->outboxFolder());
-  folders->prepend(kmkernel->inboxFolder());
-  for (int i = ((mOutboxShown) ? 4 : 3); i >= 0; i--)
-    names->prepend((*(folders->at(i)))->label());
 }