зеркало из https://github.com/mozilla/pjs.git
more work on offline startup prompt, 221734, address Seth and Neil's comments, not part of build yet
This commit is contained in:
Родитель
96e46326e4
Коммит
93369c5c46
|
@ -9,12 +9,7 @@
|
|||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The JavaScript Debugger
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation
|
||||
# Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation.
|
||||
# The Original Code is The Offline Startup Manager
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the
|
||||
# terms of the GNU Public License (the "GPL"), in which case the
|
||||
|
@ -45,6 +40,3 @@ DIRS = resources
|
|||
EXTRA_COMPONENTS = js/offlineStartup.js
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
install::
|
||||
@$(REGCHROME_INSTALL) locale en-US/offlineStartup en-US.jar
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
en-US.jar:
|
||||
locale/en-US/offline-startup/contents.rdf (resources/locale/en-US/contents.rdf)
|
||||
locale/en-US/offline-startup/offlineStartup.properties (resources/locale/en-US/offlineStartup.properties)
|
||||
locale/en-US/messenger/offlineStartup.properties (resources/locale/en-US/offlineStartup.properties)
|
||||
|
|
|
@ -32,10 +32,12 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
const kDebug = false;
|
||||
const kUNBundleURI = "chrome://messenger/locale/offlineStartup.properties";
|
||||
const kBundleURI = "chrome://messenger/locale/offlineStartup.properties";
|
||||
const kOfflineStartupPref = "offline.startup_state";
|
||||
var gShuttingDown = false;
|
||||
var gOfflineStartupMode; //0 = remember last state, 1 = ask me, 2 == online, 3 == offline
|
||||
const kRememberLastState = 0;
|
||||
const kAskForOnlineState = 1;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// nsOfflineStartup : nsIProfileStartupListener, nsIObserver
|
||||
|
@ -58,7 +60,7 @@ var nsOfflineStartup =
|
|||
|
||||
gOfflineStartupMode = prefs.getIntPref(kOfflineStartupPref);
|
||||
|
||||
if (gOfflineStartupMode == 0)
|
||||
if (gOfflineStartupMode == kRememberLastState)
|
||||
{
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
|
@ -71,20 +73,20 @@ var nsOfflineStartup =
|
|||
observerService.addObserver(this, "network:offline-status-changed", false);
|
||||
observerService.addObserver(this, "quit-application", false);
|
||||
}
|
||||
else if (gOfflineStartupMode == 1)
|
||||
else if (gOfflineStartupMode == kAskForOnlineState)
|
||||
{
|
||||
var promptService = Components.
|
||||
classes["@mozilla.org/embedcomp/prompt-service;1"].
|
||||
getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
var unBundle = getBundle(kUNBundleURI);
|
||||
if (!unBundle)
|
||||
var bundle = getBundle(kBundleURI);
|
||||
if (!bundle)
|
||||
return;
|
||||
|
||||
var title = unBundle.GetStringFromName("title");
|
||||
var desc = unBundle.GetStringFromName("desc");
|
||||
var button0Text = unBundle.GetStringFromName("workOnline");
|
||||
var button1Text = unBundle.GetStringFromName("workOffline");
|
||||
var title = bundle.GetStringFromName("title");
|
||||
var desc = bundle.GetStringFromName("desc");
|
||||
var button0Text = bundle.GetStringFromName("workOnline");
|
||||
var button1Text = bundle.GetStringFromName("workOffline");
|
||||
var checkVal = {value:0};
|
||||
|
||||
var result = promptService.confirmEx(null, title, desc,
|
||||
|
@ -105,10 +107,7 @@ var nsOfflineStartup =
|
|||
{
|
||||
debug("observe: " + aTopic);
|
||||
|
||||
if (aTopic == "domwindowopened")
|
||||
{
|
||||
}
|
||||
else if (aTopic == "network:offline-status-changed")
|
||||
if (aTopic == "network:offline-status-changed")
|
||||
{
|
||||
debug("network:offline-status-changed: " + aData);
|
||||
// if we're not shutting down, and startup mode is "remember online state"
|
||||
|
|
Загрузка…
Ссылка в новой задаче