mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Fix 'Open Containing Folder' on unselected file.
This commit is contained in:
parent
7bc7b0e6b8
commit
94ae9544d8
@ -446,29 +446,20 @@ void PropertiesWidget::openFile(const QModelIndex &index) {
|
|||||||
|
|
||||||
void PropertiesWidget::openFolder(const QModelIndex &index, bool containing_folder) {
|
void PropertiesWidget::openFolder(const QModelIndex &index, bool containing_folder) {
|
||||||
// FOLDER
|
// FOLDER
|
||||||
QStringList path_items;
|
int i = PropListModel->getFileIndex(index);
|
||||||
path_items << index.data().toString();
|
const QDir saveDir(h.save_path());
|
||||||
QModelIndex parent = PropListModel->parent(index);
|
const QString filename = h.filepath_at(i);
|
||||||
while(parent.isValid()) {
|
const QString file_path = fsutils::expandPath(saveDir.absoluteFilePath(filename));
|
||||||
path_items.prepend(parent.data().toString());
|
|
||||||
parent = PropListModel->parent(parent);
|
|
||||||
}
|
|
||||||
if (path_items.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if !(defined(Q_OS_WIN) || (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)))
|
#if !(defined(Q_OS_WIN) || (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)))
|
||||||
if (containing_folder)
|
if (containing_folder)
|
||||||
path_items.removeLast();
|
file_path = fsutils::folderName(file_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QDir saveDir(h.save_path());
|
|
||||||
const QString filename = path_items.join("/");
|
|
||||||
// Flush data
|
// Flush data
|
||||||
h.flush_cache();
|
h.flush_cache();
|
||||||
|
if (!QFile::exists(file_path))
|
||||||
QString file_path = fsutils::expandPath(saveDir.absoluteFilePath(filename));
|
return;
|
||||||
if (QFile::exists(file_path + ".!qB"))
|
|
||||||
file_path += ".!qB";
|
|
||||||
qDebug("Trying to open folder at %s", qPrintable(file_path));
|
qDebug("Trying to open folder at %s", qPrintable(file_path));
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
Loading…
Reference in New Issue
Block a user