diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2009-04-16 08:08:06 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-04-16 08:08:06 (GMT) |
commit | e37684d2899b8f2cbc14fa0ab19ab12ed23d495a (patch) | |
tree | 0487bce9f7cc1b21186dce75cebad8c61ca5a7fe | |
parent | 876d4b64acce6f9f786d5a59612d73688167ef64 (diff) | |
parent | a4c4f994fa51ff216f0d43098824617e14b8a284 (diff) | |
download | Qt-e37684d2899b8f2cbc14fa0ab19ab12ed23d495a.zip Qt-e37684d2899b8f2cbc14fa0ab19ab12ed23d495a.tar.gz Qt-e37684d2899b8f2cbc14fa0ab19ab12ed23d495a.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
-rw-r--r-- | src/gui/dialogs/qfiledialog.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index b20321f..f70669c 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1593,7 +1593,12 @@ QString QFileDialog::getOpenFileName(QWidget *parent, args.parent = parent; args.caption = caption; args.directory = QFileDialogPrivate::workingDirectory(dir); - args.selection = QFileDialogPrivate::initialSelection(dir); + //If workingDirectory returned a different path than the initial one, + //it means that the initial path was invalid. There is no point to try select a file + if (args.directory != QFileInfo(dir).path()) + args.selection = QString(); + else + args.selection = QFileDialogPrivate::initialSelection(dir); args.filter = filter; args.mode = ExistingFile; args.options = options; @@ -1678,7 +1683,12 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, args.parent = parent; args.caption = caption; args.directory = QFileDialogPrivate::workingDirectory(dir); - args.selection = QFileDialogPrivate::initialSelection(dir); + //If workingDirectory returned a different path than the initial one, + //it means that the initial path was invalid. There is no point to try select a file + if (args.directory != QFileInfo(dir).path()) + args.selection = QString(); + else + args.selection = QFileDialogPrivate::initialSelection(dir); args.filter = filter; args.mode = ExistingFiles; args.options = options; @@ -1764,7 +1774,12 @@ QString QFileDialog::getSaveFileName(QWidget *parent, args.parent = parent; args.caption = caption; args.directory = QFileDialogPrivate::workingDirectory(dir); - args.selection = QFileDialogPrivate::initialSelection(dir); + //If workingDirectory returned a different path than the initial one, + //it means that the initial path was invalid. There is no point to try select a file + if (args.directory != QFileInfo(dir).path()) + args.selection = QString(); + else + args.selection = QFileDialogPrivate::initialSelection(dir); args.filter = filter; args.mode = AnyFile; args.options = options; |