Added the posibility to go into "statusbar mode"
authorAdrian Bak <adba@adba.local>
Fri, 8 Aug 2008 21:03:28 +0000 (23:03 +0200)
committerKristian Kræmmer Nielsen <jkkn@jkkn.dk>
Sun, 10 Aug 2008 00:37:24 +0000 (02:37 +0200)
content/browser_overlay.xul
content/options.js
content/options.xul
content/tv2developer.js
locale/da-DK/tv2developer.dtd
locale/en-US/tv2developer.dtd

index ce8e101a07c40c5094f77e873f9513ef4435dce1..19cc76ad3bf54cab1273978b130102f3471d768f 100644 (file)
@@ -21,7 +21,6 @@
                   oncommand="window.openDialog('chrome://tv2developer/content/about.xul','tv2about','modal,centerscreen,chrome,resizable=no')" />
     </popup>
 </popupset>
-
 <toolbarpalette id="BrowserToolbarPalette">
   <toolbarbutton id="tv2-swap-button" type="menu-button"
                  context="tv2developer-contextmenu"
                  onclick="checkForMiddleClick(this, event);"
                  onmouseover="TV2Developer.handleStatusText(event);"
                  onmouseout="TV2Developer.setStatusText('');">
-    <menupopup context=""
+  <menupopup context=""
                id="tv2developer-popupmenu"
                onpopupshowing="TV2Developer.fillMenu(event)"
                oncommand="TV2Developer.handleMenu(event); event.stopPropagation();"
                onmouseover="TV2Developer.handleStatusText(event);"
                onmouseout="TV2Developer.setStatusText('');"
                onclick="checkForMiddleClick(this, event);"/>
   </toolbarbutton>
 </toolbarpalette>
 
+<statusbar id="status-bar">
+    <statusbarpanel class="statusbarpanel-menu-iconic" id="tv2developer_statusbutton" src="chrome://tv2developer/skin/interaktiv.png"/>
+</statusbar>
+
 </overlay>
 
index c581a11255b5c917ccc72e56660a3c7c6e2d4a62..52e1333360d60b810cbe2718651072c85c37d526 100644 (file)
@@ -5,6 +5,10 @@ var TV2Options = {
     _prefBranch: null,
     _hackEnabled: false,
     init: function() {
+        
+        // the status bar thingy.
+        document.getElementById('statusbarmode').checked = TV2Util.getPref('useStatusBarMode', false);
+
         var hacks = document.getElementById('mac-hacks');
         var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
         this._keyBranch = prefs.getBranch('ui.key.');
@@ -23,6 +27,7 @@ var TV2Options = {
         this.php4sitesFillIn(TV2Util.getPref('php4sites', ''));
         document.getElementById('php4auto').selectedIndex =
             (TV2Util.hasPref('php4sites') ? 1 : 0);
+        
     },
     
     /* fill in list */
@@ -117,10 +122,17 @@ var TV2Options = {
                 TV2Util.clearPref('php4sites');
             }
         }
+        
+        // Save the statusbar thing
+        var statusbar = document.getElementById('statusbarmode').checked;
+        TV2Util.setPref('useStatusBarMode', statusbar);
+
     },
     
     update: function() {
-       var instantApply = this._prefBranch.getBoolPref("instantApply", false);
+       if(this._prefBranch != null) { // sometimes it's null on my mac (adba)
+           var instantApply = this._prefBranch.getBoolPref("instantApply", false);
+       }
        if (instantApply) this.save();
     }
     
index 60157bd57f3531b40cdaaa4404fd4046b3f5a8b4..951b1962f6157e4f55c84d05f5ca22e0f03c78d4 100644 (file)
           oncommand="TV2Options.update()"
           tooltiptext="&optionsDialog.mac.accesskeys.tooltiptext;"/>
     </groupbox>
+    <groupbox id="misc">
+        <checkbox id="statusbarmode" label="&optionsDialog.misc.statusbarmode;"
+          oncommand="TV2Options.update()"
+          tooltiptext="&optionsDialog.misc.statusbarmode.tooltiptext;"/>
+    </groupbox>
   </prefpane>
 
 </prefwindow>
index 5962028322bbd83c88447eb8aa8c3e44197c310f..385b119769dff12fbb1bc89b48d6b7cc2f7ba0f1 100644 (file)
 var TV2Developer = {
     
     _lastAction: null,
-    
+    _statusBarIconEnabled: false,
+   
+    /* toggle between statusbar/toolbar mode */
+    enableStatusBarIcon: function( enabled ) {
+        this._statusBarIconEnabled = enabled;
+        var statusbutton = document.getElementById('tv2developer_statusbutton');
+        var swapbutton = document.getElementById('tv2-swap-button');
+        var popupmenu = document.getElementById('tv2developer-popupmenu');
+
+        statusbutton.hidden = !enabled;
+        swapbutton.hidden = enabled;
+
+        statusbutton.setAttribute('context', 'tv2developer-contextmenu'); // Add the rightclick menu.
+        if(enabled) {
+            statusbutton.appendChild(popupmenu);
+        } else {
+            swapbutton.appendChild(popupmenu);
+        }
+    },
+
     /* method for initialize, reading properties, adding icon at firstrun, added keyshortcuts */
     init: function() {
-        // init
+       // init
         this._lastAction = TV2Util.getPref('lastaction-linktype');
         // add shortcuts depending on platform
         var shortcuts = document.getElementById('mainKeyset');
@@ -87,6 +106,9 @@ var TV2Developer = {
              }
              catch(e) { }
         }
+        
+        // initializes the statusbar icon.
+        this.enableStatusBarIcon(TV2Util.getPref('useStatusBarMode', false));
     },
     
     /* utility function to create shortcut object */
@@ -551,7 +573,8 @@ var TV2Developer = {
 
     /* shortcut to open menu */
     handleKeyShortcut: function(event) {
-        document.getElementById('tv2-swap-button').open = true;
+        var popupmenu = document.getElementById('tv2developer-popupmenu');
+        popupmenu.showPopup();
     },
     
     /* utility function to go to a link */
index 06e513c46556d26843db832acd910e0b76853b9b..7eb570a95d18954cd5db7a0d17045207f6d11569 100644 (file)
 <!ENTITY optionsDialog.mac.accesskeys "Slå genvejstaster til i Firefox på Mac">
 <!ENTITY optionsDialog.mac.accesskeys.tooltiptext "Ændring af dette felt kræver genstart af Firefox">
 
+<!ENTITY optionsDialog.misc.statusbarmode "Slås statusbar til">
+<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "Ændring af dette felt kræver genstart af Firefox">
+
+
 <!ENTITY optionsDialog.php4sites.label "Gamle PHP 4 sites">
 <!ENTITY optionsDialog.php4sites.tooltiptext "Sites i denne liste vil blive betragtet som PHP 4 sites.">
 <!ENTITY optionsDialog.php4sites.defaults "Brug standard PHP 4 sites">
index b1d628e7b59236cbdf445f3e51cbcf7c1a29c056..4d3350ea21ed96961608e0c848b205836cd52a21 100644 (file)
@@ -10,6 +10,9 @@
 <!ENTITY optionsDialog.mac.accesskeys "Enable accesskeys in Firefox on Mac">
 <!ENTITY optionsDialog.mac.accesskeys.tooltiptext "Changing this requires restart of Firefox">
 
+<!ENTITY optionsDialog.misc.statusbarmode "Enable statusbar mode">
+<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "Changing this requires restart of Firefox">
+
 <!ENTITY optionsDialog.php4sites.label "PHP 4 legacy sites">
 <!ENTITY optionsDialog.php4sites.tooltiptext "Sites listed here will be seen as PHP 4 sites.">
 <!ENTITY optionsDialog.php4sites.defaults "Use default PHP 4 sites">