summaryrefslogtreecommitdiffstats
path: root/mailnews/news/content
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
committerMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
commit302bf1b523012e11b60425d6eee1221ebc2724eb (patch)
treeb191a895f8716efcbe42f454f37597a545a6f421 /mailnews/news/content
parent21b3f6247403c06f85e1f45d219f87549862198f (diff)
downloadUXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.gz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.lz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.xz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.zip
Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1
Diffstat (limited to 'mailnews/news/content')
-rw-r--r--mailnews/news/content/downloadheaders.js85
-rw-r--r--mailnews/news/content/downloadheaders.xul49
2 files changed, 134 insertions, 0 deletions
diff --git a/mailnews/news/content/downloadheaders.js b/mailnews/news/content/downloadheaders.js
new file mode 100644
index 000000000..bd856ae0d
--- /dev/null
+++ b/mailnews/news/content/downloadheaders.js
@@ -0,0 +1,85 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/. */
+
+Components.utils.import("resource:///modules/mailServices.js");
+
+var markreadElement = null;
+var numberElement = null;
+
+var nntpServer = null;
+var args = null;
+
+function OnLoad()
+{
+ let newsBundle = document.getElementById("bundle_news");
+
+ if ("arguments" in window && window.arguments[0]) {
+ args = window.arguments[0]
+ .QueryInterface(Components.interfaces.nsINewsDownloadDialogArgs);
+ /* by default, act like the user hit cancel */
+ args.hitOK = false;
+ /* by default, act like the user did not select download all */
+ args.downloadAll = false;
+
+
+ nntpServer = MailServices.accounts.getIncomingServer(args.serverKey)
+ .QueryInterface(Components.interfaces.nsINntpIncomingServer);
+
+ document.title = newsBundle.getString("downloadHeadersTitlePrefix");
+
+ let infotext = newsBundle.getFormattedString("downloadHeadersInfoText",
+ [args.articleCount]);
+ setText('info', infotext);
+ let okButtonText = newsBundle.getString("okButtonText");
+ let okbutton = document.documentElement.getButton("accept");
+ okbutton.setAttribute("label", okButtonText);
+ okbutton.focus();
+ setText("newsgroupLabel", args.groupName);
+ }
+
+ numberElement = document.getElementById("number");
+ numberElement.value = nntpServer.maxArticles;
+
+ markreadElement = document.getElementById("markread");
+ markreadElement.checked = nntpServer.markOldRead;
+
+ return true;
+}
+
+function setText(id, value) {
+ let element = document.getElementById(id);
+ if (!element)
+ return;
+
+ if (element.hasChildNodes())
+ element.firstChild.remove();
+ let textNode = document.createTextNode(value);
+ element.appendChild(textNode);
+}
+
+function OkButtonCallback() {
+ nntpServer.maxArticles = numberElement.value;
+ nntpServer.markOldRead = markreadElement.checked;
+
+ let radio = document.getElementById("all");
+ if (radio)
+ args.downloadAll = radio.selected;
+
+ args.hitOK = true;
+ return true;
+}
+
+function CancelButtonCallback() {
+ args.hitOK = false;
+ return true;
+}
+
+function setupDownloadUI(enable) {
+ let checkbox = document.getElementById("markread");
+ let numberFld = document.getElementById("number");
+
+ checkbox.disabled = !enable;
+ numberFld.disabled = !enable;
+}
diff --git a/mailnews/news/content/downloadheaders.xul b/mailnews/news/content/downloadheaders.xul
new file mode 100644
index 000000000..1adf7c819
--- /dev/null
+++ b/mailnews/news/content/downloadheaders.xul
@@ -0,0 +1,49 @@
+<?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/. -->
+
+<?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
+
+<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/downloadheaders.dtd">
+
+<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="max-width: 27em;"
+ buttonpack="center"
+ ondialogaccept="return OkButtonCallback();"
+ ondialogcancel="return CancelButtonCallback();"
+ onload="OnLoad();">
+
+ <stringbundle id="bundle_news" src="chrome://messenger/locale/news.properties"/>
+ <script type="application/javascript" src="chrome://messenger/content/downloadheaders.js"/>
+
+ <label class="header" style="width: 25em; max-width: 25em;" id="newsgroupLabel" control="downloadGroup"/>
+ <description style="width: 25em; max-width: 25em;" id="info" control="downloadGroup"/>
+ <separator class="thin"/>
+ <vbox class="indent">
+ <radiogroup id="downloadGroup">
+ <radio id="all" label="&all.label;" accesskey="&all.accesskey;"
+ oncommand="setupDownloadUI(false);"/>
+ <separator class="thin"/>
+ <hbox align="center" valign="middle">
+ <radio id="some" selected="true" label="&download.label;"
+ accesskey="&download.accesskey;"
+ oncommand="setupDownloadUI(true);"
+ aria-labelledby="some number headers"/>
+ <textbox id="number"
+ size="7"
+ type="number"
+ min="1"
+ increment="10"
+ aria-labelledby="some number headers"/>
+ <label value="&headers.label;" accesskey="&headers.accesskey;"
+ id="headers" control="number"/>
+ </hbox>
+ </radiogroup>
+
+ <hbox class="indent" align="start">
+ <checkbox id="markread" label="&mark.label;" accesskey="&mark.accesskey;"/>
+ </hbox>
+ </vbox>
+
+</dialog>