Commit 1a8ef7f3 authored by Petar Perisin's avatar Petar Perisin Committed by Eike Ziller
Browse files

PathChooser - fix handling of predefined path



predefined path was not set when path chooser was set to select files.

Change-Id: I2a9b3d9f2d84b0c5f048bde8e098c6c17772e957
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 8d96ce55
......@@ -357,11 +357,21 @@ void PathChooser::slotBrowse()
emit beforeBrowsing();
QString predefined = path();
if ((predefined.isEmpty() || !QFileInfo(predefined).isDir())
QFileInfo fi(predefined);
if (!predefined.isEmpty() && !fi.isDir()) {
predefined = fi.path();
fi.setFile(predefined);
}
if ((predefined.isEmpty() || !fi.isDir())
&& !d->m_initialBrowsePathOverride.isNull()) {
predefined = d->m_initialBrowsePathOverride;
if (!QFileInfo(predefined).isDir())
fi.setFile(predefined);
if (!fi.isDir()) {
predefined.clear();
fi.setFile(QString());
}
}
// Prompt for a file/dir
......@@ -392,7 +402,6 @@ void PathChooser::slotBrowse()
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::AnyFile);
dialog.setWindowTitle(makeDialogTitle(tr("Choose File")));
QFileInfo fi(predefined);
if (fi.exists())
dialog.setDirectory(fi.absolutePath());
// FIXME: fix QFileDialog so that it filters properly: lib*.a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment