1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-09 05:14:23 +00:00

- cleaned up arnaud's code for double-click action

This commit is contained in:
Christophe Dumez 2007-11-08 18:31:41 +00:00
parent 0ce114a7f8
commit 4401b60d51

View File

@ -969,25 +969,19 @@ void GUI::torrentDoubleClicked(QString hash, bool finished) {
int action; int action;
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QTorrentHandle h = BTSession->getTorrentHandle(hash); QTorrentHandle h = BTSession->getTorrentHandle(hash);
QString fileName;
int ret;
settings.beginGroup("Preferences");
settings.beginGroup("Downloads");
if(finished) { if(finished) {
action = settings.value(QString::fromUtf8("DblClOnTorFN"), 0).toInt(); action = settings.value(QString::fromUtf8("Preferences/Downloads/DblClOnTorFN"), 0).toInt();
} else { } else {
action = settings.value(QString::fromUtf8("DblClOnTorDl"), 0).toInt(); action = settings.value(QString::fromUtf8("Preferences/Downloads/DblClOnTorDl"), 0).toInt();
} }
settings.endGroup();
settings.endGroup();
switch(action) { switch(action) {
case TOGGLE_PAUSE : case TOGGLE_PAUSE:
this->togglePausedState(hash); this->togglePausedState(hash);
break; break;
case DELETE_IT : case DELETE_IT: {
ret = QMessageBox::question( int ret = QMessageBox::question(
this, this,
tr("Are you sure? -- qBittorrent"), tr("Are you sure? -- qBittorrent"),
tr("Are you sure you want to delete the selected item(s) from download list and from hard drive?"), tr("Are you sure you want to delete the selected item(s) from download list and from hard drive?"),
@ -995,7 +989,7 @@ void GUI::torrentDoubleClicked(QString hash, bool finished) {
QString(), 0, 1); QString(), 0, 1);
if(ret) if(ret)
return; return;
fileName = h.name(); QString fileName = h.name();
// Remove the torrent // Remove the torrent
BTSession->deleteTorrent(hash, true); BTSession->deleteTorrent(hash, true);
// Delete item from list // Delete item from list
@ -1006,7 +1000,8 @@ void GUI::torrentDoubleClicked(QString hash, bool finished) {
} }
// Update info bar // Update info bar
downloadingTorrentTab->setInfoBar(tr("'%1' was removed permanently.", "'xxx.avi' was removed permanently.").arg(fileName)); downloadingTorrentTab->setInfoBar(tr("'%1' was removed permanently.", "'xxx.avi' was removed permanently.").arg(fileName));
break; break;
}
case SHOW_PROPERTIES : case SHOW_PROPERTIES :
if(finished) { if(finished) {
finishedTorrentTab->showPropertiesFromHash(hash); finishedTorrentTab->showPropertiesFromHash(hash);