mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Add "Automatically save draft" option
This commit is contained in:
parent
8da988fef2
commit
45fe0217f2
7 changed files with 40 additions and 6 deletions
|
|
@ -2,10 +2,14 @@
|
||||||
import _ from '_';
|
import _ from '_';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import {delegateRunOnDestroy} from 'Common/Utils';
|
import {delegateRunOnDestroy, boolToAjax} from 'Common/Utils';
|
||||||
|
import {Magics} from 'Common/Enums';
|
||||||
import {bIsHttps} from 'Common/Globals';
|
import {bIsHttps} from 'Common/Globals';
|
||||||
|
|
||||||
import PgpStore from 'Stores/User/Pgp';
|
import PgpStore from 'Stores/User/Pgp';
|
||||||
|
import SettingsStore from 'Stores/User/Settings';
|
||||||
|
|
||||||
|
import Remote from 'Remote/User/Ajax';
|
||||||
|
|
||||||
import {getApp} from 'Helper/Apps/User';
|
import {getApp} from 'Helper/Apps/User';
|
||||||
|
|
||||||
|
|
@ -20,6 +24,8 @@ class OpenPgpUserSettings
|
||||||
|
|
||||||
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
|
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
|
||||||
|
|
||||||
|
this.allowDraftAutosave = SettingsStore.allowDraftAutosave;
|
||||||
|
|
||||||
this.isHttps = bIsHttps;
|
this.isHttps = bIsHttps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,6 +72,16 @@ class OpenPgpUserSettings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBuild() {
|
||||||
|
_.delay(() => {
|
||||||
|
|
||||||
|
this.allowDraftAutosave.subscribe(
|
||||||
|
Remote.saveSettingsHelper('AllowDraftAutosave', boolToAjax)
|
||||||
|
);
|
||||||
|
|
||||||
|
}, Magics.Time50ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export {OpenPgpUserSettings, OpenPgpUserSettings as default};
|
export {OpenPgpUserSettings, OpenPgpUserSettings as default};
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ class SettingsUserStore
|
||||||
|
|
||||||
this.showImages = ko.observable(false);
|
this.showImages = ko.observable(false);
|
||||||
this.useCheckboxesInList = ko.observable(true);
|
this.useCheckboxesInList = ko.observable(true);
|
||||||
|
this.allowDraftAutosave = ko.observable(true);
|
||||||
this.useThreads = ko.observable(false);
|
this.useThreads = ko.observable(false);
|
||||||
this.replySameFolder = ko.observable(false);
|
this.replySameFolder = ko.observable(false);
|
||||||
|
|
||||||
|
|
@ -61,6 +62,7 @@ class SettingsUserStore
|
||||||
|
|
||||||
this.showImages(!!Settings.settingsGet('ShowImages'));
|
this.showImages(!!Settings.settingsGet('ShowImages'));
|
||||||
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
|
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
|
||||||
|
this.allowDraftAutosave(!!Settings.settingsGet('AllowDraftAutosave'));
|
||||||
this.useThreads(!!Settings.settingsGet('UseThreads'));
|
this.useThreads(!!Settings.settingsGet('UseThreads'));
|
||||||
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
|
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -314,8 +314,8 @@ class ComposePopupView extends AbstractViewNext
|
||||||
this.saveMessageResponse = _.bind(this.saveMessageResponse, this);
|
this.saveMessageResponse = _.bind(this.saveMessageResponse, this);
|
||||||
|
|
||||||
Events.sub('interval.2m', () => {
|
Events.sub('interval.2m', () => {
|
||||||
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
|
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && SettingsStore.allowDraftAutosave() &&
|
||||||
!this.saving() && !this.sending() && !this.savedError())
|
!this.isEmptyForm(false) && !this.saving() && !this.sending() && !this.savedError())
|
||||||
{
|
{
|
||||||
this.saveCommand();
|
this.saveCommand();
|
||||||
}
|
}
|
||||||
|
|
@ -519,7 +519,7 @@ class ComposePopupView extends AbstractViewNext
|
||||||
this.bSkipNextHide = true;
|
this.bSkipNextHide = true;
|
||||||
|
|
||||||
if (this.modalVisibility() && !this.saving() && !this.sending() &&
|
if (this.modalVisibility() && !this.saving() && !this.sending() &&
|
||||||
!FolderStore.draftFolderNotEnabled())
|
!FolderStore.draftFolderNotEnabled() && SettingsStore.allowDraftAutosave())
|
||||||
{
|
{
|
||||||
this.saveCommand();
|
this.saveCommand();
|
||||||
}
|
}
|
||||||
|
|
@ -563,8 +563,8 @@ class ComposePopupView extends AbstractViewNext
|
||||||
}
|
}
|
||||||
|
|
||||||
autosaveFunction() {
|
autosaveFunction() {
|
||||||
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
|
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && SettingsStore.allowDraftAutosave() &&
|
||||||
!this.saving() && !this.sending() && !this.savedError())
|
!this.isEmptyForm(false) && !this.saving() && !this.sending() && !this.savedError())
|
||||||
{
|
{
|
||||||
this.saveCommand();
|
this.saveCommand();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1834,6 +1834,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
$aResult['UseCheckboxesInList'] = (bool) $oConfig->Get('defaults', 'view_use_checkboxes', true);
|
$aResult['UseCheckboxesInList'] = (bool) $oConfig->Get('defaults', 'view_use_checkboxes', true);
|
||||||
$aResult['AutoLogout'] = (int) $oConfig->Get('defaults', 'autologout', 30);
|
$aResult['AutoLogout'] = (int) $oConfig->Get('defaults', 'autologout', 30);
|
||||||
$aResult['UseThreads'] = (bool) $oConfig->Get('defaults', 'mail_use_threads', false);
|
$aResult['UseThreads'] = (bool) $oConfig->Get('defaults', 'mail_use_threads', false);
|
||||||
|
$aResult['AllowDraftAutosave'] = (bool) $oConfig->Get('defaults', 'allow_draft_autosave', true);
|
||||||
$aResult['ReplySameFolder'] = (bool) $oConfig->Get('defaults', 'mail_reply_same_folder', false);
|
$aResult['ReplySameFolder'] = (bool) $oConfig->Get('defaults', 'mail_reply_same_folder', false);
|
||||||
$aResult['ContactsAutosave'] = (bool) $oConfig->Get('defaults', 'contacts_autosave', true);
|
$aResult['ContactsAutosave'] = (bool) $oConfig->Get('defaults', 'contacts_autosave', true);
|
||||||
$aResult['EnableTwoFactor'] = false;
|
$aResult['EnableTwoFactor'] = false;
|
||||||
|
|
@ -1876,6 +1877,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
$aResult['SoundNotification'] = (bool) $oSettings->GetConf('SoundNotification', $aResult['SoundNotification']);
|
$aResult['SoundNotification'] = (bool) $oSettings->GetConf('SoundNotification', $aResult['SoundNotification']);
|
||||||
$aResult['DesktopNotifications'] = (bool) $oSettings->GetConf('DesktopNotifications', $aResult['DesktopNotifications']);
|
$aResult['DesktopNotifications'] = (bool) $oSettings->GetConf('DesktopNotifications', $aResult['DesktopNotifications']);
|
||||||
$aResult['UseCheckboxesInList'] = (bool) $oSettings->GetConf('UseCheckboxesInList', $aResult['UseCheckboxesInList']);
|
$aResult['UseCheckboxesInList'] = (bool) $oSettings->GetConf('UseCheckboxesInList', $aResult['UseCheckboxesInList']);
|
||||||
|
$aResult['AllowDraftAutosave'] = (bool) $oSettings->GetConf('AllowDraftAutosave', $aResult['AllowDraftAutosave']);
|
||||||
$aResult['AutoLogout'] = (int) $oSettings->GetConf('AutoLogout', $aResult['AutoLogout']);
|
$aResult['AutoLogout'] = (int) $oSettings->GetConf('AutoLogout', $aResult['AutoLogout']);
|
||||||
$aResult['Layout'] = (int) $oSettings->GetConf('Layout', $aResult['Layout']);
|
$aResult['Layout'] = (int) $oSettings->GetConf('Layout', $aResult['Layout']);
|
||||||
|
|
||||||
|
|
@ -5016,6 +5018,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
$this->setSettingsFromParams($oSettings, 'DesktopNotifications', 'bool');
|
$this->setSettingsFromParams($oSettings, 'DesktopNotifications', 'bool');
|
||||||
$this->setSettingsFromParams($oSettings, 'SoundNotification', 'bool');
|
$this->setSettingsFromParams($oSettings, 'SoundNotification', 'bool');
|
||||||
$this->setSettingsFromParams($oSettings, 'UseCheckboxesInList', 'bool');
|
$this->setSettingsFromParams($oSettings, 'UseCheckboxesInList', 'bool');
|
||||||
|
$this->setSettingsFromParams($oSettings, 'AllowDraftAutosave', 'bool');
|
||||||
$this->setSettingsFromParams($oSettings, 'AutoLogout', 'int');
|
$this->setSettingsFromParams($oSettings, 'AutoLogout', 'int');
|
||||||
|
|
||||||
$this->setSettingsFromParams($oSettings, 'EnableTwoFactor', 'bool');
|
$this->setSettingsFromParams($oSettings, 'EnableTwoFactor', 'bool');
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,7 @@ Values:
|
||||||
'show_images' => array(false),
|
'show_images' => array(false),
|
||||||
'contacts_autosave' => array(true),
|
'contacts_autosave' => array(true),
|
||||||
'mail_use_threads' => array(false),
|
'mail_use_threads' => array(false),
|
||||||
|
'allow_draft_autosave' => array(true),
|
||||||
'mail_reply_same_folder' => array(false)
|
'mail_reply_same_folder' => array(false)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -581,6 +581,7 @@ en:
|
||||||
TITLE_PUBLIC: "Public"
|
TITLE_PUBLIC: "Public"
|
||||||
DELETING_ASK: "Are you sure?"
|
DELETING_ASK: "Are you sure?"
|
||||||
GENERATE_ONLY_HTTPS: "HTTPS only"
|
GENERATE_ONLY_HTTPS: "HTTPS only"
|
||||||
|
LABEL_ALLOW_DRAFT_AUTOSAVE: "Automatically save draft"
|
||||||
SHORTCUTS_HELP:
|
SHORTCUTS_HELP:
|
||||||
LEGEND_SHORTCUTS_HELP: "Keyboard shortcuts help"
|
LEGEND_SHORTCUTS_HELP: "Keyboard shortcuts help"
|
||||||
TAB_MAILBOX: "Mailbox"
|
TAB_MAILBOX: "Mailbox"
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,17 @@
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<div data-bind="component: {
|
||||||
|
name: 'Checkbox',
|
||||||
|
params: {
|
||||||
|
label: 'SETTINGS_OPEN_PGP/LABEL_ALLOW_DRAFT_AUTOSAVE',
|
||||||
|
value: allowDraftAutosave
|
||||||
|
}
|
||||||
|
}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<table class="table table-hover list-table" data-bind="i18nUpdate: openpgpkeys">
|
<table class="table table-hover list-table" data-bind="i18nUpdate: openpgpkeys">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue