[Pkg-mozext-commits] [gcontactsync] 56/88: Issue #35: Accounts.saveSelectedAccount doesn't reset if username or group option changes.

David Prévot taffit at moszumanska.debian.org
Thu Sep 18 20:52:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository gcontactsync.

commit 502936b88a24b1453f5e33bd159a2ad49b042ee0
Author: Josh Geenen <joshgeenen at gmail.com>
Date:   Sun Jun 15 16:49:15 2014 -0500

    Issue #35: Accounts.saveSelectedAccount doesn't reset if username or group option changes.
---
 src/content/Accounts.js                  | 28 ++++++++++++++--------------
 src/locale/en-US/gcontactsync.properties |  2 +-
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/content/Accounts.js b/src/content/Accounts.js
index 3e61b0a..14fd12d 100644
--- a/src/content/Accounts.js
+++ b/src/content/Accounts.js
@@ -186,17 +186,17 @@ com.gContactSync.Accounts = {
         pluginElem    = document.getElementById("Plugin"),
         disableElem   = document.getElementById("disabled"),
         updateGElem   = document.getElementById("updateGoogleInConflicts"),
-        ab            = this.getSelectedAb(),
-        needsReset    = false;
-    if (!ab) {
-      return null;
-    }
+        ab            = this.getSelectedAb();
 
-    if (!usernameElem || !groupElem || !directionElem || !pluginElem || !disableElem) {
+    if (!ab || !usernameElem || !groupElem || !directionElem || !pluginElem || !disableElem) {
       return false;
     }
+
     var syncGroups = String(groupElem.value === "All"),
-        myContacts = String(groupElem.value !== "All" && groupElem.value !== "false");
+        myContacts = String(groupElem.value !== "All" && groupElem.value !== "false");;
+    // check if the AB should be reset based on the new values
+    var needsReset = this.needsReset(ab, usernameElem.value, syncGroups, myContacts, groupElem.value);
+
     // the simple preferences
     ab.savePref("Username",                usernameElem.value);
     ab.savePref("Plugin",                  pluginElem.value);
@@ -211,19 +211,20 @@ com.gContactSync.Accounts = {
     // Sync Direction
     ab.savePref("writeOnly", String(directionElem.value === "WriteOnly"));
     ab.savePref("readOnly",  String(directionElem.value === "ReadOnly"));
-    // this is done before the needsReset call in case something happens
+
     // reset the unsaved change
     this.mUnsavedChange = false;
     this.fillUsernames();
     this.fillAbTree();
-    this.selectedAbChange();
-    // check if the AB should be reset based on the new values
-    needsReset = this.needsReset(ab, usernameElem.value, syncGroups, myContacts, groupElem.value);
+    this.selectedAbChange()
+
     if (needsReset) {
       ab.reset();
+      com.gContactSync.Preferences.setSyncPref("needRestart", true);
+      var restartStr = com.gContactSync.StringBundle.getStr("pleaseRestart");
+      com.gContactSync.Preferences.setSyncPref("statusBarText", restartStr);
       com.gContactSync.alert(com.gContactSync.StringBundle.getStr("finishedAcctSave"));
-    }
-    else {
+    } else {
       com.gContactSync.alert(com.gContactSync.StringBundle.getStr("finishedAcctSaveNoRestart"));
     }
     return true;
@@ -516,7 +517,6 @@ com.gContactSync.Accounts = {
       "  * " + aMyContactsName + " <- " + aAB.mPrefs.myContactsName + "\n" +
       "  * Last sync date: " + aAB.mPrefs.lastSync
      );
-    // NOTE: mUnsavedChange is reset to false before this method is called
     if ((aAB.mPrefs.Username && aAB.mPrefs.Username !== "none") &&
          aUsername !== "none" &&
          parseInt(aAB.mPrefs.lastSync, 10) > 0 &&
diff --git a/src/locale/en-US/gcontactsync.properties b/src/locale/en-US/gcontactsync.properties
index a5c71df..e57a2c9 100644
--- a/src/locale/en-US/gcontactsync.properties
+++ b/src/locale/en-US/gcontactsync.properties
@@ -251,7 +251,7 @@ unsavedAcctChanges=There are unsaved changes.  Do you want to save them before c
 finishedAcctSave=Your account settings have been saved.  Please close and re-open Thunderbird.
 # This should be very similar to finishedAcctSave except if this string is used then the user does not need to restart Thunderbird.
 finishedAcctSaveNoRestart=Your account settings have been saved and will be used the next time you synchronize your contacts.
-confirmABReset=The adress book should be 'reset' in order to save these changes.  This means that all of its current contacts and mailing lists will be deleted locally in Thunderbird.\nThis is necessary based on the changes you made to avoid duplicate contacts.\nClick OK to reset the address book or Cancel if you do not want the AB to be reset (not recommended).\n\nYou may want to switch to the Address Book and copy or export your contacts before clicking OK.
+confirmABReset=The address book should be 'reset' in order to save these changes.  This means that all of its current contacts and mailing lists will be deleted locally in Thunderbird.\nThis is necessary based on the changes you made to avoid duplicate contacts.\nClick OK to reset the address book or Cancel if you do not want the AB to be reset (not recommended).\n\nYou may want to switch to the Address Book and copy or export your contacts before clicking OK.
 #LOCALIZATION NOTE: '%d' will be replaced with the number of old/unused preferences that were deleted
 finishedPrefClean=gContactSync has finished cleaning %d unused preference(s).
 #LOCALIZATION NOTE: '%d' will be replaced with the number of old/unused contact photos that were deleted (from deleted address books)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/gcontactsync.git



More information about the Pkg-mozext-commits mailing list