Skip to content

Commit

Permalink
Merge pull request #77 from dpc22/realnames
Browse files Browse the repository at this point in the history
Add show_real_foldernames preference and configuration option.
  • Loading branch information
alecpl committed Jun 11, 2013
2 parents 5455593 + 149f8a0 commit 174327c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions config/main.inc.php.dist
Expand Up @@ -481,6 +481,9 @@ $rcmail_config['trash_mbox'] = 'Trash';
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
$rcmail_config['default_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');

// Disable localization of the four default folder names listed above
$rcmail_config['show_real_foldernames'] = false;

// automatically create the above listed default folders on first login
$rcmail_config['create_default_folders'] = false;

Expand Down
9 changes: 7 additions & 2 deletions program/include/rcmail.php
Expand Up @@ -1326,6 +1326,9 @@ public function render_folder_tree_html(&$arrFolders, &$mbox_name, &$jslist, $at
$msgcounts = $this->storage->get_cache('messagecount');
$collapsed = $this->config->get('collapsed_folders');

if ($this->config->get('show_real_foldernames'))
$realnames = true;

$out = '';
foreach ($arrFolders as $folder) {
$title = null;
Expand Down Expand Up @@ -1491,15 +1494,17 @@ public function localize_foldername($name, $with_path = true)
if ($count > 1) {
for ($i = 0; $i < $count; $i++) {
$folder = implode($delimiter, array_slice($path, 0, -$i));
if ($folder_class = $this->folder_classname($folder)) {
if (!$this->config->get('show_real_foldernames') &&
($folder_class = $this->folder_classname($folder))) {
$name = implode($delimiter, array_slice($path, $count - $i));
return $this->gettext($folder_class) . $delimiter . rcube_charset::convert($name, 'UTF7-IMAP');
}
}
}
}

if ($folder_class = $this->folder_classname($name)) {
if (!$this->config->get('show_real_foldernames') &&
($folder_class = $this->folder_classname($name))) {
return $this->gettext($folder_class);
}
else {
Expand Down
1 change: 1 addition & 0 deletions program/localization/en_GB/labels.inc
Expand Up @@ -37,6 +37,7 @@ $labels['drafts'] = 'Drafts';
$labels['sent'] = 'Sent';
$labels['trash'] = 'Deleted Items';
$labels['junk'] = 'Junk';
$labels['show_real_foldernames'] = 'Show real names for special folders';

// message listing
$labels['subject'] = 'Subject';
Expand Down
13 changes: 13 additions & 0 deletions program/steps/settings/func.inc
Expand Up @@ -780,6 +780,19 @@ function rcmail_user_prefs($current=null)
'main' => array('name' => Q(rcube_label('mainoptions'))),
);


if (!isset($no_override['show_real_foldernames'])) {
$field_id = 'show_real_foldernames';
$input_show_real_foldernames =
new html_checkbox(array('name' => '_show_real_foldernames',
'id' => $field_id, 'value' => 1));

$blocks['main']['options']['show_real_foldernames'] = array(
'title' => html::label($field_id,
Q(rcube_label('show_real_foldernames'))),
'content' => $input_show_real_foldernames->show($config['show_real_foldernames']?1:0),
);
}
// Configure special folders
if (!isset($no_override['default_folders'])) {
// load folders list only when needed
Expand Down
2 changes: 2 additions & 0 deletions program/steps/settings/save_prefs.inc
Expand Up @@ -120,6 +120,8 @@ switch ($CURR_SECTION)

case 'folders':
$a_user_prefs = array(
'show_real_foldernames' =>
isset($_POST['_show_real_foldernames']) ? TRUE : FALSE,
'drafts_mbox' => get_input_value('_drafts_mbox', RCUBE_INPUT_POST, true),
'sent_mbox' => get_input_value('_sent_mbox', RCUBE_INPUT_POST, true),
'junk_mbox' => get_input_value('_junk_mbox', RCUBE_INPUT_POST, true),
Expand Down

0 comments on commit 174327c

Please sign in to comment.