From 9dd0d6c427a44f089cedef256899fed367899733 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 11 Dec 2014 13:31:32 -0500 Subject: [PATCH] Draft autossave feature --- NEWS | 1 + SoObjects/Mailer/SOGoDraftObject.m | 2 +- SoObjects/SOGo/SOGoDefaults.plist | 2 ++ SoObjects/SOGo/SOGoDomainDefaults.h | 4 +-- SoObjects/SOGo/SOGoDomainDefaults.m | 2 -- SoObjects/SOGo/SOGoUserDefaults.h | 5 ++- SoObjects/SOGo/SOGoUserDefaults.m | 21 +++++++++-- UI/MailerUI/UIxMailMainFrame.m | 2 +- .../English.lproj/Localizable.strings | 3 ++ UI/PreferencesUI/UIxPreferences.m | 10 ++++++ UI/Templates/MailerUI/UIxMailEditor.wox | 2 +- UI/Templates/PreferencesUI/UIxPreferences.wox | 3 ++ UI/WebServerResources/UIxMailEditor.js | 35 +++++++++++++++++-- 13 files changed, 78 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index 06c0efc12..fe792274a 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ New features - Allow including or not freebusy info from subscribed calendars + - Now possible to set an autosave timer for draft messages 2.2.11a (2014-12-10) -------------------- diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 24b84e8bd..c70e56c09 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -629,7 +629,7 @@ static NSString *userAgent = nil; folder = [imap4 imap4FolderNameForURL: [container imap4URL]]; result = [client append: message toFolder: folder - withFlags: [NSArray arrayWithObjects: @"seen", @"draft", nil]]; + withFlags: [NSArray arrayWithObjects: @"draft", nil]]; if ([[result objectForKey: @"result"] boolValue]) { if (IMAP4ID > -1) diff --git a/SoObjects/SOGo/SOGoDefaults.plist b/SoObjects/SOGo/SOGoDefaults.plist index 17388f261..d0d230c43 100644 --- a/SoObjects/SOGo/SOGoDefaults.plist +++ b/SoObjects/SOGo/SOGoDefaults.plist @@ -68,6 +68,8 @@ SOGoDraftsFolderName = "Drafts"; SOGoTrashFolderName = "Trash"; + SOGoMailAutoSave = "5"; + SOGoCalendarDefaultCategoryColor = "#aaa"; SOGoCalendarShouldDisplayWeekend = YES; SOGoCalendarEventsDefaultClassification = "PUBLIC"; diff --git a/SoObjects/SOGo/SOGoDomainDefaults.h b/SoObjects/SOGo/SOGoDomainDefaults.h index 00a79cfe9..4743917af 100644 --- a/SoObjects/SOGo/SOGoDomainDefaults.h +++ b/SoObjects/SOGo/SOGoDomainDefaults.h @@ -1,8 +1,6 @@ /* SOGoDomainDefaults.h - this file is part of SOGo * - * Copyright (C) 2009-2013 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2009-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/SOGo/SOGoDomainDefaults.m b/SoObjects/SOGo/SOGoDomainDefaults.m index 1a577c3f6..35a078b3f 100644 --- a/SoObjects/SOGo/SOGoDomainDefaults.m +++ b/SoObjects/SOGo/SOGoDomainDefaults.m @@ -2,8 +2,6 @@ * * Copyright (C) 2009-2014 Inverse inc. * - * Author: Wolfgang Sourdeau - * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) diff --git a/SoObjects/SOGo/SOGoUserDefaults.h b/SoObjects/SOGo/SOGoUserDefaults.h index 4cb893b8d..66dbcf5fb 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.h +++ b/SoObjects/SOGo/SOGoUserDefaults.h @@ -1,6 +1,6 @@ /* SOGoUserDefaults.h - this file is part of SOGo * - * Copyright (C) 2011-2013 Inverse inc. + * Copyright (C) 2011-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -126,6 +126,9 @@ extern NSString *SOGoWeekStartFirstFullWeek; - (void) setMailDisplayRemoteInlineImages: (NSString *) newValue; - (NSString *) mailDisplayRemoteInlineImages; +- (void) setMailAutoSave: (NSString *) newValue; +- (NSString *) mailAutoSave; + - (void) setMailMessageForwarding: (NSString *) newValue; - (NSString *) mailMessageForwarding; diff --git a/SoObjects/SOGo/SOGoUserDefaults.m b/SoObjects/SOGo/SOGoUserDefaults.m index 031a3283a..5d975f146 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.m +++ b/SoObjects/SOGo/SOGoUserDefaults.m @@ -1,6 +1,6 @@ /* SOGoUserDefaults.m - this file is part of SOGo * - * Copyright (C) 2009-2013 Inverse inc. + * Copyright (C) 2009-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -508,7 +508,7 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return [self stringForKey: @"SOGoMailComposeMessageType"]; } -- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue; +- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue { [self setObject: newValue forKey: @"SOGoMailDisplayRemoteInlineImages"]; } @@ -518,6 +518,23 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return [self stringForKey: @"SOGoMailDisplayRemoteInlineImages"]; } +- (void) setMailAutoSave: (NSString *) newValue +{ + [self setObject: newValue forKey: @"SOGoMailAutoSave"]; +} + +- (NSString *) mailAutoSave +{ + NSString *s; + + s = [self stringForKey: @"SOGoMailAutoSave"]; + + if ([s intValue] == 0) + s = @"5"; + + return s; +} + - (void) setMailMessageForwarding: (NSString *) newValue { [self setObject: newValue forKey: @"SOGoMailMessageForwarding"]; diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index d94f90aae..488449207 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2007-2013 Inverse inc. + Copyright (C) 2007-2014 Inverse inc. This file is part of SOGo. diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index ebc9ace4e..538bd3d9b 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -153,6 +153,9 @@ "displayremoteinlineimages_never" = "Never"; "displayremoteinlineimages_always" = "Always"; +"Auto save every" = "Auto save every"; +"minutes" = "minutes"; + /* Contact */ "Personal Address Book" = "Personal Address Book"; "Collected Address Book" = "Collected Address Book"; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 5017a4bec..a43a8e744 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -959,6 +959,16 @@ static NSArray *reminderValues = nil; [userDefaults setMailDisplayRemoteInlineImages: newType]; } +- (void) setAutoSave: (NSString *) theValue +{ + [userDefaults setMailAutoSave: theValue]; +} + +- (NSString *) autoSave +{ + return [userDefaults mailAutoSave]; +} + /* mail autoreply (vacation) */ - (BOOL) isSieveScriptsEnabled diff --git a/UI/Templates/MailerUI/UIxMailEditor.wox b/UI/Templates/MailerUI/UIxMailEditor.wox index ea18d9c4f..51a3e0afc 100644 --- a/UI/Templates/MailerUI/UIxMailEditor.wox +++ b/UI/Templates/MailerUI/UIxMailEditor.wox @@ -10,7 +10,7 @@ className="UIxPageFrame" title="panelTitle" const:popup="YES" - const:userDefaultsKeys="SOGoMailComposeMessageType,SOGoMailReplyPlacement,SOGoMailSignature" + const:userDefaultsKeys="SOGoMailComposeMessageType,SOGoMailReplyPlacement,SOGoMailSignature,SOGoMailAutoSave,SOGoDraftsFolderName" const:jsFiles="UIxMailToSelection.js,ckeditor/ckeditor.js,SOGoAutoCompletion.js,ContactsUI.js,jquery-ui.js,jquery.fileupload.js,jquery.iframe-transport.js" const:cssFiles="jquery.fileupload.css">