diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/suite/chatzilla/xul/content/about | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/suite/chatzilla/xul/content/about')
-rw-r--r-- | comm/suite/chatzilla/xul/content/about/about.js | 112 | ||||
-rw-r--r-- | comm/suite/chatzilla/xul/content/about/about.xul | 57 |
2 files changed, 169 insertions, 0 deletions
diff --git a/comm/suite/chatzilla/xul/content/about/about.js b/comm/suite/chatzilla/xul/content/about/about.js new file mode 100644 index 0000000000..b68c64aa8f --- /dev/null +++ b/comm/suite/chatzilla/xul/content/about/about.js @@ -0,0 +1,112 @@ +/* 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/. */ + +var ownerClient = null; + +// To be able to load static.js, we need a few things defined first: +function CIRCNetwork() {} +function CIRCServer() {} +function CIRCChannel() {} +function CIRCUser() {} +function CIRCChanUser() {} +function CIRCDCCUser() {} +function CIRCDCCChat() {} +function CIRCDCCFile() {} +function CIRCDCCFileTransfer() {} +function CIRCSTS() {} + +// Our friend from messages.js: +function getMsg(msgName, params, deflt) +{ + return client.messageManager.getMsg(msgName, params, deflt); +} + +function onLoad() +{ + const propsPath = "chrome://chatzilla/locale/chatzilla.properties"; + + // Find our owner, if we have one. + ownerClient = window.arguments ? window.arguments[0].client : null; + if (ownerClient) + ownerClient.aboutDialog = window; + + client.entities = new Object(); + client.messageManager = new MessageManager(client.entities); + client.messageManager.loadBrands(); + client.defaultBundle = client.messageManager.addBundle(propsPath); + + var version = getVersionInfo(); + client.userAgent = getMsg(MSG_VERSION_REPLY, [version.cz, version.ua]); + + var verLabel = document.getElementById("version"); + var verString = verLabel.getAttribute("format").replace("%S", version.cz); + verLabel.setAttribute("value", verString); + verLabel.setAttribute("condition", __cz_condition); + + var localizers = document.getElementById("localizers"); + var localizerNames = getMsg("locale.authors", null, ""); + if (localizerNames && (localizerNames.substr(0, 11) != "XXX REPLACE")) + { + localizerNames = localizerNames.split(/\s*;\s*/); + + for (var i = 0; i < localizerNames.length; i++) { + var loc = document.createElement("label"); + loc.setAttribute("value", localizerNames[i]); + localizers.appendChild(loc); + } + } + else + { + var localizersHeader = document.getElementById("localizers-header"); + localizersHeader.style.display = "none"; + localizers.style.display = "none"; + } + + if (window.opener) + { + // Force the window to be the right size now, not later. + window.sizeToContent(); + + // Position it centered over, but never up or left of parent. + var opener = window.opener; + var sx = Math.max((opener.outerWidth - window.outerWidth ) / 2, 0); + var sy = Math.max((opener.outerHeight - window.outerHeight) / 2, 0); + window.moveTo(opener.screenX + sx, opener.screenY + sy); + } + + /* Find and focus the dialog's default button (OK), otherwise the focus + * lands on the first focusable content - the homepage link. Links in XUL + * look horrible when focused. + */ + var binding = document.documentElement; + var defaultButton = binding.getButton(binding.defaultButton); + if (defaultButton) + setTimeout(function() { defaultButton.focus() }, 0); +} + +function onUnload() +{ + if (ownerClient) + delete ownerClient.aboutDialog; +} + +function copyVersion() +{ + const cbID = Components.interfaces.nsIClipboard.kGlobalClipboard; + var cb = getService("@mozilla.org/widget/clipboard;1", "nsIClipboard"); + var tr = newObject("@mozilla.org/widget/transferable;1", "nsITransferable"); + var str = newObject("@mozilla.org/supports-string;1", "nsISupportsString"); + + str.data = client.userAgent; + tr.setTransferData("text/unicode", str, str.data.length * 2); + cb.setData(tr, null, cbID); +} + +function openHomepage() +{ + if (ownerClient) + ownerClient.dispatch("goto-url", {url: MSG_SOURCE_REPLY}); + else + window.opener.open(MSG_SOURCE_REPLY, "_blank"); +} diff --git a/comm/suite/chatzilla/xul/content/about/about.xul b/comm/suite/chatzilla/xul/content/about/about.xul new file mode 100644 index 0000000000..54dc7b1bd4 --- /dev/null +++ b/comm/suite/chatzilla/xul/content/about/about.xul @@ -0,0 +1,57 @@ +<?xml version="1.0"?> +<!-- 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/. --> + +<!DOCTYPE dialog SYSTEM "chrome://chatzilla/locale/about.dtd"> + +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> +<?xml-stylesheet href="chrome://chatzilla/skin/about.css" type="text/css"?> + +<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + windowtype="irc:chatzilla:about" + buttons="accept" + onload="onLoad()" + onunload="onUnload()" + title="&window.title;"> + + <script src="chrome://chatzilla/content/lib/js/utils.js"/> + <script src="chrome://chatzilla/content/about/about.js"/> + <script src="chrome://chatzilla/content/lib/js/message-manager.js"/> + <script src="chrome://chatzilla/content/static.js"/> + + <vbox class="box-padded" flex="1"> + <hbox> + <image id="logo"/> + <vbox flex="1"> + <hbox> + <label class="header large-text" id="name" value="&chatzilla.label;"/> + <spacer flex="1"/> + <label class="header" id="version" value="&version.unknown.label;" format="&version.known.label;"/> + </hbox> + <hbox> + <label class="text-link" onclick="openHomepage()" value="&homepage.label;"/> + <spacer flex="1"/> + <label class="text-link" onclick="copyVersion()" value="©version.label;"/> + </hbox> + </vbox> + </hbox> + <description id="description">&description.label;</description> + <label class="contributors-label header" value="§ion.core.label;"/> + <vbox class="contributors"> + <label>Robert Ginda</label> + <label>Gijs Kruitbosch</label> + <label>James Ross</label> + <label>Samuel Sieb</label> + </vbox> + <label class="contributors-label header" id="localizers-header" value="§ion.locale.label;"/> + <vbox class="contributors" id="localizers"> + <!-- These are inserted from onLoad(), as read from locale file. --> + </vbox> + <label class="contributors-label header" value="§ion.contrib.label;"/> + <vbox class="contributors"> + <label>Lim Chee Aun (graphics)</label> + </vbox> + </vbox> + <separator id="groove" class="groove"/> +</dialog> |