Bug 130465

Summary: Option to delete files when removing them
Product: [Applications] ktorrent Reporter: Christian Ledwon <cledwon>
Component: generalAssignee: Joris Guisson <joris.guisson>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Christian Ledwon 2006-07-08 14:20:03 UTC
Version:            (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages
OS:                Linux

There should be another context menu item to not only remove a torrent, but also delete the corresponding files (e.g. "Remove and delete files").
Comment 1 Joris Guisson 2006-07-08 19:07:48 UTC
There is one, you get asked what do with the data when an incompleted torrent is deleted.
Comment 2 Eike Hein 2006-07-08 19:10:14 UTC
I assume he's referring to completed downloads, i.e. uploads. When you're torrenting archives, you usually extract them in-place and go about your merry way with the data, while the archives stick around to share to a ratio of 1.0. When that's done, you want to delete both the torrent and the now-useless data in one go.
Comment 3 Christian Ledwon 2006-07-08 23:35:34 UTC
Err, yes. What Eike says ;)

Sorry if I did not make this clear in my initial wish. Somehow I never removed an incomplete torrent before, only completed ones...
Comment 4 Niek Beernink 2006-07-10 02:59:26 UTC
I would like to see this feature too, except I can't vote because bugs in Ark are leeching all of them. So here is a reply to show my support. ;)
Comment 5 Niek Beernink 2006-07-10 03:05:09 UTC
I didn't know you could vote per component. Added some votes. :)
Comment 6 Igor Schwarzmann 2006-07-10 14:37:54 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Joris Guisson 2006-10-03 19:59:48 UTC
SVN commit 592053 by guisson:

Added feature to remove torrent and data in context menu of view.

BUG: 130465



 M  +25 -1     apps/ktorrent/ktorrentview.cpp  
 M  +2 -0      apps/ktorrent/ktorrentview.h  
 M  +2 -0      libktorrent/torrent/torrentcontrol.cpp  


--- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrentview.cpp #592052:592053
@@ -142,9 +142,13 @@
 			this,SLOT(startDownloads()));
 
 	remove_id = menu->insertItem(
-			iload->loadIconSet("ktremove",KIcon::Small),i18n("Remove"),
+			iload->loadIconSet("ktremove",KIcon::Small),i18n("Remove Torrent"),
 			this,SLOT(removeDownloads()));
 	
+	remove_all_id = menu->insertItem(
+			iload->loadIconSet("ktremove",KIcon::Small),i18n("Remove Torrent And Data"),
+			this,SLOT(removeDownloadsAndData()));
+	
 	queue_id = menu->insertItem(
 			iload->loadIconSet("player_playlist",KIcon::Small),i18n("Enqueue/Dequeue"),
 			this,SLOT(queueSlot()));
@@ -335,6 +339,25 @@
 	onSelectionChanged();
 }
 
+void KTorrentView::removeDownloadsAndData()
+{
+	QString msg = i18n("You will lose all the downloaded data. Are you sure you want to do this ?");
+	if (KMessageBox::warningYesNo(this,msg) == KMessageBox::No)
+		return;
+	
+	QPtrList<QListViewItem> sel = selectedItems();
+	for (QPtrList<QListViewItem>::iterator itr = sel.begin(); itr != sel.end();itr++)
+	{
+		KTorrentViewItem* kvi = (KTorrentViewItem*)*itr;
+		TorrentInterface* tc = kvi->getTC();
+		if (tc)
+			wantToRemove(tc,true);
+	}
+	
+	// make sure toolbuttons get updated
+	onSelectionChanged();
+}
+
 void KTorrentView::manualAnnounce()
 {
 	QPtrList<QListViewItem> sel = selectedItems();
@@ -447,6 +470,7 @@
 	menu->setItemEnabled(start_id,en_start);
 	menu->setItemEnabled(stop_id,en_stop);
 	menu->setItemEnabled(remove_id,en_remove);
+	menu->setItemEnabled(remove_all_id,en_remove);
 	menu->setItemEnabled(preview_id,en_prev);
 	menu->setItemEnabled(add_peer_id, en_add_peer);
 	menu->setItemEnabled(announce_id,en_announce);
--- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrentview.h #592052:592053
@@ -103,6 +103,7 @@
 	void manualAnnounce();
 	void previewFiles();
 	void removeDownloads();
+	void removeDownloadsAndData();
 	void onSelectionChanged();
 	void queueSlot();
 	void checkDataIntegrity();
@@ -143,6 +144,7 @@
 	int stop_id;
 	int start_id;
 	int remove_id;
+	int remove_all_id;
 	int preview_id;
 	int announce_id;
 	int queue_id;
--- trunk/extragear/network/ktorrent/libktorrent/torrent/torrentcontrol.cpp #592052:592053
@@ -709,6 +709,8 @@
 
 	bool TorrentControl::changeDataDir(const QString & new_dir)
 	{
+#warning "This code is broken at the moment, will fix later"
+		return false;
 		// new_dir doesn't contain the torX/ part
 		// so first get that and append it to new_dir
 		int dd = datadir.findRev(DirSeparator(),datadir.length() - 2,false);