Display "Open Sync Preferences..." button instead of "Report Errors..." on WebDAV verification failure during sync

This commit is contained in:
Dan Stillman 2009-12-14 20:15:47 +00:00
parent c1054b57d6
commit 39092b7c82
2 changed files with 27 additions and 8 deletions

View file

@ -99,8 +99,23 @@ Zotero.Sync.Storage = new function () {
}
else {
Zotero.debug(_session.name + " verification failed");
_callbacks.onError(_session.name + " verification failed. Verify your "
+ "WebDAV settings in the Sync pane of the Zotero preferences.");
var e = new Zotero.Error(
_session.name + " verification failed. Verify your "
+ "WebDAV settings in the Sync pane of the Zotero preferences.",
0,
{
// TODO: localize
dialogButtonText: "Open Sync Preferences...",
dialogButtonCallback: function () {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var lastWin = wm.getMostRecentWindow("navigator:browser");
lastWin.ZoteroPane.openPreferences('zotero-prefpane-sync');
}
}
);
_callbacks.onError(e);
}
}

View file

@ -805,8 +805,15 @@ Zotero.Sync.Runner = new function () {
Components.utils.reportError(message);
}
if (typeof buttonText == 'undefined') {
// TODO: localize
buttonText = "Report Error...";
buttonCallback = function () {
win.ZoteroPane.reportErrors();
}
}
// If secondary button is explicitly null, just use an alert
if (buttonText === null) {
else if (buttonText === null) {
pr.alert(title, message);
return;
}
@ -818,15 +825,12 @@ Zotero.Sync.Runner = new function () {
message,
buttonFlags,
"",
// TODO: localize
"Report Error...",
buttonText,
"", null, {}
);
if (index == 1) {
win.setTimeout(function () {
win.ZoteroPane.reportErrors();
}, 1);
setTimeout(buttonCallback, 1);
}
}
}