|
|
@ -18,9 +18,22 @@ |
|
|
|
</span><br/><br/> |
|
|
|
</span><br/><br/> |
|
|
|
QBT_TR(Automatically add torrents from:)QBT_TR<br/> |
|
|
|
QBT_TR(Automatically add torrents from:)QBT_TR<br/> |
|
|
|
<table border="1" id="watched_folders_tab"> |
|
|
|
<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> |
|
|
|
<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/> |
|
|
|
</table><br/> |
|
|
|
<input type="checkbox" id="exportdir_checkbox" onclick="updateExportDirEnabled();"/> |
|
|
|
<input type="checkbox" id="exportdir_checkbox" onclick="updateExportDirEnabled();"/> |
|
|
|
<label for="exportdir_checkbox">QBT_TR(Copy .torrent files to:)QBT_TR</label> |
|
|
|
<label for="exportdir_checkbox">QBT_TR(Copy .torrent files to:)QBT_TR</label> |
|
|
@ -414,36 +427,73 @@ addWatchFolder = function() { |
|
|
|
var new_folder = $('new_watch_folder_txt').getProperty('value').trim(); |
|
|
|
var new_folder = $('new_watch_folder_txt').getProperty('value').trim(); |
|
|
|
if (new_folder.length <= 0) return; |
|
|
|
if (new_folder.length <= 0) return; |
|
|
|
|
|
|
|
|
|
|
|
var checked = ""; |
|
|
|
var new_other = $('new_watch_folder_other_txt').getProperty('value').trim(); |
|
|
|
if ($('new_watch_folder_dl').getProperty('checked') == true) |
|
|
|
if (new_other.length <= 0) return; |
|
|
|
checked = "checked"; |
|
|
|
|
|
|
|
var i = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var myinput = "<input id='text_watch_"+ i +"' type='text' value='" + new_folder + "'>"; |
|
|
|
var new_select = $('new_watch_folder_select').getProperty('value').trim(); |
|
|
|
var mycb = "<input id='cb_watch_"+ i +"' type='checkbox' " + checked + ">"; |
|
|
|
|
|
|
|
WatchedFoldersTable.push([myinput, mycb]); |
|
|
|
var i = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length; |
|
|
|
|
|
|
|
pushWatchFolder(i, new_folder, new_select, new_other); |
|
|
|
|
|
|
|
|
|
|
|
// Clear fields |
|
|
|
// Clear fields |
|
|
|
$('new_watch_folder_txt').setProperty('value', ''); |
|
|
|
$('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() { |
|
|
|
getWatchedFolders = function() { |
|
|
|
var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length; |
|
|
|
var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length; |
|
|
|
var folders = Array(); |
|
|
|
var folders = new Hash(); |
|
|
|
var download_in_place = Array(); |
|
|
|
for(var i = 0; i < nb_folders; i++) { |
|
|
|
for(var i=0; i<nb_folders; i+=1) { |
|
|
|
var fpath = $('text_watch_' + i).getProperty('value').trim(); |
|
|
|
var folder_path = $('text_watch_'+i).getProperty('value').trim(); |
|
|
|
if (fpath.length > 0) { |
|
|
|
if(folder_path.length > 0) { |
|
|
|
var other; |
|
|
|
folders[folders.length] = folder_path; |
|
|
|
var sel = $('cb_watch_' + i).getProperty('value').trim(); |
|
|
|
if($("cb_watch_"+i).getProperty('checked')) { |
|
|
|
if (sel == "other") { |
|
|
|
download_in_place[download_in_place.length] = 1; |
|
|
|
other = $('cb_watch_txt_' + i).getProperty('value').trim(); |
|
|
|
} else { |
|
|
|
} 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() { |
|
|
|
updateExportDirEnabled = function() { |
|
|
@ -714,14 +764,17 @@ loadPreferences = function() { |
|
|
|
updateTempDirEnabled(); |
|
|
|
updateTempDirEnabled(); |
|
|
|
$('preallocateall_checkbox').setProperty('checked', pref.preallocate_all); |
|
|
|
$('preallocateall_checkbox').setProperty('checked', pref.preallocate_all); |
|
|
|
$('appendext_checkbox').setProperty('checked', pref.incomplete_files_ext); |
|
|
|
$('appendext_checkbox').setProperty('checked', pref.incomplete_files_ext); |
|
|
|
var i; |
|
|
|
var i = 0; |
|
|
|
for(i=0; i<pref.scan_dirs.length; i+=1) { |
|
|
|
for (var folder in pref.scan_dirs) { |
|
|
|
var myinput = "<input id='text_watch_"+ i +"' type='text' value='" + pref.scan_dirs[i] + "'>"; |
|
|
|
var sel; |
|
|
|
var checked = ""; |
|
|
|
var other = ""; |
|
|
|
if (pref.download_in_scan_dirs[i]) |
|
|
|
if (typeof pref.scan_dirs[folder] == "string") { |
|
|
|
checked = "checked"; |
|
|
|
other = pref.scan_dirs[folder]; |
|
|
|
var mycb = "<input id='cb_watch_"+ i +"' type='checkbox' " + checked + ">"; |
|
|
|
sel = "other"; |
|
|
|
WatchedFoldersTable.push([myinput, mycb]); |
|
|
|
} else { |
|
|
|
|
|
|
|
sel = (pref.scan_dirs[folder] == 0) ? "watch_folder" : "default_folder"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pushWatchFolder(i++, folder, sel, other); |
|
|
|
} |
|
|
|
} |
|
|
|
if(pref.export_dir != '') { |
|
|
|
if(pref.export_dir != '') { |
|
|
|
$('exportdir_checkbox').setProperty('checked', true); |
|
|
|
$('exportdir_checkbox').setProperty('checked', true); |
|
|
@ -950,9 +1003,7 @@ applyPreferences = function() { |
|
|
|
settings.set('temp_path', $('temppath_text').getProperty('value')); |
|
|
|
settings.set('temp_path', $('temppath_text').getProperty('value')); |
|
|
|
settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked')); |
|
|
|
settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked')); |
|
|
|
settings.set('incomplete_files_ext', $('appendext_checkbox').getProperty('checked')); |
|
|
|
settings.set('incomplete_files_ext', $('appendext_checkbox').getProperty('checked')); |
|
|
|
var watched_folders = getWatchedFolders(); |
|
|
|
settings.set('scan_dirs', getWatchedFolders()); |
|
|
|
settings.set('scan_dirs', watched_folders[0]); |
|
|
|
|
|
|
|
settings.set('download_in_scan_dirs', watched_folders[1]); |
|
|
|
|
|
|
|
if($('exportdir_checkbox').getProperty('checked')) |
|
|
|
if($('exportdir_checkbox').getProperty('checked')) |
|
|
|
settings.set('export_dir', $('exportdir_text').getProperty('value')); |
|
|
|
settings.set('export_dir', $('exportdir_text').getProperty('value')); |
|
|
|
else |
|
|
|
else |
|
|
|