← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3370: Transferview: Added "Remove file from queue" menu option and "Force attempt" is now only availabl...

 

------------------------------------------------------------
revno: 3370
committer: Fredrik Ullner <ullner@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Fri 2013-11-29 18:18:43 +0100
message:
  Transferview: Added "Remove file from queue" menu option and "Force attempt" is now only available for downloads
modified:
  changelog.txt
  win32/TransferView.cpp
  win32/TransferView.h


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2013-11-22 22:26:10 +0000
+++ changelog.txt	2013-11-29 17:18:43 +0000
@@ -3,6 +3,7 @@
 * [L#1250614] Added menu option on hub tab for only searching in that hub (ullner)
 * [L#250238] Remove queued files that are already shared when DC++ starts (ullner)
 * [L#309815] Hub icon will change depending on user status (user/registered/operator) (ullner)
+* [L#721513] Transferview: Added "Remove file from queue" menu option and "Force attempt" is now only available for downloads (ullner)
 
 -- 0.831 2013-11-11 --
 * [L#1249810] Fix NMDC TTH search responses (emtee)

=== modified file 'win32/TransferView.cpp'
--- win32/TransferView.cpp	2013-09-15 16:39:42 +0000
+++ win32/TransferView.cpp	2013-11-29 17:18:43 +0000
@@ -270,6 +270,10 @@
 	ConnectionManager::getInstance()->disconnect(user, parent.type);
 }
 
+void TransferView::ConnectionInfo::removeFileFromQueue() {
+	QueueManager::getInstance()->remove(transfer().path);
+}
+
 TransferView::TransferInfo::TransferInfo(const TTHValue& tth, ConnectionType type, const string& path, const string& tempPath) :
 	ItemInfo(),
 	tth(tth),
@@ -392,6 +396,12 @@
 	}
 }
 
+void TransferView::TransferInfo::removeFileFromQueue() {
+	for(auto& conn: conns) {
+		conn.removeFileFromQueue();
+	}
+}
+
 TransferView::HttpInfo::HttpInfo(const string& url) :
 	TransferInfo(TTHValue(), CONNECTION_TYPE_DOWNLOAD, url, Util::emptyString),
 	status(STATUS_WAITING)
@@ -518,11 +528,16 @@
 		}
 		menu->appendShellMenu(paths);
 
+		bool isDownload = transfer->type == CONNECTION_TYPE_DOWNLOAD;
 		if(!onlyHttp) {
 			menu->appendSeparator();
-			menu->appendItem(T_("&Force attempt"), [this] { handleForce(); });
+			menu->appendItem(T_("&Force attempt"), [this] { handleForce(); }, dwt::IconPtr(), isDownload);
+			menu->appendSeparator();
+
+			menu->appendItem(T_("&Remove file from queue"), [this] { handleRemoveFileFromQueue(); }, dwt::IconPtr(), isDownload);
 			menu->appendSeparator();
 		}
+		
 		menu->appendItem(T_("&Disconnect"), [this] { handleDisconnect(); });
 
 		WinUtil::addCopyMenu(menu.get(), transfers);
@@ -547,6 +562,11 @@
 	transfers->forEachSelected(&ItemInfo::disconnect);
 }
 
+void TransferView::handleRemoveFileFromQueue()
+{
+	transfers->forEachSelected(&ItemInfo::removeFileFromQueue);
+}
+
 bool TransferView::handleKeyDown(int c) {
 	if(c == VK_DELETE) {
 		handleDisconnect();

=== modified file 'win32/TransferView.h'
--- win32/TransferView.h	2013-09-15 16:39:42 +0000
+++ win32/TransferView.h	2013-11-29 17:18:43 +0000
@@ -99,6 +99,7 @@
 
 		virtual void force() = 0;
 		virtual void disconnect() = 0;
+		virtual void removeFileFromQueue() = 0;
 
 		int64_t timeleft;
 		int64_t speed;
@@ -124,6 +125,7 @@
 
 		virtual void force();
 		virtual void disconnect();
+		virtual void removeFileFromQueue();
 
 		bool transferFailed;
 		Status status;
@@ -146,6 +148,7 @@
 
 		virtual void force();
 		virtual void disconnect();
+		virtual void removeFileFromQueue();
 
 		TTHValue tth;
 		ConnectionType type;
@@ -242,6 +245,7 @@
 	bool handleContextMenu(dwt::ScreenCoordinate pt);
 	void handleForce();
 	void handleDisconnect();
+	void handleRemoveFileFromQueue();
 	bool handleKeyDown(int c);
 	void handleDblClicked();
 	LRESULT handleCustomDraw(NMLVCUSTOMDRAW& data);