summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--config/main.inc.php.dist3
-rw-r--r--program/js/app.js26
-rw-r--r--program/localization/en_GB/labels.inc1
-rw-r--r--program/localization/en_US/labels.inc1
-rw-r--r--program/localization/zh_TW/labels.inc1
-rw-r--r--program/steps/mail/func.inc2
-rw-r--r--program/steps/mail/show.inc9
-rw-r--r--program/steps/settings/func.inc10
-rw-r--r--program/steps/settings/save_prefs.inc1
10 files changed, 45 insertions, 10 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 6bdb8aa4a..5006fe08b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Add option to delete messages instead of moving to Trash when in Junk folder (#1486686)
- Fix invisible cursor when replying to a html message (#1487073)
- Reset IP stored in session when destroying session data (#1488056)
- Fix bug where memory_limit = -1 wasn't handled properly
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index b5019abdc..185df7579 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -785,6 +785,9 @@ $rcmail_config['addressbook_search_mods'] = null; // Example: array('name'=>1,
// when user is over quota and Trash is included in the quota.
$rcmail_config['delete_always'] = false;
+// Directly delete messages in Junk instead of moving to Trash
+$rcmail_config['delete_junk'] = false;
+
// Behavior if a received message requests a message delivery notification (read receipt)
// 0 = ask the user, 1 = send automatically, 2 = ignore (never send or ask)
// 3 = send automatically if sender is in addressbook, otherwise ask the user
diff --git a/program/js/app.js b/program/js/app.js
index 5fe97c9fd..120e5459f 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -220,8 +220,7 @@ function rcube_webmail()
$(this.gui_objects.qsearchbox).focusin(function() { rcmail.message_list.blur(); });
}
- if (!this.env.flag_for_deletion && this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox)
- this.set_alttext('delete', 'movemessagetotrash');
+ this.set_button_titles();
this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', 'forward',
'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', 'download',
@@ -573,13 +572,10 @@ function rcube_webmail()
this.reset_qsearch();
if (this.task == 'mail') {
this.list_mailbox(props);
-
- if (this.env.trash_mailbox && !this.env.flag_for_deletion)
- this.set_alttext('delete', this.env.mailbox != this.env.trash_mailbox ? 'movemessagetotrash' : 'deletemessage');
+ this.set_button_titles();
}
- else if (this.task == 'addressbook') {
+ else if (this.task == 'addressbook')
this.list_contacts(props);
- }
break;
case 'load-headers':
@@ -2570,6 +2566,9 @@ function rcube_webmail()
// @TODO: we should check if defined trash mailbox exists
else if (!trash || this.env.mailbox == trash)
this.permanently_remove_messages();
+ // we're in Junk folder and delete_junk is enabled
+ else if (this.env.delete_junk && this.env.junk_mailbox && this.env.mailbox == this.env.junk_mailbox)
+ this.permanently_remove_messages();
// if there is a trash mailbox defined and we're not currently in it
else {
// if shift was pressed delete it immediately
@@ -2869,6 +2868,19 @@ function rcube_webmail()
return this.select_all_mode ? '*' : uids.join(',');
};
+ // Sets title of the delete button
+ this.set_button_titles = function()
+ {
+ var label = 'deletemessage';
+
+ if (!this.env.flag_for_deletion
+ && this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox
+ && (!this.env.delete_junk || !this.env.junk_mailbox || this.env.mailbox != this.env.junk_mailbox)
+ )
+ label = 'movemessagetotrash';
+
+ this.set_alttext('delete', label);
+ };
/*********************************************************/
/********* mailbox folders methods *********/
diff --git a/program/localization/en_GB/labels.inc b/program/localization/en_GB/labels.inc
index fbd0a1ea7..ea6456045 100644
--- a/program/localization/en_GB/labels.inc
+++ b/program/localization/en_GB/labels.inc
@@ -341,6 +341,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'] = 'If moving messages to "Deleted Items" fails, permanently delete them';
+$labels['deletejunk'] = 'Directly delete messages in Junk';
$labels['showremoteimages'] = 'Display remote inline images';
$labels['fromknownsenders'] = 'from known senders';
$labels['always'] = 'always';
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 218207440..4c7120889 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -402,6 +402,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'] = 'If moving messages to Trash fails, delete them';
+$labels['deletejunk'] = 'Directly delete messages in Junk';
$labels['showremoteimages'] = 'Display remote inline images';
$labels['fromknownsenders'] = 'from known senders';
$labels['always'] = 'always';
diff --git a/program/localization/zh_TW/labels.inc b/program/localization/zh_TW/labels.inc
index 43c5dfb69..7e151de82 100644
--- a/program/localization/zh_TW/labels.inc
+++ b/program/localization/zh_TW/labels.inc
@@ -341,6 +341,7 @@ $labels['readwhendeleted'] = '將刪除的郵件標示為已讀取';
$labels['flagfordeletion'] = '刪除郵件時將原始郵件標示為已刪除';
$labels['skipdeleted'] = '不要顯示已刪除的郵件';
$labels['deletealways'] = '如果移到垃圾桶失敗,就直接刪除';
+$labels['deletejunk'] = '直接從垃圾郵件刪除';
$labels['showremoteimages'] = '顯示遠端郵件內文中的圖片';
$labels['fromknownsenders'] = '從已知的寄件者';
$labels['always'] = '總是接受';
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 7d1fbaab4..8dcd37b20 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -99,6 +99,8 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
$OUTPUT->set_env('threads', $threading || $RCMAIL->storage->get_capability('THREAD'));
$OUTPUT->set_env('preview_pane_mark_read', $RCMAIL->config->get('preview_pane_mark_read', 0));
+ if ($CONFIG['delete_junk'])
+ $OUTPUT->set_env('delete_junk', true);
if ($CONFIG['flag_for_deletion'])
$OUTPUT->set_env('flag_for_deletion', true);
if ($CONFIG['read_when_deleted'])
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index d3b70b4ab..c6c6d9636 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -52,16 +52,19 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
$OUTPUT->set_env('permaurl', rcmail_url('show', array('_uid' => $MESSAGE->uid, '_mbox' => $mbox_name)));
$OUTPUT->set_env('delimiter', $RCMAIL->storage->get_hierarchy_delimiter());
$OUTPUT->set_env('mailbox', $mbox_name);
- if ($CONFIG['drafts_mbox']) {
- $OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']);
- }
// mimetypes supported by the browser (default settings)
$mimetypes = $RCMAIL->config->get('client_mimetypes', 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/x-javascript,application/pdf,application/x-shockwave-flash');
$OUTPUT->set_env('mimetypes', is_string($mimetypes) ? explode(',', $mimetypes) : (array)$mimetypes);
+ if ($CONFIG['drafts_mbox'])
+ $OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']);
if ($CONFIG['trash_mbox'])
$OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']);
+ if ($CONFIG['junk_mbox'])
+ $OUTPUT->set_env('junk_mailbox', $CONFIG['junk_mbox']);
+ if ($CONFIG['delete_junk'])
+ $OUTPUT->set_env('delete_junk', true);
if ($CONFIG['flag_for_deletion'])
$OUTPUT->set_env('flag_for_deletion', true);
if ($CONFIG['read_when_deleted'])
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index fc836ed50..48d1d5a0b 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -816,6 +816,16 @@ function rcmail_user_prefs($current=null)
);
}
+ if (!isset($no_override['delete_junk'])) {
+ $field_id = 'rcmfd_delete_junk';
+ $input_delete_junk = new html_checkbox(array('name' => '_delete_junk', 'id' => $field_id, 'value' => 1));
+
+ $blocks['main']['options']['delete_junk'] = array(
+ 'title' => html::label($field_id, Q(rcube_label('deletejunk'))),
+ 'content' => $input_delete_junk->show($config['delete_junk']?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 4af4a3f8f..f521f4f34 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -110,6 +110,7 @@ switch ($CURR_SECTION)
'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,
+ 'delete_junk' => isset($_POST['_delete_junk']) ? TRUE : FALSE,
'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE,
'logout_expunge' => isset($_POST['_logout_expunge']) ? TRUE : FALSE,
);