- removed alert()s

- removed unnecessary strings in string bundle
- smaller fixes as usual


git-svn-id: svn://10.0.0.236/branches/BEONEX_0_8_BRANCH@143785 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mozilla.BenB%bucksch.org
2003-06-17 05:23:49 +00:00
parent 369a6a628d
commit 52d78bb784
7 changed files with 113 additions and 96 deletions

View File

@@ -3,7 +3,7 @@ todo:
- license headers
- nsresult for internal functions, clean up interfaces
- warn before saving pw
- alert() -> nsiprompt or dialog
- experimental warning
- remove printfs
- XXXs
- firebird/thunderbird extension
@@ -18,8 +18,14 @@ don't care (for now):
- problem: cancel by user in progress dialog: xpconnect errors
solution: prevent dialog closure (even if cancel pressed) until we're done.
- listing progressmeter doesn't work
- If one file is missing on both server and client and we didn't upload, but
there is no conflict, we still show one. That's due to that commented-out
check in compareFiles(). Mind the warning there and fix it.
- no preselection in conflict dialog
- not using statusText for FTP errors (file not readable in this case)
Enhance
- better error dialog
- protocols
- HTTPS
- LDAP (already done by Sun?)

View File

@@ -299,7 +299,7 @@ function download(transfer, remoteListing)
// avoid conflicts for files which don't exist on server or locally
var conflicts = substractFiles(comparisonStep2aa.mismatches,
missingRemote.concat(missingLocal));
addFiles(missingRemote, missingLocal));
if (conflicts.length > 0)
{
@@ -315,7 +315,7 @@ function download(transfer, remoteListing)
onCancel();
return;
}
keepLocalVersionFiles = keepLocalVersionFiles.concat(answer.local);
keepLocalVersionFiles =addFiles(keepLocalVersionFiles, answer.local);
}
}
}
@@ -398,7 +398,7 @@ function upload(transfer, remoteListing)
// avoid conflicts for files which don't exist on server or locally
var conflicts = substractFiles(comparisonStep2a.mismatches,
missingRemote.concat(missingLocal));
addFiles(missingRemote, missingLocal));
if (conflicts.length == 0)
{
@@ -423,7 +423,7 @@ function upload(transfer, remoteListing)
return;
}
uploadStep4(transfer, localFiles, remoteListing,
missingLocal.concat(answer.server));
addFiles(missingLocal, answer.server));
}
}, false);
}
@@ -444,7 +444,8 @@ function uploadStep4(transfer, localFiles, remoteFiles, keepServerVersionFiles)
ddump("Step 5: Generating listing file based on facts");
var filesDone = extractFiles(transfer.filesWithStatus("done"),
localFiles);
createListingFile(filesDone.concat(substractFiles(remoteFiles, filesDone)),
createListingFile(addFiles(filesDone,
substractFiles(remoteFiles, filesDone)),
kListingTransferFilename);
ddump("Step 6: Uploading listing file to server");
@@ -530,7 +531,7 @@ function compareFiles(filesList, files1, files2)
var matches = (f1 && f2
&& f1.size == f2.size
&& f1.lastModified == f2.lastModified);
//if (!f1 && !f2) needed? Would break current conflict logic
//if (!f1 && !f2) needed? Would break current conflict logic (|missing*|)
// matches = true;
ddump(filename + (matches ? " matches" : " doesn't match"));
@@ -598,6 +599,20 @@ function substractFiles(files1, filesList)
return result;
}
/*
Returns files1 + files2, i.e. returns all entries of files1 and
all entries of files2. It is *not* garanteed that every entry appears
only once in the result.
@param files1 FilesList
@param files2 FilesList
@result FilesStats Superset of files1 and files2
*/
function addFiles(files1, files2)
{
return files1.concat(files2);
}
/*
Returns |files|'s entry which matches |filename|.

View File

@@ -48,7 +48,6 @@ function Startup()
ddump("In sroaming/transfer/progressDialog::Startup()");
gDialog.FileList = document.getElementById("FileList");
gDialog.FinalStatusMessage = document.getElementById("FinalStatusMessage");
gDialog.StatusMessage = document.getElementById("StatusMessage");
gDialog.ListingProgress = document.getElementById("ListingProgress");
gDialog.Close = document.documentElement.getButton("cancel");
@@ -63,7 +62,7 @@ function Startup()
/* All kinds of exceptions should end up here, esp. from init, meaning
this is the main last backstop for unexpected or fatal errors,
esp. those not related to a certain file. */
SetGlobalStatusMessage(ErrorMessageForException(e));
GlobalError(ErrorMessageForException(e));
return;
}
@@ -247,7 +246,7 @@ function SetProgressStatus(filenr)
gDialog.FileList.appendChild(listitem);
}
CheckDone(false);
// CheckDone(false); -- already called from conflictCheck.js
return found;
}
@@ -347,14 +346,13 @@ function CleanUpDialog()
clearTimeout(gTimerID);
gTimerID = null;
}
if (!gFinished)
if (!gFinished && gTransfer)
{
gTransfer.cancel();
}
PassBackParams();
}
// UI stuff
// Sets the text in the prominent center of the dialog
@@ -363,14 +361,15 @@ function SetStatusMessage(message)
if (!message)
message = "";
if (!gTransferFailed)
gDialog.FinalStatusMessage.value = message;
gDialog.StatusMessage.value = message;
}
// For fatal errors like unexpected exceptions. Bail and go home.
function GlobalError(message)
{
alert(message); // XXX
CloseDialog(); // XXX
GetPromptService().alert(window, GetString("FatalError"),
message);
CloseDialog();
}
/*
@@ -387,7 +386,8 @@ function addFileStatus(file)
//XXX hack
function showErrors()
{
alert(gResults);
GetPromptService().alert(window, GetString("TransferErrorsTitle"),
gResults);
}
// set to on, if a listing.xml file is being transferred (and off afterwards)

View File

@@ -10,8 +10,7 @@
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is Mozilla Communicator client code, released
- March 31, 1998.
- The Original Code is Mozilla Communicator client code.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
@@ -19,7 +18,8 @@
- Rights Reserved.
-
- Contributor(s):
- Charles Manxke (cmanske@netscape.com)
- Charles Manske <cmanske@netscape.com>
- Ben Bucksch <http://www.bucksch.org> of Beonex <http://www.beonex.com>
-->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
@@ -31,9 +31,8 @@
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://sroaming/locale/progressDialog.dtd">
<!-- dialog containing a control requiring initial setup -->
<dialog title="&defaultTitle;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&defaultTitle;"
buttons="cancel"
onload="Startup();"
ondialogaccept="return onEnterKey();"
@@ -52,7 +51,6 @@
src="chrome://sroaming/content/transfer/utility.js" />
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<broadcaster id="args" value=""/>
<groupbox>
<caption><label id="TransferToFromSite"/></caption>
@@ -63,19 +61,18 @@
</groupbox>
<groupbox>
<caption><label value="&fileList.label;"/></caption>
<vbox align="center" style="max-width:30em" id="aboxingbox">
<vbox align="center" style="max-width:30em">
<hbox>
<progressmeter id="ListingProgress"
mode="undetermined" value="0"
hidden="true" />
<label id="FinalStatusMessage" class="bold" value="&status.label;" />
<text id="StatusMessage" class="bold" value="&status.label;" />
</hbox>
</vbox>
<description id="StatusMessage"
class="wrap" style="max-width:30em; min-height: 1em"/>
<vbox flex="1">
<listbox id="FileList" rows="1"/>
</vbox>
<spacer class="bigspacer"/>
<listbox id="FileList" rows="1" flex="1" />
<hbox align="center" id="failureBox" hidden="true">
<image class="progressitem" progress="done"/>
<label value="&succeeded.label;"/>

View File

@@ -1373,14 +1373,6 @@ TransferProgressListener.prototype =
function GetPromptService()
{
// no caching, not worth it
// throw errors into caller
return Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
}
var gIOService;
function GetIOService()
{

View File

@@ -27,7 +27,6 @@
*/
////////////////////////////////////////////////////////////////////////////
// UI
////////////////////////////////////////////////////////////////////////////
@@ -59,47 +58,15 @@ function GetStringWithFile(stringname, filename)
return GetString(stringname).replace(/%file%/, filename);
}
/* Returns a human-readable name for a profile file, e.g.
"abook.mab" -> "Personal Addressbook"
Will look for a stringbundle match
- for filename
- if failing that, for id
- if failing that, use the raw id
- if failing that, use the raw filename
@param filename string
@param id in case the filename is changing for a certain profile file
(e.g. in the case of password files), optionally pass an ID
for the file here, as used in filedescr.properties.
May be null.
@return string Description for file
*/
var gStringBundleFiledescr;
function GetFileDescription(filename, id)
{
if (!gStringBundleFiledescr)
{
try {
gStringBundleFiledescr =
Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
.createBundle("chrome://sroaming/locale/filedescr.properties");
} catch (e) {
return null;
}
}
try {
return gStringBundleFiledescr.GetStringFromName(filename);
} catch (e) {
try {
return gStringBundleFiledescr.GetStringFromName(id);
} catch (e) {
if (id)
return id;
return filename;
}
}
}
// See also GetFileDescription() below
function GetPromptService()
{
// no caching, not worth it
// throw errors into caller
return Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
}
////////////////////////////////////////////////////////////////////////////
@@ -499,3 +466,51 @@ function dumpError(text)
{
dump(text + "\n");
}
///////////////////////////////////////////////////////////////////////
// Profile-related stuff
// Only makes sense for roaming
///////////////////////////////////////////////////////////////////////
/* Returns a human-readable name for a profile file, e.g.
"abook.mab" -> "Personal Addressbook"
Will look for a stringbundle match
- for filename
- if failing that, for id
- if failing that, use the raw id
- if failing that, use the raw filename
@param filename string
@param id in case the filename is changing for a certain profile file
(e.g. in the case of password files), optionally pass an ID
for the file here, as used in filedescr.properties.
May be null.
@return string Description for file
*/
var gStringBundleFiledescr;
function GetFileDescription(filename, id)
{
if (!gStringBundleFiledescr)
{
try {
gStringBundleFiledescr =
Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
.createBundle("chrome://sroaming/locale/filedescr.properties");
} catch (e) {
return null;
}
}
try {
return gStringBundleFiledescr.GetStringFromName(filename);
} catch (e) {
try {
return gStringBundleFiledescr.GetStringFromName(id);
} catch (e) {
if (id)
return id;
return filename;
}
}
}

View File

@@ -1,8 +1,6 @@
Transfer=Transfer
TransferPage=Transfer Page
DontTransfer=Don't Transfer
#transfer.js
Alert=Alert
PasswordTitle=Password for Roaming Access
PasswordTitle=Password for file transfer
# LOCALIZATION NOTE Don't translate %realm%, %username% or similar. Same for the whole file.
EnterPasswordForUserAt=Enter password for user %username% at %realm%
SavePassword=Save password
@@ -24,30 +22,24 @@ NotFinished=The transfer of file "%file%" didn't finish
HTTPResponseFailed="%file%" failed, HTTP server said "%responsecode%: %responsetext%"
HTTPResponseSucceeded="%file%" succeeded, HTTP server said "%responsecode%: %responsetext%"
StatusTextOnly="%file%" failed with error %statustext%
FTPCWD=Directory of "%file%" cannot be found. Did you use the right base URL in preferences?
FTPCWD=File or directory of "%file%" cannot be found.
# also getting the above error in case the file is e.g. not readable, so don't say: Did you use the right base URL in preferences?
MalformedURI=The Base URL is malformed.
NoFilesSelected=You did not select any files to be transfered.
NoUsername=No username given.
#results
TransferFailed=Transfer failed.
TransferCompleted=Transfer completed successfully
TransferSomeFileFailed=Some files failed to transfer
FailedFileMsg=%x% of %total% files failed to transfer.
# End-Transfering error strings
Prompt=Prompt
PromptFTPUsernamePassword=Enter username and password for FTP server at %host%
#ProgressDialog.js
TransferProgressCaption=Roaming transfer: %title%
TransferToSite=Transfering to site: %site%
TransferFromSite=Transfering from site: %site%
MissingSiteNameError=Please enter a name for this site.
MissingTransferUrlError=Please enter a location for transfering this file.
MissingTransferFilename=Please enter a filename for the current file.
MissingTransferSiteError=No transfering site information given. Switching to Settings panel so you can supply transfering information.
Close=Close
TransferFailed=Transfer failed
TransferCompleted=Transfer completed successfully
Transfering=Transfering...
TransferingListing=Transfering listing file
TransferErrorsTitle=Transfer Errors
FatalError=Fatal error while trying to transfer files
#Conflict resolve
FileStats=%date%, %size% Bytes