Browse Source

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

adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
4401b60d51
  1. 17
      src/GUI.cpp

17
src/GUI.cpp

@ -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
@ -1007,6 +1001,7 @@ 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);

Loading…
Cancel
Save