Browse Source

COSMETIC: Same deletion confirmation dialog in the GUI and Web UI

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
493499cded
  1. 1
      Changelog
  2. BIN
      src/Icons/skin/delete_perm.png
  3. BIN
      src/Icons/skin/delete_perm22.png
  4. 2
      src/icons.qrc
  5. 69
      src/webui/html/confirmdeletion.html
  6. 7
      src/webui/html/index.html
  7. 36
      src/webui/scripts/mocha-init.js
  8. 1
      src/webui/webui.qrc

1
Changelog

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.6.0
- FEATURE: Use system icons (Linux, Qt >= 4.6)
- FEATURE: Simplify program preferences
- COSMETIC: Same deletion confirmation dialog in the GUI and Web UI
- COSMETIC: Simplified the top toolbar
* Sun Dec 5 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.5.0

BIN
src/Icons/skin/delete_perm.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

BIN
src/Icons/skin/delete_perm22.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

2
src/icons.qrc

@ -11,7 +11,6 @@ @@ -11,7 +11,6 @@
<file>Icons/magnet.png</file>
<file>Icons/slow.png</file>
<file>Icons/L.gif</file>
<file>Icons/skin/delete_perm22.png</file>
<file>Icons/skin/seeding.png</file>
<file>Icons/skin/splash.png</file>
<file>Icons/skin/tabs.gif</file>
@ -23,7 +22,6 @@ @@ -23,7 +22,6 @@
<file>Icons/skin/paused.png</file>
<file>Icons/skin/slider-area.gif</file>
<file>Icons/skin/stalledDL.png</file>
<file>Icons/skin/delete_perm.png</file>
<file>Icons/skin/error.png</file>
<file>Icons/skin/handle-icon-horizontal.gif</file>
<file>Icons/skin/qbittorrent32.png</file>

69
src/webui/html/confirmdeletion.html

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>_(Deletion confirmation - qBittorrent)</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script type="text/javascript" src="scripts/mootools-1.2-core-yc.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/mootools-1.2-more.js" charset="utf-8"></script>
<script type="text/javascript">
function $get(key,url){
if(arguments.length < 2) url =location.href;
if(arguments.length > 0 && key != ""){
if(key == "#"){
var regex = new RegExp("[#]([^$]*)");
} else if(key == "?"){
var regex = new RegExp("[?]([^#$]*)");
} else {
var regex = new RegExp("[?&]"+key+"=([^&#]*)");
}
var results = regex.exec(url);
return (results == null )? "" : results[1].replace(/%22/g, "'");
} else {
url = url.split("?");
var results = {};
if(url.length > 1){
url = url[1].split("#");
if(url.length > 1) results["hash"] = url[1];
url[0].split("&").each(function(item,index){
item = item.split("=");
results[item[0]] = item[1].replace(/%22/g, "'");
});
}
return results;
}
}
var hashes = JSON.decode($get('hashes'));
window.addEvent('domready', function(){
$('cancelBtn').focus();
$('cancelBtn').addEvent('click', function(e){
new Event(e).stop();
window.parent.document.getElementById('confirmDeletionPage').parentNode.removeChild(window.parent.document.getElementById('confirmDeletionPage'));
});
$('confirmBtn').addEvent('click', function(e){
new Event(e).stop();
var cmd = '/command/delete';
if($('deleteFromDiskCB').get('checked'))
cmd = '/command/deletePerm';
hashes.each(function(item, index){
new Request({url: cmd, method: 'post', data: {hash: item}}).send();
});
window.parent.document.getElementById('confirmDeletionPage').parentNode.removeChild(window.parent.document.getElementById('confirmDeletionPage'));
});
});
</script>
</head>
<body>
<br/>
<p>_(Are you sure you want to delete the selected torrents from the transfer list?)</p>
&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="deleteFromDiskCB"/> <i>_(Also delete the files on the hard disk)</i><br/><br/>
<div style="text-align: right;">
<input type="button" id="cancelBtn" value="_(No)" />&nbsp;&nbsp;<input type="button" id="confirmBtn" value="Yes"/>&nbsp;&nbsp;
</div>
</body>
</html>

7
src/webui/html/index.html

@ -48,8 +48,7 @@ @@ -48,8 +48,7 @@
<li class="divider"><a id="resumeLink"><img class="MyMenuIcon" src="theme/media-playback-start" width="16" height="16" onload="fixPNG(this)"/>_(&Start)</a></li>
<li><a id="pauseLink"><img class="MyMenuIcon" src="theme/media-playback-pause" width="16" height="16" onload="fixPNG(this)"/>_(&Pause)</a></li>
<li><a id="recheckLink"><img class="MyMenuIcon" src="theme/document-edit-verify" width="16" height="16" onload="fixPNG(this)"/>_(Force recheck)</a></li>
<li class="divider"><a id="deleteLink"><img class="MyMenuIcon" src="theme/edit-delete" width="16" height="16" onload="fixPNG(this)"/>_(&Delete)</a></li>
<li><a id="deletePermLink"><img class="MyMenuIcon" src="theme/edit-delete" width="16" height="16" onload="fixPNG(this)"/>_(Delete from HD)</a></li>
<li class="divider"><a id="deleteLink"><img class="MyMenuIcon" src="theme/list-remove" width="16" height="16" onload="fixPNG(this)"/>_(&Delete)</a></li>
</ul>
</li>
<li>
@ -73,7 +72,6 @@ @@ -73,7 +72,6 @@
<a id="uploadButton"><img class="mochaToolButton" title="_(Download local torrent)" src="theme/list-add" width="32" height="32" onload="fixPNG(this)"/></a>
<a id="downloadButton"><img class="mochaToolButton" title="_(Download from URL)" src="theme/insert-link" width="32" height="32" onload="fixPNG(this)"/></a>
<a id="deleteButton" class="divider"><img class="mochaToolButton" title="_(Delete)" src="theme/list-remove" width="32" height="32" onload="fixPNG(this)"/></a>
<a id="deletePermButton"><img class="mochaToolButton" title="_(Delete from HD)" src="images/skin/delete_perm.png" width="32" height="32" onload="fixPNG(this)"/></a>
<a id="resumeButton" class="divider"><img class="mochaToolButton" title="_(Start)" src="theme/media-playback-start" width="32" height="32" onload="fixPNG(this)"/></a>
<a id="pauseButton"><img class="mochaToolButton" title="_(Pause)" src="theme/media-playback-pause" width="32" height="32" onload="fixPNG(this)"/></a>
<span id="queueingButtons">
@ -89,8 +87,7 @@ @@ -89,8 +87,7 @@
<ul id="contextmenu">
<li><a href="#Start"><img src="theme/media-playback-start"/> _(Start)</a></li>
<li><a href="#Pause"><img src="theme/media-playback-pause"/> _(Pause)</a></li>
<li class="separator"><a href="#Delete""><img src="theme/edit-delete"/> _(Delete)</a></li>
<li><a href="#DeleteHD"><img src="theme/edit-delete"/> _(Delete from HD)</a></li>
<li class="separator"><a href="#Delete""><img src="theme/list-remove"/> _(Delete)</a></li>
<li class="separator"><a href="#priority" class="arrow-right">_(Priority)</a>
<ul>
<li><a href="#prioTop""><img src="theme/go-top"/> _(Move to top)</a></li>

36
src/webui/scripts/mocha-init.js

@ -150,11 +150,25 @@ initializeWindows = function(){ @@ -150,11 +150,25 @@ initializeWindows = function(){
deleteFN = function() {
var h = myTable.selectedIds();
if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) {
/*if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) {
h.each(function(item, index){
new Request({url: '/command/delete', method: 'post', data: {hash: item}}).send();
});
}
}*/
if(h.length) {
new MochaUI.Window({
id: 'confirmDeletionPage',
title: "_(Deletion confirmation - qBittorrent)",
loadMethod: 'iframe',
contentURL:'confirmdeletion.html?hashes='+JSON.encode(h),
scrollbars: false,
resizable: false,
maximizable: false,
padding: 10,
width: 424,
height: 140
});
}
};
addClickEvent('delete', function(e){
@ -162,21 +176,6 @@ initializeWindows = function(){ @@ -162,21 +176,6 @@ initializeWindows = function(){
deleteFN();
});
deleteHDFN = function() {
var h = myTable.selectedIds();
if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list and hard disk?)')) {
h.each(function(item, index){
new Request({url: '/command/deletePerm', method: 'post', data: {hash: item}}).send();
});
}
};
addClickEvent('deletePerm', function(e){
new Event(e).stop();
deleteHDFN();
});
pauseFN = function() {
var h = myTable.selectedIds();
if(h.length){
@ -274,7 +273,8 @@ initializeWindows = function(){ @@ -274,7 +273,8 @@ initializeWindows = function(){
loadMethod: 'iframe',
contentURL: 'about.html',
width: 650,
height: 400
height: 400,
padding: 10
});
});

1
src/webui/webui.qrc

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
<file>html/downloadlimit.html</file>
<file>html/preferences.html</file>
<file>html/preferences_content.html</file>
<file>html/confirmdeletion.html</file>
<file>css/Core.css</file>
<file>css/Layout.css</file>
<file>css/Window.css</file>

Loading…
Cancel
Save