Bug 1943783 - Re-arrange toolbar menus in cZ. r=frg f=njsg DONTBUILD
authorIan Neal <iann_cvs@blueyonder.co.uk>
Sat, 22 Feb 2025 14:39:29 +0000 (4 months ago)
changeset 44463 3f83c413453bfd3c33ee98c2389664bf9f2fb91b
parent 44462 10ce8169c211529119fdcc5b9b155d41325327ea
child 44464 f327bbc04743cce4221fd0e016444505b165838c
push id23518
push userfrgrahl@gmx.net
push dateMon, 14 Apr 2025 14:25:26 +0000 (2 months ago)
treeherdercomm-central@72b8c741a964 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg
bugs1943783
Bug 1943783 - Re-arrange toolbar menus in cZ. r=frg f=njsg DONTBUILD
suite/chatzilla/locales/en-US/chrome/chatzilla.dtd
suite/chatzilla/locales/en-US/chrome/chatzilla.properties
suite/chatzilla/xul/content/chatzilla.xul
suite/chatzilla/xul/content/commands.js
suite/chatzilla/xul/content/menus.js
--- a/suite/chatzilla/locales/en-US/chrome/chatzilla.dtd
+++ b/suite/chatzilla/locales/en-US/chrome/chatzilla.dtd
@@ -1,12 +1,17 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
+<!ENTITY installPlugin.label "Install Plugin…">
+<!ENTITY installPlugin.accesskey "I">
+<!ENTITY editNetworks.label "Edit Networks…">
+<!ENTITY editNetworks.accesskey "E">
+
 <!ENTITY reloadUI.commandkey "r">
 
 <!ENTITY Menubar.tooltip    "Main Menu">
 <!ENTITY Toolbar.tooltip    "Main Toolbar">
 
 
 <!ENTITY multiline-expand.tooltip   "Switch to multi-line input (Ctrl+Up)">
 <!ENTITY multiline-contract.tooltip "Switch to single-line input (Ctrl+Down)">
--- a/suite/chatzilla/locales/en-US/chrome/chatzilla.properties
+++ b/suite/chatzilla/locales/en-US/chrome/chatzilla.properties
@@ -188,17 +188,16 @@ cmd.disconnect.help   = Disconnects from
 cmd.disconnect-all.label  = &Disconnect From All Networks
 cmd.disconnect-all.helpUsage = [<reason>]
 cmd.disconnect-all.key    = accel D
 cmd.disconnect-all.help   = Disconnects from all networks providing the reason <reason> or the default reason if <reason> is not specified.
 
 cmd.echo.helpUsage = <message>
 cmd.echo.help   = Displays <message> in the current view, but does not send it to the server.
 
-cmd.edit-networks.label = &Networks…
 cmd.edit-networks.help  = Opens the network editor, where you can edit the list of available networks and servers.
 
 cmd.enable-plugin.helpUsage = <plugin>
 cmd.enable-plugin.help   = Meant to be used to re-enable a plugin after calling |disable-plugin|, this command calls the plugin's enablePlugin function.  There are no guarantees that the plugin will properly enable itself.
 
 cmd.eval.helpUsage = <expression>
 cmd.eval.help   = Evaluates <expression> as JavaScript code.  Not for the faint of heart.
 
@@ -319,17 +318,16 @@ cmd.userlist.help = Toggles the visibili
 cmd.identify.helpUsage = [<password>]
 cmd.identify.help   = Identify with nickname services on the current server. If <password> is not provided, you will be asked to enter the password in a prompt with a masked textfield (so nobody will be able to read it when you type it).
 
 cmd.ignore.helpUsage = [<mask>]
 cmd.ignore.help   = Add someone to your ignore list for the current network. A nickname will suffice for <mask>, but you can also use a hostmask. With no parameters, it shows a list of all currently ignored users.
 
 cmd.install-plugin.helpUsage = [<url> [<name>]]
 cmd.install-plugin.help   = Installs a ChatZilla plugin for you.
-cmd.install-plugin.label  = &Install Plugin…
 
 cmd.invite.helpUsage = <nickname> [<channel-name>]
 cmd.invite.help   = Invites <nickname> to <channel-name> or current channel if not supplied. Requires operator status if +i is set.
 
 cmd.j.helpUsage = [<channel-name> [<key>]]
 cmd.j.help   = This command is an alias for /join.
 
 cmd.join.label  = &Join Channel…
@@ -778,17 +776,16 @@ msg.rsp.info  = [INFO]
 msg.rsp.evin  = [EVAL-IN]
 msg.rsp.evout = [EVAL-OUT]
 msg.rsp.disconnect = [QUIT]
 
 # For these menu labels, too, an accesskey may be specified using a .accesskey
 # string, or by prefixing the desired letter with "&" in the label.
 # The accesskey string should have the form: msg.mnu.<menuname>.accesskey
 msg.mnu.chatzilla  = &ChatZilla
-msg.mnu.irc        = &IRC
 msg.mnu.edit       = &Edit
 msg.mnu.view       = &View
 msg.mnu.views      = &Views
 msg.mnu.motifs     = Co&lor Scheme
 msg.mnu.opcommands = &Operator Commands
 msg.mnu.usercommands = &User Commands
 msg.mnu.fonts      = &Font Family and Size
 
--- a/suite/chatzilla/xul/content/chatzilla.xul
+++ b/suite/chatzilla/xul/content/chatzilla.xul
@@ -223,27 +223,36 @@
   <toolbox id="main-toolbox" class="toolbox-top">
     <menubar id="mainmenu"
              persist="collapsed"
              grippytooltiptext="&Menubar.tooltip;">
 
       <!-- ChatZilla menu placeholder, see menus.js -->
       <menu id="mainmenu:chatzilla"><menupopup/></menu>
 
-      <!-- IRC menu placeholder, see menus.js -->
-      <menu id="mainmenu:irc"><menupopup/></menu>
-
       <!-- Edit menu placeholder, see menus.js -->
       <menu id="mainmenu:edit"><menupopup/></menu>
 
       <!-- View menu placeholder, see menus.js -->
       <menu id="mainmenu:view"><menupopup/></menu>
 
       <!-- Tasks menu -->
-      <menu id="tasksMenu"/>
+      <menu id="tasksMenu">
+        <menupopup id="taskPopup">
+          <menuitem id="editNetworks"
+                    label="&editNetworks.label;"
+                    accesskey="&editNetworks.accesskey;"
+                    oncommand="cmdEditNetworks();"/>
+          <menuitem id="installPlugin"
+                    label="&installPlugin.label;"
+                    accesskey="&installPlugin.accesskey;"
+                    oncommand="cmdInstallPlugin();"/>
+          <menuseparator id="czTasksSeparator"/>
+        </menupopup>
+      </menu>
 
       <!-- Window menu -->
       <menu id="windowMenu"/>
 
       <!-- Help menu -->
       <!-- Mac expects a help menu with this ID, and there is nothing we can
              do about it. -->
       <menu id="menu_Help"/>
--- a/suite/chatzilla/xul/content/commands.js
+++ b/suite/chatzilla/xul/content/commands.js
@@ -4392,17 +4392,30 @@ function cmdInputTextDirection(e) {
       //invalid value -> set to default direction
       client.input.setAttribute("dir", "ltr");
   }
 
   return true;
 }
 
 function cmdInstallPlugin(e) {
-  var ipURL = "chrome://chatzilla/content/install-plugin/install-plugin.xul";
+  if (!e || !e.url) {
+    if ("installPluginDialog" in client) {
+      return client.installPluginDialog.focus();
+    }
+
+    window.openDialog(
+      "chrome://chatzilla/content/install-plugin/install-plugin.xul",
+      "",
+      "chrome,dialog",
+      client
+    );
+    return;
+  }
+
   var ctx = {};
   var pluginDownloader = {
     onStartRequest: function _onStartRequest(request, context) {
       var tempName = "plugin-install.temp";
       if (urlMatches) {
         tempName += urlMatches[2];
       }
 
@@ -4434,25 +4447,16 @@ function cmdInstallPlugin(e) {
       try {
         ctx.outFile.remove(false);
       } catch (ex) {
         display(getMsg(MSG_INSTALL_PLUGIN_ERR_REMOVE_TEMP, ex), MT_ERROR);
       }
     },
   };
 
-  if (!e.url) {
-    if ("installPluginDialog" in client) {
-      return client.installPluginDialog.focus();
-    }
-
-    window.openDialog(ipURL, "", "chrome,dialog", client);
-    return;
-  }
-
   var urlMatches = e.url.match(/([^\/]+?)((\..{0,3}){0,2})$/);
   if (!e.name) {
     if (urlMatches) {
       e.name = urlMatches[1];
     } else {
       display(MSG_INSTALL_PLUGIN_ERR_NO_NAME, MT_ERROR);
       return;
     }
--- a/suite/chatzilla/xul/content/menus.js
+++ b/suite/chatzilla/xul/content/menus.js
@@ -87,42 +87,19 @@ function initMenus() {
   var NetConnected = "(cx.network and cx.network.isConnected())";
   var NetDisconnected = "(cx.network and !cx.network.isConnected())";
 
   client.menuSpecs["mainmenu:chatzilla"] = {
     label: MSG_MNU_CHATZILLA,
     accesskey: getAccessKeyForMenu("MSG_MNU_CHATZILLA"),
     getContext: getDefaultContext,
     items: [
-      ["cmd-prefs"],
-      ["install-plugin"],
+      ["join"],
       ["goto-startup"],
       ["-"],
-      ["print"],
-      ["save"],
-      ["-", { visibleif: NotMac }],
-      ["exit", { visibleif: Win }],
-      ["quit", { visibleif: NotMac + " and " + NotWin }],
-    ],
-  };
-
-  client.menuSpecs["mainmenu:irc"] = {
-    label: MSG_MNU_IRC,
-    accesskey: getAccessKeyForMenu("MSG_MNU_IRC"),
-    getContext: getDefaultContext,
-    items: [
-      ["join"],
-      ["-"],
-      ["edit-networks"],
-      ["-"],
-      [">popup:views"],
-      [">popup:nickname"],
-      ["-"],
-      ["clear-view"],
-      ["hide-view", { enabledif: "client.viewsArray.length > 1" }],
       [
         "toggle-oas",
         {
           type: "checkbox",
           checkedif: "isStartupURL(cx.sourceObject.getURL())",
         },
       ],
       ["-"],
@@ -131,17 +108,23 @@ function initMenus() {
       ["dcc-close", { visibleif: DCCActive }],
       [
         "delete-view",
         { visibleif: "!" + ChannelActive + " and !" + DCCActive },
       ],
       ["disconnect", { visibleif: NetConnected }],
       ["reconnect", { visibleif: NetDisconnected }],
       ["-"],
-      ["toggle-text-dir"],
+      [">popup:nickname"],
+      ["-"],
+      ["save"],
+      ["print"],
+      ["-", { visibleif: NotMac }],
+      ["exit", { visibleif: Win }],
+      ["quit", { visibleif: NotMac + " and " + NotWin }],
     ],
   };
 
   client.menuSpecs["popup:views"] = {
     label: MSG_MNU_VIEWS,
     accesskey: getAccessKeyForMenu("MSG_MNU_VIEWS"),
     getContext: getViewsContext,
     items: [
@@ -171,16 +154,19 @@ function initMenus() {
       ["cmd-paste", { enabledif: "getCommandEnabled('cmd_paste')" }],
       ["cmd-delete", { enabledif: "getCommandEnabled('cmd_delete')" }],
       ["-"],
       ["cmd-selectall", { enabledif: "getCommandEnabled('cmd_selectAll')" }],
       ["-"],
       ["find"],
       ["find-again", { enabledif: "canFindAgainInPage()" }],
       ["-"],
+      ["toggle-text-dir"],
+      ["-"],
+      ["cmd-prefs"],
       ["cmd-mozilla-prefs"],
     ],
   };
 
   client.menuSpecs["popup:motifs"] = {
     label: MSG_MNU_MOTIFS,
     accesskey: getAccessKeyForMenu("MSG_MNU_MOTIFS"),
     items: [
@@ -189,30 +175,35 @@ function initMenus() {
     ],
   };
 
   client.menuSpecs["mainmenu:view"] = {
     label: MSG_MNU_VIEW,
     accesskey: getAccessKeyForMenu("MSG_MNU_VIEW"),
     getContext: getDefaultContext,
     items: [
+      [">popup:views"],
+      ["-"],
       ["tabstrip", { type: "checkbox", checkedif: "isVisible('view-tabs')" }],
       [
         "header",
         {
           type: "checkbox",
           checkedif: "cx.sourceObject.prefs['displayHeader']",
         },
       ],
       [
         "userlist",
         { type: "checkbox", checkedif: "isVisible('user-list-box')" },
       ],
       ["statusbar", { type: "checkbox", checkedif: "isVisible('status-bar')" }],
       ["-"],
+      ["clear-view"],
+      ["hide-view", { enabledif: "client.viewsArray.length > 1" }],
+      ["-"],
       [">popup:motifs"],
       [">popup:fonts"],
       ["-"],
       [
         "toggle-ccm",
         { type: "checkbox", checkedif: "client.prefs['collapseMsgs']" },
       ],
       [