Changed FolderNavigationWidget::showInGraphicalShell to show expected directories.

This commit is contained in:
Robert Loehning
2010-02-08 20:00:58 +01:00
parent 84e2ecb054
commit 1ae9c10fb8

View File

@@ -386,7 +386,6 @@ static inline void showGraphicalShellError(QWidget *parent,
void FolderNavigationWidget::showInGraphicalShell(QWidget *parent, const QString &pathIn) void FolderNavigationWidget::showInGraphicalShell(QWidget *parent, const QString &pathIn)
{ {
Q_UNUSED(parent)
// Mac, Windows support folder or file. // Mac, Windows support folder or file.
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
const QString explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe")); const QString explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe"));
@@ -396,8 +395,13 @@ void FolderNavigationWidget::showInGraphicalShell(QWidget *parent, const QString
tr("Could not find explorer.exe in path to launch Windows Explorer.")); tr("Could not find explorer.exe in path to launch Windows Explorer."));
return; return;
} }
QProcess::startDetached(explorer, QStringList(QLatin1String("/select,") + QDir::toNativeSeparators(pathIn))); QString param;
if (!QFileInfo(pathIn).isDir())
param = QLatin1String("/select,");
param += QDir::toNativeSeparators(pathIn);
QProcess::startDetached(explorer, QStringList(param));
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
Q_UNUSED(parent)
QStringList scriptArgs; QStringList scriptArgs;
scriptArgs << QLatin1String("-e") scriptArgs << QLatin1String("-e")
<< QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"") << QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"")
@@ -410,7 +414,7 @@ void FolderNavigationWidget::showInGraphicalShell(QWidget *parent, const QString
#else #else
// we cannot select a file here, because no file browser really supports it... // we cannot select a file here, because no file browser really supports it...
const QFileInfo fileInfo(pathIn); const QFileInfo fileInfo(pathIn);
const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.absolutePath(); const QString folder = fileInfo.absoluteFilePath();
const QString app = Utils::UnixUtils::fileBrowser(Core::ICore::instance()->settings()); const QString app = Utils::UnixUtils::fileBrowser(Core::ICore::instance()->settings());
QProcess browserProc; QProcess browserProc;
const QString browserArgs = Utils::UnixUtils::substituteFileBrowserParameters(app, folder); const QString browserArgs = Utils::UnixUtils::substituteFileBrowserParameters(app, folder);