mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06:00
Allow to edit tracker URI
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "trackerlist.h"
|
||||
#include "propertieswidget.h"
|
||||
#include "trackersadditiondlg.h"
|
||||
#include "trackereditdlg.h"
|
||||
#include "iconprovider.h"
|
||||
#include "qbtsession.h"
|
||||
#include "qinisettings.h"
|
||||
@@ -343,6 +344,21 @@ void TrackerList::deleteSelectedTrackers() {
|
||||
loadTrackers();
|
||||
}
|
||||
|
||||
void TrackerList::editSelectedTracker() {
|
||||
QTorrentHandle h = properties->getCurrentTorrent();
|
||||
if (!h.is_valid()) return;
|
||||
|
||||
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
||||
if (selected_items.isEmpty()) return;
|
||||
// During multi-select only process item selected last
|
||||
QString tracker_URI = selected_items.last()->data(COL_URL, Qt::DisplayRole).toString();
|
||||
if (!TrackerEditDlg::editSelectedTracker(h,tracker_URI))
|
||||
return;
|
||||
|
||||
h.force_reannounce();
|
||||
loadTrackers();
|
||||
}
|
||||
|
||||
void TrackerList::showTrackerListMenu(QPoint) {
|
||||
QTorrentHandle h = properties->getCurrentTorrent();
|
||||
if (!h.is_valid()) return;
|
||||
@@ -352,8 +368,10 @@ void TrackerList::showTrackerListMenu(QPoint) {
|
||||
QAction *addAct = menu.addAction(IconProvider::instance()->getIcon("list-add"), tr("Add a new tracker..."));
|
||||
QAction *copyAct = menu.addAction(IconProvider::instance()->getIcon("edit-copy"), tr("Copy tracker url"));
|
||||
QAction *delAct = 0;
|
||||
QAction *editAct = 0;
|
||||
if (!getSelectedTrackerItems().isEmpty()) {
|
||||
delAct = menu.addAction(IconProvider::instance()->getIcon("list-remove"), tr("Remove tracker"));
|
||||
editAct = menu.addAction(IconProvider::instance()->getIcon("edit-rename"),tr("Edit selected tracker URI"));
|
||||
}
|
||||
QAction *act = menu.exec(QCursor::pos());
|
||||
if (act == 0) return;
|
||||
@@ -369,6 +387,10 @@ void TrackerList::showTrackerListMenu(QPoint) {
|
||||
deleteSelectedTrackers();
|
||||
return;
|
||||
}
|
||||
if (act == editAct) {
|
||||
editSelectedTracker();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void TrackerList::loadSettings() {
|
||||
|
||||
Reference in New Issue
Block a user