Bug 602715 - Sync UI: Only mention enabled engines in client wipe confirmation dialog. r=mconnor a=blocking-beta8
authorPhilipp von Weitershausen <philipp@weitershausen.de>
Wed, 10 Nov 2010 09:36:47 -0800
changeset 57257 581df48b929645c5196ee93cdb1daa881541f3ec
parent 57256 25df336746e4e8c7cae63288192c79e722e36543
child 57258 d1649deec02593d36dde45d32e87d30d2ab8ab27
push id16850
push userpweitershausen@mozilla.com
push dateWed, 10 Nov 2010 17:37:27 +0000
treeherdermozilla-central@581df48b9296 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconnor, blocking-beta8
bugs602715
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 602715 - Sync UI: Only mention enabled engines in client wipe confirmation dialog. r=mconnor a=blocking-beta8
browser/base/content/syncSetup.js
browser/base/content/syncSetup.xul
browser/locales/en-US/chrome/browser/syncSetup.dtd
--- a/browser/base/content/syncSetup.js
+++ b/browser/base/content/syncSetup.js
@@ -757,65 +757,78 @@ var gSyncSetup = {
   _handleChoice: function () {
     let desc = document.getElementById("mergeChoiceRadio").selectedIndex;
     document.getElementById("chosenActionDeck").selectedIndex = desc;
     switch (desc) {
       case 1:
         if (this._case1Setup)
           break;
 
-        // history
-        let db = Weave.Svc.History.DBConnection;
+        let places_db = Weave.Svc.History.DBConnection;
+        if (Weave.Engines.get("history").enabled) {
+          let daysOfHistory = 0;
+          let stm = places_db.createStatement(
+            "SELECT ROUND(( " +
+              "strftime('%s','now','localtime','utc') - " +
+              "( " +
+                "SELECT visit_date FROM moz_historyvisits " +
+                "UNION ALL " +
+                "SELECT visit_date FROM moz_historyvisits_temp " +
+                "ORDER BY visit_date ASC LIMIT 1 " +
+                ")/1000000 " +
+              ")/86400) AS daysOfHistory ");
 
-        let daysOfHistory = 0;
-        let stm = db.createStatement(
-          "SELECT ROUND(( " +
-            "strftime('%s','now','localtime','utc') - " +
-            "( " +
-              "SELECT visit_date FROM moz_historyvisits " +
-              "UNION ALL " +
-              "SELECT visit_date FROM moz_historyvisits_temp " +
-              "ORDER BY visit_date ASC LIMIT 1 " +
-              ")/1000000 " +
-            ")/86400) AS daysOfHistory ");
-
-        if (stm.step())
-          daysOfHistory = stm.getInt32(0);
-        // Support %S for historical reasons (see bug 600141)
-        document.getElementById("historyCount").value =
-          PluralForm.get(daysOfHistory,
-                         this._stringBundle.GetStringFromName("historyDaysCount.label"))
-                    .replace("%S", daysOfHistory)
-                    .replace("#1", daysOfHistory);
+          if (stm.step())
+            daysOfHistory = stm.getInt32(0);
+          // Support %S for historical reasons (see bug 600141)
+          document.getElementById("historyCount").value =
+            PluralForm.get(daysOfHistory,
+                           this._stringBundle.GetStringFromName("historyDaysCount.label"))
+                      .replace("%S", daysOfHistory)
+                      .replace("#1", daysOfHistory);
+        } else {
+          document.getElementById("historyCount").hidden = true;
+        }
 
-        // bookmarks
-        let bookmarks = 0;
-        stm = db.createStatement(
-          "SELECT count(*) AS bookmarks " +
-          "FROM moz_bookmarks b " +
-          "LEFT JOIN moz_bookmarks t ON " +
-          "b.parent = t.id WHERE b.type = 1 AND t.parent <> :tag");
-        stm.params.tag = Weave.Svc.Bookmark.tagsFolder;
-        if (stm.executeStep())
-          bookmarks = stm.row.bookmarks;
-        // Support %S for historical reasons (see bug 600141)
-        document.getElementById("bookmarkCount").value =
-          PluralForm.get(bookmarks,
-                         this._stringBundle.GetStringFromName("bookmarksCount.label"))
-                    .replace("%S", bookmarks)
-                    .replace("#1", bookmarks);
+        if (Weave.Engines.get("bookmarks").enabled) {
+          let bookmarks = 0;
+          let stm = places_db.createStatement(
+            "SELECT count(*) AS bookmarks " +
+            "FROM moz_bookmarks b " +
+            "LEFT JOIN moz_bookmarks t ON " +
+            "b.parent = t.id WHERE b.type = 1 AND t.parent <> :tag");
+          stm.params.tag = Weave.Svc.Bookmark.tagsFolder;
+          if (stm.executeStep())
+            bookmarks = stm.row.bookmarks;
+          // Support %S for historical reasons (see bug 600141)
+          document.getElementById("bookmarkCount").value =
+            PluralForm.get(bookmarks,
+                           this._stringBundle.GetStringFromName("bookmarksCount.label"))
+                      .replace("%S", bookmarks)
+                      .replace("#1", bookmarks);
+        } else {
+          document.getElementById("bookmarkCount").hidden = true;
+        }
 
-        // passwords
-        let logins = Weave.Svc.Login.getAllLogins({});
-        // Support %S for historical reasons (see bug 600141)
-        document.getElementById("passwordCount").value =
-          PluralForm.get(logins.length,
-                         this._stringBundle.GetStringFromName("passwordsCount.label"))
-                    .replace("%S", logins.length)
-                    .replace("#1", logins.length);
+        if (Weave.Engines.get("passwords").enabled) {
+          let logins = Weave.Svc.Login.getAllLogins({});
+          // Support %S for historical reasons (see bug 600141)
+          document.getElementById("passwordCount").value =
+            PluralForm.get(logins.length,
+                           this._stringBundle.GetStringFromName("passwordsCount.label"))
+                      .replace("%S", logins.length)
+                      .replace("#1", logins.length);
+        } else {
+          document.getElementById("passwordCount").hidden = true;
+        }
+
+        if (!Weave.Engines.get("prefs").enabled) {
+          document.getElementById("prefsWipe").hidden = true;
+        }
+
         this._case1Setup = true;
         break;
       case 2:
         if (this._case2Setup)
           break;
         let count = 0;
         function appendNode(label) {
           let box = document.getElementById("clientList");
--- a/browser/base/content/syncSetup.xul
+++ b/browser/base/content/syncSetup.xul
@@ -475,44 +475,38 @@
       <deck id="chosenActionDeck">
         <vbox id="chosenActionMerge" class="confirm">
           <description class="normal">
             &confirm.merge.label;
           </description>
         </vbox>
         <vbox id="chosenActionWipeClient" class="confirm">
           <description class="normal">
-            &confirm.client.label;
+            &confirm.client2.label;
           </description>
           <separator class="thin"/>
           <vbox id="dataList">
             <label class="data indent" id="bookmarkCount"/>
             <label class="data indent" id="historyCount"/>
             <label class="data indent" id="passwordCount"/>
+            <label class="data indent" id="prefsWipe"
+                   value="&engine.prefs.label;"/>
           </vbox>
           <separator class="thin"/>
           <description class="normal">
             &confirm.client.moreinfo.label;
           </description>
-          <separator class="thin"/>
-          <description class="warning">
-            &confirm.client.warning.label;
-          </description>
         </vbox>
         <vbox id="chosenActionWipeServer" class="confirm">
           <description class="normal">
-            &confirm.server.label;
+            &confirm.server2.label;
           </description>
           <separator class="thin"/>
           <vbox id="clientList">
           </vbox>
-          <separator class="thin"/>
-          <description class="warning">
-            &confirm.server.warning.label;
-          </description>
         </vbox>
       </deck>
   </wizardpage>
 
   <wizardpage label="&setup.successPage.title;" 
               id="successfulSetup"
               onextra1="gSyncSetup.onSyncOptions()"
               onpageshow="gSyncSetup.onPageShow()">
--- a/browser/locales/en-US/chrome/browser/syncSetup.dtd
+++ b/browser/locales/en-US/chrome/browser/syncSetup.dtd
@@ -87,18 +87,16 @@
 <!ENTITY choice2.merge.main.label      "Merge this computer's data with my &syncBrand.shortName.label; data">
 <!ENTITY choice2.merge.recommended.label "Recommended:">
 <!ENTITY choice2.client.main.label     "Replace all data on this computer with my &syncBrand.shortName.label; data">
 <!ENTITY choice2.server.main.label     "Replace all other devices with this computer's data">
 
 <!-- Confirm Merge Options -->
 <!ENTITY setup.optionsConfirmPage.title "Confirm">
 <!ENTITY confirm.merge.label    "&syncBrand.fullName.label; will now merge all this computer's browser data into your Sync account.">
-<!ENTITY confirm.client.label         "All &brandShortName; data on this computer will be deleted, including the following:">
+<!ENTITY confirm.client2.label         "Warning: The following &brandShortName; data on this computer will be deleted:">
 <!ENTITY confirm.client.moreinfo.label "&brandShortName; will then copy your &syncBrand.fullName.label; data to this computer.">
-<!ENTITY confirm.client.warning.label "WARNING: This will result in all &brandShortName; data on this computer being replaced!">
-<!ENTITY confirm.server.label         "The following devices will be overwritten with your local data:">
-<!ENTITY confirm.server.warning.label "WARNING: Your local data will replace all &brandShortName; data on these devices!">
+<!ENTITY confirm.server2.label         "Warning: The following devices will be overwritten with your local data:">
 
 <!-- New & Existing Account: Setup Complete -->
 <!ENTITY setup.successPage.title "Setup Complete">
 <!ENTITY changeOptions.label "You can change this preference by selecting Sync Options below.">
 <!ENTITY continueUsing.label "You may now continue using &brandShortName;.">