* $Id$
*/
+#include <QDir>
+
#include <libtransmission/transmission.h>
#include <libtransmission/variant.h>
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 ();
}
*/
#include <QApplication>
+#include <QDir>
#include <QFileDialog>
#include <QFileIconProvider>
#include <QFileInfo>
if (myPath == path)
return;
- myPath = Utils::removeTrailingDirSeparator (path);
+ myPath = QDir::toNativeSeparators (Utils::removeTrailingDirSeparator (path));
updateAppearance ();
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)));