diff --git a/qt/freespace-label.cc b/qt/freespace-label.cc index e80a8385a..16ce02f15 100644 --- a/qt/freespace-label.cc +++ b/qt/freespace-label.cc @@ -7,6 +7,8 @@ * $Id$ */ +#include + #include #include @@ -98,7 +100,7 @@ FreespaceLabel::onSessionExecuted (int64_t tag, const QString& result, tr_varian const char * path = 0; tr_variantDictFindStr (arguments, TR_KEY_path, &path, &len); str = QString::fromUtf8 (path, len); - setToolTip (str); + setToolTip (QDir::toNativeSeparators (str)); myTimer.start (); } diff --git a/qt/path-button.cc b/qt/path-button.cc index 75cb89114..634ff81e6 100644 --- a/qt/path-button.cc +++ b/qt/path-button.cc @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -63,7 +64,7 @@ TrPathButton::setPath (const QString& path) if (myPath == path) return; - myPath = Utils::removeTrailingDirSeparator (path); + myPath = QDir::toNativeSeparators (Utils::removeTrailingDirSeparator (path)); updateAppearance (); @@ -114,7 +115,20 @@ TrPathButton::onClicked () dialog->setOption (QFileDialog::ShowDirsOnly); if (!myNameFilter.isEmpty ()) dialog->setNameFilter (myNameFilter); - dialog->selectFile (myPath); + + const QFileInfo pathInfo (myPath); + if (!myPath.isEmpty () && pathInfo.exists ()) + { + if (pathInfo.isDir ()) + { + dialog->setDirectory (pathInfo.absoluteFilePath ()); + } + else + { + dialog->setDirectory (pathInfo.absolutePath ()); + dialog->selectFile (pathInfo.fileName ()); + } + } connect (dialog, SIGNAL (fileSelected (QString)), this, SLOT (onFileSelected (QString)));