this.modifyPoll(baseelt.up('LI').readAttribute('mbox'), id == 'ctx_folder_poll');
break;
+ case 'ctx_folder_sub':
+ case 'ctx_folder_unsub':
+ this.subscribeFolder(baseelt.up('LI').readAttribute('mbox'), id == 'ctx_folder_sub');
+ break;
+
case 'ctx_container_create':
this.createSubFolder(baseelt);
break;
if (baseelt.readAttribute('mbox') == 'INBOX') {
elts.invoke('hide');
- } else if (DIMP.conf.fixed_folders &&
- DIMP.conf.fixed_folders.indexOf(baseelt.readAttribute('mbox')) != -1) {
- elts.shift();
- elts.invoke('hide');
+ $('ctx_folder_sub', 'ctx_folder_unsub').invoke('hide');
} else {
- elts.invoke('show');
+ tmp = baseelt.hasClassName('unsubFolder');
+ [ $('ctx_folder_sub') ].invoke(tmp ? 'show' : 'hide');
+ [ $('ctx_folder_unsub') ].invoke(tmp ? 'hide' : 'show');
+
+ if (DIMP.conf.fixed_folders &&
+ DIMP.conf.fixed_folders.indexOf(baseelt.readAttribute('mbox')) != -1) {
+ elts.shift();
+ elts.invoke('hide');
+ } else {
+ elts.invoke('show');
+ }
}
tmp = baseelt.hasAttribute('u');
[ $('ctx_folder_poll') ].invoke(tmp ? 'hide' : 'show');
- [ $('ctx_folder_nopoll') ].invoke(tmp? 'show' : 'hide');
+ [ $('ctx_folder_nopoll') ].invoke(tmp ? 'show' : 'hide');
break;
case 'ctx_reply':
var p = DIMP.conf.preview_pref = !DIMP.conf.preview_pref;
$('previewtoggle').setText(p ? DIMP.text.hide_preview : DIMP.text.show_preview);
[ $('msgList') ].invoke(p ? 'removeClassName' : 'addClassName', 'msglistNoPreview');
- this._updatePrefs('show_preview', p ? 1 : 0);
+ this._updatePrefs('show_preview', Number(p));
this.viewport.showSplitPane(p);
if (p) {
this.initPreviewPane();
{
if (update) {
DIMP.conf.toggle_pref = !DIMP.conf.toggle_pref;
- this._updatePrefs('dimp_toggle_headers', elt.id == 'th_expand' ? 1 : 0);
+ this._updatePrefs('dimp_toggle_headers', Number(elt.id == 'th_expand'));
}
[ elt.up().select('A'), $('msgHeadersColl', 'msgHeaders') ].flatten().invoke('toggle');
},
DimpCore.doAction('ListFolders', { unsub: Number(this.showunsub) }, null, this._folderLoadCallback.bind(this));
},
+ subscribeFolder: function(f, sub)
+ {
+ var fid = this.getFolderId(f);
+ DimpCore.doAction('Subscribe', { view: f, sub: Number(sub) });
+
+ if (this.showunsub) {
+ [ $(fid) ].invoke(sub ? 'removeClassName' : 'addClassName', 'unsubFolder');
+ } else if (!sub) {
+ this.deleteFolderElt(fid);
+ }
+ },
+
/* Flag actions for message list. */
_getFlagSelection: function(opts)
{
modifyPoll: function(folder, add)
{
- DimpCore.doAction('ModifyPoll', { view: folder, add: (add) ? 1 : 0 }, null, this.bcache.get('modifyPFC') || this.bcache.set('modifyPFC', this._modifyPollCallback.bind(this)));
+ DimpCore.doAction('ModifyPoll', { view: folder, add: Number(add) }, null, this.bcache.get('modifyPFC') || this.bcache.set('modifyPFC', this._modifyPollCallback.bind(this)));
},
_modifyPollCallback: function(r)