Browse Source

Fix "Open destination folder" that would open a subfolder instead (closes #607510)

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
a91ad3c9c7
  1. 9
      src/qtorrenthandle.cpp
  2. 33
      src/transferlistwidget.cpp

9
src/qtorrenthandle.cpp

@ -450,15 +450,6 @@ bool QTorrentHandle::priv() const {
return h.get_torrent_info().priv(); return h.get_torrent_info().priv();
} }
QString QTorrentHandle::root_path() const {
Q_ASSERT(h.is_valid());
if(num_files() == 0) return "";
QStringList path_list = misc::toQStringU(h.get_torrent_info().file_at(0).path.string()).split("/");
if(path_list.size() > 1)
return save_path()+"/"+path_list.first();
return save_path();
}
QString QTorrentHandle::firstFileSavePath() const { QString QTorrentHandle::firstFileSavePath() const {
Q_ASSERT(h.is_valid()); Q_ASSERT(h.is_valid());
Q_ASSERT(has_metadata()); Q_ASSERT(has_metadata());

33
src/transferlistwidget.cpp

@ -515,10 +515,10 @@ void TransferListWidget::refreshList(bool force) {
if(s == STATE_PAUSED_DL) { if(s == STATE_PAUSED_DL) {
++nb_paused; ++nb_paused;
} }
++nb_inactive; ++nb_inactive;
++nb_downloading; ++nb_downloading;
break; break;
} }
case STATE_SEEDING: case STATE_SEEDING:
++nb_active; ++nb_active;
++nb_seeding; ++nb_seeding;
@ -530,10 +530,10 @@ void TransferListWidget::refreshList(bool force) {
if(s == STATE_PAUSED_UP) { if(s == STATE_PAUSED_UP) {
++nb_paused; ++nb_paused;
} }
++nb_seeding; ++nb_seeding;
++nb_inactive; ++nb_inactive;
break; break;
} }
case STATE_INVALID: case STATE_INVALID:
bad_hashes << getHashFromRow(i); bad_hashes << getHashFromRow(i);
break; break;
@ -601,10 +601,11 @@ void TransferListWidget::torrentDoubleClicked(const QModelIndex& index) {
} }
break; break;
case OPEN_DEST: case OPEN_DEST:
if(h.has_metadata()) #ifdef Q_WS_WIN
QDesktopServices::openUrl(QUrl("file://" + h.root_path())); QDesktopServices::openUrl(QUrl("file:///" + h.save_path()));
else #else
QDesktopServices::openUrl(QUrl("file://" + h.save_path())); QDesktopServices::openUrl(QUrl("file://" + h.save_path()));
#endif
break; break;
} }
} }
@ -638,10 +639,10 @@ void TransferListWidget::setSelectedTorrentsLocation() {
} }
} }
foreach(const QString & hash, hashes) { foreach(const QString & hash, hashes) {
// Actually move storage // Actually move storage
QTorrentHandle h = BTSession->getTorrentHandle(hash); QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(!BTSession->useTemporaryFolder() || h.is_seed()) if(!BTSession->useTemporaryFolder() || h.is_seed())
h.move_storage(savePath.absolutePath()); h.move_storage(savePath.absolutePath());
} }
} }
} }
@ -764,7 +765,7 @@ void TransferListWidget::openSelectedTorrentsFolder() const {
foreach(const QString &hash, hashes) { foreach(const QString &hash, hashes) {
const QTorrentHandle &h = BTSession->getTorrentHandle(hash); const QTorrentHandle &h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) { if(h.is_valid()) {
const QString &savePath = h.root_path(); const QString &savePath = h.save_path();
qDebug("Opening path at %s", qPrintable(savePath)); qDebug("Opening path at %s", qPrintable(savePath));
if(!pathsList.contains(savePath)) { if(!pathsList.contains(savePath)) {
pathsList.append(savePath); pathsList.append(savePath);

Loading…
Cancel
Save