diff --git a/src/addTorrentDialog.ui b/src/addTorrentDialog.ui
index f2cd090d4..b0c28ab69 100644
--- a/src/addTorrentDialog.ui
+++ b/src/addTorrentDialog.ui
@@ -69,6 +69,9 @@
-
+
+ Qt::CustomContextMenu
+
QAbstractItemView::ExtendedSelection
@@ -157,6 +160,16 @@
+
+
+ select
+
+
+
+
+ Unselect
+
+
diff --git a/src/torrentAddition.h b/src/torrentAddition.h
index 0330cd93e..5d2b9daf4 100644
--- a/src/torrentAddition.h
+++ b/src/torrentAddition.h
@@ -27,6 +27,7 @@
#include
#include
#include
+#include
#include
#include
@@ -54,6 +55,10 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
torrentAdditionDialog(QWidget *parent, QString filePath, bool fromScanDir=false, QString from_url=QString::null) : QDialog(parent), filePath(filePath), fromScanDir(fromScanDir), from_url(from_url){
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
+ actionSelect->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
+ actionUnselect->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
+ connect(actionSelect, SIGNAL(triggered()), this, SLOT(selectItems()));
+ connect(actionUnselect, SIGNAL(triggered()), this, SLOT(unselectItems()));
//TODO: Remember last entered path
QString home = QDir::homePath();
if(home[home.length()-1] != QDir::separator()){
@@ -96,6 +101,7 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
}
//Connects
connect(torrentContentList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(toggleSelection(QTreeWidgetItem*, int)));
+ connect(torrentContentList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displaySelectionMenu(const QPoint&)));
show();
}
@@ -111,6 +117,28 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
close();
}
+ void selectItems(){
+ QList selectedItems = torrentContentList->selectedItems();
+ QTreeWidgetItem *item;
+ foreach(item, selectedItems){
+ int row = torrentContentList->indexOfTopLevelItem(item);
+ setLineColor(row, "green");
+ item->setText(SELECTED, tr("True"));
+ selection.replace(row, true);
+ }
+ }
+
+ void unselectItems(){
+ QList selectedItems = torrentContentList->selectedItems();
+ QTreeWidgetItem *item;
+ foreach(item, selectedItems){
+ int row = torrentContentList->indexOfTopLevelItem(item);
+ setLineColor(row, "red");
+ item->setText(SELECTED, tr("False"));
+ selection.replace(row, false);
+ }
+ }
+
void toggleSelection(QTreeWidgetItem *item, int){
int row = torrentContentList->indexOfTopLevelItem(item);
if(row == -1){
@@ -127,6 +155,13 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
}
}
+ void displaySelectionMenu(const QPoint& pos){
+ QMenu mySelectionMenu(this);
+ mySelectionMenu.addAction(actionSelect);
+ mySelectionMenu.addAction(actionUnselect);
+ mySelectionMenu.exec(mapToGlobal(pos)+QPoint(10, 150));
+ }
+
void saveFilteredFiles(){
QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileName+".pieces");
// First, remove old file