Hi martin.
Thunderbird3.0a2pre can open message or folder in new tab.
So I create this patch opens in new tab and move to next/previous tab
Command:
:tabo[pen]
open the selected message in new tab
:tabo[pen]!
open the selected folder in new tab
:tabo[pen] Server/folder/slash/separeted/path
open the specified folder in new tab
Mapping:
gt
Go to the next tab
gT
Go to the previous tab
Any suggestions ?
Best regards :)
----
teramako
### Eclipse Workspace Patch 1.0
#P vimperator
Index: src/content/mail.js
===================================================================
RCS file: /cvs/vimperator/src/content/mail.js,v
retrieving revision 1.32
diff -u -r1.32 mail.js
--- src/content/mail.js 17 May 2008 16:04:24 -0000 1.32
+++ src/content/mail.js 19 May 2008 14:44:18 -0000
@@ -509,6 +509,24 @@
folder.markAllMessagesRead();
});
});
+
+ liberator.mappings.add(modes,["gt"],
+ "Go to the next tab",
+ function(count)
+ {
+ liberator.mail.tabs.select(count > 0 ? count -1 : "+1", count > 0 ? false : true);
+ },{
+ flags: liberator.Mappings.flags.COUNT
+ });
+
+ liberator.mappings.add(modes,["gT"],
+ "Go to the previous tab",
+ function(count)
+ {
+ liberator.mail.tabs.select("-" + (count < 0 ? 1 : count), true);
+ },{
+ flags: liberator.Mappings.flags.COUNT
+ });
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMMANDS ////////////////////////////////////////////////
@@ -562,6 +580,52 @@
liberator.mail.getNewMessages(!special);
});
+ liberator.commands.add(["tab[open]"],
+ "Open the current message or the specified folder in new tab",
+ function(arg, special)
+ {
+ if (!gDBView) return;
+ if (!arg)
+ {
+ try
+ {
+ special ? MsgOpenNewTabForFolder() : MsgOpenNewTabForMessage();
+ }
+ catch(e)
+ {
+ MsgOpenNewTabForFolder();
+ }
+
+ return;
+ }
+ var list = liberator.mail.getAllFolderPathes();
+ for (var i=0; i<list.length; i++)
+ {
+ if (list[i].indexOf(arg) != -1){
+ MsgOpenNewTabForFolder(list[i][1]);
+ return
+ }
+ }
+ liberator.echoerr("Folder \"" + arg + "\" does not exist");
+ },{
+ completer: function(filter)
+ {
+ var list = liberator.mail.getAllFolderPathes();
+ if (!filter) return [0, list];
+
+ var candidates = [];
+ var reg = new RegExp("(^"+filter+")|(^"+liberator.mail.currentAccount.prettiestName+"/"+filter+")","i");
+ list.forEach(function(folder)
+ {
+ if (reg.test(folder[0]))
+ candidates.push([folder[0], folder[1]]);
+ else if (reg.test(folder[1]))
+ candidates.push([folder[1], folder[0]]);
+ });
+ return [0, candidates];
+ }
+ });
+
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
@@ -600,6 +664,12 @@
return folders;
},
+ getAllFolderPathes: function()
+ {
+ function getPath(folder) folder.parent ? getPath(folder.parent) + "/" + folder.prettiestName : folder.prettiestName;
+ return this.getFolders("",true,true).map(function(f) f.isServer ? [f.prettiestName, f.URI] : [getPath(f), f.URI]);
+ },
+
getNewMessages: function(currentAccountOnly)
{
var accounts = currentAccountOnly ? [this.currentAccount]
@@ -780,6 +850,60 @@
liberator.beep();
},
+ tabs: (function()
+ {
+ var tabMail;
+ function indexFromSpec(spec, wrap)
+ {
+ var position = getTabmail().tabContainer.selectedIndex;
+ var length = getTabmail().tabContainer.itemCount;
+ var last = length - 1;
+
+ if (spec === undefined || spec === "")
+ return position;
+
+ if (typeof spec === "number")
+ position = spec;
+ else if (spec === "$")
+ position = last;
+ else if (/^[+-]\d+$/.test(spec))
+ position += parseInt(spec, 10);
+ else if (/^\d+$/.test(spec))
+ position = parseInt(spec, 10);
+ else
+ return -1;
+
+ if (position > last)
+ position = wrap ? position % length : last;
+ else if (position < 0)
+ position = wrap ? (position % length) + length : 0;
+
+ return position;
+ }
+ function getTabmail()
+ {
+ if (tabMail)
+ return tabMail
+ else
+ tabMail = document.getElementById('tabmail');
+
+ return tabMail;
+ }
+ var tabManager = {
+ select: function(spec, wrap)
+ {
+ var index = indexFromSpec(spec, wrap);
+ if (index === -1)
+ {
+ liberator.beep();
+ return;
+ }
+ getTabmail().tabContainer.selectedIndex = index;
+ },
+ };
+ return tabManager;
+ })(),
+
};
//}}}
_______________________________________________
Muttator mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/muttator