This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Deleting files using the Web interface

Tags: None
(comma "," separated)
ktnex
Registered Member
Posts
2
Karma
0
I want the red "X" in the web interface to delete the torrent files when I delete the torrent.
Also, I want it to be a one-click procedure -- no "Are you absolutely sure..." prompt.

So, I coded up a patch to make the web interface behave as I want.
I thought I'd share it here for anyone else who is interested.

This is all my notes.
If you want to make the changes:
1. download the source
2. edit the two files so that your diffs look like my diffs below.
3. ./configure , make, make install.

If you don't have all the libraries that ./configure needs, you will get nasty, useless and misleading error messages.
If you look inside config.log , you will usually find the name of a file you are missing. You will need, at least:
kdelibs4-dev
libgmp3-dev
libzzip-0-12
libqt3-mt-dev

the version numbers are just what I was using today. They will certainly change over time.


This patch is for version 2.1.4:

/usr/share/apps/ktorrent/www/default/interface.php
builds the prompt message "Are you absolutely sure that you want to remove this torrent?"
--commented out msg call:
diff interface.php.ORIG interface.php
26c26
< msg = "Are you absolutely sure that you want remove this torrent?";
---
> <!-- msg = "Are you absolutely sure that you want remove this torrent?"; -->



plugins/webinterface/php_interface.cpp calls: core->remove((*i), false);
the "false" is a 0 (zero)

this eventually triggers the remove call described in coreinterface.h:
/**
* Remove a download.This will delete all temp
* data from this TorrentControl And delete the
* TorrentControl itself. It can also potentially
* start a new download (when one is waiting to be downloaded).
* @param tc The torrent
* @param data_to Wether or not to delete the file data to
*/
virtual void remove(TorrentInterface* tc,bool data_to) = 0;

--If we change "false" to "true", the torrent data files are removed:
diff php_interface.cpp.ORIG php_interface.cpp
286c286
< core->remove((*i), false);
---
> core->remove((*i), true); /* delete data */
George
Moderator
Posts
5421
Karma
1

Mon Jun 25, 2007 6:12 pm
This is very dangerous, you want to get rid of the warning and you delete the data. So if somebody misclicks by accident on the X, he or she has lost all the data.
ktnex
Registered Member
Posts
2
Karma
0

in the eye of the beholder.

Mon Jun 25, 2007 8:28 pm
Perhaps.

But, it is a risk/reward balance.
The other side of the risk is that I forget to delete old stuff, and I run out of disk space.

Also, I think it is very instructive for the community to know how to make changes like this.

I meant this posting in its technical spirit.
I'd rather not get into a deep discussion of UI's.
People can use this, or not, as is their inclination.

Thanks, Bob
rapsys
Registered Member
Posts
71
Karma
0

Wed Jun 27, 2007 2:01 am
I think that the delete confirmation can be removed from php code.

A simple onclick="if(!confirm('confirm text here')) return false;" should be enough on delete link.

That way it avoid a full refresh of php page (especialy problematic when banwith is completely used by torrent upload).

The pros are :
- easy
- quick

The cons :
- will not work on javascript not enabled navigator
dierbro
Registered Member
Posts
36
Karma
0

Wed Jun 27, 2007 6:27 am
in default interface we already use onclick and javascript


unzip;strip;touch;finger;mount;fsck;more;yes;umount;sleep


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]