diff --git a/src/eventmanager.cpp b/src/eventmanager.cpp index 28b485cc8..845e2aaf1 100644 --- a/src/eventmanager.cpp +++ b/src/eventmanager.cpp @@ -163,6 +163,12 @@ void EventManager::setGlobalPreferences(QVariantMap m) const { } if(m.contains("export_dir")) Preferences::setExportDir(m["export_dir"].toString()); + if(m.contains("mail_notification_enabled")) + Preferences::setMailNotificationEnabled(m["mail_notification_enabled"].toBool()); + if(m.contains("mail_notification_email")) + Preferences::setMailNotificationEmail(m["mail_notification_email"].toString()); + if(m.contains("mail_notification_smtp")) + Preferences::setMailNotificationSMTP(m["mail_notification_smtp"].toString()); if(m.contains("preallocate_all")) Preferences::preAllocateAllFiles(m["preallocate_all"].toBool()); if(m.contains("queueing_enabled")) @@ -265,6 +271,9 @@ QVariantMap EventManager::getGlobalPreferences() const { data["download_in_scan_dirs"] = var_list; data["export_dir_enabled"] = Preferences::isTorrentExportEnabled(); data["export_dir"] = Preferences::getExportDir(); + data["mail_notification_enabled"] = Preferences::isMailNotificationEnabled(); + data["mail_notification_email"] = Preferences::getMailNotificationEmail(); + data["mail_notification_smtp"] = Preferences::getMailNotificationSMTP(); data["preallocate_all"] = Preferences::preAllocateAllFiles(); data["queueing_enabled"] = Preferences::isQueueingSystemEnabled(); data["max_active_downloads"] = Preferences::getMaxActiveDownloads(); diff --git a/src/webui/preferences_content.html b/src/webui/preferences_content.html index fe0d3cf88..70a8fa6e6 100644 --- a/src/webui/preferences_content.html +++ b/src/webui/preferences_content.html @@ -118,13 +118,25 @@
- _(Torrent queueing) -
+ _(Email notification upon download completion) +
+ _(Email notification upon download completion) - + + + +
_(Torrent queueing)_(Destination email:)
_(SMTP server:)
+
+
+
+ _(Torrent queueing) +
+ _(Torrent queueing) + + @@ -360,6 +372,11 @@ var max_active_downloads = $('max_active_dl_value').get('value'); var max_active_uploads = $('max_active_up_value').get('value'); var max_active_torrents = $('max_active_to_value').get('value'); + var mail_notification_enabled = 0; + if($defined($('mail_notification_checkbox').get('checked')) && $('mail_notification_checkbox').get('checked')) + mail_notification_enabled = 1; + var mail_notification_email = $('dest_email_txt').get('value'); + var mail_notification_smtp = $('smtp_server_txt').get('value'); // IP Filter var ip_filter_enabled = 0; if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked')) @@ -471,6 +488,9 @@ dict.set('max_active_uploads', max_active_uploads); dict.set('max_active_downloads', max_active_downloads); dict.set('max_active_torrents', max_active_torrents); + dict.set('mail_notification_enabled', mail_notification_enabled); + dict.set('mail_notification_email', mail_notification_email); + dict.set('mail_notification_smtp', mail_notification_smtp); // IP Filter dict.set('ip_filter_enabled', ip_filter_enabled); dict.set('ip_filter_path', ip_filter_path); @@ -586,6 +606,16 @@ updateQueueingSystem = function() { } } +updateMailNotification = function() { + if($defined($('mail_notification_checkbox').get('checked')) && $('mail_notification_checkbox').get('checked')) { + $('dest_email_txt').removeProperty('disabled'); + $('smtp_server_txt').removeProperty('disabled'); + } else { + $('dest_email_txt').set('disabled', 'true'); + $('smtp_server_txt').set('disabled', 'true'); + } +} + updateFilterSettings = function() { if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked')) { $('ipfilter_text').removeProperty('disabled'); @@ -661,7 +691,6 @@ getWatchedFolders = function() { var download_in_place = Array(); for(var i=0; i 0) { folders[folders.length] = folder_path; if($defined($("cb_watch_"+i).get('checked')) && $("cb_watch_"+i).get('checked')) { @@ -834,6 +863,15 @@ loadPreferences = function() { $('exportdir_checkbox').removeProperty('checked'); } updateExportDirEnabled(); + var mail_notification_enabled = pref.mail_notification_enabled; + if(mail_notification_enabled) { + $('mail_notification_checkbox').set('checked', 'checked'); + } else { + $('mail_notification_checkbox').removeProperty('checked'); + } + $('dest_email_txt').set('value', pref.mail_notification_email); + $('smtp_server_txt').set('value', pref.mail_notification_smtp); + updateMailNotification(); if(pref.preallocate_all) { $('preallocateall_checkbox').set('checked', 'checked'); } else {
_(Maximum active downloads:)