|
326 | 326 | <fieldset class="settings"> |
327 | 327 | <legend> |
328 | 328 | <input type="checkbox" id="mail_notification_checkbox" onclick="qBittorrent.Preferences.updateMailNotification();"> |
329 | | - <label for="mail_notification_checkbox">QBT_TR(Email notification upon download completion)QBT_TR[CONTEXT=OptionsDialog]</label> |
| 329 | + <label for="mail_notification_checkbox">QBT_TR(Email notification)QBT_TR[CONTEXT=OptionsDialog]</label> |
330 | 330 | </legend> |
| 331 | + <fieldset class="settings"> |
| 332 | + <legend>QBT_TR(Send when)QBT_TR[CONTEXT=OptionsDialog]</legend> |
| 333 | + <div class="formRow"> |
| 334 | + <input type="checkbox" id="mailNotificationOnAddCheckbox" title="QBT_TR(Send email notification when a torrent is added.)QBT_TR[CONTEXT=OptionsDialog]" onclick="qBittorrent.Preferences.updateMailWhenToSend();"> |
| 335 | + <label id="mailNotificationOnAddLabel" for="mailNotificationOnAddCheckbox">QBT_TR(Torrent Added)QBT_TR[CONTEXT=OptionsDialog]</label> |
| 336 | + </div> |
| 337 | + <div class="formRow"> |
| 338 | + <input type="checkbox" id="mailNotificationOnEndCheckbox" title="QBT_TR(Send email notification when a torrent has finished downloading.)QBT_TR[CONTEXT=OptionsDialog]" onclick="qBittorrent.Preferences.updateMailWhenToSend();"> |
| 339 | + <label id="mailNotificationOnEndLabel" for="mailNotificationOnEndCheckbox">QBT_TR(Torrent Finished)QBT_TR[CONTEXT=OptionsDialog]</label> |
| 340 | + </div> |
| 341 | + </fieldset> |
331 | 342 | <table> |
332 | 343 | <tbody> |
333 | 344 | <tr> |
|
1866 | 1877 | updateExcludedFileNamesEnabled: updateExcludedFileNamesEnabled, |
1867 | 1878 | changeWatchFolderSelect: changeWatchFolderSelect, |
1868 | 1879 | updateMailNotification: updateMailNotification, |
| 1880 | + updateMailWhenToSend: updateMailWhenToSend, |
1869 | 1881 | updateMailAuthSettings: updateMailAuthSettings, |
1870 | 1882 | sendTestEmail: sendTestEmail, |
1871 | 1883 | updateAutoRun: updateAutoRun, |
|
2029 | 2041 |
|
2030 | 2042 | const updateMailNotification = () => { |
2031 | 2043 | const isMailNotificationEnabled = document.getElementById("mail_notification_checkbox").checked; |
| 2044 | + document.getElementById("mailNotificationOnAddCheckbox").disabled = !isMailNotificationEnabled; |
| 2045 | + document.getElementById("mailNotificationOnEndCheckbox").disabled = !isMailNotificationEnabled; |
2032 | 2046 | document.getElementById("src_email_txt").disabled = !isMailNotificationEnabled; |
2033 | 2047 | document.getElementById("dest_email_txt").disabled = !isMailNotificationEnabled; |
2034 | 2048 | document.getElementById("smtp_server_txt").disabled = !isMailNotificationEnabled; |
2035 | 2049 | document.getElementById("mailNotificationEncryptionCombobox").disabled = !isMailNotificationEnabled; |
2036 | 2050 | document.getElementById("mail_auth_checkbox").disabled = !isMailNotificationEnabled; |
2037 | 2051 | document.getElementById("mail_test_button").disabled = !isMailNotificationEnabled; |
2038 | | - |
| 2052 | + if (isMailNotificationEnabled) |
| 2053 | + updateMailWhenToSend(); |
2039 | 2054 | if (!isMailNotificationEnabled) { |
2040 | 2055 | document.getElementById("mail_auth_checkbox").checked = !isMailNotificationEnabled; |
2041 | 2056 | updateMailAuthSettings(); |
2042 | 2057 | } |
2043 | 2058 | }; |
2044 | 2059 |
|
| 2060 | + const updateMailWhenToSend = () => { |
| 2061 | + const isMailNotificationOnAddChecked = document.getElementById("mailNotificationOnAddCheckbox").checked; |
| 2062 | + const isMailNotificationOnEndChecked = document.getElementById("mailNotificationOnEndCheckbox").checked; |
| 2063 | + if (!isMailNotificationOnAddChecked && !isMailNotificationOnEndChecked) |
| 2064 | + return; |
| 2065 | + document.getElementById("mailNotificationOnAddCheckbox").disabled = !isMailNotificationOnEndChecked; |
| 2066 | + document.getElementById("mailNotificationOnEndCheckbox").disabled = !isMailNotificationOnAddChecked; |
| 2067 | + }; |
| 2068 | + |
2045 | 2069 | const updateMailAuthSettings = () => { |
2046 | 2070 | const isMailAuthEnabled = document.getElementById("mail_auth_checkbox").checked; |
2047 | 2071 | document.getElementById("mail_username_text").disabled = !isMailAuthEnabled; |
|
2466 | 2490 |
|
2467 | 2491 | // Email notification upon download completion |
2468 | 2492 | document.getElementById("mail_notification_checkbox").checked = pref.mail_notification_enabled; |
| 2493 | + document.getElementById("mailNotificationOnAddCheckbox").checked = pref.mail_notification_on_add; |
| 2494 | + document.getElementById("mailNotificationOnEndCheckbox").checked = pref.mail_notification_on_end; |
2469 | 2495 | document.getElementById("src_email_txt").value = pref.mail_notification_sender; |
2470 | 2496 | document.getElementById("dest_email_txt").value = pref.mail_notification_email; |
2471 | 2497 | document.getElementById("smtp_server_txt").value = pref.mail_notification_smtp; |
|
2868 | 2894 |
|
2869 | 2895 | // Email notification upon download completion |
2870 | 2896 | settings["mail_notification_enabled"] = document.getElementById("mail_notification_checkbox").checked; |
| 2897 | + settings["mail_notification_on_add"] = document.getElementById("mailNotificationOnAddCheckbox").checked; |
| 2898 | + settings["mail_notification_on_end"] = document.getElementById("mailNotificationOnEndCheckbox").checked; |
2871 | 2899 | settings["mail_notification_sender"] = document.getElementById("src_email_txt").value; |
2872 | 2900 | settings["mail_notification_email"] = document.getElementById("dest_email_txt").value; |
2873 | 2901 | settings["mail_notification_smtp"] = document.getElementById("smtp_server_txt").value; |
|
0 commit comments