diff options
Diffstat (limited to 'src/downloadmanager.cpp')
| -rw-r--r-- | src/downloadmanager.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 78162f11..686092b5 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1037,7 +1037,7 @@ void DownloadManager::openFile(int index) return; } - ::ShellExecuteW(nullptr, L"explore", ToWString(QDir::toNativeSeparators(m_OutputDirectory)).c_str(), nullptr, nullptr, SW_SHOWNORMAL); + ExploreFile(m_OutputDirectory); return; } @@ -1047,23 +1047,22 @@ void DownloadManager::openInDownloadsFolder(int index) reportError(tr("OpenFileInDownloadsFolder: invalid download index %1").arg(index)); return; } - QString params = "/select,\""; - QDir path = QDir(m_OutputDirectory); - if (path.exists(getFileName(index))) { - params = params + QDir::toNativeSeparators(getFilePath(index)) + "\""; - ::ShellExecuteW(nullptr, nullptr, L"explorer", ToWString(params).c_str(), nullptr, SW_SHOWNORMAL); - return; - } - else if (path.exists(getFileName(index) + ".unfinished")) { - params = params + QDir::toNativeSeparators(getFilePath(index)+".unfinished") + "\""; + const auto path = getFilePath(index); - ::ShellExecuteW(nullptr, nullptr, L"explorer", ToWString(params).c_str(), nullptr, SW_SHOWNORMAL); + if (QFile::exists(path)) { + ExploreFile(path); return; } + else { + const auto unfinished = path + ".unfinished"; + if (QFile::exists(unfinished)) { + ExploreFile(unfinished); + return; + } + } - ::ShellExecuteW(nullptr, L"explore", ToWString(QDir::toNativeSeparators(m_OutputDirectory)).c_str(), nullptr, nullptr, SW_SHOWNORMAL); - return; + ExploreFile(m_OutputDirectory); } |
