mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 15:07:22 -06:00
"Open destination folder" now opens torrent root folder (if it contains one) instead of the parent folder
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.1.2
|
||||
- BUGFIX: Fix overwrite check when renaming a folder in a torrent
|
||||
- BUGFIX: Force a recheck after renaming files to avoid overwriting
|
||||
- BUGFIX: Improve "Open destination folder" behavior
|
||||
- COSMETIC: Improved transfer speed display in peers list
|
||||
|
||||
* Wed Jan 20 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.1
|
||||
|
||||
@@ -432,6 +432,15 @@ bool QTorrentHandle::priv() const {
|
||||
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::toQString(h.get_torrent_info().file_at(0).path.string()).split(QDir::separator());
|
||||
if(path_list.size() > 1)
|
||||
return save_path()+QDir::separator()+path_list.first();
|
||||
return save_path();
|
||||
}
|
||||
|
||||
//
|
||||
// Setters
|
||||
//
|
||||
|
||||
@@ -126,6 +126,7 @@ class QTorrentHandle {
|
||||
#endif
|
||||
bool priv() const;
|
||||
bool first_last_piece_first() const;
|
||||
QString root_path() const;
|
||||
|
||||
//
|
||||
// Setters
|
||||
|
||||
@@ -529,7 +529,7 @@ void TransferListWidget::torrentDoubleClicked(QModelIndex index) {
|
||||
}
|
||||
break;
|
||||
case OPEN_DEST:
|
||||
QDesktopServices::openUrl("file://" + h.save_path());
|
||||
QDesktopServices::openUrl("file://" + h.root_path());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -663,7 +663,7 @@ void TransferListWidget::openSelectedTorrentsFolder() const {
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
|
||||
if(h.is_valid()) {
|
||||
QString savePath = h.save_path();
|
||||
QString savePath = h.root_path();
|
||||
if(!pathsList.contains(savePath)) {
|
||||
pathsList.append(savePath);
|
||||
QDesktopServices::openUrl(QUrl(QString("file://")+savePath));
|
||||
|
||||
Reference in New Issue
Block a user