From 13cc138afc58fd4df06eae17314292ca9a2c9dd4 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 19 May 2009 23:31:51 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 3e3f539c1798ad054238bb1eb3099675124b888b Monotone-Revision: 57dd1ad4053d9e7949e68a06c4f52bd1ec44d9d1 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-05-19T23:31:51 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 15 +++++++++++++++ SoObjects/Mailer/SOGoMailAccount.m | 14 +++++++++++--- UI/PreferencesUI/UIxPreferences.m | 16 ++++++++++++++-- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 290f02de1..4fc2dd6a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2009-05-19 Francis Lachapelle + + * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount + -allFolderPaths]): if the user default "showSubscribedFoldersOnly" + is not defined for the user, use the application default + "SOGoMailShowSubscribedFoldersOnly". + + * UI/PreferencesUI/UIxPreferences.m ([UIxPreferences + -showSubscribedFoldersOnly]): return the user default or the + application default if not defined. + ([UIxPreferences-setShowSubscribedFoldersOnly]): when false, set + the user default parameter "showSubscribedFoldersOnly" to NO + instead of removing the entry. This will ensure user defaults are + taking precedence over application defaults. + 2009-05-15 Francis Lachapelle * SOPE/sope-ldap/NGLdap/NGLdapConnection.m: added methods diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index f994892eb..3adf9dec1 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -57,7 +57,7 @@ static NSString *sentFolderName = nil; static NSString *trashFolderName = nil; static NSString *sharedFolderName = @""; // TODO: add English default static NSString *otherUsersFolderName = @""; // TODO: add English default - +static BOOL defaultShowSubscribedFoldersOnly = NO; // this is temporary, until we allow users to manage their own accounts static NSString *fallbackIMAP4Server = nil; @@ -109,6 +109,8 @@ static NSString *fallbackIMAP4Server = nil; else fallbackIMAP4Server = @"localhost"; } + + defaultShowSubscribedFoldersOnly = [ud boolForKey: @"SOGoMailShowSubscribedFoldersOnly"]; } - (id) init @@ -209,10 +211,16 @@ static NSString *fallbackIMAP4Server = nil; NSMutableArray *folderPaths; NSArray *rawFolders, *mainFolders; NSUserDefaults *ud; + NSString *showSubscribedFoldersOnly; ud = [[context activeUser] userDefaults]; - rawFolders = [[self imap4Connection] allFoldersForURL: [self imap4URL] - onlySubscribedFolders: [ud boolForKey: @"showSubscribedFoldersOnly"]]; + showSubscribedFoldersOnly = [ud stringForKey: @"showSubscribedFoldersOnly"]; + if (showSubscribedFoldersOnly) + rawFolders = [[self imap4Connection] allFoldersForURL: [self imap4URL] + onlySubscribedFolders: [showSubscribedFoldersOnly boolValue]]; + else + rawFolders = [[self imap4Connection] allFoldersForURL: [self imap4URL] + onlySubscribedFolders: defaultShowSubscribedFoldersOnly]; mainFolders = [[NSArray arrayWithObjects: [self inboxFolderNameInContext: context], diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index d8522d0a4..971466427 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -46,6 +46,7 @@ static BOOL defaultsRead = NO; static BOOL shouldDisplayPasswordChange = NO; static BOOL shouldDisplayAdditionalPreferences = NO; +static BOOL defaultShowSubscribedFoldersOnly = NO; @implementation UIxPreferences @@ -60,6 +61,8 @@ static BOOL shouldDisplayAdditionalPreferences = NO; = [ud boolForKey: @"SOGoUIxUserCanChangePassword"]; shouldDisplayAdditionalPreferences = [ud boolForKey: @"SOGoUIxAdditionalPreferences"]; + defaultShowSubscribedFoldersOnly + = [ud boolForKey: @"SOGoMailShowSubscribedFoldersOnly"]; defaultsRead = YES; } } @@ -452,12 +455,21 @@ static BOOL shouldDisplayAdditionalPreferences = NO; if (showSubscribedFoldersOnly) [userDefaults setBool: YES forKey: @"showSubscribedFoldersOnly"]; else - [userDefaults removeObjectForKey: @"showSubscribedFoldersOnly"]; + [userDefaults setBool: NO forKey: @"showSubscribedFoldersOnly"]; } - (BOOL) showSubscribedFoldersOnly { - return [userDefaults boolForKey: @"showSubscribedFoldersOnly"]; + NSString *showSubscribedFoldersOnly; + BOOL r; + + showSubscribedFoldersOnly = [userDefaults stringForKey: @"showSubscribedFoldersOnly"]; + if (showSubscribedFoldersOnly) + r = [showSubscribedFoldersOnly boolValue]; + else + r = defaultShowSubscribedFoldersOnly; + + return r; } - (NSArray *) messageCheckList