Browse Source

Updated Web UI to reflect the mail notification changes

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
c7a2d3589f
  1. 9
      src/eventmanager.cpp
  2. 46
      src/webui/preferences_content.html

9
src/eventmanager.cpp

@ -163,6 +163,12 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
} }
if(m.contains("export_dir")) if(m.contains("export_dir"))
Preferences::setExportDir(m["export_dir"].toString()); 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")) if(m.contains("preallocate_all"))
Preferences::preAllocateAllFiles(m["preallocate_all"].toBool()); Preferences::preAllocateAllFiles(m["preallocate_all"].toBool());
if(m.contains("queueing_enabled")) if(m.contains("queueing_enabled"))
@ -265,6 +271,9 @@ QVariantMap EventManager::getGlobalPreferences() const {
data["download_in_scan_dirs"] = var_list; data["download_in_scan_dirs"] = var_list;
data["export_dir_enabled"] = Preferences::isTorrentExportEnabled(); data["export_dir_enabled"] = Preferences::isTorrentExportEnabled();
data["export_dir"] = Preferences::getExportDir(); 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["preallocate_all"] = Preferences::preAllocateAllFiles();
data["queueing_enabled"] = Preferences::isQueueingSystemEnabled(); data["queueing_enabled"] = Preferences::isQueueingSystemEnabled();
data["max_active_downloads"] = Preferences::getMaxActiveDownloads(); data["max_active_downloads"] = Preferences::getMaxActiveDownloads();

46
src/webui/preferences_content.html

@ -118,13 +118,25 @@
</div> </div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend><b>_(Torrent queueing)</b></legend> <legend><b>_(Email notification upon download completion)</b></legend>
<div style="padding-left: 30px;"> <div style="padding-left: 30px;">
<input type="checkbox" id="mail_notification_checkbox" onclick="updateMailNotification();"/> _(Email notification upon download completion)
<table> <table>
<tr> <tr>
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="queueing_checkbox" onclick="updateQueuingSystem();"/></td><td>_(Torrent queueing)</td> <td style="vertical-align: bottom; text-align: right;">_(Destination email:)</td><td><input type="text" id="dest_email_txt"/></td>
</tr> </tr>
<tr> <tr>
<td style="vertical-align: bottom; text-align: right;">_(SMTP server:)</td><td><input type="text" id="smtp_server_txt"/></td>
</tr>
</table>
</div>
</fieldset>
<fieldset>
<legend><b>_(Torrent queueing)</b></legend>
<div style="padding-left: 30px;">
<input type="checkbox" id="queueing_checkbox" onclick="updateQueuingSystem();"/> _(Torrent queueing)
<table>
<tr>
<td style="vertical-align: bottom; text-align: right;">_(Maximum active downloads:)</td><td><input type="text" id="max_active_dl_value" style="width: 4em;"/></td> <td style="vertical-align: bottom; text-align: right;">_(Maximum active downloads:)</td><td><input type="text" id="max_active_dl_value" style="width: 4em;"/></td>
</tr> </tr>
<tr> <tr>
@ -360,6 +372,11 @@
var max_active_downloads = $('max_active_dl_value').get('value'); var max_active_downloads = $('max_active_dl_value').get('value');
var max_active_uploads = $('max_active_up_value').get('value'); var max_active_uploads = $('max_active_up_value').get('value');
var max_active_torrents = $('max_active_to_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 // IP Filter
var ip_filter_enabled = 0; var ip_filter_enabled = 0;
if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked')) 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_uploads', max_active_uploads);
dict.set('max_active_downloads', max_active_downloads); dict.set('max_active_downloads', max_active_downloads);
dict.set('max_active_torrents', max_active_torrents); 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 // IP Filter
dict.set('ip_filter_enabled', ip_filter_enabled); dict.set('ip_filter_enabled', ip_filter_enabled);
dict.set('ip_filter_path', ip_filter_path); 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() { updateFilterSettings = function() {
if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked')) { if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked')) {
$('ipfilter_text').removeProperty('disabled'); $('ipfilter_text').removeProperty('disabled');
@ -661,7 +691,6 @@ getWatchedFolders = function() {
var download_in_place = Array(); var download_in_place = Array();
for(var i=0; i<nb_folders; i+=1) { for(var i=0; i<nb_folders; i+=1) {
var folder_path = $('text_watch_'+i).get('value').trim(); var folder_path = $('text_watch_'+i).get('value').trim();
alert(folder_path);
if(folder_path.length > 0) { if(folder_path.length > 0) {
folders[folders.length] = folder_path; folders[folders.length] = folder_path;
if($defined($("cb_watch_"+i).get('checked')) && $("cb_watch_"+i).get('checked')) { if($defined($("cb_watch_"+i).get('checked')) && $("cb_watch_"+i).get('checked')) {
@ -834,6 +863,15 @@ loadPreferences = function() {
$('exportdir_checkbox').removeProperty('checked'); $('exportdir_checkbox').removeProperty('checked');
} }
updateExportDirEnabled(); 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) { if(pref.preallocate_all) {
$('preallocateall_checkbox').set('checked', 'checked'); $('preallocateall_checkbox').set('checked', 'checked');
} else { } else {

Loading…
Cancel
Save