summaryrefslogtreecommitdiffstats
path: root/application/basilisk/base/content/browser-syncui.js
diff options
context:
space:
mode:
Diffstat (limited to 'application/basilisk/base/content/browser-syncui.js')
-rw-r--r--application/basilisk/base/content/browser-syncui.js82
1 files changed, 54 insertions, 28 deletions
diff --git a/application/basilisk/base/content/browser-syncui.js b/application/basilisk/base/content/browser-syncui.js
index 51bcb15d5..3a57140f2 100644
--- a/application/basilisk/base/content/browser-syncui.js
+++ b/application/basilisk/base/content/browser-syncui.js
@@ -19,6 +19,7 @@ var gSyncUI = {
_obs: ["weave:service:sync:start",
"weave:service:sync:finish",
"weave:service:sync:error",
+ "weave:service:quota:remaining",
"weave:service:setup-complete",
"weave:service:login:start",
"weave:service:login:finish",
@@ -246,6 +247,21 @@ var gSyncUI = {
this.updateUI();
},
+ onQuotaNotice: function onQuotaNotice(subject, data) {
+ let title = this._stringBundle.GetStringFromName("warning.sync.quota.label");
+ let description = this._stringBundle.GetStringFromName("warning.sync.quota.description");
+ let buttons = [];
+ buttons.push(new Weave.NotificationButton(
+ this._stringBundle.GetStringFromName("error.sync.viewQuotaButton.label"),
+ this._stringBundle.GetStringFromName("error.sync.viewQuotaButton.accesskey"),
+ function() { gSyncUI.openQuotaDialog(); return true; }
+ ));
+
+ let notification = new Weave.Notification(
+ title, description, null, Weave.Notifications.PRIORITY_WARNING, buttons);
+ Weave.Notifications.replaceTitle(notification);
+ },
+
_getAppName: function () {
let brand = new StringBundle("chrome://branding/locale/brand.properties");
return brand.get("brandShortName");
@@ -293,17 +309,13 @@ var gSyncUI = {
*/
openSetup: function SUI_openSetup(wizardType, entryPoint = "syncbutton") {
- if (this.weaveService.fxAccountsEnabled) {
- this.openPrefs(entryPoint);
- } else {
- let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
- if (win)
- win.focus();
- else {
- window.openDialog("chrome://browser/content/sync/setup.xul",
- "weaveSetup", "centerscreen,chrome,resizable=no",
- wizardType);
- }
+ let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
+ if (win)
+ win.focus();
+ else {
+ window.openDialog("chrome://browser/content/sync/setup.xul",
+ "weaveSetup", "centerscreen,chrome,resizable=no",
+ wizardType);
}
},
@@ -328,23 +340,6 @@ var gSyncUI = {
gFxAccounts.openSignInAgainPage(entryPoint);
},
- openSyncedTabsPanel() {
- let placement = CustomizableUI.getPlacementOfWidget("sync-button");
- let area = placement ? placement.area : CustomizableUI.AREA_NAVBAR;
- let anchor = document.getElementById("sync-button") ||
- document.getElementById("PanelUI-menu-button");
- if (area == CustomizableUI.AREA_PANEL) {
- // The button is in the panel, so we need to show the panel UI, then our
- // subview.
- PanelUI.show().then(() => {
- PanelUI.showSubView("PanelUI-remotetabs", anchor, area);
- }).catch(Cu.reportError);
- } else {
- // It is placed somewhere else - just try and show it.
- PanelUI.showSubView("PanelUI-remotetabs", anchor, area);
- }
- },
-
/* After Sync is initialized we perform a once-only check for the sync
button being in "customize purgatory" and if so, move it to the panel.
This is done primarily for profiles created before SyncedTabs landed,
@@ -456,6 +451,32 @@ var gSyncUI = {
}
},
+ onSyncError: function SUI_onSyncError() {
+ this.log.debug("onSyncError: login=${login}, sync=${sync}", Weave.Status);
+ let title = this._stringBundle.GetStringFromName("error.sync.title");
+ let error = Weave.Utils.getErrorString(Weave.Status.sync);
+ let description =
+ this._stringBundle.formatStringFromName("error.sync.description", [error], 1);
+ let priority = Weave.Notifications.PRIORITY_WARNING;
+ let buttons = [];
+
+ if (Weave.Status.sync == Weave.OVER_QUOTA) {
+ description = this._stringBundle.GetStringFromName("error.sync.quota.description");
+ buttons.push(new Weave.NotificationButton(
+ this._stringBundle.GetStringFromName("error.sync.viewQuotaButton.label"),
+ this._stringBundle.GetStringFromName("error.sync.viewQuotaButton.accesskey"),
+ function() { gSyncUI.openQuotaDialog(); return true; } )
+ );
+ // Only show the notification bar on Quota error. the panel will show the rest.
+ let notification =
+ new Weave.Notification(title, description, null, priority, buttons);
+ Weave.Notifications.replaceTitle(notification);
+ }
+
+ this.updateUI();
+ },
+
+
observe: function SUI_observe(subject, topic, data) {
this.log.debug("observed", topic);
if (this._unloaded) {
@@ -487,12 +508,17 @@ var gSyncUI = {
// Do nothing.
break;
case "weave:ui:sync:error":
+ this.onSyncError();
+ break;
case "weave:service:setup-complete":
case "weave:service:login:finish":
case "weave:service:login:start":
case "weave:service:start-over":
this.updateUI();
break;
+ case "weave:service:quota:remaining":
+ this.onQuotaNotice();
+ break;
case "weave:ui:login:error":
case "weave:service:login:error":
this.onLoginError();