From 2cbc2ba742a39bfd8528b3841386a6453fa4143a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 19 Nov 2007 22:44:12 +0000 Subject: [PATCH] Monotone-Parent: 53787a178138e23c283a66af023cbddab3f3c417 Monotone-Revision: d74fd5d68d5fae10363904ec274b94033ae33c2c Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-19T22:44:12 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 16 +++++++++++ .../SOGoMailEnglishForward.html | 2 ++ .../SOGoMailEnglishForward.wod | 5 ++++ .../SOGoMailEnglishReply.html | 2 ++ .../SOGoMailEnglishReply.wod | 5 ++++ SoObjects/Mailer/SOGoMailForward.m | 13 +++++++++ .../SOGoMailFrenchForward.html | 2 ++ .../SOGoMailFrenchForward.wod | 5 ++++ .../SOGoMailFrenchReply.html | 2 ++ .../SOGoMailFrenchReply.wod | 5 ++++ .../SOGoMailGermanForward.html | 2 ++ .../SOGoMailGermanForward.wod | 5 ++++ .../SOGoMailGermanReply.html | 2 ++ .../SOGoMailGermanReply.wod | 5 ++++ SoObjects/Mailer/SOGoMailReply.m | 13 +++++++++ UI/MailerUI/UIxMailAccountActions.m | 27 ++++++++++++++----- UI/PreferencesUI/UIxPreferences.m | 25 ++++++++++++++--- UI/Templates/PreferencesUI/UIxPreferences.wox | 13 +++++---- UI/WebServerResources/UIxPreferences.css | 8 ++++++ 19 files changed, 143 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a2fb10b3..fc8949637 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2007-11-19 Wolfgang Sourdeau + * UI/PreferencesUI/UIxPreferences.m ([UIxPreferences -signature]): + returns the signature for the default identity of the default + accouunt... + ([UIxPreferences -setSignature:newSignature]): accessor that sets + the default signature. + + * UI/MailerUI/UIxMailAccountActions.m ([UIxMailAccountActions + -composeAction]): append the message signature to the new draft. + + * SoObjects/Mailer/SOGoMailReply.m ([SOGoMailReply -signature]): + same as above. + + * SoObjects/Mailer/SOGoMailForward.m ([SOGoMailForward + -signature]): new method that takes the user's signature and put + it at the end of the message, if exists. + * UI/Common/UIxPageFrame.m ([UIxPageFrame -isSuperUser]): new accessor that forwards the call to the active user. diff --git a/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.html b/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.html index c1b652eb6..3f50a3f64 100644 --- a/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.html +++ b/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.html @@ -6,3 +6,5 @@ From: <#from/> <#hasCc>CC: <#cc/><#hasNewsGroups>Newsgroups: <#newsgroups/><#hasReferences>References: <#references/> <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.wod b/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.wod index 517bc8cc1..df237286f 100644 --- a/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.wod +++ b/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.wod @@ -67,3 +67,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html index e0274ea00..0ccbf4549 100644 --- a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html +++ b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html @@ -1,3 +1,5 @@ On <#date/>, <#from/> wrote: <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod index 830cd7a76..7a66a17bf 100644 --- a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod +++ b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod @@ -12,3 +12,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailForward.m b/SoObjects/Mailer/SOGoMailForward.m index ce3545ddb..e666f9b8f 100644 --- a/SoObjects/Mailer/SOGoMailForward.m +++ b/SoObjects/Mailer/SOGoMailForward.m @@ -149,6 +149,19 @@ return [sourceMail contentForEditing]; } +- (NSString *) signature +{ + NSString *signature, *mailSignature; + + signature = [[context activeUser] signature]; + if ([signature length]) + mailSignature = [NSString stringWithFormat: @"--\r\n%@", signature]; + else + mailSignature = @""; + + return mailSignature; +} + @end @implementation SOGoMailEnglishForward diff --git a/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.html b/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.html index 3ae60f74c..6ebbd4598 100644 --- a/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.html +++ b/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.html @@ -6,3 +6,5 @@ De: <#from/> <#hasCc>Copie: <#cc/><#hasNewsGroups>Forums de discussion: <#newsgroups/><#hasReferences>Références: <#references/> <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.wod b/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.wod index 517bc8cc1..df237286f 100644 --- a/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.wod +++ b/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.wod @@ -67,3 +67,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html index 406f945d0..d7f225103 100644 --- a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html +++ b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html @@ -1,3 +1,5 @@ Le <#date/>, <#from/> a écrit: <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod index 830cd7a76..7a66a17bf 100644 --- a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod +++ b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod @@ -12,3 +12,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.html b/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.html index 26fa08039..1260988e4 100644 --- a/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.html +++ b/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.html @@ -6,3 +6,5 @@ Sender: <#from/> <#hasCc>Kopie: <#cc/><#hasNewsGroups>Newsgroup: <#newsgroups/><#hasReferences>Referenzen: <#references/> <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.wod b/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.wod index 517bc8cc1..df237286f 100644 --- a/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.wod +++ b/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.wod @@ -67,3 +67,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html index e0274ea00..0ccbf4549 100644 --- a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html +++ b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html @@ -1,3 +1,5 @@ On <#date/>, <#from/> wrote: <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod index 830cd7a76..7a66a17bf 100644 --- a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod +++ b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod @@ -12,3 +12,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailReply.m b/SoObjects/Mailer/SOGoMailReply.m index f1758ed6a..9016b469d 100644 --- a/SoObjects/Mailer/SOGoMailReply.m +++ b/SoObjects/Mailer/SOGoMailReply.m @@ -73,6 +73,19 @@ return [[sourceMail contentForEditing] stringByApplyingMailQuoting]; } +- (NSString *) signature +{ + NSString *signature, *mailSignature; + + signature = [[context activeUser] signature]; + if ([signature length]) + mailSignature = [NSString stringWithFormat: @"--\r\n%@", signature]; + else + mailSignature = @""; + + return mailSignature; +} + @end @implementation SOGoMailEnglishReply diff --git a/UI/MailerUI/UIxMailAccountActions.m b/UI/MailerUI/UIxMailAccountActions.m index f9d4d2b82..69fe254d9 100644 --- a/UI/MailerUI/UIxMailAccountActions.m +++ b/UI/MailerUI/UIxMailAccountActions.m @@ -24,16 +24,18 @@ #import #import -#import +#import #import #import #import + #import #import #import #import #import #import +#import #import "../Common/WODirectAction+SOGo.h" @@ -143,22 +145,35 @@ { SOGoDraftsFolder *drafts; SOGoDraftObject *newDraftMessage; - NSString *urlBase, *url, *value; + NSString *urlBase, *url, *value, *signature; NSArray *mailTo; - + BOOL save; drafts = [[self clientObject] draftsFolderInContext: context]; newDraftMessage = [drafts newDraft]; + save = NO; + value = [[self request] formValueForKey: @"mailto"]; if ([value length] > 0) { mailTo = [NSArray arrayWithObject: value]; - [newDraftMessage setHeaders: [NSDictionary dictionaryWithObject: mailTo - forKey: @"to"]]; - [newDraftMessage storeInfo]; + [newDraftMessage + setHeaders: [NSDictionary dictionaryWithObject: mailTo + forKey: @"to"]]; + save = YES; } + signature = [[context activeUser] signature]; + if ([signature length]) + { + [newDraftMessage + setText: [NSString stringWithFormat: @"\r\n--\r\n%@", signature]]; + save = YES; + } + if (save) + [newDraftMessage storeInfo]; + urlBase = [newDraftMessage baseURLInContext: context]; url = [urlBase composeURLWithAction: @"edit" parameters: nil diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 958675336..192d8267e 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -28,6 +28,7 @@ #import #import +#import #import #import @@ -472,7 +473,12 @@ static BOOL shouldDisplayPasswordChange = NO; // string="itemIdentityText" selection="defaultIdentity"/> - (NSArray *) identitiesList { - return [user allIdentities]; + NSDictionary *primaryAccount; + +#warning we manage only one account per user at this time... + primaryAccount = [[user mailAccounts] objectAtIndex: 0]; + + return [primaryAccount objectForKey: @"identities"]; } - (NSString *) itemIdentityText @@ -480,9 +486,9 @@ static BOOL shouldDisplayPasswordChange = NO; return [item keysWithFormat: @"%{fullName} <%{email}>"]; } -- (NSDictionary *) defaultIdentity +- (NSMutableDictionary *) defaultIdentity { - NSDictionary *currentIdentity, *defaultIdentity; + NSMutableDictionary *currentIdentity, *defaultIdentity; NSEnumerator *identities; defaultIdentity = nil; @@ -496,6 +502,19 @@ static BOOL shouldDisplayPasswordChange = NO; return defaultIdentity; } +- (NSString *) signature +{ + return [[self defaultIdentity] objectForKey: @"signature"]; +} + +- (void) setSignature: (NSString *) newSignature +{ + [[self defaultIdentity] setObject: newSignature + forKey: @"signature"]; + [userDefaults setObject: [user mailAccounts] + forKey: @"MailAccounts"]; +} + - (id ) defaultAction { id results; diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 3bf8804b5..bb01400d4 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -19,8 +19,8 @@ label:value="Calendar Options"/>
  • - +
  • @@ -97,10 +97,13 @@ -->
    - + +
    +