From 39092b7c82f78085635eb6c4af8710a173d4425e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 14 Dec 2009 20:15:47 +0000 Subject: [PATCH] Display "Open Sync Preferences..." button instead of "Report Errors..." on WebDAV verification failure during sync --- chrome/content/zotero/xpcom/storage.js | 19 +++++++++++++++++-- chrome/content/zotero/xpcom/sync.js | 16 ++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js index 2dd44e6a9c..13de1b86f9 100644 --- a/chrome/content/zotero/xpcom/storage.js +++ b/chrome/content/zotero/xpcom/storage.js @@ -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); } } diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index 6675f9a12b..72ab580bfd 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -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); } } }