зеркало из https://github.com/mozilla/pjs.git
changes for #120421. progress UI (and driving code) for LDAP replication.
initial work by srilatha. NOT PART OF THE BUILD. a=asa
This commit is contained in:
Родитель
a2a4dae41d
Коммит
c9a4f09351
|
@ -0,0 +1,147 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Srilatha Moturi <srilatha@netscape.com>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rajiv Dayal <rdayal@netscape.com>
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
*
|
||||
* 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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gCurrentDirectoryPrefName;
|
||||
var gReplicationService = Components.classes["@mozilla.org/addressbook/ldap-replication-service;1"].getService(Components.interfaces.nsIAbLDAPReplicationService);
|
||||
var gProgressText;
|
||||
var gProgressMeter;
|
||||
var gReplicationBundle;
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
var dirName;
|
||||
|
||||
if (window.arguments[0]) {
|
||||
dirName = window.arguments[0].dirName;
|
||||
gCurrentDirectoryPrefName = window.arguments[0].prefName;
|
||||
}
|
||||
|
||||
gProgressText = document.getElementById("replication.status");
|
||||
gProgressMeter = document.getElementById("replication.progress");
|
||||
gReplicationBundle = document.getElementById("bundle_replication");
|
||||
|
||||
window.title = gReplicationBundle.getFormattedString("replicatingTitle", [dirName])
|
||||
|
||||
Replicate();
|
||||
}
|
||||
|
||||
function DoReplicationClose()
|
||||
{
|
||||
// XXX todo, confirm the cancel
|
||||
onCancelReplication(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
var progressListener = {
|
||||
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus)
|
||||
{
|
||||
if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_START) {
|
||||
// start the spinning
|
||||
gProgressMeter.setAttribute("mode","undetermined");
|
||||
if (aStatus)
|
||||
SetProgressText(gReplicationBundle.getString("replicationStarted"));
|
||||
else
|
||||
SetProgressText(gReplicationBundle.getString("changesStarted"));
|
||||
}
|
||||
|
||||
if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) {
|
||||
// stop the spinning
|
||||
gProgressMeter.setAttribute("mode","normal");
|
||||
gProgressMeter.setAttribute("value", "100");
|
||||
|
||||
if (aStatus) {
|
||||
SetProgressText(gReplicationBundle.getString("replicationSucceeded"));
|
||||
}
|
||||
else {
|
||||
SetProgressText(gReplicationBundle.getString("replicationFailed"));
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
},
|
||||
onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
|
||||
{
|
||||
SetProgressText(gReplicationBundle.getFormattedString("currentCount", [aCurSelfProgress]));
|
||||
},
|
||||
onLocationChange: function(aWebProgress, aRequest, aLocation)
|
||||
{
|
||||
},
|
||||
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage)
|
||||
{
|
||||
},
|
||||
onSecurityChange: function(aWebProgress, aRequest, state)
|
||||
{
|
||||
},
|
||||
QueryInterface : function(iid)
|
||||
{
|
||||
if (iid.equals(Components.interfaces.nsIWebProgressListener) ||
|
||||
iid.equals(Components.interfaces.nsISupportsWeakReference))
|
||||
return this;
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
}
|
||||
};
|
||||
|
||||
function Replicate()
|
||||
{
|
||||
try {
|
||||
gReplicationService.startReplication(gCurrentDirectoryPrefName, progressListener);
|
||||
}
|
||||
catch (ex) {
|
||||
// XXX todo
|
||||
// are you offline? If so, you need to go offline to use this
|
||||
dump("replication failed. ex=" + ex + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
function onCancelReplication(closeWindow)
|
||||
{
|
||||
try {
|
||||
gReplicationService.cancelReplication(gCurrentDirectoryPrefName);
|
||||
}
|
||||
catch (ex) {
|
||||
// XXX todo
|
||||
// perhaps replication hasn't started yet? This can happen if you hit cancel after attempting to replication when offline
|
||||
dump("unexpected failure while cancelling. ex=" + ex + "\n");
|
||||
if (closeWindow)
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
function SetProgressText(textStr)
|
||||
{
|
||||
gProgressText.value = textStr;
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla 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/MPL/
|
||||
-
|
||||
- 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.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Srilatha Moturi <srilatha@netscape.com>
|
||||
- Portions created by the Initial Developer are Copyright (C) 2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Rajiv Dayal <rdayal@netscape.com>
|
||||
- Seth Spitzer <sspitzer@netscape.com>
|
||||
-
|
||||
- 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 MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. 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 MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://messenger/locale/addressbook/replicationProgress.dtd">
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="replicationProgress"
|
||||
onload="onLoad()"
|
||||
onclose="return DoReplicationClose()">
|
||||
|
||||
<stringbundle id="bundle_replication" src="chrome://messenger/locale/addressbook/replicationProgress.properties"/>
|
||||
<script type="application/x-javascript" src="chrome://messenger/content/addressbook/replicationProgress.js"/>
|
||||
|
||||
<grid flex="1">
|
||||
<columns>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
|
||||
<rows>
|
||||
<row>
|
||||
<hbox pack="end">
|
||||
<label value="&status.label;"/>
|
||||
</hbox>
|
||||
<label id="replication.status"/>
|
||||
</row>
|
||||
<row class="thin-separator">
|
||||
<hbox pack="end">
|
||||
<label value="&progress.label;"/>
|
||||
</hbox>
|
||||
<progressmeter id="replication.progress" mode="normal" value="0"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator/>
|
||||
<hbox id="CancelButton" pack="end">
|
||||
<button id="cancel" label="&replicationCancel.label;" accesskey="&replicationCancel.accesskey;" oncommand="onCancelReplication(true);"/>
|
||||
</hbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,41 @@
|
|||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla 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/MPL/
|
||||
-
|
||||
- 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.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Srilatha Moturi <srilatha@netscape.com>
|
||||
- Portions created by the Initial Developer are Copyright (C) 2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Rajiv Dayal <rdayal@netscape.com>
|
||||
- Seth Spitzer <sspitzer@netscape.com>
|
||||
-
|
||||
- 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 MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. 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 MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
<!ENTITY status.label "Status:">
|
||||
<!ENTITY progress.label "Progress:">
|
||||
<!ENTITY replicationCancel.label "Cancel">
|
||||
<!ENTITY replicationCancel.accesskey "C">
|
|
@ -0,0 +1,43 @@
|
|||
#***** BEGIN LICENSE BLOCK *****
|
||||
#Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
#The contents of this file are subject to the Mozilla 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/MPL/
|
||||
#
|
||||
#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.
|
||||
#
|
||||
#The Initial Developer of the Original Code is
|
||||
# Srilatha Moturi <srilatha@netscape.com>.
|
||||
#Portions created by the Initial Developer are Copyright (C) 2002
|
||||
#the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
#Contributor(s):
|
||||
# Rajiv Dayal <rdayal@netscape.com>
|
||||
# Seth Spitzer <sspitzer@netscape.com>
|
||||
#
|
||||
#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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
#
|
||||
#***** END LICENSE BLOCK *****
|
||||
replicationStarted=Replication started...
|
||||
changesStarted=Started finding changes to replicate...
|
||||
replicationSucceeded=Replication succeeded
|
||||
replicationFailed=Replication failed
|
||||
currentCount=Replicated %S entries so far...
|
||||
replicatingTitle=Replicating %S
|
|
@ -6,6 +6,8 @@ messenger.jar:
|
|||
content/messenger/addressbook/pref-directory.js (addrbook/prefs/resources/content/pref-directory.js)
|
||||
content/messenger/addressbook/pref-directory-add.js (addrbook/prefs/resources/content/pref-directory-add.js)
|
||||
content/messenger/addressbook/pref-directory-add.xul (addrbook/prefs/resources/content/pref-directory-add.xul)
|
||||
content/messenger/addressbook/replicationProgress.xul (addrbook/prefs/resources/content/replicationProgress.xul)
|
||||
content/messenger/addressbook/replicationProgress.js (addrbook/prefs/resources/content/replicationProgress.js)
|
||||
content/messenger/addressbook/pref-editdirectories.xul (addrbook/prefs/resources/content/pref-editdirectories.xul)
|
||||
content/messenger/addressbook/abAddressBookNameDialog.js (addrbook/resources/content/abAddressBookNameDialog.js)
|
||||
content/messenger/addressbook/abAddressBookNameDialog.xul (addrbook/resources/content/abAddressBookNameDialog.xul)
|
||||
|
@ -275,6 +277,8 @@ en-US.jar:
|
|||
locale/en-US/messenger/addressbook/pref-addressing.dtd (addrbook/prefs/resources/locale/en-US/pref-addressing.dtd)
|
||||
locale/en-US/messenger/addressbook/pref-directory.dtd (addrbook/prefs/resources/locale/en-US/pref-directory.dtd)
|
||||
locale/en-US/messenger/addressbook/pref-directory-add.dtd (addrbook/prefs/resources/locale/en-US/pref-directory-add.dtd)
|
||||
locale/en-US/messenger/addressbook/replicationProgress.dtd (addrbook/prefs/resources/locale/en-US/replicationProgress.dtd)
|
||||
locale/en-US/messenger/addressbook/replicationProgress.properties (addrbook/prefs/resources/locale/en-US/replicationProgress.properties)
|
||||
locale/en-US/messenger/mime.properties (mime/resources/mime.properties)
|
||||
locale/en-US/messenger/mimeheader.properties (mime/resources/mimeheader.properties)
|
||||
locale/en-US/messenger/vcard.properties (mime/cthandlers/resources/vcard.properties)
|
||||
|
|
Загрузка…
Ссылка в новой задаче