1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

[Windows] fixed: open folder and select downloaded file (using ShellExecute for run explorer).

-Now it covers all possible situations (e.g. path with spaces, file without extention, ...)
This commit is contained in:
S. Razi Alavizadeh 2013-01-17 16:49:19 +03:30
parent ef4cfad805
commit f917f03b26

View File

@ -367,9 +367,16 @@ void DownloadItem::openFile()
void DownloadItem::openFolder()
{
#ifdef Q_OS_WIN
QString winFileName = m_path + m_fileName;
winFileName.replace(QLatin1Char('/'), "\\");
QProcess::startDetached("explorer.exe /e,/select,\"" + winFileName + "\"");
if (m_fileName.endsWith(" ")) {
// explorer.exe don't support filenames that end with SPACE
QDesktopServices::openUrl(QUrl::fromLocalFile(m_path));
}
else {
QString winFileName = m_path + m_fileName;
winFileName.replace(QLatin1Char('/'), "\\");
QString shExArg = "/e,/select,\""+winFileName+"\"";
ShellExecute(NULL, NULL, TEXT("explorer.exe"), shExArg.toStdWString().c_str(), NULL, SW_SHOW);
}
#else
QDesktopServices::openUrl(QUrl::fromLocalFile(m_path));
#endif