From b7f952248e47c126406044ab26829133d3184429 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 05 Mar 2010 05:18:01 -0500
Subject: [PATCH] - Add 'delete_always' option to user preferences

---
 CHANGELOG                             |    1 +
 program/steps/settings/func.inc       |   10 ++++++++++
 program/localization/en_US/labels.inc |    2 +-
 program/localization/pl_PL/labels.inc |    1 +
 config/main.inc.php.dist              |   14 ++++++--------
 program/steps/settings/save_prefs.inc |    1 +
 6 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index cb9ecdd..d1a73d6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Add 'delete_always' option to user preferences
 - Support/Require tls:// prefix in 'smtp_server' option for TLS connections
 - Fix inconsistent behaviour of 'delete_always' option (#1486299)
 - Fix deleting all messages from last list page (#1486293)
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 2bcd70f..61736c2 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -322,14 +322,6 @@
 // don't let users set pagesize to more than this value if set
 $rcmail_config['max_pagesize'] = 200;
 
-/**
- * 'Delete always'
- * This setting reflects if mail should be always deleted
- * when moving to Trash fails. This is necessary in some setups
- * when user is over quota and Trash is included in the quota.
- */
-$rcmail_config['delete_always'] = false;
-
 // Minimal value of user's 'keep_alive' setting (in seconds)
 // Must be less than 'session_lifetime'
 $rcmail_config['min_keep_alive'] = 60;
@@ -506,5 +498,11 @@
 // Please note that folder names should to be in sync with $rcmail_config['default_imap_folders']
 $rcmail_config['search_mods'] = null;  // Example: array('*' => array('subject'=>1, 'from'=>1), 'Sent' => array('subject'=>1, 'to'=>1));
 
+// 'Delete always'
+// This setting reflects if mail should be always deleted
+// when moving to Trash fails. This is necessary in some setups
+// when user is over quota and Trash is included in the quota.
+$rcmail_config['delete_always'] = false;
+
 // end of config file
 ?>
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 7aaee37..5e9c968 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -288,6 +288,7 @@
 $labels['readwhendeleted'] = 'Mark the message as read on delete';
 $labels['flagfordeletion'] = 'Flag the message for deletion instead of delete';
 $labels['skipdeleted'] = 'Do not show deleted messages';
+$labels['deletealways'] = 'When moving messages to Trash fails delete them';
 $labels['showremoteimages'] = 'Display remote inline images';
 $labels['fromknownsenders'] = 'from known senders';
 $labels['always'] = 'always';
@@ -313,7 +314,6 @@
 $labels['maintenance'] = 'Maintenance';
 $labels['newmessage'] = 'New Message';
 $labels['listoptions'] = 'List Options';
-
 $labels['signatureoptions'] = 'Signature Options';
 $labels['whenreplying'] = 'When replying';
 $labels['replytopposting'] = 'start new message above original';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index 72ba479..c00d73c 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -241,6 +241,7 @@
 $labels['readwhendeleted'] = 'Podczas usuwania oznacz wiadomość jako przeczytaną';
 $labels['flagfordeletion'] = 'Oznacz wiadomość do usunięcia zamiast ją usuwać';
 $labels['skipdeleted'] = 'Ukryj wiadomości oznaczone do usunięcia';
+$labels['deletealways'] = 'Usuń wiadomości, gdy przenoszenie do Kosza zawiedzie';
 $labels['autosavedraft'] = 'Automatycznie zapisuj tworzoną wiadomość';
 $labels['indexsort'] = 'Stosuj indeks wiadomości do sortowania wg daty';
 $labels['keepalive']  = 'Sprawdzaj czy nadeszły nowe wiadomości';
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 7d59e73..91e1e3f 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -589,6 +589,16 @@
       );
     }
 
+    if (!isset($no_override['delete_always'])) {
+      $field_id = 'rcmfd_delete_always';
+      $input_delete_always = new html_checkbox(array('name' => '_delete_always', 'id' => $field_id, 'value' => 1));
+
+      $blocks['main']['options']['delete_always'] = array(
+        'title' => html::label($field_id, Q(rcube_label('deletealways'))),
+        'content' => $input_delete_always->show($config['delete_always']?1:0),
+      );
+    }
+
     // Trash purging on logout
     if (!isset($no_override['logout_purge'])) {
       $field_id = 'rcmfd_logout_purge';
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 8a732bf..8f0a0e7 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -75,6 +75,7 @@
       'read_when_deleted' => isset($_POST['_read_when_deleted']) ? TRUE : FALSE,
       'skip_deleted'      => isset($_POST['_skip_deleted']) ? TRUE : FALSE,
       'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? TRUE : FALSE,
+      'delete_always' 	  => isset($_POST['_delete_always']) ? TRUE : FALSE,
       'logout_purge'      => isset($_POST['_logout_purge']) ? TRUE : FALSE,
       'logout_expunge'    => isset($_POST['_logout_expunge']) ? TRUE : FALSE,
     );

--
Gitblit v1.9.1