Draft autossave feature

This commit is contained in:
Ludovic Marcotte
2014-12-11 13:31:32 -05:00
parent 990f782b62
commit 9dd0d6c427
13 changed files with 78 additions and 14 deletions
+1
View File
@@ -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)
--------------------
+1 -1
View File
@@ -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)
+2
View File
@@ -68,6 +68,8 @@
SOGoDraftsFolderName = "Drafts";
SOGoTrashFolderName = "Trash";
SOGoMailAutoSave = "5";
SOGoCalendarDefaultCategoryColor = "#aaa";
SOGoCalendarShouldDisplayWeekend = YES;
SOGoCalendarEventsDefaultClassification = "PUBLIC";
+1 -3
View File
@@ -1,8 +1,6 @@
/* SOGoDomainDefaults.h - this file is part of SOGo
*
* Copyright (C) 2009-2013 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* 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
-2
View File
@@ -2,8 +2,6 @@
*
* Copyright (C) 2009-2014 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* 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)
+4 -1
View File
@@ -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;
+19 -2
View File
@@ -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"];
+1 -1
View File
@@ -1,5 +1,5 @@
/*
Copyright (C) 2007-2013 Inverse inc.
Copyright (C) 2007-2014 Inverse inc.
This file is part of SOGo.
@@ -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";
+10
View File
@@ -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
+1 -1
View File
@@ -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">
<script type="text/javascript">
@@ -389,6 +389,9 @@
const:name="displayRemoteInlineImages"
string="itemDisplayRemoteInlineImagesText"
selection="userDisplayRemoteInlineImages"/></dd>
<dt><var:string label:value="Auto save every"/></dt>
<dd><input const:name="autoSave" const:id="autoSave"
type="text" autocomplete="off" var:value="autoSave"/><var:string label:value="minutes"/></dd>
</dl>
<div class="tabsContainer" id="mailOptionsTabs">
+32 -3
View File
@@ -11,6 +11,15 @@ var MailEditor = {
textFirstFocus: true
};
var autoSaveTimer;
function refreshDraftsFolder() {
if (window.opener && window.opener.open && !window.opener.closed) {
var nodes = window.opener.$("mailboxTree").select("DIV[datatype=draft]");
window.opener.getUnseenCountForFolder(nodes[0].readAttribute("dataname"));
}
}
function onContactAdd(button) {
var div = $("contacts");
if (div.visible()) {
@@ -167,6 +176,8 @@ function onPostComplete(http) {
if (p && p.refreshMessage)
p.refreshMessage(jsonResponse["sourceFolder"],
jsonResponse["sourceMessageID"]);
refreshDraftsFolder();
onCloseButtonClick();
}
else {
@@ -239,8 +250,7 @@ function clickedEditorSave() {
triggerAjaxRequest(document.pageform.action, function (http) {
if (http.readyState == 4) {
if (http.status == 200) {
if (window.opener && window.opener.open && !window.opener.closed)
window.opener.refreshFolderByType('draft');
refreshDraftsFolder();
}
else {
var response = http.responseText.evalJSON(true);
@@ -373,6 +383,24 @@ function initAddresses() {
});
}
function initAutoSaveTimer() {
var autoSave = UserDefaults["SOGoMailAutoSave"];
if (autoSave) {
var interval;
interval = parseInt(autoSave) * 60;
autoSaveTimer = window.setInterval(onAutoSaveCallback,
interval * 1000);
}
}
function onAutoSaveCallback(event) {
clickedEditorSave();
}
/* Overwrite function of MailerUI.js */
function configureDragHandle() {
var handle = $("hiddenDragHandle");
@@ -477,7 +505,8 @@ function initMailEditor() {
configureAttachments();
initAddresses();
initAutoSaveTimer();
var focusField = textarea;
if (!mailIsReply) {
focusField = $("addr_0");