Thank you for the suggestions :)
I re-create this patch.

How about this ?

On Tue, May 20, 2008 at 11:26 PM, Martin Stubenschrott
<[EMAIL PROTECTED]> wrote:
> M.Terada wrote:
>
>> put simply
>>
>> - I need to use tab.js
>
>
> Yes. If you think about how to code the things, they could probably be done 
> there with
> a few lines only. I guess one only needs to abstract the use of:
>
> getBrowser().mTabContainer  and add the "tabs" feature to muttator.js's 
> config.
>
>>   - go out of use :tabopen
>
> Well, you can still use :tabopen to open the current message, IF there are no 
> arguments.
> Then it just works like "I".
>
>> - completion of :tabopen move to completion.js
>
> Well, :tabopen will have completions for mails, not folders. But there should 
> at some
> point be a liberator.completion.mails(...) method to get all mails.
>
> If you want completion for folders in :goto/:copyto etc. prompts, make it a 
> private method
> in mail.js.
>
>>> 3c) function getPath(folder) without {} after it? looks strange at least
>> It is a feature of javascript 1.8
>> http://developer.mozilla.org/en/docs/New_in_JavaScript_1.8#Expression_closures
>> But surely it is looked strange. so I would like to add {}
>
> Ah thanks.
>
>
> I think, you got most of the points which need to be changed.
>
> --
> Martin
>

-- 
teramako
### Eclipse Workspace Patch 1.0
#P vimperator
Index: src/content/tabs.js
===================================================================
RCS file: /cvs/vimperator/src/content/tabs.js,v
retrieving revision 1.28
diff -u -r1.28 tabs.js
--- src/content/tabs.js	27 May 2008 15:15:37 -0000	1.28
+++ src/content/tabs.js	31 May 2008 13:31:54 -0000
@@ -31,6 +31,26 @@
     ////////////////////////////////////////////////////////////////////////////////
     ////////////////////// PRIVATE SECTION /////////////////////////////////////////
     /////////////////////////////////////////////////////////////////////////////{{{
+    var tabmail;
+    var getBrowser = (function(){
+        if (liberator.config.hostApplication == "Thunderbird")
+        {
+            return function()
+            {
+                if (!tabmail)
+                {
+                    tabmail = document.getElementById('tabmail');
+                    tabmail.__defineGetter__('mTabContainer',function(){ return this.tabContainer; });
+                    tabmail.__defineGetter__('mTabs',function(){ return this.tabContainer.childNodes; });
+                    tabmail.__defineGetter__('mCurrentTab',function(){ return this.tabContainer.selectedItem; });
+                    tabmail.__defineGetter__('mStrip',function(){ return this.tabStrip; });
+                }
+                return tabmail;
+            };
+        }
+        else
+            return window.getBrowser;
+    })();
     var alternates = [getBrowser().mCurrentTab, null];
 
     // used for the "gb" and "gB" mappings to remember the last :buffer[!] command
@@ -72,7 +92,8 @@
     }
 
     // hide tabs initially
-    getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0].collapsed = true;
+    if (liberator.config.name == "Vimperator")
+        getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0].collapsed = true;
 
     /////////////////////////////////////////////////////////////////////////////}}}
     ////////////////////// OPTIONS /////////////////////////////////////////////////
@@ -121,7 +142,7 @@
         {
             setter: function (value)
             {
-                var tabs = getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0];
+                var tabs = liberator.tabs.tabStrip;
                 if (!tabs)
                     return;
 
@@ -266,7 +287,7 @@
             liberator.execute(args);
             liberator.forceNewTab = false;
         },
-        { completer: function (filter) { return liberator.completion.command(filter); } });
+        { completer: function (filter) { return liberator.completion.exTabCompletion(filter); } });
 
     liberator.commands.add(["tabl[ast]"],
         "Switch to the last tab",
@@ -431,6 +452,14 @@
 
         get count() { return getBrowser().mTabs.length; },
 
+        get tabStrip()
+        {
+            if (liberator.config.hostApplication == "Firefox")
+                return getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0];
+            else if (liberator.config.hostApplication == "Thunderbird")
+                return getBrowser().mStrip;
+        },
+
         // @returns the index of the currently selected tab starting with 0
         index: function (tab)
         {
@@ -531,22 +560,37 @@
         // quitOnLastTab = 2: quit and save session
         remove: function (tab, count, focusLeftTab, quitOnLastTab)
         {
-            function removeOrBlankTab (tab)
+            var removeOrBlankTab = (function ()
             {
-                if (getBrowser().mTabs.length > 1)
-                    getBrowser().removeTab(tab);
-                else
+                if (liberator.config.hostApplication == "Firefox")
                 {
-                    if (liberator.buffer.URL != "about:blank" ||
-                        getWebNavigation().sessionHistory.count > 0)
+                    return function (tab)
                     {
-                        liberator.open("about:blank", liberator.NEW_BACKGROUND_TAB);
-                        getBrowser().removeTab(tab);
-                    }
-                    else
-                        liberator.beep();
+                        if (getBrowser().mTabs.length > 1)
+                            getBrowser().removeTab(tab);
+                        else
+                        {
+                            if (liberator.buffer.URL != "about:blank" ||
+                                getWebNavigation().sessionHistory.count > 0)
+                            {
+                                liberator.open("about:blank", liberator.NEW_BACKGROUND_TAB);
+                                getBrowser().removeTab(tab);
+                            }
+                            else
+                                liberator.beep();
+                        }
+                    };
+                } else if (liberator.config.hostApplication == "Thunderbird"){
+                    return function (tab)
+                    {
+                        if (getBrowser().mTabs.length > 1)
+                            getBrowser().removeTab(tab);
+                        else
+                            liberator.beep();
+                    };
                 }
-            }
+                return function() { return null; };
+            })();
 
             if (typeof count != "number" || count < 1)
                 count = 1;
Index: src/content/muttator.xul
===================================================================
RCS file: /cvs/vimperator/src/content/muttator.xul,v
retrieving revision 1.10
diff -u -r1.10 muttator.xul
--- src/content/muttator.xul	14 May 2008 12:21:06 -0000	1.10
+++ src/content/muttator.xul	31 May 2008 13:31:54 -0000
@@ -55,6 +55,7 @@
     <script type="application/x-javascript;version=1.8" src="options.js"/>
     <script type="application/x-javascript;version=1.8" src="ui.js"/>
     <script type="application/x-javascript;version=1.8" src="util.js"/>
+    <script type="application/x-javascript;version=1.8" src="tabs.js"/>
 
     <window id="messengerWindow">
 
Index: src/content/muttator.js
===================================================================
RCS file: /cvs/vimperator/src/content/muttator.js,v
retrieving revision 1.19
diff -u -r1.19 muttator.js
--- src/content/muttator.js	27 May 2008 16:13:49 -0000	1.19
+++ src/content/muttator.js	31 May 2008 13:31:54 -0000
@@ -32,7 +32,7 @@
     hostApplication: "Thunderbird", // TODO: can this be found out otherwise? gBrandBundle.getString("brandShortName");
 
     /*** optional options, there are checked for existance and a fallback provided  ***/
-    features: ["hints", "mail", "marks"],
+    features: ["hints", "mail", "marks", "tabs"],
     guioptions: { m: ["mail-toolbar-menubar2"], T: ["mail-bar2"], f: ["folderPaneBox", "folderpane_splitter"], F: ["folderPaneHeader"] },
 
     get browserModes() { return [liberator.modes.MESSAGE]; },
Index: src/content/mail.js
===================================================================
RCS file: /cvs/vimperator/src/content/mail.js,v
retrieving revision 1.37
diff -u -r1.37 mail.js
--- src/content/mail.js	29 May 2008 10:33:47 -0000	1.37
+++ src/content/mail.js	31 May 2008 13:31:54 -0000
@@ -277,6 +277,18 @@
         "Inspect (focus) message",
         function () { content.focus(); });
 
+    liberator.mappings.add(modes, ["I"],
+	    "Open the message in new tab",
+	    function ()
+	    {
+	    	if (gDBView && gDBView.selection.count < 1)
+	    	{
+	    		liberator.echoerr("Message is not selected");
+	    		return;
+	    	}
+	    	MsgOpenNewTabForMessage();
+	    });
+
     liberator.mappings.add(modes, ["<Space>"],
         "Scroll message or select next unread one",
         function () { return true; },
@@ -637,6 +649,8 @@
             var folder = liberator.mail.getFolders(args, true, true)[count];
             if (!folder)
                 liberator.echoerr("Folder \"" + args + "\" does not exist");
+            else if (liberator.forceNewTab)
+                MsgOpenNewTabForFolder(folder.URI);
             else
                 SelectFolder(folder.URI);
         },
_______________________________________________
Muttator mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/muttator

Reply via email to