Bug 582170 - warn user that messages will be removed from server for some retention options. ui-r=Paenglab, r=mkmelin, r=IanN a=aleth CLOSED TREE
authoraceman <acelists@atlas.sk>
Mon, 24 Aug 2015 09:32:00 +0200
changeset 26338 e19758d2bb79cd884f8d910a172d33e9e286c602
parent 26337 069a4fdedeb14a029f9855491e88ec8a6ad40308
child 26339 700e2642446e2b1feefd3dba734306b8ca41b8f2
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersPaenglab, mkmelin, IanN, aleth
bugs582170
Bug 582170 - warn user that messages will be removed from server for some retention options. ui-r=Paenglab, r=mkmelin, r=IanN a=aleth CLOSED TREE
mail/locales/en-US/chrome/messenger/prefs.properties
mailnews/base/prefs/content/am-offline.js
mailnews/base/prefs/content/am-offline.xul
suite/locales/en-US/chrome/mailnews/pref/prefs.properties
--- a/mail/locales/en-US/chrome/messenger/prefs.properties
+++ b/mail/locales/en-US/chrome/messenger/prefs.properties
@@ -74,8 +74,11 @@ identity-edit-req-title=Error Creating I
 identity-delete-confirm=Are you sure you want to delete the identity\n%S?
 ## LOCALIZATION NOTE (identity-delete-confirm-title): %S is the account name
 identity-delete-confirm-title=Deleting identity for %S
 identity-delete-confirm-button=Delete
 
 choosefile=Choose a file
 
 forAccount=For account "%S"
+
+removeFromServerTitle=Confirm permanent, automatic deletion of messages
+removeFromServer=This setting will permanently delete old messages from the remote server AND your local storage. Are you sure you want to proceed?
--- a/mailnews/base/prefs/content/am-offline.js
+++ b/mailnews/base/prefs/content/am-offline.js
@@ -323,8 +323,28 @@ function restoreOfflineFolders(offlineFo
     let allFolders = gIncomingServer.rootFolder.descendants;
     for (let folder in fixIterator(allFolders, Components.interfaces.nsIMsgFolder)) {
       if (offlineFolderMap[folder.folderURL])
         folder.setFlag(Components.interfaces.nsMsgFolderFlags.Offline);
       else
         folder.clearFlag(Components.interfaces.nsMsgFolderFlags.Offline);
     }
 }
+
+/**
+ * Checks if the user selected a permanent removal of messages from server and
+ * warns about it.
+ *
+ * @param aRadio  The radiogroup element containing the retention options.
+ */
+function warnServerRemove(aRadio)
+{
+  if (aRadio.value != 1) {
+    let prefBundle = document.getElementById("bundle_prefs");
+    let title = prefBundle.getString("removeFromServerTitle");
+    let question = prefBundle.getString("removeFromServer");
+    if (!Services.prompt.confirm(window, title, question)) {
+      // If the user doesn't agree, fall back to not deleting anything.
+      aRadio.value = 1;
+      onCheckKeepMsg();
+    }
+  }
+}
--- a/mailnews/base/prefs/content/am-offline.xul
+++ b/mailnews/base/prefs/content/am-offline.xul
@@ -114,17 +114,18 @@
     </hbox>
 
     <vbox align="start">
     <separator hidefor="none,rss"/>
     <label id="retentionDescription" hidefor="imap,pop3" class="desc" control="retention.keepMsg">&retentionCleanup.label;</label>
     <label id="retentionDescriptionImap" hidefor="movemail,pop3,nntp,none,rss" class="desc" control="retention.keepMsg">&retentionCleanupImap.label;</label>
     <label id="retentionDescriptionPop" hidefor="movemail,imap,nntp,none,rss" class="desc" control="retention.keepMsg">&retentionCleanupPop.label;</label>
 
-    <radiogroup wsm_persist="true" hidefor="" id="retention.keepMsg" class="indent">
+    <radiogroup wsm_persist="true" hidefor="" id="retention.keepMsg" class="indent"
+                oncommand="warnServerRemove(this);">
         <radio wsm_persist="true" id="retention.keepAllMsg" value="1" accesskey="&retentionKeepAll.accesskey;"
             label="&retentionKeepAll.label;" oncommand="onCheckKeepMsg();"/>
         <hbox flex="1" align="center">
             <radio wsm_persist="true" id="retention.keepNewMsg" accesskey="&retentionKeepRecent.accesskey;" 
                 value="3" label="&retentionKeepRecent.label;" oncommand="onCheckKeepMsg();"/>
             <textbox wsm_persist="true" id="retention.keepNewMsgMin"
                      type="number" min="1" increment="10" size="4" value="2000"
                      aria-labelledby="retention.keepNewMsg retention.keepNewMsgMin newMsgLabel"/>
--- a/suite/locales/en-US/chrome/mailnews/pref/prefs.properties
+++ b/suite/locales/en-US/chrome/mailnews/pref/prefs.properties
@@ -75,8 +75,11 @@ identity-edit-req-title=Error Creating I
 identity-delete-confirm=Are you sure you want to delete the identity\n%S?
 ## LOCALIZATION NOTE (identity-delete-confirm-title): %S is the account name
 identity-delete-confirm-title=Deleting identity for %S
 identity-delete-confirm-button=Delete
 
 choosefile=Choose a file
 
 forAccount=For account "%S"
+
+removeFromServerTitle=Confirm permanent, automatic deletion of messages
+removeFromServer=This setting will permanently delete old messages from the remote server AND your local storage. Are you sure you want to proceed?