Author Topic: Toggle empty and full trash icon  (Read 3501 times)

Offline lacri

  • Full Member
  • ***
  • Posts: 179
    • http://www.php-lexikon.de
Toggle empty and full trash icon
« on: March 11, 2009, 07:06:31 AM »
to toggle Trash Icon to show if trash is empty or full
add this to /skins/default/mail.css

Code: [Select]
#mailboxlist li.trash.unread
{
  background-image: url(images/icons/folder-trash_f.png);
}

you must only upload the attached image to /skins/default/images/icons/

Offline lacri

  • Full Member
  • ***
  • Posts: 179
    • http://www.php-lexikon.de
Toggle empty and full trash icon
« Reply #1 on: March 11, 2009, 09:40:27 AM »
for full details and fix for read messages in trash see
#1485775 (Toggle Trash Icon Empty or Full Trash) ? RoundCube Webmail

Offline lacri

  • Full Member
  • ***
  • Posts: 179
    • http://www.php-lexikon.de
Toggle empty and full trash icon
« Reply #2 on: March 12, 2009, 05:35:38 AM »
her is the final optimized and perfekt working version for toggle Trash Icon

display full trash Icon if any messages in the trash folder (read or unread messages)
and display if read or unread messages in the trash
icon will toogle when messages move into empty trash and toggle to empty trash icon
when you clear trash or move messages in another folder.
its fully implemented for using drag and drop.

add this to /skins/default/mail.css

#mailboxlist li.trash.unread,
#mailboxlist li.trash.full
 
{
   
background-imageurl(images/icons/folder-trash_f.png);
 }
modifie the /program/include/main.inc
search to

$maxlength 
intval($attrib['maxlength']);
$realnames = (bool)$attrib['realnames'];
$msgcounts $RCMAIL->imap->get_cache('messagecount');
and add after this

$trashcounts 
$RCMAIL->imap->messagecount($CONFIG['trash_mbox']);
search to

else if ($folder['id']==$CONFIG['drafts_mbox'])
       
$classes[] = 'drafts';
else if (
$folder['id']==$CONFIG['trash_mbox'])
       
$classes[] = 'trash';
and replace with

else if ($folder['id']==$CONFIG['drafts_mbox'])
       
$classes[] = 'drafts';
else if (
$folder['id']==$CONFIG['trash_mbox'] and $trashcounts == 0)
       
$classes[] = 'trash';
else if (
$folder['id']==$CONFIG['trash_mbox'] and $trashcounts >= 1) {
       
$classes[] = 'trash';
       
$classes[] = 'full';
}
modifie the /program/js/app.js
search to

var regtext_objitemmycountchildcountdiv;

     if (
item this.get_folder_li(mbox))
       {
       
mycount this.env.unread_counts[mbox] ? this.env.unread_counts[mbox] : 0;
and replace with

var regtext_objitemmycountchildcountdivtrashcounts;

     if (
item this.get_folder_li(mbox))
       {
       
mycount this.env.unread_counts[mbox] ? this.env.unread_counts[mbox] : 0;
       
trashcounts this.env.trashcount this.env.trashcount 0;
      
search to

this
.set_unread_count_display(mboxset_title);
}
and add after this

// update the trashcount
  
this.set_trashcount = function(mboxcountset_title)
    {
     if (!
this.gui_objects.mailboxlist)
       return 
false;
  
   
this.env.trashcount count;
    
this.set_unread_count_display(mboxset_title);
    }
search to

this
.set_classname(item'unread', (mycount+childcount)>true false);
and add after this

this
.set_classname(item'full', (trashcounts)>true false);
modifie the /program/steps/mail/func.inc

search to

$OUTPUT
->add_gui_object('messagelist'$attrib['id']);
$OUTPUT->set_env('messagecount'$message_count);
and add after this

$trashcounts 
$IMAP->messagecount($CONFIG['trash_mbox']);
$OUTPUT->set_env('trashcount'$trashcounts);
modifie the /program/steps/mail/check_recent.inc

search to

$OUTPUT
->set_env('messagecount'$all_count);
$OUTPUT->set_env('pagesize'$IMAP->page_size);
and add before

$trashcounts 
$IMAP->messagecount($CONFIG['trash_mbox']);
 
$OUTPUT->set_env('trashcount'$trashcounts);
search to

else if ($unseen $IMAP->messagecount($mbox_name'UNSEEN'$check_all)) {
$OUTPUT->command('set_unread_count'$mbox_name$unseen);
and replace with

else if ($unseen $IMAP->messagecount($mbox_name'UNSEEN'$check_all) or $trashcounts $IMAP->messagecount($CONFIG['trash_mbox'])) {
       
$OUTPUT->command('set_unread_count'$mbox_name$unseen);
       
$OUTPUT->command('set_trashcount'$CONFIG['trash_mbox'], $trashcounts);

modifie the /program/steps/mail/folders.inc
search to
else
       
$commands "// purged: $success";
   }
and add after this

$trashcounts    
$IMAP->messagecount($CONFIG['trash_mbox']);
$OUTPUT->set_env('trashcount'$trashcounts);
$OUTPUT->command('set_trashcount'$CONFIG['trash_mbox'], $trashcounts);
modifie the /program/steps/mail/getunread.inc
search to
$OUTPUT->command('set_unread_count'$mbox_row$IMAP->messagecount($mbox_row'UNSEEN'), $inbox && $mbox_row == 'INBOX');and add after this

$trashcounts    
$IMAP->messagecount($CONFIG['trash_mbox']);
$OUTPUT->set_env('trashcount'$trashcounts);
$OUTPUT->command('set_trashcount'$CONFIG['trash_mbox'], $trashcounts);

modifie the /program/steps/mail/move_del.inc

search to

$pages          
ceil($msg_count $IMAP->page_size);
 
$nextpage_count $old_count $IMAP->page_size $IMAP->list_page;
 
$remaining      $msg_count $IMAP->page_size * ($IMAP->list_page 1);
and add after this

$trashcounts    
$IMAP->messagecount($CONFIG['trash_mbox']);
search to

$OUTPUT
->set_env('pagecount'$pages);
$OUTPUT->set_env('messagecount'$msg_count);
and add after this

$OUTPUT
->set_env('trashcount'$trashcounts);
search to

$OUTPUT
->command('set_unread_count'$target$IMAP->messagecount($target'UNSEEN'));
and add after this

$OUTPUT
->command('set_trashcount'$CONFIG['trash_mbox'], $trashcounts);
and the last search to

// update mailboxlist
 
$OUTPUT->command('set_unread_count'$mbox$IMAP->messagecount($mbox'UNSEEN'), ($mbox == 'INBOX'));
and finaly add after this

$OUTPUT
->command('set_trashcount'$CONFIG['trash_mbox'], $trashcounts);
« Last Edit: March 12, 2009, 08:35:28 AM by lacri »

Offline lacri

  • Full Member
  • ***
  • Posts: 179
    • http://www.php-lexikon.de
Toggle empty and full trash icon
« Reply #3 on: June 05, 2009, 09:14:53 AM »
Here is a new version based on SVN r2611

i have this modification over 3 Months in my installation and no issue works perfekt.

:)