From a0751f9b0c1c3871076a89695c6711b617de8de1 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 28 May 2007 19:06:13 +0000 Subject: [PATCH] Monotone-Parent: f445ddae9e72252fda8d9a7adee3c89ef2f81c87 Monotone-Revision: c8246ff1dd544334660bbbfbf76f6e992438c1e7 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-28T19:06:13 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ SoObjects/Mailer/SOGoMailAccount.h | 2 +- SoObjects/Mailer/SOGoMailAccount.m | 23 +++++++++++++++++------ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e74c803cc..e84483a51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-05-28 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount + -allFolderPaths]): renamed version of "allFolderPathes", sorted by + named and at the beginning of which we put the predefined folders. + * UI/MailerUI/UIxMailFolderActions.m ([UIxMailFolderActions -emptyTrashAction]): new method inspired by a similar one from UIxMailListView, to which we added the ability to remove diff --git a/SoObjects/Mailer/SOGoMailAccount.h b/SoObjects/Mailer/SOGoMailAccount.h index 23a866140..d9bd07513 100644 --- a/SoObjects/Mailer/SOGoMailAccount.h +++ b/SoObjects/Mailer/SOGoMailAccount.h @@ -45,7 +45,7 @@ /* folder pathes */ -- (NSArray *)allFolderPathes; +- (NSArray *)allFolderPaths; - (NSArray *)additionalRootFolderNames; /* stuff like filters and drafts */ /* shared accounts */ diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index a9a148aa2..184274881 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -134,12 +134,23 @@ static BOOL useAltNamespace = NO; return self; } -- (NSArray *)allFolderPathes { - NSArray *pathes; - - pathes = [[self imap4Connection] allFoldersForURL:[self imap4URL] ]; - pathes = [pathes sortedArrayUsingSelector:@selector(compare:)]; - return pathes; +- (NSArray *) allFolderPaths +{ + NSMutableArray *newFolders; + NSArray *rawFolders, *mainFolders; + + rawFolders = [[self imap4Connection] + allFoldersForURL: [self imap4URL]]; + + mainFolders = [NSArray arrayWithObjects: inboxFolderName, draftsFolderName, + sentFolder, trashFolder, nil]; + newFolders = [NSMutableArray arrayWithArray: rawFolders]; + [newFolders removeObjectsInArray: mainFolders]; + [newFolders sortUsingSelector: @selector (caseInsensitiveCompare:)]; + [newFolders replaceObjectsInRange: NSMakeRange (0, 0) + withObjectsFromArray: mainFolders]; + + return newFolders; } /* IMAP4 */