diff --git a/ChangeLog b/ChangeLog index 3fc1ced17..7e97907ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2007-10-17 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount -draftsFolderNameInContext:_ctx]) + ([SOGoMailAccount -sentFolderNameInContext:]) + ([SOGoMailAccount -trashFolderNameInContext:]): modified to take + the user settings into account. + + * UI/MailerUI/UIxMailFolderActions.m ([UIxMailFolderActions -setAsDraftsFolderAction]) + ([UIxMailFolderActions -setAsSentFolderAction]) + ([UIxMailFolderActions -setAsTrashFolderAction]): new web methods + that change the purpose of the active folder to "Sent", "Drafts" + or "Trash". + * UI/SOGoUI/SOGoACLAdvisory.m ([SOGoACLAdvisory -subject]): returns the subject as quoted-printable. diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index bf2a7a587..eea913c2b 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -32,6 +32,8 @@ #import #import +#import + #import "SOGoMailFolder.h" #import "SOGoMailManager.h" #import "SOGoDraftsFolder.h" @@ -333,10 +335,32 @@ static BOOL useAltNamespace = NO; return [NSString stringWithFormat: @"folder%@", inboxFolderName]; } +- (NSString *) _userFolderNameWithPurpose: (NSString *) purpose +{ + NSUserDefaults *ud; + NSMutableDictionary *mailSettings; + NSString *folderName; + + folderName = nil; + ud = [[context activeUser] userSettings]; + mailSettings = [ud objectForKey: @"Mail"]; + if (mailSettings) + folderName + = [mailSettings objectForKey: [NSString stringWithFormat: @"%@Folder", + purpose]]; + + return folderName; +} + - (NSString *) draftsFolderNameInContext: (id) _ctx { - /* SOGo managed folder */ - return [NSString stringWithFormat: @"folder%@", draftsFolderName]; + NSString *folderName; + + folderName = [self _userFolderNameWithPurpose: @"Drafts"]; + if (!folderName) + folderName = draftsFolderName; + + return [NSString stringWithFormat: @"folder%@", folderName]; } - (NSString *) sieveFolderNameInContext: (id) _ctx @@ -346,12 +370,24 @@ static BOOL useAltNamespace = NO; - (NSString *) sentFolderNameInContext: (id)_ctx { - return [NSString stringWithFormat: @"folder%@", sentFolderName]; + NSString *folderName; + + folderName = [self _userFolderNameWithPurpose: @"Sent"]; + if (!folderName) + folderName = sentFolderName; + + return [NSString stringWithFormat: @"folder%@", folderName]; } - (NSString *) trashFolderNameInContext: (id)_ctx { - return [NSString stringWithFormat: @"folder%@", trashFolderName]; + NSString *folderName; + + folderName = [self _userFolderNameWithPurpose: @"Trash"]; + if (!folderName) + folderName = trashFolderName; + + return [NSString stringWithFormat: @"folder%@", folderName]; } - (SOGoMailFolder *) inboxFolderInContext: (id) _ctx diff --git a/UI/MailerUI/English.lproj/Localizable.strings b/UI/MailerUI/English.lproj/Localizable.strings index b8d4e8b9a..96cf5ca59 100644 --- a/UI/MailerUI/English.lproj/Localizable.strings +++ b/UI/MailerUI/English.lproj/Localizable.strings @@ -139,9 +139,64 @@ "MoveTo" = "Move …"; -"error_missingsubject" = "Missing Subject"; -"error_missingrecipients" = "Missing Recipients"; -"error_validationfailed" = "Validation failed"; +/* Address Popup menu */ +"Add to Address Book..." = "Add to Address Book..."; +"Compose Mail To" = "Compose Mail To"; +"Create Filter From Message..." = "Create Filter From Message..."; + +/* Mailbox popup menus */ +"Open in New Mail Window" = "Open in New Mail Window"; +"Copy Folder Location" = "Copy Folder Location"; +"Subscribe..." = "Subscribe..."; +"Mark Folder Read..." = "Mark Folder Read..."; +"New Folder..." = "New Folder..."; +"Compact This Folder" = "Compact This Folder"; +"Search Messages..." = "Search Messages..."; +"Sharing..." = "Sharing..."; +"New Subfolder..." = "New Subfolder..."; +"Rename Folder..." = "Rename Folder..."; +"Delete Folder" = "Delete Folder"; +"Use This Folder For" = "Use This Folder For"; +"Get Messages for Account" = "Get Messages for Account"; + +/* Use This Folder menu */ +"Sent Messages" = "Sent Messages"; +"Drafts" = "Drafts"; +"Deleted Messages" = "Deleted Messages"; + +/* Message list popup menu */ +"Open Message In New Window" = "Open Message In New Window"; +"Reply to Sender Only" = "Reply to Sender Only"; +"Reply to All" = "Reply to All"; +"Forward" = "Forward"; +"Edit As New..." = "Edit As New..."; +"Move To" = "Move To"; +"Copy To" = "Copy To"; +"Label" = "Label"; +"Mark" = "Mark"; +"Save As..." = "Save As..."; +"Print Preview" = "Print Preview"; +"View Message Source" = "View Message Source"; +"Print..." = "Print..."; +"Delete Message" = "Delete Message"; + +/* Label popup menu */ +"None" = "None"; +"Important" = "Important"; +"Work" = "Work"; +"Personal" = "Personal"; +"To Do" = "To Do"; +"Later" = "Later"; + +/* Mark popup menu */ +"As Read" = "As Read"; +"Thread As Read" = "Thread As Read"; +"As Read By Date..." = "As Read By Date..."; +"All Read" = "All Read"; +"Flag" = "Flag"; +"As Junk" = "As Junk"; +"As Not Junk" = "As Not Junk"; +"Run Junk Mail Controls" = "Run Junk Mail Controls"; /* Folder operations */ "Name :" = "Name :"; @@ -156,3 +211,6 @@ "Please select a message." = "Please select a message."; "Please select a message to print." = "Please select a message to print."; "Please select only one message to print." = "Please select only one message to print."; + +"You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!"; +"You need to choose a root subfolder!" = "You need to choose a root subfolder!"; diff --git a/UI/MailerUI/French.lproj/Localizable.strings b/UI/MailerUI/French.lproj/Localizable.strings index 3fed423bc..3fcae69b3 100644 --- a/UI/MailerUI/French.lproj/Localizable.strings +++ b/UI/MailerUI/French.lproj/Localizable.strings @@ -157,8 +157,14 @@ "New Subfolder..." = "Nouveau sous-dossier..."; "Rename Folder..." = "Renommer le dossier..."; "Delete Folder" = "Supprimer le dossier..."; +"Use This Folder For" = "Utiliser ce dossier pour"; "Get Messages for Account" = "Relever les messages de ce compte"; +/* Use This Folder menu */ +"Sent Messages" = "les message envoyés"; +"Drafts" = "les brouillons"; +"Deleted Messages" = "les message effacés"; + /* Message list popup menu */ "Open Message In New Window" = "Ouvrir dans une nouvelle fenétre"; "Reply to Sender Only" = "Répondre à l'expéditeur"; @@ -206,3 +212,6 @@ "Please select a message." = "Veuillez sélectionner un message."; "Please select a message to print." = "Veuillez sélectionner un message à imprimer."; "Please select only one message to print." = "Veuillez ne sélectionner qu'un seul message à imprimer."; + +"You need to choose a non-virtual folder!" = "Vous devez choisir un dossier non-virtuel."; +"You need to choose a root subfolder!" = "Vous devez choisir un sous-dossier de la racine."; diff --git a/UI/MailerUI/German.lproj/Localizable.strings b/UI/MailerUI/German.lproj/Localizable.strings index ad9ec372c..b464f3f81 100644 --- a/UI/MailerUI/German.lproj/Localizable.strings +++ b/UI/MailerUI/German.lproj/Localizable.strings @@ -140,8 +140,14 @@ "New Subfolder..." = "Neuer Unterordner..."; "Rename Folder..." = "Umbenennen..."; "Delete Folder" = "Löschen"; +"Use This Folder For" = "Use This Folder For"; "Get Messages for Account" = "Neue Nachrichten empfangen"; +/* Use This Folder menu */ +"Sent Messages" = "Sent Messages"; +"Drafts" = "Drafts"; +"Deleted Messages" = "Deleted Messages"; + /* Message list popup menu */ "Open Message In New Window" = "In neuem Fenster õffnen"; "Reply to Sender Only" = "Antworten nur an Absender"; @@ -189,3 +195,6 @@ "Please select a message." = "Sie müssen eine Nachricht auswählen."; "Please select a message to print." = "Sie müssen eine Nachricht zum Drucken auswählen."; "Please select only one message to print." = "Bitte wählen Sie nur eine Nachricht zum Drucken aus."; + +"You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!"; +"You need to choose a root subfolder!" = "You need to choose a root subfolder!"; diff --git a/UI/MailerUI/UIxMailFolderActions.m b/UI/MailerUI/UIxMailFolderActions.m index 84d7fa95e..ade6ed8d2 100644 --- a/UI/MailerUI/UIxMailFolderActions.m +++ b/UI/MailerUI/UIxMailFolderActions.m @@ -24,8 +24,10 @@ #import #import #import +#import #import +#import #import #import #import @@ -35,6 +37,7 @@ #import #import #import +#import #import @@ -172,6 +175,55 @@ return response; } +- (WOResponse *) _setFolderPurpose: (NSString *) purpose +{ + SOGoMailFolder *co; + WOResponse *response; + NSUserDefaults *ud; + NSMutableDictionary *mailSettings; + + co = [self clientObject]; + if ([NSStringFromClass ([co class]) isEqualToString: @"SOGoMailFolder"]) + { + ud = [[context activeUser] userSettings]; + mailSettings = [ud objectForKey: @"Mail"]; + if (!mailSettings) + { + mailSettings = [NSMutableDictionary new]; + [mailSettings autorelease]; + } + [ud setObject: mailSettings forKey: @"Mail"]; + [mailSettings setObject: [co relativeImap4Name] + forKey: [NSString stringWithFormat: @"%@Folder", + purpose]]; + [ud synchronize]; + response = [self responseWith204]; + } + else + { + response = [self responseWithStatus: 500]; + [response + appendContentString: @"Unable to change the purpose of this folder."]; + } + + return response; +} + +- (WOResponse *) setAsDraftsFolderAction +{ + return [self _setFolderPurpose: @"Drafts"]; +} + +- (WOResponse *) setAsSentFolderAction +{ + return [self _setFolderPurpose: @"Sent"]; +} + +- (WOResponse *) setAsTrashFolderAction +{ + return [self _setFolderPurpose: @"Trash"]; +} + - (WOResponse *) expungeAction { NSException *error; diff --git a/UI/MailerUI/product.plist b/UI/MailerUI/product.plist index 73ed08099..d04579f11 100644 --- a/UI/MailerUI/product.plist +++ b/UI/MailerUI/product.plist @@ -140,6 +140,21 @@ actionClass = "UIxMailFolderActions"; actionName = "deleteFolder"; }; + setAsDraftsFolder = { + protectedBy = "View"; + actionClass = "UIxMailFolderActions"; + actionName = "setAsDraftsFolder"; + }; + setAsSentFolder = { + protectedBy = "View"; + actionClass = "UIxMailFolderActions"; + actionName = "setAsSentFolder"; + }; + setAsTrashFolder = { + protectedBy = "View"; + actionClass = "UIxMailFolderActions"; + actionName = "setAsTrashFolder"; + }; userRights = { protectedBy = "ReadAcls"; pageName = "UIxMailUserRightsEditor"; diff --git a/UI/Templates/MailerUI/UIxMailMainFrame.wox b/UI/Templates/MailerUI/UIxMailMainFrame.wox index e389db9c0..29f8de8c0 100644 --- a/UI/Templates/MailerUI/UIxMailMainFrame.wox +++ b/UI/Templates/MailerUI/UIxMailMainFrame.wox @@ -66,11 +66,20 @@
  • +
  • + +