Browse Source

Add email "From" option

adaptive-webui-19844
Thomas Piccirello 6 years ago
parent
commit
e499e1ba85
  1. 3
      src/webui/api/appcontroller.cpp
  2. 11
      src/webui/www/private/preferences_content.html

3
src/webui/api/appcontroller.cpp

@ -113,6 +113,7 @@ void AppController::preferencesAction() @@ -113,6 +113,7 @@ void AppController::preferencesAction()
data["scan_dirs"] = nativeDirs;
// Email notification upon download completion
data["mail_notification_enabled"] = pref->isMailNotificationEnabled();
data["mail_notification_sender"] = pref->getMailNotificationSender();
data["mail_notification_email"] = pref->getMailNotificationEmail();
data["mail_notification_smtp"] = pref->getMailNotificationSMTP();
data["mail_notification_ssl_enabled"] = pref->getMailNotificationSMTPSSL();
@ -324,6 +325,8 @@ void AppController::setPreferencesAction() @@ -324,6 +325,8 @@ void AppController::setPreferencesAction()
// Email notification upon download completion
if (m.contains("mail_notification_enabled"))
pref->setMailNotificationEnabled(m["mail_notification_enabled"].toBool());
if ((it = m.find(QLatin1String("mail_notification_sender"))) != m.constEnd())
pref->setMailNotificationSender(it.value().toString());
if (m.contains("mail_notification_email"))
pref->setMailNotificationEmail(m["mail_notification_email"].toString());
if (m.contains("mail_notification_smtp"))

11
src/webui/www/private/preferences_content.html

@ -148,6 +148,14 @@ @@ -148,6 +148,14 @@
<label for="mail_notification_checkbox">QBT_TR(Email notification upon download completion)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<table>
<tr>
<td>
<label for="src_email_txt">QBT_TR(From:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="src_email_txt" />
</td>
</tr>
<tr>
<td>
<label for="dest_email_txt">QBT_TR(To:)QBT_TR[CONTEXT=OptionsDialog]</label>
@ -858,6 +866,7 @@ @@ -858,6 +866,7 @@
updateMailNotification = function() {
var isMailNotificationEnabled = $('mail_notification_checkbox').getProperty('checked');
$('src_email_txt').setProperty('disabled', !isMailNotificationEnabled);
$('dest_email_txt').setProperty('disabled', !isMailNotificationEnabled);
$('smtp_server_txt').setProperty('disabled', !isMailNotificationEnabled);
$('mail_ssl_checkbox').setProperty('disabled', !isMailNotificationEnabled);
@ -1093,6 +1102,7 @@ @@ -1093,6 +1102,7 @@
// Email notification upon download completion
$('mail_notification_checkbox').setProperty('checked', pref.mail_notification_enabled);
$('src_email_txt').setProperty('value', pref.mail_notification_sender);
$('dest_email_txt').setProperty('value', pref.mail_notification_email);
$('smtp_server_txt').setProperty('value', pref.mail_notification_smtp);
$('mail_ssl_checkbox').setProperty('checked', pref.mail_notification_ssl_enabled);
@ -1323,6 +1333,7 @@ @@ -1323,6 +1333,7 @@
// Email notification upon download completion
settings.set('mail_notification_enabled', $('mail_notification_checkbox').getProperty('checked'));
settings.set('mail_notification_sender', $('src_email_txt').getProperty('value'));
settings.set('mail_notification_email', $('dest_email_txt').getProperty('value'));
settings.set('mail_notification_smtp', $('smtp_server_txt').getProperty('value'));
settings.set('mail_notification_ssl_enabled', $('mail_ssl_checkbox').getProperty('checked'));

Loading…
Cancel
Save