|
|
|
@ -18,9 +18,22 @@
@@ -18,9 +18,22 @@
|
|
|
|
|
</span><br/><br/> |
|
|
|
|
QBT_TR(Automatically add torrents from:)QBT_TR<br/> |
|
|
|
|
<table border="1" id="watched_folders_tab"> |
|
|
|
|
<thead><tr><th>QBT_TR(Watched Folder)QBT_TR</th><th>QBT_TR(Download here)QBT_TR</th></tr></thead> |
|
|
|
|
<thead><tr><th>QBT_TR(Watched Folder)QBT_TR</th><th>QBT_TR(Save Files to)QBT_TR</th></tr></thead> |
|
|
|
|
<tbody></tbody> |
|
|
|
|
<tfoot><tr><td style="padding-top:4px;"><input type="text" id="new_watch_folder_txt"/></td><td style="padding-top:4px;"><input type="checkbox" id="new_watch_folder_dl" style="padding-left:18px;"/><img src="theme/list-add" alt="Add" style="padding-left:2px;width:16px;cursor:pointer;margin-right:-18px;" onclick="addWatchFolder();"/></td></tr></tfoot> |
|
|
|
|
<tfoot><tr> |
|
|
|
|
<td style="padding-top:4px;"><input type="text" id="new_watch_folder_txt"/></td> |
|
|
|
|
<td style="padding-top:4px;"> |
|
|
|
|
<div class="select-watched-folder-editable"> |
|
|
|
|
<select id="new_watch_folder_select" onchange="changeWatchFolderSelect(this)"> |
|
|
|
|
<option selected value="watch_folder">QBT_TR(Watch Folder)QBT_TR</option> |
|
|
|
|
<option value="default_folder">QBT_TR(Default Folder)QBT_TR</option> |
|
|
|
|
<option value="other">QBT_TR(Other...)QBT_TR</option> |
|
|
|
|
</select> |
|
|
|
|
<input id="new_watch_folder_other_txt" type="text" value="QBT_TR(Watch Folder)QBT_TR" onchange="changeWatchFolderText(this)" /> |
|
|
|
|
<img src="theme/list-add" alt="Add" style="padding-left:170px;width:16px;cursor:pointer;" onclick="addWatchFolder();"/> |
|
|
|
|
</div> |
|
|
|
|
</td> |
|
|
|
|
</tr></tfoot> |
|
|
|
|
</table><br/> |
|
|
|
|
<input type="checkbox" id="exportdir_checkbox" onclick="updateExportDirEnabled();"/> |
|
|
|
|
<label for="exportdir_checkbox">QBT_TR(Copy .torrent files to:)QBT_TR</label> |
|
|
|
@ -412,38 +425,75 @@ updateTempDirEnabled = function() {
@@ -412,38 +425,75 @@ updateTempDirEnabled = function() {
|
|
|
|
|
|
|
|
|
|
addWatchFolder = function() { |
|
|
|
|
var new_folder = $('new_watch_folder_txt').getProperty('value').trim(); |
|
|
|
|
if(new_folder.length <= 0) return; |
|
|
|
|
if (new_folder.length <= 0) return; |
|
|
|
|
|
|
|
|
|
var checked = ""; |
|
|
|
|
if ($('new_watch_folder_dl').getProperty('checked') == true) |
|
|
|
|
checked = "checked"; |
|
|
|
|
var i = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length; |
|
|
|
|
var new_other = $('new_watch_folder_other_txt').getProperty('value').trim(); |
|
|
|
|
if (new_other.length <= 0) return; |
|
|
|
|
|
|
|
|
|
var myinput = "<input id='text_watch_"+ i +"' type='text' value='" + new_folder + "'>"; |
|
|
|
|
var mycb = "<input id='cb_watch_"+ i +"' type='checkbox' " + checked + ">"; |
|
|
|
|
WatchedFoldersTable.push([myinput, mycb]); |
|
|
|
|
var new_select = $('new_watch_folder_select').getProperty('value').trim(); |
|
|
|
|
|
|
|
|
|
var i = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length; |
|
|
|
|
pushWatchFolder(i, new_folder, new_select, new_other); |
|
|
|
|
|
|
|
|
|
// Clear fields |
|
|
|
|
$('new_watch_folder_txt').setProperty('value', ''); |
|
|
|
|
$('new_watch_folder_dl').setProperty('checked', false); |
|
|
|
|
var elt = $('new_watch_folder_select'); |
|
|
|
|
elt.setProperty('value', 'watch_folder'); |
|
|
|
|
var text = elt.options[elt.selectedIndex].innerHTML; |
|
|
|
|
$('new_watch_folder_other_txt').setProperty('value', text); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
changeWatchFolderSelect = function(item) { |
|
|
|
|
if (item.value == "other") { |
|
|
|
|
item.nextElementSibling.value = 'QBT_TR(Type folder here)QBT_TR'; |
|
|
|
|
item.nextElementSibling.select(); |
|
|
|
|
} else { |
|
|
|
|
var text = item.options[item.selectedIndex].innerHTML; |
|
|
|
|
item.nextElementSibling.value = text; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
changeWatchFolderText = function(item) { |
|
|
|
|
item.previousElementSibling.value = 'other'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pushWatchFolder = function(pos, folder, sel, other) { |
|
|
|
|
var myinput = "<input id='text_watch_"+ pos +"' type='text' value='" + folder + "'>"; |
|
|
|
|
var mycb = "<div class='select-watched-folder-editable'>" + |
|
|
|
|
"<select id ='cb_watch_" + pos + "' onchange='changeWatchFolderSelect(this)'>" + |
|
|
|
|
"<option value='watch_folder'>QBT_TR(Watch Folder)QBT_TR</option>" + |
|
|
|
|
"<option value='default_folder'>QBT_TR(Default Folder)QBT_TR</option>" + |
|
|
|
|
"<option value='other'>QBT_TR(Other...)QBT_TR</option>" + |
|
|
|
|
"</select>" + |
|
|
|
|
"<input id='cb_watch_txt_" + pos + "' type='text' " + |
|
|
|
|
"onchange='changeWatchFolderText(this)' /></div>"; |
|
|
|
|
|
|
|
|
|
WatchedFoldersTable.push([myinput, mycb]); |
|
|
|
|
$('cb_watch_' + pos).setProperty('value', sel); |
|
|
|
|
if (sel != "other") { |
|
|
|
|
var elt = $('cb_watch_' + pos); |
|
|
|
|
other = elt.options[elt.selectedIndex].innerHTML; |
|
|
|
|
} |
|
|
|
|
$('cb_watch_txt_'+ pos).setProperty('value', other); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getWatchedFolders = function() { |
|
|
|
|
var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length; |
|
|
|
|
var folders = Array(); |
|
|
|
|
var download_in_place = Array(); |
|
|
|
|
for(var i=0; i<nb_folders; i+=1) { |
|
|
|
|
var folder_path = $('text_watch_'+i).getProperty('value').trim(); |
|
|
|
|
if(folder_path.length > 0) { |
|
|
|
|
folders[folders.length] = folder_path; |
|
|
|
|
if($("cb_watch_"+i).getProperty('checked')) { |
|
|
|
|
download_in_place[download_in_place.length] = 1; |
|
|
|
|
var folders = new Hash(); |
|
|
|
|
for(var i = 0; i < nb_folders; i++) { |
|
|
|
|
var fpath = $('text_watch_' + i).getProperty('value').trim(); |
|
|
|
|
if (fpath.length > 0) { |
|
|
|
|
var other; |
|
|
|
|
var sel = $('cb_watch_' + i).getProperty('value').trim(); |
|
|
|
|
if (sel == "other") { |
|
|
|
|
other = $('cb_watch_txt_' + i).getProperty('value').trim(); |
|
|
|
|
} else { |
|
|
|
|
download_in_place[download_in_place.length] = 0; |
|
|
|
|
other = (sel == "watch_folder") ? 0 : 1; |
|
|
|
|
} |
|
|
|
|
folders.set(fpath, other); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return [folders, download_in_place]; |
|
|
|
|
return folders; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
updateExportDirEnabled = function() { |
|
|
|
@ -714,14 +764,17 @@ loadPreferences = function() {
@@ -714,14 +764,17 @@ loadPreferences = function() {
|
|
|
|
|
updateTempDirEnabled(); |
|
|
|
|
$('preallocateall_checkbox').setProperty('checked', pref.preallocate_all); |
|
|
|
|
$('appendext_checkbox').setProperty('checked', pref.incomplete_files_ext); |
|
|
|
|
var i; |
|
|
|
|
for(i=0; i<pref.scan_dirs.length; i+=1) { |
|
|
|
|
var myinput = "<input id='text_watch_"+ i +"' type='text' value='" + pref.scan_dirs[i] + "'>"; |
|
|
|
|
var checked = ""; |
|
|
|
|
if (pref.download_in_scan_dirs[i]) |
|
|
|
|
checked = "checked"; |
|
|
|
|
var mycb = "<input id='cb_watch_"+ i +"' type='checkbox' " + checked + ">"; |
|
|
|
|
WatchedFoldersTable.push([myinput, mycb]); |
|
|
|
|
var i = 0; |
|
|
|
|
for (var folder in pref.scan_dirs) { |
|
|
|
|
var sel; |
|
|
|
|
var other = ""; |
|
|
|
|
if (typeof pref.scan_dirs[folder] == "string") { |
|
|
|
|
other = pref.scan_dirs[folder]; |
|
|
|
|
sel = "other"; |
|
|
|
|
} else { |
|
|
|
|
sel = (pref.scan_dirs[folder] == 0) ? "watch_folder" : "default_folder"; |
|
|
|
|
} |
|
|
|
|
pushWatchFolder(i++, folder, sel, other); |
|
|
|
|
} |
|
|
|
|
if(pref.export_dir != '') { |
|
|
|
|
$('exportdir_checkbox').setProperty('checked', true); |
|
|
|
@ -950,9 +1003,7 @@ applyPreferences = function() {
@@ -950,9 +1003,7 @@ applyPreferences = function() {
|
|
|
|
|
settings.set('temp_path', $('temppath_text').getProperty('value')); |
|
|
|
|
settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked')); |
|
|
|
|
settings.set('incomplete_files_ext', $('appendext_checkbox').getProperty('checked')); |
|
|
|
|
var watched_folders = getWatchedFolders(); |
|
|
|
|
settings.set('scan_dirs', watched_folders[0]); |
|
|
|
|
settings.set('download_in_scan_dirs', watched_folders[1]); |
|
|
|
|
settings.set('scan_dirs', getWatchedFolders()); |
|
|
|
|
if($('exportdir_checkbox').getProperty('checked')) |
|
|
|
|
settings.set('export_dir', $('exportdir_text').getProperty('value')); |
|
|
|
|
else |
|
|
|
|