summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/base/content/retention.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/base/content/retention.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--comm/mailnews/base/content/retention.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/comm/mailnews/base/content/retention.js b/comm/mailnews/base/content/retention.js
new file mode 100644
index 0000000000..ac40f173b3
--- /dev/null
+++ b/comm/mailnews/base/content/retention.js
@@ -0,0 +1,52 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* globals gLockedPref */ // From either folderProps.js or am-offline.js.
+
+function initCommonRetentionSettings(retentionSettings) {
+ document.getElementById("retention.keepMsg").value =
+ retentionSettings.retainByPreference;
+ document.getElementById("retention.keepOldMsgMin").value =
+ retentionSettings.daysToKeepHdrs > 0
+ ? retentionSettings.daysToKeepHdrs
+ : 30;
+ document.getElementById("retention.keepNewMsgMin").value =
+ retentionSettings.numHeadersToKeep > 0
+ ? retentionSettings.numHeadersToKeep
+ : 2000;
+
+ document.getElementById("retention.applyToFlagged").checked =
+ !retentionSettings.applyToFlaggedMessages;
+}
+
+function saveCommonRetentionSettings(aRetentionSettings) {
+ aRetentionSettings.retainByPreference =
+ document.getElementById("retention.keepMsg").value;
+
+ aRetentionSettings.daysToKeepHdrs = document.getElementById(
+ "retention.keepOldMsgMin"
+ ).value;
+ aRetentionSettings.numHeadersToKeep = document.getElementById(
+ "retention.keepNewMsgMin"
+ ).value;
+
+ aRetentionSettings.applyToFlaggedMessages = !document.getElementById(
+ "retention.applyToFlagged"
+ ).checked;
+
+ return aRetentionSettings;
+}
+
+function onCheckKeepMsg() {
+ if (gLockedPref && gLockedPref["retention.keepMsg"]) {
+ // if the pref associated with the radiobutton is locked, as indicated
+ // by the gLockedPref, skip this function. All elements in this
+ // radiogroup have been locked by the function onLockPreference.
+ return;
+ }
+
+ var keepMsg = document.getElementById("retention.keepMsg").value;
+ document.getElementById("retention.keepOldMsgMin").disabled = keepMsg != 2;
+ document.getElementById("retention.keepNewMsgMin").disabled = keepMsg != 3;
+}