Landing new download UI.
This commit is contained in:
Родитель
0c45ad3c10
Коммит
e4157bbd63
|
@ -1,629 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// SYNTAX HINTS: dashes are delimiters. Use underscores instead.
|
||||
// The first character after a period must be alphabetic.
|
||||
|
||||
pref("startup.homepage_override_url","chrome://navigator-region/locale/region.properties");
|
||||
pref("browser.chromeURL","chrome://browser/content/");
|
||||
|
||||
pref("keyword.enabled", true);
|
||||
pref("keyword.URL", "http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=");
|
||||
|
||||
pref("general.useragent.locale", "chrome://navigator/locale/navigator.properties");
|
||||
pref("general.useragent.contentlocale", "chrome://navigator-region/locale/region.properties");
|
||||
pref("general.useragent.misc", "rv:1.2b");
|
||||
pref("general.useragent.vendor", "Phoenix");
|
||||
pref("general.useragent.vendorSub", "0.2");
|
||||
|
||||
pref("backups.number_of_prefs_copies", 1);
|
||||
|
||||
// 0 = blank, 1 = home (browser.startup.homepage), 2 = last
|
||||
// XXXBlake Remove this stupid pref
|
||||
pref("browser.startup.page", 1);
|
||||
pref("browser.startup.homepage", "chrome://navigator-region/locale/region.properties");
|
||||
// "browser.startup.homepage_override" was for 4.x
|
||||
pref("browser.startup.homepage_override.1", true);
|
||||
|
||||
pref("browser.cache.enable", true); // see also network.http.use-cache
|
||||
pref("browser.cache.disk.enable", true);
|
||||
pref("browser.cache.disk.capacity", 50000);
|
||||
pref("browser.cache.memory.enable", true);
|
||||
pref("browser.cache.memory.capacity", 4096);
|
||||
// 0 = once-per-session, 1 = each-time, 2 = never, 3 = when-appropriate/automatically
|
||||
pref("browser.cache.check_doc_frequency", 3);
|
||||
|
||||
pref("browser.display.use_document_fonts", 1); // 0 = never, 1 = quick, 2 = always
|
||||
pref("browser.display.use_document_colors", true);
|
||||
pref("browser.display.use_system_colors", false);
|
||||
pref("browser.display.foreground_color", "#000000");
|
||||
pref("browser.display.background_color", "#FFFFFF");
|
||||
pref("browser.display.force_inline_alttext", false); // true = force ALT text for missing images to be layed out inline
|
||||
// 0 = no external leading,
|
||||
// 1 = use external leading only when font provides,
|
||||
// 2 = add extra leading both internal leading and external leading are zero
|
||||
pref("browser.display.normal_lineheight_calc_control", 2);
|
||||
pref("browser.display.show_image_placeholders", true); // true = show image placeholders while image is loaded and when image is broken
|
||||
pref("browser.anchor_color", "#0000EE");
|
||||
pref("browser.visited_color", "#551A8B");
|
||||
pref("browser.underline_anchors", true);
|
||||
pref("browser.blink_allowed", true);
|
||||
|
||||
pref("browser.display.use_focus_colors", false);
|
||||
pref("browser.display.focus_background_color", "#117722");
|
||||
pref("browser.display.focus_text_color", "#ffffff");
|
||||
pref("browser.display.focus_ring_width", 1);
|
||||
pref("browser.display.focus_ring_on_anything", false);
|
||||
|
||||
pref("browser.urlbar.autoFill", false);
|
||||
pref("browser.urlbar.showPopup", true);
|
||||
pref("browser.urlbar.showSearch", true);
|
||||
pref("browser.urlbar.matchOnlyTyped", false);
|
||||
|
||||
pref("browser.chrome.site_icons", true);
|
||||
pref("browser.chrome.favicons", true);
|
||||
|
||||
pref("browser.chrome.toolbar_tips", true);
|
||||
|
||||
pref("browser.turbo.enabled", false);
|
||||
|
||||
pref("browser.helperApps.alwaysAsk.force", false);
|
||||
pref("browser.helperApps.neverAsk.saveToDisk", "");
|
||||
pref("browser.helperApps.neverAsk.openFile", "");
|
||||
|
||||
pref("accessibility.browsewithcaret", false);
|
||||
pref("accessibility.warn_on_browsewithcaret", true);
|
||||
pref("accessibility.usetexttospeech", "");
|
||||
pref("accessibility.usebrailledisplay", "");
|
||||
pref("accessibility.accesskeycausesactivation", true);
|
||||
|
||||
pref("browser.download.progressDnldDialog.keepAlive", true); // keep the dnload progress dialog up after dnload is complete
|
||||
pref("browser.download.progressDnldDialog.enable_launch_reveal_buttons", true);
|
||||
|
||||
// various default search settings
|
||||
pref("browser.search.defaulturl", "chrome://browser-region/locale/region.properties");
|
||||
// basic search popup constraint: minimum sherlock plugin version displayed
|
||||
// (note: must be a string representation of a float or it'll default to 0.0)
|
||||
pref("browser.search.basic.min_ver", "0.0");
|
||||
pref("browser.urlbar.autocomplete.enabled", true);
|
||||
|
||||
pref("browser.history.last_page_visited", "");
|
||||
pref("browser.history_expire_days", 9);
|
||||
pref("browser.history.grouping", "day");
|
||||
pref("browser.sessionhistory.max_entries", 50);
|
||||
|
||||
// loading and rendering of framesets and iframes
|
||||
pref("browser.frames.enabled", true);
|
||||
|
||||
// form submission
|
||||
pref("browser.forms.submit.backwards_compatible", true);
|
||||
|
||||
// Tab browser preferences.
|
||||
pref("browser.tabs.autoHide", true);
|
||||
pref("browser.tabs.forceHide", false);
|
||||
pref("browser.tabs.loadInBackground", true);
|
||||
pref("browser.tabs.opentabfor.middleclick", true);
|
||||
pref("browser.tabs.opentabfor.urlbar", true);
|
||||
|
||||
// view source
|
||||
pref("view_source.syntax_highlight", true);
|
||||
pref("view_source.wrap_long_lines", false);
|
||||
|
||||
// gfx widgets
|
||||
pref("nglayout.widget.mode", 2);
|
||||
pref("nglayout.widget.gfxscrollbars", true);
|
||||
|
||||
// css2 hover pref
|
||||
pref("nglayout.events.showHierarchicalHover", false);
|
||||
|
||||
// dispatch left clicks only to content in browser (still allows clicks to chrome/xul)
|
||||
pref("nglayout.events.dispatchLeftClickOnly", true);
|
||||
|
||||
// whether or not to use xbl form controls
|
||||
pref("nglayout.debug.enable_xbl_forms", false);
|
||||
|
||||
// size of scrollbar snapping region
|
||||
pref("slider.snapMultiplier", 6);
|
||||
|
||||
// option to choose plug-in finder
|
||||
pref("application.use_ns_plugin_finder", false);
|
||||
|
||||
// Smart Browsing prefs
|
||||
pref("browser.related.enabled", true);
|
||||
pref("browser.related.autoload", 1); // 0 = Always, 1 = After first use, 2 = Never
|
||||
pref("browser.related.provider", "http://www-rl.netscape.com/wtgn?");
|
||||
pref("browser.related.disabledForDomains", "");
|
||||
pref("browser.goBrowsing.enabled", true);
|
||||
|
||||
// URI fixup prefs
|
||||
pref("browser.fixup.alternate.enabled", true);
|
||||
pref("browser.fixup.alternate.prefix", "www.");
|
||||
pref("browser.fixup.alternate.suffix", ".com");
|
||||
|
||||
// Default bookmark sorting
|
||||
pref("browser.bookmarks.sort.direction", "descending");
|
||||
pref("browser.bookmarks.sort.resource", "rdf:http://home.netscape.com/NC-rdf#Name");
|
||||
|
||||
//Internet Search
|
||||
pref("browser.search.defaultenginename", "chrome://browser-region/locale/region.properties");
|
||||
|
||||
// Print header customization
|
||||
// Use the following codes:
|
||||
// &T - Title
|
||||
// &U - Document URL
|
||||
// &D - Date/Time
|
||||
// &P - Page Number
|
||||
// &PT - Page Number "of" Page total
|
||||
// Set each header to a string containing zero or one of these codes
|
||||
// and the code will be replaced in that string by the corresponding data
|
||||
pref("print.print_headerleft", "&T");
|
||||
pref("print.print_headercenter", "");
|
||||
pref("print.print_headerright", "&U");
|
||||
pref("print.print_footerleft", "&PT");
|
||||
pref("print.print_footercenter", "");
|
||||
pref("print.print_footerright", "&D");
|
||||
pref("print.show_print_progress", true);
|
||||
|
||||
// When this is set to false it means each window has its PrintSettings
|
||||
// and a change in one browser window does not effect the others
|
||||
pref("print.use_global_printsettings", true);
|
||||
|
||||
// This indicates whether it should use the native dialog or the XP Dialog50
|
||||
pref("print.use_native_print_dialog", false);
|
||||
|
||||
// Save the Printings after each print job
|
||||
pref("print.save_print_settings", true);
|
||||
|
||||
pref("print.whileInPrintPreview", true);
|
||||
|
||||
// Cache old Presentation when going into Print Preview
|
||||
pref("print.always_cache_old_pres", false);
|
||||
|
||||
// Enables you to specify the gap from the edge of the paper to the margin
|
||||
// this is used by both Printing and Print Preview
|
||||
pref("print.print_edge_top", 0); // 1/100 of an inch
|
||||
pref("print.print_edge_left", 0); // 1/100 of an inch
|
||||
pref("print.print_edge_right", 0); // 1/100 of an inch
|
||||
pref("print.print_edge_bottom", 0); // 1/100 of an inch
|
||||
|
||||
// Default Capability Preferences: Security-Critical!
|
||||
// Editing these may create a security risk - be sure you know what you're doing
|
||||
//pref("capability.policy.default.barprop.visible.set", "UniversalBrowserWrite");
|
||||
|
||||
pref("capability.policy.default_policynames", "mailnews");
|
||||
pref("capability.policy.policynames", "");
|
||||
|
||||
pref("capability.policy.default.DOMException.code", "allAccess");
|
||||
pref("capability.policy.default.DOMException.message", "allAccess");
|
||||
pref("capability.policy.default.DOMException.name", "allAccess");
|
||||
pref("capability.policy.default.DOMException.result", "allAccess");
|
||||
pref("capability.policy.default.DOMException.toString", "allAccess");
|
||||
|
||||
pref("capability.policy.default.History.back", "allAccess");
|
||||
pref("capability.policy.default.History.current", "UniversalBrowserRead");
|
||||
pref("capability.policy.default.History.forward", "allAccess");
|
||||
pref("capability.policy.default.History.go", "allAccess");
|
||||
pref("capability.policy.default.History.item", "UniversalBrowserRead");
|
||||
pref("capability.policy.default.History.next", "UniversalBrowserRead");
|
||||
pref("capability.policy.default.History.previous", "UniversalBrowserRead");
|
||||
pref("capability.policy.default.History.toString", "UniversalBrowserRead");
|
||||
|
||||
pref("capability.policy.default.HTMLDocument.close", "allAccess");
|
||||
pref("capability.policy.default.HTMLDocument.open", "allAccess");
|
||||
pref("capability.policy.default.HTMLDocument.write", "allAccess");
|
||||
pref("capability.policy.default.HTMLDocument.writeln", "allAccess");
|
||||
|
||||
pref("capability.policy.default.Location.hash.set", "allAccess");
|
||||
pref("capability.policy.default.Location.href.set", "allAccess");
|
||||
pref("capability.policy.default.Location.reload", "allAccess");
|
||||
pref("capability.policy.default.Location.replace", "allAccess");
|
||||
|
||||
pref("capability.policy.default.Navigator.preference", "allAccess");
|
||||
pref("capability.policy.default.Navigator.preferenceinternal.get", "UniversalPreferencesRead");
|
||||
pref("capability.policy.default.Navigator.preferenceinternal.set", "UniversalPreferencesWrite");
|
||||
|
||||
pref("capability.policy.default.Window.blur", "allAccess");
|
||||
pref("capability.policy.default.Window.close", "allAccess");
|
||||
pref("capability.policy.default.Window.closed", "allAccess");
|
||||
pref("capability.policy.default.Window.Components", "allAccess");
|
||||
pref("capability.policy.default.Window.document", "allAccess");
|
||||
pref("capability.policy.default.Window.focus", "allAccess");
|
||||
pref("capability.policy.default.Window.frames", "allAccess");
|
||||
pref("capability.policy.default.Window.fullScreen", "noAccess");
|
||||
pref("capability.policy.default.Window.history", "allAccess");
|
||||
pref("capability.policy.default.Window.length", "allAccess");
|
||||
pref("capability.policy.default.Window.location", "allAccess");
|
||||
pref("capability.policy.default.Window.opener", "allAccess");
|
||||
pref("capability.policy.default.Window.parent", "allAccess");
|
||||
pref("capability.policy.default.Window.self", "allAccess");
|
||||
pref("capability.policy.default.Window.top", "allAccess");
|
||||
pref("capability.policy.default.Window.window", "allAccess");
|
||||
|
||||
// Scripts & Windows prefs
|
||||
pref("browser.block.target_new_window", false);
|
||||
pref("dom.disable_cookie_get", false);
|
||||
pref("dom.disable_cookie_set", false);
|
||||
pref("dom.disable_image_src_set", false);
|
||||
pref("dom.disable_open_during_load", true);
|
||||
pref("dom.disable_window_flip", false);
|
||||
pref("dom.disable_window_move_resize", false);
|
||||
pref("dom.disable_window_status_change", false);
|
||||
|
||||
pref("dom.disable_window_open_feature.titlebar", false);
|
||||
pref("dom.disable_window_open_feature.close", false);
|
||||
pref("dom.disable_window_open_feature.toolbar", false);
|
||||
pref("dom.disable_window_open_feature.location", false);
|
||||
pref("dom.disable_window_open_feature.directories", false);
|
||||
pref("dom.disable_window_open_feature.personalbar", false);
|
||||
pref("dom.disable_window_open_feature.menubar", false);
|
||||
pref("dom.disable_window_open_feature.scrollbars", false);
|
||||
pref("dom.disable_window_open_feature.resizable", false);
|
||||
pref("dom.disable_window_open_feature.minimizable", false);
|
||||
pref("dom.disable_window_open_feature.status", false);
|
||||
|
||||
pref("javascript.enabled", true);
|
||||
pref("javascript.options.strict", false);
|
||||
pref("javascript.options.showInConsole", true);
|
||||
|
||||
// advanced prefs
|
||||
pref("advanced.always_load_images", true);
|
||||
pref("security.enable_java", true);
|
||||
pref("advanced.mailftp", false);
|
||||
pref("image.animation_mode", "normal");
|
||||
|
||||
// If there is ever a security firedrill that requires
|
||||
// us to block certian ports global, this is the pref
|
||||
// to use. Is is a comma delimited list of port numbers
|
||||
// for example:
|
||||
// pref("network.security.ports.banned", "1,2,3,4,5");
|
||||
// prevents necko connecting to ports 1-5 unless the protocol
|
||||
// overrides.
|
||||
|
||||
pref("network.hosts.smtp_server", "mail");
|
||||
pref("network.hosts.pop_server", "mail");
|
||||
pref("network.protocols.useSystemDefaults", false); // set to true if user links should use system default handlers
|
||||
|
||||
// <http>
|
||||
pref("network.http.version", "1.1"); // default
|
||||
// pref("network.http.version", "1.0"); // uncomment this out in case of problems
|
||||
// pref("network.http.version", "0.9"); // it'll work too if you're crazy
|
||||
// keep-alive option is effectively obsolete. Nevertheless it'll work with
|
||||
// some older 1.0 servers:
|
||||
|
||||
pref("network.http.proxy.version", "1.1"); // default
|
||||
// pref("network.http.proxy.version", "1.0"); // uncomment this out in case of problems
|
||||
// (required if using junkbuster proxy)
|
||||
|
||||
// enable caching of http documents
|
||||
pref("network.http.use-cache", true);
|
||||
|
||||
pref("network.http.keep-alive", true); // set it to false in case of problems
|
||||
pref("network.http.proxy.keep-alive", true);
|
||||
pref("network.http.keep-alive.timeout", 300);
|
||||
|
||||
// limit the absolute number of http connections.
|
||||
pref("network.http.max-connections", 24);
|
||||
|
||||
// limit the absolute number of http connections that can be established per
|
||||
// host. if a http proxy server is enabled, then the "server" is the proxy
|
||||
// server. Otherwise, "server" is the http origin server.
|
||||
pref("network.http.max-connections-per-server", 8);
|
||||
|
||||
// if network.http.keep-alive is true, and if NOT connecting via a proxy, then
|
||||
// a new connection will only be attempted if the number of active persistent
|
||||
// connections to the server is less then max-persistent-connections-per-server.
|
||||
pref("network.http.max-persistent-connections-per-server", 2);
|
||||
|
||||
// if network.http.keep-alive is true, and if connecting via a proxy, then a
|
||||
// new connection will only be attempted if the number of active persistent
|
||||
// connections to the proxy is less then max-persistent-connections-per-proxy.
|
||||
pref("network.http.max-persistent-connections-per-proxy", 4);
|
||||
|
||||
// amount of time (in seconds) to suspend pending requests, before spawning a
|
||||
// new connection, once the limit on the number of persistent connections per
|
||||
// host has been reached. however, a new connection will not be created if
|
||||
// max-connections or max-connections-per-server has also been reached.
|
||||
pref("network.http.request.max-start-delay", 10);
|
||||
|
||||
// http specific network timeouts (XXX currently unused)
|
||||
pref("network.http.connect.timeout", 30); // in seconds
|
||||
pref("network.http.request.timeout", 120); // in seconds
|
||||
|
||||
// Headers
|
||||
pref("network.http.accept.default", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1");
|
||||
|
||||
pref("network.http.sendRefererHeader", 2); // 0=don't send any, 1=send only on clicks, 2=send on image requests as well
|
||||
|
||||
// Maximum number of consecutive redirects before aborting.
|
||||
pref("network.http.redirection-limit", 10);
|
||||
|
||||
// Enable http compression: comment this out in case of problems with 1.1
|
||||
pref("network.http.accept-encoding" ,"gzip, deflate, compress;q=0.9");
|
||||
|
||||
pref("network.http.pipelining" , false);
|
||||
pref("network.http.proxy.pipelining", false);
|
||||
|
||||
// Always pipeling the very first request: this will only work when you are
|
||||
// absolutely sure the the site or proxy you are browsing to/through support
|
||||
// pipelining; the default behavior will be that the browser will first make
|
||||
// a normal, non-pipelined request, then examine and remember the responce
|
||||
// and only the subsequent requests to that site will be pipeline
|
||||
pref("network.http.pipelining.firstrequest", false);
|
||||
|
||||
// Max number of requests in the pipeline
|
||||
pref("network.http.pipelining.maxrequests" , 4);
|
||||
|
||||
pref("network.http.proxy.ssl.connect",true);
|
||||
// </http>
|
||||
|
||||
// This preference controls whether or not internationalized domain names (IDN)
|
||||
// are handled. IDN requires a nsIIDNService implementation.
|
||||
pref("network.enableIDN", true);
|
||||
|
||||
// This preference controls whether or not URLs with UTF-8 characters are
|
||||
// escaped. Set this preference to TRUE for strict RFC2396 conformance.
|
||||
pref("network.standard-url.escape-utf8", true);
|
||||
|
||||
// Idle timeout for ftp control connections - 5 minute default
|
||||
pref("network.ftp.idleConnectionTimeout", 300);
|
||||
|
||||
// directory listing format - constants are defined in nsIDirectoryListing.idl
|
||||
// Do not set this to 0...
|
||||
pref("network.dir.format", 2);
|
||||
|
||||
// sspitzer: change this back to "news" when we get to beta.
|
||||
// for now, set this to news.mozilla.org because you can only
|
||||
// post to the server specified by this pref.
|
||||
pref("network.hosts.nntp_server", "news.mozilla.org");
|
||||
|
||||
pref("network.image.enable", true); // 0-Accept, 1-dontAcceptForeign, 2-dontUse
|
||||
pref("network.image.enableForOriginatingWebsiteOnly", false);
|
||||
pref("network.image.warnAboutImages", false);
|
||||
pref("network.proxy.autoconfig_url", "");
|
||||
pref("network.proxy.type", 0);
|
||||
pref("network.proxy.ftp", "");
|
||||
pref("network.proxy.ftp_port", 0);
|
||||
pref("network.proxy.gopher", "");
|
||||
pref("network.proxy.gopher_port", 0);
|
||||
pref("network.proxy.news", "");
|
||||
pref("network.proxy.news_port", 0);
|
||||
pref("network.proxy.http", "");
|
||||
pref("network.proxy.http_port", 0);
|
||||
pref("network.proxy.wais", "");
|
||||
pref("network.proxy.wais_port", 0);
|
||||
pref("network.proxy.ssl", "");
|
||||
pref("network.proxy.ssl_port", 0);
|
||||
pref("network.proxy.socks", "");
|
||||
pref("network.proxy.socks_port", 0);
|
||||
pref("network.proxy.socks_version", 5);
|
||||
pref("network.proxy.no_proxies_on", "");
|
||||
pref("network.online", true); //online/offline
|
||||
pref("network.cookie.enable", true); // 0-Accept, 1-dontAcceptForeign, 2-dontUse, 3-p3p
|
||||
pref("network.cookie.warnAboutCookies", false);
|
||||
pref("network.cookie.enableForCurrentSessionOnly", false);
|
||||
pref("network.cookie.enableForOriginatingWebsiteOnly", false);
|
||||
pref("network.cookie.lifetime.days", 90);
|
||||
|
||||
// The following default value is for p3p medium mode.
|
||||
// See extensions/cookie/resources/content/p3p.xul for the definitions of low/medium/hi
|
||||
pref("network.cookie.p3p", "ffffaaaa");
|
||||
pref("network.cookie.p3plevel", 1); // 0=low, 1=medium, 2=high, 3=custom
|
||||
|
||||
pref("network.enablePad", false); // Allow client to do proxy autodiscovery
|
||||
pref("network.enableIDN", false); // Turn on/off IDN (Internationalized Domain Name) resolution
|
||||
pref("converter.html2txt.structs", true); // Output structured phrases (strong, em, code, sub, sup, b, i, u)
|
||||
pref("converter.html2txt.header_strategy", 1); // 0 = no indention; 1 = indention, increased with header level; 2 = numbering and slight indention
|
||||
pref("imageblocker.enabled", true);
|
||||
pref("intl.accept_languages", "chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.accept_charsets", "iso-8859-1,*,utf-8");
|
||||
pref("intl.collationOption", "chrome://navigator-platform/locale/navigator.properties");
|
||||
pref("intl.menuitems.alwaysappendacceskeys","chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.charsetmenu.browser.static", "chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.charsetmenu.browser.more1", "chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.charsetmenu.browser.more2", "chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.charsetmenu.browser.more3", "chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.charsetmenu.browser.more4", "chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.charsetmenu.browser.more5", "chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.charsetmenu.browser.cache.size", 5);
|
||||
pref("intl.charset.detector", "chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.charset.default", "chrome://navigator-platform/locale/navigator.properties");
|
||||
pref("intl.content.langcode", "chrome://communicator-region/locale/region.properties");
|
||||
pref("intl.locale.matchOS", false);
|
||||
// fallback charset list for Unicode conversion (converting from Unicode)
|
||||
// currently used for mail send only to handle symbol characters (e.g Euro, trademark, smartquotes)
|
||||
// for ISO-8859-1
|
||||
pref("intl.fallbackCharsetList.ISO-8859-1", "windows-1252");
|
||||
pref("font.language.group", "chrome://navigator/locale/navigator.properties");
|
||||
|
||||
// -- folders (Mac: these are binary aliases.)
|
||||
pref("security.directory", "");
|
||||
|
||||
pref("spellchecker.dictionary", "");
|
||||
|
||||
pref("signed.applets.codebase_principal_support", false);
|
||||
pref("security.checkloaduri", true);
|
||||
pref("security.xpconnect.plugin.unrestricted", true);
|
||||
|
||||
// Modifier key prefs: default to Windows settings,
|
||||
// menu access key = alt, accelerator key = control.
|
||||
// Use 17 for Ctrl, 18 for Alt, 224 for Meta, 0 for none. Mac settings in macprefs.js
|
||||
pref("ui.key.accelKey", 17);
|
||||
pref("ui.key.generalAccessKey", 18);
|
||||
pref("ui.key.menuAccessKey", 18);
|
||||
pref("ui.key.menuAccessKeyFocuses", false);
|
||||
pref("ui.key.saveLink.shift", true); // true = shift, false = meta
|
||||
|
||||
// Middle-mouse handling
|
||||
pref("middlemouse.paste", false);
|
||||
pref("middlemouse.openNewWindow", true);
|
||||
pref("middlemouse.contentLoadURL", false);
|
||||
pref("middlemouse.scrollbarPosition", false);
|
||||
|
||||
// Clipboard behavior
|
||||
pref("clipboard.autocopy", false);
|
||||
|
||||
// 0=lines, 1=pages, 2=history , 3=text size
|
||||
pref("mousewheel.withnokey.action",0);
|
||||
pref("mousewheel.withnokey.numlines",1);
|
||||
pref("mousewheel.withnokey.sysnumlines",true);
|
||||
pref("mousewheel.withcontrolkey.action",0);
|
||||
pref("mousewheel.withcontrolkey.numlines",1);
|
||||
pref("mousewheel.withcontrolkey.sysnumlines",true);
|
||||
pref("mousewheel.withshiftkey.action",0);
|
||||
pref("mousewheel.withshiftkey.numlines",1);
|
||||
pref("mousewheel.withshiftkey.sysnumlines",false);
|
||||
pref("mousewheel.withaltkey.action",2);
|
||||
pref("mousewheel.withaltkey.numlines",1);
|
||||
pref("mousewheel.withaltkey.sysnumlines",false);
|
||||
|
||||
pref("profile.confirm_automigration",true);
|
||||
|
||||
// the amount of time (in seconds) that must elapse
|
||||
// before we think your mozilla profile is defunct
|
||||
// and you'd benefit from re-migrating from 4.x
|
||||
// see bug #137886 for more details
|
||||
//
|
||||
// if -1, we never think your profile is defunct
|
||||
// and users will never see the remigrate UI.
|
||||
pref("profile.seconds_until_defunct", -1);
|
||||
|
||||
// Customizable toolbar stuff
|
||||
pref("custtoolbar.personal_toolbar_folder", "");
|
||||
|
||||
pref("prefs.converted-to-utf8",false);
|
||||
// --------------------------------------------------
|
||||
// IBMBIDI
|
||||
// --------------------------------------------------
|
||||
//
|
||||
// ------------------
|
||||
// Text Direction
|
||||
// ------------------
|
||||
// 1 = directionLTRBidi *
|
||||
// 2 = directionRTLBidi
|
||||
pref("bidi.direction", 1);
|
||||
// ------------------
|
||||
// Text Type
|
||||
// ------------------
|
||||
// 1 = charsettexttypeBidi *
|
||||
// 2 = logicaltexttypeBidi
|
||||
// 3 = visualtexttypeBidi
|
||||
pref("bidi.texttype", 1);
|
||||
// ------------------
|
||||
// Controls Text Mode
|
||||
// ------------------
|
||||
// 1 = logicalcontrolstextmodeBidiCmd
|
||||
// 2 = visualcontrolstextmodeBidi <-- NO LONGER SUPPORTED
|
||||
// 3 = containercontrolstextmodeBidi *
|
||||
pref("bidi.controlstextmode", 1);
|
||||
// ------------------
|
||||
// Clipboard Text Mode
|
||||
// ------------------
|
||||
// 1 = logicalclipboardtextmodeBidi
|
||||
// 2 = visiualclipboardtextmodeBidi
|
||||
// 3 = sourceclipboardtextmodeBidi *
|
||||
pref("bidi.clipboardtextmode", 3);
|
||||
// ------------------
|
||||
// Numeral Style
|
||||
// ------------------
|
||||
// 1 = regularcontextnumeralBidi *
|
||||
// 2 = hindicontextnumeralBidi
|
||||
// 3 = arabicnumeralBidi
|
||||
// 4 = hindinumeralBidi
|
||||
pref("bidi.numeral", 1);
|
||||
// ------------------
|
||||
// Support Mode
|
||||
// ------------------
|
||||
// 1 = mozillaBidisupport *
|
||||
// 2 = OsBidisupport
|
||||
// 3 = disableBidisupport
|
||||
pref("bidi.support", 1);
|
||||
// ------------------
|
||||
// Charset Mode
|
||||
// ------------------
|
||||
// 1 = doccharactersetBidi *
|
||||
// 2 = defaultcharactersetBidi
|
||||
pref("bidi.characterset", 1);
|
||||
|
||||
pref("browser.throbber.url","chrome://navigator-region/locale/region.properties");
|
||||
|
||||
// used for double-click word selection behavior. Win will override.
|
||||
pref("layout.word_select.eat_space_to_next_word", false);
|
||||
pref("layout.word_select.stop_at_punctuation", true);
|
||||
|
||||
// pref to force frames to be resizable
|
||||
pref("layout.frames.force_resizability", false);
|
||||
|
||||
// pref to permit users to make verified SOAP calls by default
|
||||
pref("capability.policy.default.SOAPCall.invokeVerifySourceHeader", "allAccess");
|
||||
|
||||
// pref to control the alert notification
|
||||
pref("alerts.slideIncrement", 1);
|
||||
pref("alerts.slideIncrementTime", 10);
|
||||
pref("alerts.totalOpenTime", 4000);
|
||||
pref("alerts.height", 50);
|
||||
|
||||
// update notifications prefs
|
||||
pref("update_notifications.enabled", true);
|
||||
pref("update_notifications.provider.0.frequency", 7); // number of days
|
||||
pref("update_notifications.provider.0.datasource", "chrome://communicator-region/locale/region.properties");
|
||||
|
||||
// 0 opens the download manager
|
||||
// 1 opens a progress dialog
|
||||
// 2 and other values, no download manager, no progress dialog.
|
||||
pref("browser.downloadmanager.behavior", 0);
|
||||
|
||||
// if true, allow plug-ins to override internal imglib decoder mime types in full-page mode
|
||||
pref("plugin.override_internal_types", false);
|
||||
pref("plugin.expose_full_path", false); // if true navigator.plugins reveals full path
|
||||
|
||||
// Help Windows NT, 2000, and XP dialup a RAS connection
|
||||
// when a network address is unreachable.
|
||||
pref("network.autodial-helper.enabled", true);
|
||||
|
||||
// Pref to control whether we set ddeexec subkeys for the http
|
||||
// Internet shortcut protocol if we are handling it. These
|
||||
// subkeys will be set only while we are running (to avoid the
|
||||
// problem of Windows showing an alert when it tries to use DDE
|
||||
// and we're not already running).
|
||||
pref("advanced.system.supportDDEExec", true);
|
||||
pref("browser.xul.error_pages.enabled", true);
|
||||
|
||||
pref("signon.rememberSignons", true);
|
||||
pref("signon.expireMasterPassword", false);
|
||||
|
||||
pref("network.protocol-handler.external.mailto", true); // for mail
|
||||
pref("network.protocol-handler.external.news" , true); // for news
|
|
@ -59,6 +59,7 @@ var gIgnoreFocus = false;
|
|||
var gIgnoreClick = false;
|
||||
var gToolbarMode = "icons";
|
||||
var gIconSize = "";
|
||||
var gMustLoadSidebar = false;
|
||||
|
||||
var gPrefService = null;
|
||||
|
||||
|
@ -319,6 +320,24 @@ function Startup()
|
|||
}
|
||||
}
|
||||
|
||||
if (window.opener) {
|
||||
var openerSidebarBox = window.opener.document.getElementById("sidebar-box");
|
||||
if (!openerSidebarBox.hidden) {
|
||||
gMustLoadSidebar = true;
|
||||
var sidebarBox = document.getElementById("sidebar-box");
|
||||
sidebarBox.hidden = false;
|
||||
var sidebarSplitter = document.getElementById("sidebar-splitter");
|
||||
sidebarSplitter.hidden = false;
|
||||
|
||||
var sidebarTitle = document.getElementById("sidebar-title");
|
||||
sidebarTitle.setAttribute("value", window.opener.document.getElementById("sidebar-title").getAttribute("value"));
|
||||
sidebarBox.setAttribute("width", openerSidebarBox.boxObject.width);
|
||||
var sidebarButton = openerSidebarBox.getAttribute("button");
|
||||
document.getElementById(sidebarButton).checked = true;
|
||||
sidebarBox.setAttribute("button", sidebarButton);
|
||||
}
|
||||
}
|
||||
|
||||
// called when we go into full screen, even if it is
|
||||
// initiated by a web page script
|
||||
addEventListener("fullscreen", onFullScreen, false);
|
||||
|
@ -339,6 +358,11 @@ function Startup()
|
|||
|
||||
function delayedStartup(aElt)
|
||||
{
|
||||
if (gMustLoadSidebar) {
|
||||
var sidebar = document.getElementById("sidebar");
|
||||
sidebar.setAttribute("src", window.opener.document.getElementById("sidebar").getAttribute("src"));
|
||||
}
|
||||
|
||||
// Perform default browser checking (after window opens).
|
||||
checkForDefaultBrowser();
|
||||
|
||||
|
@ -2434,7 +2458,7 @@ function toDownloadManager()
|
|||
dlmgrWindow.focus();
|
||||
}
|
||||
else {
|
||||
window.openDialog("chrome://browser/content/downloadmanager/downloadmanager.xul", "Downloads", "chrome");
|
||||
window.openDialog("chrome://browser/content/downloads/downloadmanager.xul", "Downloads", "chrome,extrachrome,resizable,scrollbars,toolbar,dialog=no");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3140,27 +3164,33 @@ nsBrowserContentListener.prototype =
|
|||
parentContentListener: null
|
||||
}
|
||||
|
||||
function openSidebar(aElt) {
|
||||
function toggleSidebar(aElt) {
|
||||
var sidebarBox = document.getElementById("sidebar-box");
|
||||
var sidebar = document.getElementById("sidebar");
|
||||
var sidebarTitle = document.getElementById("sidebar-title");
|
||||
var sidebarSplitter = document.getElementById("sidebar-splitter");
|
||||
|
||||
if (aElt.checked) {
|
||||
aElt.checked = false;
|
||||
sidebar.hidden = true;
|
||||
sidebarBox.hidden = true;
|
||||
sidebarSplitter.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
aElt.checked = true;
|
||||
|
||||
if (sidebar.hidden) {
|
||||
// Can't use .hidden = false here, since that will remove the attr.
|
||||
// and we need it to exist so we can persist its value.
|
||||
sidebar.setAttribute("hidden", "false");
|
||||
sidebarSplitter.setAttribute("hidden", "false");
|
||||
if (sidebarBox.hidden) {
|
||||
sidebarBox.hidden = false;
|
||||
sidebarSplitter.hidden = false;
|
||||
}
|
||||
|
||||
var url = aElt.getAttribute("sidebarurl");
|
||||
var title = aElt.getAttribute("sidebartitle");
|
||||
if (!title)
|
||||
title = aElt.getAttribute("label");
|
||||
sidebar.setAttribute("src", url);
|
||||
sidebarBox.setAttribute("button", aElt.id);
|
||||
sidebarTitle.setAttribute("value", title);
|
||||
}
|
||||
|
||||
function goPreferences(containerID, paneURL, itemID)
|
||||
|
|
|
@ -778,9 +778,27 @@ Contributor(s):
|
|||
tooltiptext="&throbber.tooltip;"/>
|
||||
</toolbaritem>
|
||||
|
||||
<toolbaritem id="personal-bookmarks" title="&bookmarksItem.title;" flex="1">
|
||||
<bookmarks-toolbar id="bookmarks-toolbar" flex="1"/>
|
||||
</toolbaritem>
|
||||
<toolbaritem id="personal-bookmarks" title="&bookmarksItem.title;" flex="1">
|
||||
<bookmarks-toolbar id="bookmarks-toolbar" flex="1"/>
|
||||
</toolbaritem>
|
||||
|
||||
<toolbarbutton id="downloads-button" class="toolbarbutton-1" autoCheck="false"
|
||||
label="&downloadsButton.label;" type="radio" group="sidebar"
|
||||
sidebarurl="chrome://browser/content/downloads/downloadPanel.xul"
|
||||
oncommand="toggleSidebar(this);"
|
||||
tooltiptext="&downloadsButton.tooltip;"/>
|
||||
|
||||
<toolbarbutton id="history-button" class="toolbarbutton-1" autoCheck="false"
|
||||
label="&historyButton.label;" type="radio" group="sidebar"
|
||||
sidebarurl="chrome://browser/content/history/history-panel.xul"
|
||||
oncommand="toggleSidebar(this);"
|
||||
tooltiptext="&historyButton.tooltip;"/>
|
||||
|
||||
<toolbarbutton id="bookmarks-button" class="toolbarbutton-1" autoCheck="false"
|
||||
label="&bookmarksButton.label;" type="radio" group="sidebar"
|
||||
sidebarurl="chrome://browser/content/bookmarks/bookmarksPanel.xul"
|
||||
oncommand="toggleSidebar(this);"
|
||||
tooltiptext="&bookmarksButton.tooltip;"/>
|
||||
</toolbarpalette>
|
||||
|
||||
<toolbar id="nav-bar" class="toolbar-primary chromeclass-toolbar"
|
||||
|
@ -809,17 +827,27 @@ Contributor(s):
|
|||
toolbarname="&personalbarCmd.label;" accesskey="&personalbarCmd.accesskey;"/>
|
||||
|
||||
</toolbox>
|
||||
|
||||
<hbox flex="1">
|
||||
<vbox id="sidebar-box" hidden="true">
|
||||
<hbox id="sidebar-header" align="center" pack="start">
|
||||
<label id="sidebar-title"/>
|
||||
</hbox>
|
||||
<browser id="sidebar" flex="1"
|
||||
style="min-width: 150px; width: 200px; max-width: 400px;"/>
|
||||
</vbox>
|
||||
|
||||
<!-- we only need to handle |ondragdrop| because everything else is
|
||||
taken care of by the builtin behavior inside the tabbrowser -->
|
||||
<tabbrowser id="content"
|
||||
flex="1" contenttooltip="aHTMLTooltip"
|
||||
contentcontextmenu="contentAreaContextMenu"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
onnewtab="BrowserOpenTab();"
|
||||
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
|
||||
onclick="return contentAreaClick(event);"/>
|
||||
|
||||
<splitter id="sidebar-splitter" hidden="true"/>
|
||||
<!-- we only need to handle |ondragdrop| because everything else is
|
||||
taken care of by the builtin behavior inside the tabbrowser -->
|
||||
<tabbrowser id="content"
|
||||
flex="1" contenttooltip="aHTMLTooltip"
|
||||
contentcontextmenu="contentAreaContextMenu"
|
||||
onnewtab="BrowserOpenTab();"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
|
||||
onclick="return contentAreaClick(event);"/>
|
||||
</hbox>
|
||||
<statusbar class="chromeclass-status" id="status-bar"
|
||||
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);">
|
||||
<statusbarpanel id="security-button" class="statusbarpanel-iconic"
|
||||
|
|
|
@ -235,4 +235,13 @@
|
|||
<!ENTITY textZoomReduceCmd.commandkey "-">
|
||||
|
||||
<!ENTITY openLocationCmd.label "Open Location">
|
||||
<!ENTITY openLocationCmd.accesskey "L">
|
||||
<!ENTITY openLocationCmd.accesskey "L">
|
||||
|
||||
<!ENTITY downloadsButton.label "Downloads">
|
||||
<!ENTITY downloadsButton.tooltip "Displays the progress of ongoing downloads">
|
||||
|
||||
<!ENTITY bookmarksButton.label "Bookmarks">
|
||||
<!ENTITY bookmarksButton.tooltip "Displays your bookmarks">
|
||||
|
||||
<!ENTITY historyButton.label "History">
|
||||
<!ENTITY historyButton.tooltip "Displays pages you've viewed recently">
|
|
@ -545,6 +545,22 @@ toolbar[iconsize="small"] #print-button[disabled="true"] {
|
|||
-moz-image-region: rect(0px 53px 27px 27px) !important;
|
||||
}
|
||||
|
||||
#sidebar-header {
|
||||
height: 23px;
|
||||
background-color: -moz-Dialog;
|
||||
border-bottom: 1px solid ThreeDShadow;
|
||||
border-top: 1px solid ThreeDHighlight;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
border-bottom: 1px solid ThreeDShadow;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#sidebar-title {
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
#go-button[disabled="true"] {
|
||||
-moz-image-region: rect(0px 80px 27px 54px) !important;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
<!DOCTYPE window [
|
||||
<!ENTITY % downloadDTD SYSTEM "chrome://browser/locale/downloads/downloadmanager.dtd" >
|
||||
%downloadDTD;
|
||||
]>
|
||||
|
||||
<bindings id="downloadBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||
|
||||
<binding id="download">
|
||||
<resources>
|
||||
<stylesheet src="chrome://browser/skin/downloadmanager/downloadmanager.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:deck anonid="title-deck">
|
||||
<xul:hbox>
|
||||
<xul:image style="max-width: 16px; max-height: 16px;" xbl:inherits="src=image"/>
|
||||
<xul:label xbl:inherits="value=target"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:image style="max-width: 16px; max-height: 16px;" xbl:inherits="src=image"/>
|
||||
<xul:label xbl:inherits="value=target" class="link" onclick="this.parentNode.parentNode.parentNode.launch();"/>
|
||||
</xul:hbox>
|
||||
</xul:deck>
|
||||
<xul:deck flex="1" anonid="deck" class="indented">
|
||||
<xul:vbox flex="1">
|
||||
<xul:hbox flex="1">
|
||||
<xul:progressmeter mode="normal" value="0" flex="1"
|
||||
xbl:inherits="value=progress,mode=progressmode"/>
|
||||
<xul:label xbl:inherits="value=progress"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox align="start">
|
||||
<xul:label value="&cancel.label;" class="link" onclick="this.parentNode.parentNode.parentNode.parentNode.cancel();"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
<xul:vbox align="start">
|
||||
<xul:label value="&done.label;" class="bold"/>
|
||||
</xul:vbox>
|
||||
<xul:label value="&cancelled.label;" class="bold"/>
|
||||
<xul:label value="&failed.label;" class="bold"/>
|
||||
</xul:deck>
|
||||
</content>
|
||||
<implementation>
|
||||
<method name="onEnd">
|
||||
<parameter name="aType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var deck = document.getAnonymousElementByAttribute(this, "anonid", "deck");
|
||||
var index;
|
||||
switch(aType) {
|
||||
case "dl-failed":
|
||||
index = 3;
|
||||
break;
|
||||
case "dl-cancel":
|
||||
index = 2;
|
||||
break;
|
||||
case "dl-done":
|
||||
default:
|
||||
index = 1;
|
||||
var titleDeck = document.getAnonymousElementByAttribute(this, "anonid", "title-deck");
|
||||
titleDeck.selectedIndex = 1;
|
||||
}
|
||||
deck.selectedIndex = index;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="cancel">
|
||||
<body>
|
||||
<![CDATA[
|
||||
const dlmgrContractID = "@mozilla.org/download-manager;1";
|
||||
const dlmgrIID = Components.interfaces.nsIDownloadManager;
|
||||
var dlmgr = Components.classes[dlmgrContractID].getService(dlmgrIID);
|
||||
dlmgr.cancelDownload(this.id);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<property name="localFile">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var lfContractID = "@mozilla.org/file/local;1";
|
||||
var lfIID = Components.interfaces.nsILocalFile;
|
||||
var lf = Components.classes[lfContractID].createInstance(lfIID);
|
||||
lf.initWithPath(this.getAttribute("file"));
|
||||
return lf;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="launch">
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
this.localFile.launch();
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="show">
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
this.localFile.reveal();
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
</bindings>
|
|
@ -0,0 +1,70 @@
|
|||
const kObserverServiceProgID = "@mozilla.org/observer-service;1";
|
||||
var gDownloadView, gDownloadManager;
|
||||
|
||||
const dlObserver = {
|
||||
observe: function(subject, topic, state) {
|
||||
var subject = subject.QueryInterface(Components.interfaces.nsIDownload);
|
||||
var elt = document.getElementById(subject.target.path);
|
||||
switch (topic) {
|
||||
case "dl-progress":
|
||||
elt.setAttribute("progress", subject.percentComplete);
|
||||
break;
|
||||
default:
|
||||
elt.onEnd(topic);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function Startup() {
|
||||
gDownloadView = document.getElementById("downloadView");
|
||||
const dlmgrContractID = "@mozilla.org/download-manager;1";
|
||||
const dlmgrIID = Components.interfaces.nsIDownloadManager;
|
||||
gDownloadManager = Components.classes[dlmgrContractID].getService(dlmgrIID);
|
||||
var ds = gDownloadManager.datasource;
|
||||
gDownloadView.database.AddDataSource(ds);
|
||||
gDownloadView.builder.rebuild();
|
||||
|
||||
var observerService = Components.classes[kObserverServiceProgID]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
observerService.addObserver(dlObserver, "dl-progress", false);
|
||||
observerService.addObserver(dlObserver, "dl-done", false);
|
||||
observerService.addObserver(dlObserver, "dl-cancel", false);
|
||||
observerService.addObserver(dlObserver, "dl-failed", false);
|
||||
|
||||
}
|
||||
|
||||
function Shutdown() {
|
||||
var observerService = Components.classes[kObserverServiceProgID]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
observerService.removeObserver(dlObserver, "dl-progress");
|
||||
observerService.removeObserver(dlObserver, "dl-done");
|
||||
observerService.removeObserver(dlObserver, "dl-cancel");
|
||||
observerService.removeObserver(dlObserver, "dl-failed");
|
||||
}
|
||||
|
||||
var downloadDNDObserver =
|
||||
{
|
||||
onDragOver: function (aEvent, aFlavour, aDragSession)
|
||||
{
|
||||
aDragSession.canDrop = true;
|
||||
},
|
||||
|
||||
onDrop: function(aEvent, aXferData, aDragSession)
|
||||
{
|
||||
var split = aXferData.data.split("\n");
|
||||
var url = split[0];
|
||||
var name = split[1];
|
||||
saveURL(url, name, null, true);
|
||||
},
|
||||
_flavourSet: null,
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
if (!this._flavourSet) {
|
||||
this._flavourSet = new FlavourSet();
|
||||
this._flavourSet.appendFlavour("text/x-moz-url");
|
||||
this._flavourSet.appendFlavour("text/unicode");
|
||||
}
|
||||
return this._flavourSet;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/downloads/downloadmanager.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/downloads/downloadmanager.css"?>
|
||||
|
||||
<page xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:nc="http://home.netscape.com/NC-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="Startup();" onunload="Shutdown();">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/downloads/downloadPanel.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
|
||||
<vbox id="downloadView" flex="1" style="overflow: auto;"
|
||||
datasources="rdf:null" ref="NC:DownloadsRoot"
|
||||
ondragdrop="nsDragAndDrop.drop(event, downloadDNDObserver);">
|
||||
<template>
|
||||
<rule nc:DownloadState="0" parseType="Integer">
|
||||
<download uri="rdf:*"
|
||||
image="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
|
||||
target="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
file="rdf:http://home.netscape.com/NC-rdf#File"/>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
</page>
|
|
@ -1,332 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
* Jan Varga <varga@utcru.sk>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const NC_NS = "http://home.netscape.com/NC-rdf#";
|
||||
|
||||
var gDownloadView = null;
|
||||
var gDownloadManager = null;
|
||||
var gRDFService = null;
|
||||
var gNC_File = null;
|
||||
var gStatusBar = null;
|
||||
|
||||
const dlObserver = {
|
||||
observe: function(subject, topic, state) {
|
||||
if (topic != "download-starting") return;
|
||||
selectDownload(subject.QueryInterface(Components.interfaces.nsIDownload));
|
||||
}
|
||||
};
|
||||
|
||||
function selectDownload(aDownload)
|
||||
{
|
||||
var dlElt = document.getElementById(aDownload.target.path);
|
||||
var dlIndex = gDownloadView.contentView.getIndexOfItem(dlElt);
|
||||
gDownloadView.treeBoxObject.selection.select(dlIndex);
|
||||
gDownloadView.treeBoxObject.ensureRowIsVisible(dlIndex);
|
||||
}
|
||||
|
||||
function Startup()
|
||||
{
|
||||
if (!window.arguments.length)
|
||||
return;
|
||||
|
||||
try {
|
||||
var observerService = Components.classes[kObserverServiceProgID]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
observerService.addObserver(dlObserver, "download-starting", false);
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
|
||||
const rdfSvcContractID = "@mozilla.org/rdf/rdf-service;1";
|
||||
const rdfSvcIID = Components.interfaces.nsIRDFService;
|
||||
gRDFService = Components.classes[rdfSvcContractID].getService(rdfSvcIID);
|
||||
|
||||
gNC_File = gRDFService.GetResource(NC_NS + "File");
|
||||
|
||||
gDownloadView = document.getElementById("downloadView");
|
||||
|
||||
const dlmgrContractID = "@mozilla.org/download-manager;1";
|
||||
const dlmgrIID = Components.interfaces.nsIDownloadManager;
|
||||
gDownloadManager = Components.classes[dlmgrContractID].getService(dlmgrIID);
|
||||
|
||||
var ds = window.arguments[0];
|
||||
gDownloadView.database.AddDataSource(ds);
|
||||
gDownloadView.builder.rebuild();
|
||||
window.setTimeout(onRebuild, 0);
|
||||
|
||||
var key;
|
||||
if (navigator.platform.indexOf("Win") != -1)
|
||||
key = "Win";
|
||||
else if (navigator.platform.indexOf("Mac") != -1)
|
||||
key = "Mac";
|
||||
else {
|
||||
key = "Unix";
|
||||
document.getElementById("btn_openfile").hidden = true;
|
||||
}
|
||||
|
||||
var bundle = document.getElementById("dlMgrBundle")
|
||||
var label = bundle.getString("showInShellLabel" + key);
|
||||
var accesskey = bundle.getString("showInShellAccesskey" + key);
|
||||
var showBtn = document.getElementById("btn_showinshell");
|
||||
showBtn.setAttribute("label", label);
|
||||
showBtn.setAttribute("accesskey", accesskey);
|
||||
}
|
||||
|
||||
function onRebuild() {
|
||||
gDownloadView.controllers.appendController(downloadViewController);
|
||||
gDownloadView.focus();
|
||||
|
||||
// If the window was opened automatically because
|
||||
// a download started, select the new download
|
||||
if (window.arguments.length > 1 && window.arguments[1]) {
|
||||
var dl = window.arguments[1];
|
||||
selectDownload(dl.QueryInterface(Components.interfaces.nsIDownload));
|
||||
}
|
||||
else if (gDownloadView.view.rowCount) {
|
||||
// Select the first item in the view, if any.
|
||||
gDownloadView.treeBoxObject.selection.select(0);
|
||||
}
|
||||
}
|
||||
|
||||
function onSelect(aEvent) {
|
||||
if (!gStatusBar)
|
||||
gStatusBar = document.getElementById("statusbar-text");
|
||||
|
||||
var selectionCount = gDownloadView.treeBoxObject.selection.count;
|
||||
if (selectionCount == 1)
|
||||
gStatusBar.label = getSelectedItem().id;
|
||||
else
|
||||
gStatusBar.label = "";
|
||||
|
||||
window.updateCommands("tree-select");
|
||||
}
|
||||
|
||||
var downloadViewController = {
|
||||
supportsCommand: function dVC_supportsCommand (aCommand)
|
||||
{
|
||||
switch (aCommand) {
|
||||
case "cmd_properties":
|
||||
case "cmd_pause":
|
||||
case "cmd_cancel":
|
||||
case "cmd_remove":
|
||||
case "cmd_openfile":
|
||||
case "cmd_showinshell":
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
isCommandEnabled: function dVC_isCommandEnabled (aCommand)
|
||||
{
|
||||
var selectionCount = gDownloadView.treeBoxObject.selection.count;
|
||||
if (!selectionCount) return false;
|
||||
|
||||
var selectedItem = getSelectedItem();
|
||||
var isDownloading = gDownloadManager.getDownload(selectedItem.id);
|
||||
switch (aCommand) {
|
||||
case "cmd_openfile":
|
||||
try {
|
||||
if (isDownloading || getFileForItem(selectedItem).isExecutable())
|
||||
return false;
|
||||
} catch(e) {
|
||||
// Exception means file doesn't exist; launch is not allowed.
|
||||
return false;
|
||||
}
|
||||
case "cmd_showinshell":
|
||||
// some apps like kazaa/morpheus let you "preview" in-progress downloads because
|
||||
// that's possible for movies and music. for now, just disable indiscriminately.
|
||||
return selectionCount == 1;
|
||||
case "cmd_properties":
|
||||
return selectionCount == 1 && isDownloading;
|
||||
case "cmd_pause":
|
||||
return false;
|
||||
case "cmd_cancel":
|
||||
// XXX check if selection is still in progress
|
||||
// how to handle multiple selection?
|
||||
return isDownloading;
|
||||
case "cmd_remove":
|
||||
// XXX ensure selection isn't still in progress
|
||||
// and how to handle multiple selection?
|
||||
return !isDownloading;
|
||||
case "cmd_selectAll":
|
||||
return gDownloadView.view.rowCount != selectionCount;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
doCommand: function dVC_doCommand (aCommand)
|
||||
{
|
||||
var selectedItem, selectedItems;
|
||||
var file, i;
|
||||
|
||||
switch (aCommand) {
|
||||
case "cmd_properties":
|
||||
selectedItem = getSelectedItem();
|
||||
gDownloadManager.openProgressDialogFor(selectedItem.id, window);
|
||||
break;
|
||||
case "cmd_openfile":
|
||||
selectedItem = getSelectedItem();
|
||||
file = getFileForItem(selectedItem);
|
||||
file.launch();
|
||||
break;
|
||||
case "cmd_showinshell":
|
||||
selectedItem = getSelectedItem();
|
||||
file = getFileForItem(selectedItem);
|
||||
|
||||
// on unix, open a browser window rooted at the parent
|
||||
if (navigator.platform.indexOf("Win") == -1 && navigator.platform.indexOf("Mac") == -1) {
|
||||
file = file.QueryInterface(Components.interfaces.nsIFile);
|
||||
var parent = file.parent;
|
||||
if (parent) {
|
||||
const browserURL = "chrome://navigator/content/navigator.xul";
|
||||
window.openDialog(browserURL, "_blank", "chrome,all,dialog=no", parent.path);
|
||||
}
|
||||
}
|
||||
else {
|
||||
file.reveal();
|
||||
}
|
||||
break;
|
||||
case "cmd_pause":
|
||||
break;
|
||||
case "cmd_cancel":
|
||||
// XXX we should probably prompt the user
|
||||
selectedItems = getSelectedItems();
|
||||
for (i = 0; i < selectedItems.length; i++)
|
||||
gDownloadManager.cancelDownload(selectedItems[i].id);
|
||||
window.updateCommands("tree-select");
|
||||
break;
|
||||
case "cmd_remove":
|
||||
selectedItems = getSelectedItems();
|
||||
gDownloadManager.startBatchUpdate();
|
||||
|
||||
// Notify the datasource that we're about to begin a batch operation
|
||||
var observer = gDownloadView.builder.QueryInterface(Components.interfaces.nsIRDFObserver);
|
||||
var ds = gDownloadView.database;
|
||||
observer.beginUpdateBatch(ds);
|
||||
|
||||
for (i = 0; i <= selectedItems.length - 1; ++i) {
|
||||
gDownloadManager.removeDownload(selectedItems[i].id);
|
||||
}
|
||||
|
||||
gDownloadManager.endBatchUpdate();
|
||||
observer.endUpdateBatch(ds);
|
||||
var remote = window.arguments[0].QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
remote.Flush();
|
||||
gDownloadView.builder.rebuild();
|
||||
if (minValue >= gDownloadView.treeBoxObject.view.rowCount)
|
||||
--minValue;
|
||||
gDownloadView.treeBoxObject.selection.select(minValue);
|
||||
break;
|
||||
case "cmd_selectAll":
|
||||
gDownloadView.treeBoxObject.selection.selectAll();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
},
|
||||
|
||||
onEvent: function dVC_onEvent (aEvent)
|
||||
{
|
||||
switch (aEvent) {
|
||||
case "tree-select":
|
||||
this.onCommandUpdate();
|
||||
}
|
||||
},
|
||||
|
||||
onCommandUpdate: function dVC_onCommandUpdate ()
|
||||
{
|
||||
var cmds = ["cmd_properties", "cmd_pause", "cmd_cancel", "cmd_remove",
|
||||
"cmd_openfile", "cmd_showinshell"];
|
||||
for (var command in cmds)
|
||||
goUpdateCommand(cmds[command]);
|
||||
}
|
||||
};
|
||||
|
||||
function getSelectedItem()
|
||||
{
|
||||
return gDownloadView.contentView.getItemAtIndex(gDownloadView.currentIndex);
|
||||
}
|
||||
|
||||
function getSelectedItems()
|
||||
{
|
||||
var items = [];
|
||||
var k = 0;
|
||||
|
||||
var selection = gDownloadView.treeBoxObject.selection;
|
||||
var rangeCount = selection.getRangeCount();
|
||||
for (var i = 0; i < rangeCount; i++) {
|
||||
var startIndex = {};
|
||||
var endIndex = {};
|
||||
selection.getRangeAt(i, startIndex, endIndex);
|
||||
for (var j = startIndex.value; j <= endIndex.value; j++)
|
||||
items[k++] = gDownloadView.contentView.getItemAtIndex(j);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
function getFileForItem(aElement)
|
||||
{
|
||||
var itemResource = gRDFService.GetResource(aElement.id);
|
||||
var fileResource = gDownloadView.database.GetTarget(itemResource, gNC_File, true);
|
||||
fileResource = fileResource.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
return createLocalFile(fileResource.Value);
|
||||
}
|
||||
|
||||
function createLocalFile(aFilePath)
|
||||
{
|
||||
var lfContractID = "@mozilla.org/file/local;1";
|
||||
var lfIID = Components.interfaces.nsILocalFile;
|
||||
var lf = Components.classes[lfContractID].createInstance(lfIID);
|
||||
lf.initWithPath(aFilePath);
|
||||
return lf;
|
||||
}
|
||||
|
||||
function Shutdown()
|
||||
{
|
||||
try {
|
||||
var observerService = Components.classes[kObserverServiceProgID]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
observerService.removeObserver(dlObserver, "download-starting");
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
}
|
|
@ -25,13 +25,13 @@
|
|||
Jan Varga <varga@utcru.sk>
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/downloads/downloadmanager.css"?>
|
||||
|
||||
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % downloadManagerDTD SYSTEM "chrome://communicator/locale/downloadmanager/downloadmanager.dtd">
|
||||
<!ENTITY % downloadManagerDTD SYSTEM "chrome://browser/locale/downloads/downloadmanager.dtd">
|
||||
%downloadManagerDTD;
|
||||
<!ENTITY % downloadProgressDTD SYSTEM "chrome://global/locale/nsProgressDialog.dtd" >
|
||||
%downloadProgressDTD;
|
||||
|
@ -40,19 +40,19 @@
|
|||
<window id="downloadManager"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:nc="http://home.netscape.com/NC-rdf#"
|
||||
windowtype="Download:Manager"
|
||||
width="500" height="300" screenX="10" screenY="10"
|
||||
persist="width height screenX screenY"
|
||||
title="&downloadManager.title;"
|
||||
onload="Startup();"
|
||||
onunload="Shutdown();">
|
||||
onload="Startup();">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/downloadmanager/downloadmanager.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/downloads/downloadmanager.js"/>
|
||||
|
||||
<stringbundle id="dlMgrBundle"
|
||||
src="chrome://communicator/locale/downloadmanager/downloadmanager.properties"/>
|
||||
src="chrome://browser/locale/downloads/downloadmanager.properties"/>
|
||||
<stringbundle id="dlProgressDlgBundle"
|
||||
src="chrome://global/locale/nsProgressDialog.properties"/>
|
||||
|
||||
|
@ -66,59 +66,37 @@
|
|||
<data id="strings.unknownTime">&unknownTime;</data>
|
||||
<data id="strings.pausedMsg">&pausedMsg;</data>
|
||||
|
||||
<commandset id="commands">
|
||||
<commandset id="commandUpdate_Downloads"
|
||||
commandupdater="true"
|
||||
events="focus,tree-select"
|
||||
oncommandupdate="downloadViewController.onCommandUpdate()"/>
|
||||
|
||||
<commandset id="downloadCommands">
|
||||
<command id="cmd_properties"
|
||||
oncommand="goDoCommand('cmd_properties');"/>
|
||||
<command id="cmd_pause"
|
||||
oncommand="goDoCommand('cmd_pause');"/>
|
||||
<command id="cmd_cancel"
|
||||
oncommand="goDoCommand('cmd_cancel');"/>
|
||||
<command id="cmd_remove"
|
||||
oncommand="goDoCommand('cmd_remove');"/>
|
||||
<command id="cmd_openfile"
|
||||
oncommand="goDoCommand('cmd_openfile');"/>
|
||||
<command id="cmd_showinshell"
|
||||
oncommand="goDoCommand('cmd_showinshell');"/>
|
||||
</commandset>
|
||||
|
||||
<!-- File Menu -->
|
||||
<command id="cmd_newNavigator"/>
|
||||
<command id="cmd_close" oncommand="close()"/>
|
||||
<command id="cmd_quit"/>
|
||||
<commandset id="commandUpdate_Downloads"
|
||||
commandupdater="true"
|
||||
events="focus,tree-select"
|
||||
oncommandupdate="downloadViewController.onCommandUpdate()"/>
|
||||
|
||||
<commandset id="downloadCommands">
|
||||
<command id="cmd_properties"
|
||||
oncommand="goDoCommand('cmd_properties');"/>
|
||||
<command id="cmd_remove"
|
||||
oncommand="goDoCommand('cmd_remove');"/>
|
||||
<command id="cmd_openfile"
|
||||
oncommand="goDoCommand('cmd_openfile');"/>
|
||||
<command id="cmd_showinshell"
|
||||
oncommand="goDoCommand('cmd_showinshell');"/>
|
||||
</commandset>
|
||||
|
||||
<broadcasterset id="navBroadcasters"/>
|
||||
|
||||
<keyset id="tasksKeys">
|
||||
<!-- File Menu -->
|
||||
<key id="key_newNavigator"/>
|
||||
<!-- File Menu -->
|
||||
<command id="cmd_close" oncommand="close()"/>
|
||||
|
||||
<keyset>
|
||||
<key id="key_close"/>
|
||||
<key id="key_quit"/>
|
||||
|
||||
<!-- These keybindings do not have a command specified in the overlay,
|
||||
which is good, but we need to specify it ourselves here -->
|
||||
<key id="key_selectAll" command="cmd_selectAll"/>
|
||||
|
||||
<key id="key_remove" keycode="VK_DELETE" command="cmd_remove"/>
|
||||
|
||||
<key id="key_properties" key="&cmd.properties.keybinding;"
|
||||
command="cmd_properties" modifiers="accel"/>
|
||||
</keyset>
|
||||
|
||||
<toolbox id="toolbox">
|
||||
<toolbar id="download-toolbar" tbalign="stretch" class="chromeclass-toolbar" persist="collapsed" grippytooltiptext="&dm.tooltip;">
|
||||
<toolbarbutton label="&cmd.properties.label;" accesskey="&cmd.properties.accesskey;"
|
||||
command="cmd_properties"/>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton label="&cmd.cancel.label;" accesskey="&cmd.cancel.accesskey;"
|
||||
command="cmd_cancel"/>
|
||||
<toolbar id="download-toolbar" tbalign="stretch" class="chromeclass-toolbar" persist="collapsed">
|
||||
<toolbarbutton label="&cmd.remove.label;" accesskey="&cmd.remove.accesskey;"
|
||||
command="cmd_remove"/>
|
||||
<toolbarseparator/>
|
||||
|
@ -130,73 +108,90 @@
|
|||
|
||||
<tree id="downloadView" flex="1" class="plain"
|
||||
datasources="rdf:null" ref="NC:DownloadsRoot" flags="dont-test-empty"
|
||||
ondblclick="return goDoCommand('cmd_properties');" enableColumnDrag="true"
|
||||
onselect="onSelect(event);">
|
||||
enableColumnDrag="true"
|
||||
onselect="this.treeBoxObject.view.selectionChanged(); onSelect(event);">
|
||||
<treecols>
|
||||
<treecol id="Name" primary="true"
|
||||
label="&view.header.name.label;"
|
||||
label="&name.label;"
|
||||
class="sortDirectionIndicator" width="3*" flex="3"
|
||||
sort="http://home.netscape.com/NC-rdf#Name"
|
||||
persist="width sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="Progress" type="progressmeter"
|
||||
label="&view.header.progress.label;"
|
||||
class="sortDirectionIndicator" width="3*" flex="3"
|
||||
sort="http://home.netscape.com/NC-rdf#ProgressPercent"
|
||||
persist="width hidden sortActive sortDirection"
|
||||
sortActive="true" sortDirection="descending"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="ProgressPercent" hidden="true"
|
||||
label="&view.header.progresstext.label;"
|
||||
<treecol id="StatusText"
|
||||
label="&status.label;"
|
||||
class="sortDirectionIndicator" width="1*" flex="1"
|
||||
sort="http://home.netscape.com/NC-rdf#ProgressPercent"
|
||||
sort="http://home.netscape.com/NC-rdf#StatusText"
|
||||
persist="width hidden sortActive sortDirection"/>
|
||||
<!--
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="TimeRemaining"
|
||||
label="&view.header.timeremaining.label;"
|
||||
label="&timeremaining.label;"
|
||||
class="sortDirectionIndicator" width="1*" flex="1"
|
||||
sort="http://home.netscape.com/NC-rdf#TimeRemaining"
|
||||
persist="width hidden sortActive sortDirection"/>
|
||||
-->
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="Transferred"
|
||||
label="&view.header.transferred.label;"
|
||||
label="&transferred.label;"
|
||||
class="sortDirectionIndicator" width="1*" flex="1"
|
||||
sort="http://home.netscape.com/NC-rdf#Transferred"
|
||||
persist="width hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="TransferRate"
|
||||
label="&view.header.transferrate.label;"
|
||||
class="sortDirectionIndicator" width="1*" flex="1"
|
||||
sort="http://home.netscape.com/NC-rdf#TransferRate"
|
||||
persist="width hidden sortActive sortDirection"/>
|
||||
<!--
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="TimeElapsed" hidden="true"
|
||||
label="&view.header.timeelapsed.label;"
|
||||
label="&timeelapsed.label;"
|
||||
class="sortDirectionIndicator" width="1*" flex="1"
|
||||
sort="http://home.netscape.com/NC-rdf#TimeElapsed"
|
||||
persist="width hidden sortActive sortDirection"/>
|
||||
-->
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="Source" hidden="true"
|
||||
label="&view.header.source.label;"
|
||||
<treecol id="Source"
|
||||
label="&source.label;"
|
||||
class="sortDirectionIndicator" width="1*" flex="1"
|
||||
sort="http://home.netscape.com/NC-rdf#URL"
|
||||
persist="width hidden sortActive sortDirection"/>
|
||||
</treecols>
|
||||
<template>
|
||||
<rule>
|
||||
<rule nc:DownloadState="1" parseType="Integer">
|
||||
<treechildren>
|
||||
<treeitem uri="rdf:*">
|
||||
<treerow>
|
||||
<treecell src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecell mode="rdf:http://home.netscape.com/NC-rdf#ProgressMode"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#ProgressPercent"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#StatusText"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#ProgressPercent"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#TimeRemaining"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#StatusText"/>
|
||||
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeRemaining"/> -->
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Transferred"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#TransferRate"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#TimeElapsed"/>
|
||||
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeElapsed"/> -->
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
<rule nc:DownloadState="2" parseType="Integer">
|
||||
<treechildren>
|
||||
<treeitem uri="rdf:*">
|
||||
<treerow>
|
||||
<treecell src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#StatusText"/>
|
||||
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeRemaining"/> -->
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Transferred"/>
|
||||
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeElapsed"/> -->
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
<rule nc:DownloadState="3" parseType="Integer">
|
||||
<treechildren>
|
||||
<treeitem uri="rdf:*">
|
||||
<treerow>
|
||||
<treecell src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#StatusText"/>
|
||||
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeRemaining"/> -->
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Transferred"/>
|
||||
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeElapsed"/> -->
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
@ -204,9 +199,4 @@
|
|||
</rule>
|
||||
</template>
|
||||
</tree>
|
||||
|
||||
<statusbar id="status-bar" class="chromeclass-status">
|
||||
<statusbarpanel id="statusbar-text" label="" flex="1"/>
|
||||
</statusbar>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
browser.jar:
|
||||
content/browser/downloads/downloadmanager.xul (content/downloadmanager.xul)
|
||||
content/browser/downloads/downloadmanager.js (content/downloadmanager.js)
|
||||
content/browser/downloads/downloadPanel.js (content/downloadPanel.js)
|
||||
content/browser/downloads/downloadPanel.xul (content/downloadPanel.xul)
|
||||
content/browser/downloads/download-bindings.xml (content/download-bindings.xml)
|
||||
content/browser/downloads/downloadmanager.css (content/downloadmanager.css)
|
||||
|
||||
classic.jar:
|
||||
skin/classic/browser/downloads/downloadmanager.css (skin/downloadmanager.css)
|
||||
|
||||
en-US.jar:
|
||||
locale/en-US/browser/downloads/downloadmanager.dtd (locale/downloadmanager.dtd)
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
<!ENTITY view.header.name.label "Name">
|
||||
<!ENTITY view.header.progress.label "Progress">
|
||||
<!ENTITY view.header.status.label "Status">
|
||||
<!ENTITY view.header.timeremaining.label "Time Remaining">
|
||||
<!ENTITY view.header.transferred.label "Transferred">
|
||||
<!ENTITY view.header.transferrate.label "Speed">
|
||||
<!ENTITY view.header.timeelapsed.label "Time Elapsed">
|
||||
<!ENTITY view.header.progresstext.label "%">
|
||||
<!ENTITY view.header.source.label "Source">
|
||||
<!ENTITY name.label "Name">
|
||||
<!ENTITY progress.label "Progress">
|
||||
<!ENTITY status.label "Status">
|
||||
<!ENTITY timeremaining.label "Time Remaining">
|
||||
<!ENTITY transferred.label "Transferred">
|
||||
<!ENTITY transferrate.label "Speed">
|
||||
<!ENTITY timeelapsed.label "Time Elapsed">
|
||||
<!ENTITY status.label "Status">
|
||||
<!--<!ENTITY progresstext.label "%">-->
|
||||
<!ENTITY source.label "Source">
|
||||
|
||||
<!ENTITY done.label "Done">
|
||||
<!ENTITY cancel.label "Cancel">
|
||||
<!ENTITY cancelled.label "Cancelled">
|
||||
<!ENTITY launch.label "Launch">
|
||||
<!ENTITY divider.label "-">
|
||||
<!ENTITY show.label "Show">
|
||||
<!ENTITY failed.label "Failed">
|
||||
|
||||
<!ENTITY downloadManager.title "Download Manager">
|
||||
|
||||
|
@ -21,7 +30,6 @@
|
|||
<!ENTITY cmd.cancel.accesskey "c">
|
||||
<!ENTITY cmd.openfile.label "Launch File">
|
||||
<!ENTITY cmd.openfile.accesskey "L">
|
||||
<!ENTITY dm.tooltip "Toolbar">
|
||||
<!ENTITY confirmCancel "Are you sure you want to cancel the saving of this file?">
|
||||
<!ENTITY progressMsgNoRate "#1KB of #2KB">
|
||||
<!ENTITY rateMsg "#1KB/sec">
|
||||
|
|
|
@ -47,6 +47,7 @@ interface nsILocalFile;
|
|||
interface nsIDownload;
|
||||
interface nsIWebBrowserPersist;
|
||||
interface nsIMIMEInfo;
|
||||
interface nsIRDFDataSource;
|
||||
|
||||
[scriptable, uuid(9be66cc0-1dd1-11b2-8617-e3a3ed26e3b0)]
|
||||
interface nsIDownloadManager : nsISupports {
|
||||
|
@ -121,17 +122,6 @@ interface nsIDownloadManager : nsISupports {
|
|||
|
||||
// UI-related methods
|
||||
|
||||
/**
|
||||
* Opens the Download Manager front end.
|
||||
*
|
||||
* @param aParent The parent, or opener, of the front end (optional).
|
||||
* @param aDownload A download to pass to the manager window. Useful
|
||||
* if, for example, you want the window to select a
|
||||
* certain download (optional).
|
||||
*/
|
||||
|
||||
void open(in nsIDOMWindow aParent, in nsIDownload aDownload);
|
||||
|
||||
/**
|
||||
* Opens an individual progress dialog displaying progress for the download.
|
||||
*
|
||||
|
@ -143,13 +133,6 @@ interface nsIDownloadManager : nsISupports {
|
|||
|
||||
void openProgressDialogFor(in string aPersistentDescriptor, in nsIDOMWindow aParent);
|
||||
|
||||
/**
|
||||
* Called when the download manager front end is closed. Useful for
|
||||
* third party managers to let us know when they've closed.
|
||||
*/
|
||||
|
||||
void onClose();
|
||||
|
||||
/**
|
||||
* Indicate that a batch update (e.g. mass removal) is about to start.
|
||||
*/
|
||||
|
@ -161,6 +144,8 @@ interface nsIDownloadManager : nsISupports {
|
|||
*/
|
||||
|
||||
void endBatchUpdate();
|
||||
|
||||
readonly attribute nsIRDFDataSource datasource;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
page > #downloadView {
|
||||
background-color: white;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
download {
|
||||
padding: 3px;
|
||||
min-height: 25px;
|
||||
}
|
||||
|
||||
#downloadView > treechildren:-moz-tree-image(Name) {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.indented {
|
||||
margin-left: 17px;
|
||||
}
|
||||
|
||||
.link {
|
||||
text-decoration: underline;
|
||||
color: blue;
|
||||
cursor: pointer;
|
||||
-moz-user-focus: normal;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.link:hover:active {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.link:focus {
|
||||
border: 1px dotted black;
|
||||
}
|
|
@ -65,10 +65,12 @@
|
|||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static PRBool gQuitting = PR_FALSE;
|
||||
|
||||
#define DOWNLOAD_MANAGER_FE_URL "chrome://communicator/content/downloadmanager/downloadmanager.xul"
|
||||
#define DOWNLOAD_MANAGER_BUNDLE "chrome://communicator/locale/downloadmanager/downloadmanager.properties"
|
||||
#define DOWNLOAD_MANAGER_FE_URL "chrome://browser/content/downloadmanager/downloadmanager.xul"
|
||||
#define DOWNLOAD_MANAGER_BUNDLE "chrome://browser/locale/downloadmanager/downloadmanager.properties"
|
||||
#define INTERVAL 500
|
||||
#define DOWNLOAD_ENDED_TIMEOUT 5000
|
||||
|
||||
nsIRDFResource* gNC_DownloadsRoot;
|
||||
nsIRDFResource* gNC_File;
|
||||
|
@ -81,11 +83,12 @@ nsIRDFResource* gNC_DownloadState;
|
|||
nsIRDFResource* gNC_StatusText;
|
||||
|
||||
nsIRDFService* gRDFService;
|
||||
nsIObserverService* gObserverService;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsDownloadManager
|
||||
|
||||
NS_IMPL_ISUPPORTS3(nsDownloadManager, nsIDownloadManager, nsIDOMEventListener, nsIObserver)
|
||||
NS_IMPL_ISUPPORTS2(nsDownloadManager, nsIDownloadManager, nsIObserver)
|
||||
|
||||
nsDownloadManager::nsDownloadManager() : mBatches(0)
|
||||
{
|
||||
|
@ -111,6 +114,31 @@ nsDownloadManager::~nsDownloadManager()
|
|||
|
||||
}
|
||||
|
||||
void PR_CALLBACK nsDownloadManager::DownloadCallback(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
DownloadClosure* closure = (DownloadClosure*)aClosure;
|
||||
closure->DownloadManager->DownloadEnded(closure->path.get(), nsnull);
|
||||
delete aClosure;
|
||||
}
|
||||
|
||||
PRInt32 PR_CALLBACK nsDownloadManager::CancelAllDownloads(nsHashKey* aKey, void* aData, void* aClosure)
|
||||
{
|
||||
nsCStringKey* key = (nsCStringKey*)aKey;
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIDownloadManager> manager = do_QueryInterface((nsISupports*)aClosure, &rv);
|
||||
if (NS_FAILED(rv)) return kHashEnumerateRemove;
|
||||
|
||||
DownloadState state;
|
||||
NS_STATIC_CAST(nsDownload*, aData)->GetDownloadState(&state);
|
||||
if (state == NOTSTARTED || state == DOWNLOADING)
|
||||
manager->CancelDownload(key->GetString());
|
||||
else
|
||||
NS_STATIC_CAST(nsDownloadManager*, aClosure)->DownloadEnded(key->GetString(), nsnull);
|
||||
|
||||
return kHashEnumerateRemove;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDownloadManager::Init()
|
||||
{
|
||||
|
@ -118,10 +146,11 @@ nsDownloadManager::Init()
|
|||
mRDFContainerUtils = do_GetService("@mozilla.org/rdf/container-utils;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
rv = nsServiceManager::GetService("@mozilla.org/observer-service;1", NS_GET_IID(nsIObserverService),
|
||||
(nsISupports**) &gObserverService);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
obsService->AddObserver(this, "quit-application", PR_FALSE);
|
||||
gObserverService->AddObserver(this, "quit-application", PR_FALSE);
|
||||
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService),
|
||||
(nsISupports**) &gRDFService);
|
||||
|
@ -144,9 +173,6 @@ nsDownloadManager::Init()
|
|||
rv = gRDFService->GetDataSourceBlocking(downloadsDB.get(), getter_AddRefs(mDataSource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mListener = do_CreateInstance("@mozilla.org/download-manager/listener;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(kStringBundleServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -169,7 +195,9 @@ nsDownloadManager::DownloadEnded(const char* aPath, const PRUnichar* aMessage)
|
|||
nsCStringKey key(aPath);
|
||||
if (mCurrDownloads.Exists(&key)) {
|
||||
AssertProgressInfoFor(aPath);
|
||||
mCurrDownloads.Remove(&key);
|
||||
|
||||
if (!gQuitting)
|
||||
mCurrDownloads.Remove(&key);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -216,14 +244,6 @@ nsDownloadManager::GetDownloadsContainer(nsIRDFContainer** aResult)
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDownloadManager::GetInternalListener(nsIDownloadProgressListener** aInternalListener)
|
||||
{
|
||||
*aInternalListener = mListener;
|
||||
NS_IF_ADDREF(*aInternalListener);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDownloadManager::GetDataSource(nsIRDFDataSource** aDataSource)
|
||||
{
|
||||
|
@ -422,6 +442,10 @@ nsDownloadManager::AddDownload(nsIURI* aSource,
|
|||
rv = aTarget->GetNativePath(path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCStringKey key(path);
|
||||
if (mCurrDownloads.Exists(&key))
|
||||
CancelDownload(path.get());
|
||||
|
||||
nsCOMPtr<nsIRDFResource> downloadRes;
|
||||
gRDFService->GetResource(path.get(), getter_AddRefs(downloadRes));
|
||||
|
||||
|
@ -518,10 +542,6 @@ nsDownloadManager::AddDownload(nsIURI* aSource,
|
|||
aPersist->SetProgressListener(listener);
|
||||
}
|
||||
|
||||
nsCStringKey key(path);
|
||||
if (mCurrDownloads.Exists(&key))
|
||||
mCurrDownloads.Remove(&key);
|
||||
|
||||
mCurrDownloads.Put(&key, *aDownload);
|
||||
|
||||
return rv;
|
||||
|
@ -579,9 +599,11 @@ nsDownloadManager::CancelDownload(const char* aPath)
|
|||
rv = observer->Observe(download, "oncancel", nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
gObserverService->NotifyObservers(download, "dl-cancel", nsnull);
|
||||
|
||||
DownloadEnded(aPath, nsnull);
|
||||
|
||||
|
||||
// if there's a progress dialog open for the item,
|
||||
// we have to notify it that we're cancelling
|
||||
nsCOMPtr<nsIProgressDialog> dialog;
|
||||
|
@ -688,59 +710,13 @@ nsDownloadManager::EndBatchUpdate()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDownloadManager::Open(nsIDOMWindow* aParent, nsIDownload* aDownload)
|
||||
nsDownloadManager::GetDatasource(nsIRDFDataSource** aDatasource)
|
||||
{
|
||||
|
||||
// first assert new progress info so the ui is correctly updated
|
||||
// if this fails, it fails -- continue.
|
||||
AssertProgressInfo();
|
||||
|
||||
//check for an existing manager window and focus it
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWindowMediator> wm = do_GetService(NS_WINDOWMEDIATOR_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISupports> dlSupports(do_QueryInterface(aDownload));
|
||||
|
||||
// if the window's already open, do nothing (focusing it would be annoying)
|
||||
nsCOMPtr<nsIDOMWindowInternal> recentWindow;
|
||||
wm->GetMostRecentWindow(NS_LITERAL_STRING("Download:Manager").get(), getter_AddRefs(recentWindow));
|
||||
if (recentWindow) {
|
||||
nsCOMPtr<nsIObserverService> obsService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return obsService->NotifyObservers(dlSupports, "download-starting", nsnull);
|
||||
}
|
||||
|
||||
// if we ever have the capability to display the UI of third party dl managers,
|
||||
// we'll open their UI here instead.
|
||||
nsCOMPtr<nsIWindowWatcher> ww = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// pass the datasource to the window
|
||||
nsCOMPtr<nsISupportsArray> params(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID));
|
||||
nsCOMPtr<nsISupports> dsSupports(do_QueryInterface(mDataSource));
|
||||
params->AppendElement(dsSupports);
|
||||
params->AppendElement(dlSupports);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
rv = ww->OpenWindow(aParent,
|
||||
DOWNLOAD_MANAGER_FE_URL,
|
||||
"_blank",
|
||||
"chrome,all,dialog=no,resizable",
|
||||
params,
|
||||
getter_AddRefs(newWindow));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(newWindow);
|
||||
if (!target) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = target->AddEventListener(NS_LITERAL_STRING("load"), this, PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return target->AddEventListener(NS_LITERAL_STRING("unload"), this, PR_FALSE);
|
||||
*aDatasource = mDataSource;
|
||||
NS_IF_ADDREF(*aDatasource);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDownloadManager::OpenProgressDialogFor(const char* aPath, nsIDOMWindow* aParent)
|
||||
{
|
||||
|
@ -772,8 +748,6 @@ nsDownloadManager::OpenProgressDialogFor(const char* aPath, nsIDOMWindow* aParen
|
|||
nsCOMPtr<nsIProgressDialog> dialog(do_CreateInstance("@mozilla.org/progressdialog;1", &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
dialog->SetCancelDownloadOnClose(PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIDownload> dl = do_QueryInterface(dialog);
|
||||
|
||||
// now give the dialog the necessary context
|
||||
|
@ -806,36 +780,6 @@ nsDownloadManager::OpenProgressDialogFor(const char* aPath, nsIDOMWindow* aParen
|
|||
return dialog->Open(aParent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDownloadManager::OnClose()
|
||||
{
|
||||
mDocument = nsnull;
|
||||
mListener->SetDocument(nsnull);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIDOMEventListener
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDownloadManager::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
// the event is either load or unload
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
if (eventType.Equals(NS_LITERAL_STRING("unload")))
|
||||
return OnClose();
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
nsresult rv = aEvent->GetTarget(getter_AddRefs(target));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> targetNode(do_QueryInterface(target));
|
||||
mDocument = do_QueryInterface(targetNode);
|
||||
mListener->SetDocument(mDocument);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIObserver
|
||||
|
||||
|
@ -861,27 +805,9 @@ nsDownloadManager::Observe(nsISupports* aSubject, const char* aTopic, const PRUn
|
|||
return CancelDownload(path.get());
|
||||
}
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, "quit-application") == 0) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
const char* uri;
|
||||
nsCOMPtr<nsIRDFInt> intLiteral;
|
||||
|
||||
gRDFService->GetIntLiteral(DOWNLOADING, getter_AddRefs(intLiteral));
|
||||
nsCOMPtr<nsISimpleEnumerator> downloads;
|
||||
rv = mDataSource->GetSources(gNC_DownloadState, intLiteral, PR_TRUE, getter_AddRefs(downloads));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool hasMoreElements;
|
||||
downloads->HasMoreElements(&hasMoreElements);
|
||||
|
||||
while (hasMoreElements) {
|
||||
downloads->GetNext(getter_AddRefs(supports));
|
||||
res = do_QueryInterface(supports);
|
||||
res->GetValueConst(&uri);
|
||||
CancelDownload(uri);
|
||||
downloads->HasMoreElements(&hasMoreElements);
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, "quit-application") == 0 && mCurrDownloads.Count()) {
|
||||
gQuitting = PR_TRUE;
|
||||
mCurrDownloads.Enumerate(CancelAllDownloads, this);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -903,11 +829,6 @@ nsDownload::nsDownload():mDownloadState(NOTSTARTED),
|
|||
|
||||
nsDownload::~nsDownload()
|
||||
{
|
||||
nsCAutoString path;
|
||||
nsresult rv = mTarget->GetNativePath(path);
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
mDownloadManager->AssertProgressInfoFor(path.get());
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1023,7 +944,7 @@ nsDownload::OnProgressChange(nsIWebProgress *aWebProgress,
|
|||
PRTime delta;
|
||||
PRTime now = PR_Now();
|
||||
LL_SUB(delta, now, mLastUpdate);
|
||||
if (LL_CMP(delta, <, INTERVAL) && aMaxTotalProgress != -1 && aCurTotalProgress < aMaxTotalProgress)
|
||||
if (LL_CMP(delta, <, INTERVAL) && aMaxTotalProgress != -1 && aCurTotalProgress < aMaxTotalProgress)
|
||||
return NS_OK;
|
||||
|
||||
mLastUpdate = now;
|
||||
|
@ -1050,14 +971,7 @@ nsDownload::OnProgressChange(nsIWebProgress *aWebProgress,
|
|||
aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
|
||||
if (mDownloadManager->MustUpdateUI()) {
|
||||
nsCOMPtr<nsIDownloadProgressListener> internalListener;
|
||||
mDownloadManager->GetInternalListener(getter_AddRefs(internalListener));
|
||||
if (internalListener) {
|
||||
internalListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress, this);
|
||||
}
|
||||
}
|
||||
gObserverService->NotifyObservers(NS_STATIC_CAST(nsIDownload *, this), "dl-progress", nsnull);
|
||||
|
||||
if (mDialogListener) {
|
||||
mDialogListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress,
|
||||
|
@ -1071,19 +985,6 @@ NS_IMETHODIMP
|
|||
nsDownload::OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsIURI *aLocation)
|
||||
{
|
||||
if (mListener)
|
||||
mListener->OnLocationChange(aWebProgress, aRequest, aLocation);
|
||||
|
||||
if (mDownloadManager->MustUpdateUI()) {
|
||||
nsCOMPtr<nsIDownloadProgressListener> internalListener;
|
||||
mDownloadManager->GetInternalListener(getter_AddRefs(internalListener));
|
||||
if (internalListener)
|
||||
internalListener->OnLocationChange(aWebProgress, aRequest, aLocation, this);
|
||||
}
|
||||
|
||||
if (mDialogListener)
|
||||
mDialogListener->OnLocationChange(aWebProgress, aRequest, aLocation);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1096,20 +997,26 @@ nsDownload::OnStatusChange(nsIWebProgress *aWebProgress,
|
|||
mDownloadState = FAILED;
|
||||
nsCAutoString path;
|
||||
nsresult rv = mTarget->GetNativePath(path);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mDownloadManager->DownloadEnded(path.get(), aMessage);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
gObserverService->NotifyObservers(NS_STATIC_CAST(nsIDownload *, this), "dl-failed", nsnull);
|
||||
|
||||
if (mTimer)
|
||||
mTimer->Cancel();
|
||||
|
||||
if (!mTimer)
|
||||
mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
DownloadClosure* closure = new DownloadClosure();
|
||||
closure->DownloadManager = mDownloadManager;
|
||||
closure->path = path;
|
||||
mTimer->InitWithFuncCallback(nsDownloadManager::DownloadCallback, (void*)closure, DOWNLOAD_ENDED_TIMEOUT, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
}
|
||||
|
||||
if (mListener)
|
||||
mListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
|
||||
if (mDownloadManager->MustUpdateUI()) {
|
||||
nsCOMPtr<nsIDownloadProgressListener> internalListener;
|
||||
mDownloadManager->GetInternalListener(getter_AddRefs(internalListener));
|
||||
if (internalListener)
|
||||
internalListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage, this);
|
||||
}
|
||||
|
||||
if (mDialogListener)
|
||||
mDialogListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
else {
|
||||
|
@ -1152,13 +1059,6 @@ nsDownload::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
if (mListener)
|
||||
mListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
||||
|
||||
if (mDownloadManager->MustUpdateUI()) {
|
||||
nsCOMPtr<nsIDownloadProgressListener> internalListener;
|
||||
mDownloadManager->GetInternalListener(getter_AddRefs(internalListener));
|
||||
if (internalListener)
|
||||
internalListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus, this);
|
||||
}
|
||||
|
||||
if (mDialogListener)
|
||||
mDialogListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
||||
|
||||
|
@ -1171,11 +1071,20 @@ nsDownload::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
mCurrBytes = mMaxBytes;
|
||||
mPercentComplete = 100;
|
||||
|
||||
gObserverService->NotifyObservers(NS_STATIC_CAST(nsIDownload *, this), "dl-done", nsnull);
|
||||
|
||||
nsCAutoString path;
|
||||
nsresult rv = mTarget->GetNativePath(path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mDownloadManager->DownloadEnded(path.get(), nsnull);
|
||||
if (!mTimer)
|
||||
mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
DownloadClosure* closure = new DownloadClosure();
|
||||
closure->DownloadManager = mDownloadManager;
|
||||
closure->path = path;
|
||||
mTimer->InitWithFuncCallback(nsDownloadManager::DownloadCallback, (void*)closure, DOWNLOAD_ENDED_TIMEOUT, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
// break the cycle we created in AddDownload
|
||||
|
@ -1190,19 +1099,6 @@ NS_IMETHODIMP
|
|||
nsDownload::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, PRUint32 aState)
|
||||
{
|
||||
if (mListener)
|
||||
mListener->OnSecurityChange(aWebProgress, aRequest, aState);
|
||||
|
||||
if (mDownloadManager->MustUpdateUI()) {
|
||||
nsCOMPtr<nsIDownloadProgressListener> internalListener;
|
||||
mDownloadManager->GetInternalListener(getter_AddRefs(internalListener));
|
||||
if (internalListener)
|
||||
internalListener->OnSecurityChange(aWebProgress, aRequest, aState, this);
|
||||
}
|
||||
|
||||
if (mDialogListener)
|
||||
mDialogListener->OnSecurityChange(aWebProgress, aRequest, aState);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1291,6 +1187,7 @@ nsDownload::GetPercentComplete(PRInt32* aPercentComplete)
|
|||
NS_IMETHODIMP
|
||||
nsDownload::SetListener(nsIWebProgressListener* aListener)
|
||||
{
|
||||
printf("SET LISTENER...\n");
|
||||
mListener = aListener;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "nsIRDFRemoteDataSource.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIRDFContainerUtils.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIURI.h"
|
||||
|
@ -59,17 +58,16 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsIProgressDialog.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
|
||||
#include "nsITimer.h"
|
||||
|
||||
enum DownloadState { NOTSTARTED = -1, DOWNLOADING, FINISHED, FAILED, CANCELED };
|
||||
|
||||
class nsDownloadManager : public nsIDownloadManager,
|
||||
public nsIDOMEventListener,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOWNLOADMANAGER
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
nsresult Init();
|
||||
|
@ -77,22 +75,22 @@ public:
|
|||
nsDownloadManager();
|
||||
virtual ~nsDownloadManager();
|
||||
|
||||
static void PR_CALLBACK DownloadCallback(nsITimer *aTimer, void *aClosure);
|
||||
static PRInt32 PR_CALLBACK CancelAllDownloads(nsHashKey* aKey, void* aData, void* aClosure);
|
||||
nsresult DownloadEnded(const char* aPersistentDescriptor, const PRUnichar* aMessage);
|
||||
|
||||
protected:
|
||||
nsresult GetDownloadsContainer(nsIRDFContainer** aResult);
|
||||
nsresult GetProfileDownloadsFileURL(nsCString& aDownloadsFileURL);
|
||||
nsresult GetInternalListener(nsIDownloadProgressListener** aInternalListener);
|
||||
nsresult GetDataSource(nsIRDFDataSource** aDataSource);
|
||||
nsresult AssertProgressInfo();
|
||||
nsresult AssertProgressInfoFor(const char* aPersistentDescriptor);
|
||||
nsresult DownloadStarted(const char* aPersistentDescriptor);
|
||||
nsresult DownloadEnded(const char* aPersistentDescriptor, const PRUnichar* aMessage);
|
||||
PRBool MustUpdateUI() { if (mDocument) return PR_TRUE; return PR_FALSE; }
|
||||
nsresult AssertProgressInfoFor(const char* aPersistentDescriptor);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIRDFDataSource> mDataSource;
|
||||
nsCOMPtr<nsIDOMDocument> mDocument;
|
||||
nsCOMPtr<nsIRDFContainer> mDownloadsContainer;
|
||||
nsCOMPtr<nsIDownloadProgressListener> mListener;
|
||||
nsCOMPtr<nsIRDFContainerUtils> mRDFContainerUtils;
|
||||
nsCOMPtr<nsIStringBundle> mBundle;
|
||||
PRInt32 mBatches;
|
||||
|
@ -101,6 +99,11 @@ private:
|
|||
friend class nsDownload;
|
||||
};
|
||||
|
||||
struct DownloadClosure {
|
||||
nsDownloadManager* DownloadManager;
|
||||
nsCString path;
|
||||
};
|
||||
|
||||
class nsDownload : public nsIDownload,
|
||||
public nsIWebProgressListener
|
||||
{
|
||||
|
@ -140,6 +143,7 @@ private:
|
|||
nsCOMPtr<nsIProgressDialog> mDialog;
|
||||
nsCOMPtr<nsIObserver> mObserver;
|
||||
nsCOMPtr<nsIMIMEInfo> mMIMEInfo;
|
||||
|
||||
DownloadState mDownloadState;
|
||||
|
||||
PRInt32 mPercentComplete;
|
||||
|
@ -147,6 +151,7 @@ private:
|
|||
PRInt32 mMaxBytes;
|
||||
PRInt64 mStartTime;
|
||||
PRTime mLastUpdate;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
|
||||
friend class nsDownloadManager;
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
|
||||
#define DOWNLOAD_MANAGER_BEHAVIOR_PREF "browser.downloadmanager.behavior"
|
||||
#define USE_PROGRESS_DIALOGS_PREF "browser.downloads.useProgressDialogs"
|
||||
|
||||
class nsDownloadProxy : public nsIDownload,
|
||||
public nsIWebProgressListener
|
||||
|
@ -70,15 +70,13 @@ public:
|
|||
rv = dm->AddDownload(aSource, aTarget, aDisplayName, aMIMEInfo, aStartTime, aPersist, getter_AddRefs(mInner));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 behavior = 0;
|
||||
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);
|
||||
|
||||
branch->GetIntPref(DOWNLOAD_MANAGER_BEHAVIOR_PREF, &behavior);
|
||||
if (behavior == 0)
|
||||
return dm->Open(nsnull, this);
|
||||
if (behavior == 1) {
|
||||
PRBool useProgressDialogs = PR_TRUE;
|
||||
branch->GetBoolPref(USE_PROGRESS_DIALOGS_PREF, &useProgressDialogs);
|
||||
if (useProgressDialogs) {
|
||||
nsCAutoString path;
|
||||
rv = aTarget->GetNativePath(path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -35,17 +35,13 @@ splitter {
|
|||
cursor: e-resize;
|
||||
border: 2px solid;
|
||||
-moz-border-top-colors: ThreeDHighlight ThreeDLightShadow;
|
||||
-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
|
||||
-moz-border-right-colors: transparent;
|
||||
-moz-border-bottom-colors: ThreeDShadow ThreeDLightShadow;
|
||||
-moz-border-left-colors: ThreeDDarkShadow ThreeDHighlight;
|
||||
min-width: 8px;
|
||||
-moz-border-left-colors: ThreeDShadow ThreeDHighlight;
|
||||
min-width: 5px;
|
||||
background-color: ThreeDFace;
|
||||
}
|
||||
|
||||
splitter[state="dragging"] {
|
||||
background-image: url("chrome://global/skin/splitter/drag-bg.gif");
|
||||
}
|
||||
|
||||
/* ::::: splitter (horizontal) ::::: */
|
||||
|
||||
splitter[orient="vertical"] {
|
||||
|
|
Загрузка…
Ссылка в новой задаче