From 2ffcb68c5072fe849faa5a9d77d9bf9adce518f0 Mon Sep 17 00:00:00 2001 From: C Robert Date: Thu, 20 Aug 2009 20:33:57 +0000 Subject: [PATCH] Mantis 113: MailFieldNames are ignored when composing email with saved preferences Monotone-Parent: fd4f04fce6a66b3dc14b58f9b67f93c6af6d450a Monotone-Revision: dc00d231986ac84ebf39553ae085b3efe0f8fae1 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-08-20T20:33:57 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ SoObjects/SOGo/SOGoUser.m | 10 +++++++++- UI/PreferencesUI/UIxPreferences.m | 13 +++++++++---- UI/WebServerResources/UIxMailEditor.js | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0e26ef44..1f7350453 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,10 @@ CalendarDefaultFilter user default. Mantis 112 * UI/Scheduler/UIxCalListingActions.m (checkFilterValue): Added to support CalendarDefaultFilter user default. Mantis 112 + * SoObjects/SOGo/SOGoUser.m: Changed "signature" setting's place: MailSignature + Mantis 113. + * UI/PreferencesUI/UIxPreferences.m: Support for MailSignature setting. + Mantis 113. 2009-08-19 Cyril Robert diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 98ca8776c..3c34caed5 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -413,6 +413,7 @@ _timeValue (NSString *key) [self logWithFormat: @"'SOGoDefaultMailDomain' is not set"]; doSave = NO; } + doSave = NO; if (doSave) [[self userDefaults] setObject: [self mailAccounts] forKey: @"MailAccounts"]; @@ -870,7 +871,14 @@ _timeValue (NSString *key) - (NSString *) signature { - return [[self primaryIdentity] objectForKey: @"signature"]; + NSString *signature; + + signature = [[self userDefaults] stringForKey: @"MailSignature"]; + // Old style + if (![signature length]) + signature = [[self primaryIdentity] objectForKey: @"signature"]; + + return signature; } - (NSString *) replyPlacement diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index dade581c6..26dcb045f 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -569,14 +569,19 @@ static BOOL defaultShowSubscribedFoldersOnly = NO; - (NSString *) signature { - return [[user defaultIdentity] objectForKey: @"signature"]; + NSString *signature; + + signature = [userDefaults stringForKey: @"MailSignature"]; + // Old style + if (![signature length]) + signature = [[user defaultIdentity] objectForKey: @"signature"]; + + return signature; } - (void) setSignature: (NSString *) newSignature { - [[user defaultIdentity] setObject: newSignature - forKey: @"signature"]; - [user saveMailAccounts]; + [userDefaults setObject: newSignature forKey: @"MailSignature"]; } - (NSArray *) replyPlacementList diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index 48636496a..1136451ae 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -632,7 +632,7 @@ function lineBreakCount(str){ function hasSignature() { try { - return(UserDefaults.MailAccounts[0].identities[0].signature.length > 0); + return(UserDefaults["MailSignature"].length > 0); } catch(e) { return false; }