diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2009-04-16 18:08:06 +1000 |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-04-16 18:08:06 +1000 |
commit | e37684d2899b8f2cbc14fa0ab19ab12ed23d495a (patch) | |
tree | 0487bce9f7cc1b21186dce75cebad8c61ca5a7fe /src | |
parent | 876d4b64acce6f9f786d5a59612d73688167ef64 (diff) | |
parent | a4c4f994fa51ff216f0d43098824617e14b8a284 (diff) | |
download | qt4-tools-e37684d2899b8f2cbc14fa0ab19ab12ed23d495a.tar.gz |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
Diffstat (limited to 'src')
-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 b20321f565..f70669c4ff 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; |