From 4cf8731681471c114274afaa7804c34851d4d70a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 6 Nov 2007 17:13:15 +0000 Subject: [PATCH] Monotone-Parent: 56e8fb42c60b615f9c931f4b5e80a51560db4269 Monotone-Revision: d25dc292baa2e15a7f6d397c032c8cb30ccdafb2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-06T17:13:15 Monotone-Branch: ca.inverse.sogo --- .../English.lproj/Localizable.strings | 3 ++ .../French.lproj/Localizable.strings | 3 ++ UI/PreferencesUI/GNUmakefile | 1 + .../German.lproj/Localizable.strings | 3 ++ UI/PreferencesUI/UIxPreferences.h | 2 +- UI/PreferencesUI/UIxPreferences.m | 30 +++++++++++++++++++ UI/PreferencesUI/product.plist | 4 +++ 7 files changed, 45 insertions(+), 1 deletion(-) diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index d216c0fe6..d9b2679cb 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -82,6 +82,9 @@ "messageforward_inline" = "Inline"; "messageforward_attached" = "As Attachment"; +"Default identity:" = "Default identity:"; +"Manage identities..." = "Manage identities..."; + /* password */ "New password:" = "New password:"; "Confirmation:" = "Confirmation:"; diff --git a/UI/PreferencesUI/French.lproj/Localizable.strings b/UI/PreferencesUI/French.lproj/Localizable.strings index 99d333873..d41dd6d1d 100644 --- a/UI/PreferencesUI/French.lproj/Localizable.strings +++ b/UI/PreferencesUI/French.lproj/Localizable.strings @@ -79,6 +79,9 @@ "messageforward_inline" = "intégrés"; "messageforward_attached" = "en pièces jointes"; +"Default identity:" = "Identité par défaut :"; +"Manage identities..." = "Gérer les identitiés..."; + /* password */ "New password:" = "Nouveau mot de passe :"; "Confirmation:" = "Confirmation :"; diff --git a/UI/PreferencesUI/GNUmakefile b/UI/PreferencesUI/GNUmakefile index 2b34be9b5..496a1eda3 100644 --- a/UI/PreferencesUI/GNUmakefile +++ b/UI/PreferencesUI/GNUmakefile @@ -11,6 +11,7 @@ PreferencesUI_LANGUAGES = English French German PreferencesUI_OBJC_FILES = \ PreferencesUIProduct.m \ \ + UIxIdentities.m \ UIxJSONPreferences.m \ UIxPreferences.m diff --git a/UI/PreferencesUI/German.lproj/Localizable.strings b/UI/PreferencesUI/German.lproj/Localizable.strings index e25c85fb0..55db9ef65 100644 --- a/UI/PreferencesUI/German.lproj/Localizable.strings +++ b/UI/PreferencesUI/German.lproj/Localizable.strings @@ -79,6 +79,9 @@ "messageforward_inline" = "Eingebunden"; "messageforward_attached" = "Als Anhang"; +"Default identity:" = "Default identity:"; +"Manage identities..." = "Manage identities..."; + /* password */ "New password:" = "Neues Passwort:"; "Confirmation:" = "Bestätigung:"; diff --git a/UI/PreferencesUI/UIxPreferences.h b/UI/PreferencesUI/UIxPreferences.h index 5570fbc7e..c97889248 100644 --- a/UI/PreferencesUI/UIxPreferences.h +++ b/UI/PreferencesUI/UIxPreferences.h @@ -32,7 +32,7 @@ @interface UIxPreferences : UIxComponent { - NSString *item; + id item; SOGoUser *user; NSUserDefaults *userDefaults; NSCalendarDate *today; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 0a6c33ef1..958675336 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -28,6 +28,7 @@ #import #import +#import #import #import "UIxPreferences.h" @@ -466,6 +467,35 @@ static BOOL shouldDisplayPasswordChange = NO; [userDefaults setObject: newMessageForwarding forKey: @"MessageForwarding"]; } +// +- (NSArray *) identitiesList +{ + return [user allIdentities]; +} + +- (NSString *) itemIdentityText +{ + return [item keysWithFormat: @"%{fullName} <%{email}>"]; +} + +- (NSDictionary *) defaultIdentity +{ + NSDictionary *currentIdentity, *defaultIdentity; + NSEnumerator *identities; + + defaultIdentity = nil; + + identities = [[user allIdentities] objectEnumerator]; + while (!defaultIdentity + && (currentIdentity = [identities nextObject])) + if ([[currentIdentity objectForKey: @"isDefault"] boolValue]) + defaultIdentity = currentIdentity; + + return defaultIdentity; +} + - (id ) defaultAction { id results; diff --git a/UI/PreferencesUI/product.plist b/UI/PreferencesUI/product.plist index de4a1d90d..2891bffa1 100644 --- a/UI/PreferencesUI/product.plist +++ b/UI/PreferencesUI/product.plist @@ -20,6 +20,10 @@ protectedBy = "View"; pageName = "UIxPreferences"; }; + identities = { + protectedBy = "View"; + pageName = "UIxIdentities"; + }; jsonDefaults = { protectedBy = "View"; actionClass = "UIxJSONPreferences";