Bug 602715 - Sync UI: Only mention enabled engines in client wipe confirmation dialog. r=mconnor a=blocking-beta8

This commit is contained in:
Philipp von Weitershausen 2010-11-10 09:36:47 -08:00
parent 9a7e28290a
commit 020811bd6a
3 changed files with 64 additions and 59 deletions

View File

@ -762,55 +762,68 @@ var gSyncSetup = {
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);
} else {
document.getElementById("historyCount").hidden = true;
}
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 (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;
}
// 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("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;
}
// 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);
this._case1Setup = true;
break;
case 2:

View File

@ -480,34 +480,28 @@
</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>

View File

@ -92,11 +92,9 @@
<!-- 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">