From 4be80f6a9411b2e4b63031d9154afa89c77515f4 Mon Sep 17 00:00:00 2001 From: Allison Naaktgeboren Date: Fri, 30 Sep 2011 21:43:19 -0700 Subject: [PATCH] Bug 675820: "Set Up Sync" link at bottom of home tab: mobile. r=philikon, ui-r=faaborg --- mobile/chrome/content/aboutHome.xhtml | 36 +++++++++++++++++++++-- mobile/locales/en-US/chrome/aboutHome.dtd | 1 + mobile/themes/core/aboutHome.css | 11 +++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/mobile/chrome/content/aboutHome.xhtml b/mobile/chrome/content/aboutHome.xhtml index 3d7877edb087..b55c05646542 100644 --- a/mobile/chrome/content/aboutHome.xhtml +++ b/mobile/chrome/content/aboutHome.xhtml @@ -92,7 +92,9 @@ &aboutHome.giveFeedback;&aboutHome.getHelp; - +
+ &aboutHome.setupSync; +
@@ -160,6 +162,7 @@ function init() { initTabs(); initAddons(); + initSetupSync(); let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).QueryInterface(Ci.nsIPrefBranch2); if (prefs.getBoolPref("browser.firstrun.show.uidiscovery")) { @@ -175,6 +178,7 @@ function uninit() { uninitAddons(); + uninitSetupSync(); } function _readFile(aFile) { @@ -451,7 +455,35 @@ doc.removeEventListener("animationend", endDiscovery, false); doc.removeEventListener("PanBegin", endDiscovery, false); } - + + function initSetupSync() { + let services = getChromeWin().Services; + if (services.prefs.prefHasUserValue("services.sync.username")) { + document.getElementById("syncSetupSync").style.display = "none"; + } + services.obs.addObserver(syncConnected, "weave:service:setup-complete", false); + services.obs.addObserver(syncDisconnected, "weave:service:start-over", false); + } + + function uninitSetupSync() { + let services = getChromeWin().Services; + services.obs.removeObserver(syncConnected, "weave:service:setup-complete"); + services.obs.removeObserver(syncDisconnected, "weave:service:start-over"); + } + + function syncConnected() { + document.getElementById("syncSetupSync").style.display = "none"; + } + + function syncDisconnected() { + document.getElementById("syncSetupSync").style.display = "inline"; + } + + function openSetupSyncWizard() { + let chromeWin = getChromeWin(); + chromeWin.WeaveGlue.open(); + } + function initLightbox() { let prefs = getChromeWin().Services.prefs; let channel = prefs.getCharPref("app.update.channel"); diff --git a/mobile/locales/en-US/chrome/aboutHome.dtd b/mobile/locales/en-US/chrome/aboutHome.dtd index 1d1f2a3daee6..a3f574d72f9d 100644 --- a/mobile/locales/en-US/chrome/aboutHome.dtd +++ b/mobile/locales/en-US/chrome/aboutHome.dtd @@ -19,3 +19,4 @@ (aboutHome.forAndroid): Second line of a multi-line button. Treat as a subtitle. --> + diff --git a/mobile/themes/core/aboutHome.css b/mobile/themes/core/aboutHome.css index 1cbbfc9bc859..7b6fe62bf806 100644 --- a/mobile/themes/core/aboutHome.css +++ b/mobile/themes/core/aboutHome.css @@ -244,6 +244,17 @@ body[dir="rtl"] { margin: 0; } +#sync-setup { + font-size: 18px; + margin-top: 24px; + text-align: center; +} + +#syncSetupSync { + text-decoration: underline; + color: blue; +} + /* Lightbox for Aurora */ #lightbox { position: fixed;