forked from qt-creator/qt-creator
Core: Use a consistent initial directory in open/save/locator
Use fileDialogInitialDirectory() for all of them. Conditionally initialize lastVisitedDirectory to projects directory to preserve existing behavior on Open, when no project is open yet. Change-Id: I318a7c7741e70a68758f0cc068ce956135103f3f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
cc80ba2a7e
commit
08f807a134
@@ -229,6 +229,9 @@ DocumentManager::DocumentManager(QObject *parent)
|
||||
qApp->installEventFilter(this);
|
||||
|
||||
readSettings();
|
||||
|
||||
if (d->m_useProjectsDirectory)
|
||||
setFileDialogLastVisitedDirectory(d->m_projectsDirectory);
|
||||
}
|
||||
|
||||
DocumentManager::~DocumentManager()
|
||||
@@ -886,13 +889,7 @@ QStringList DocumentManager::getOpenFileNames(const QString &filters,
|
||||
const QString &pathIn,
|
||||
QString *selectedFilter)
|
||||
{
|
||||
QString path = pathIn;
|
||||
if (path.isEmpty()) {
|
||||
if (EditorManager::currentDocument() && !EditorManager::currentDocument()->isTemporary())
|
||||
path = EditorManager::currentDocument()->filePath().toString();
|
||||
if (path.isEmpty() && useProjectsDirectory())
|
||||
path = projectsDirectory();
|
||||
}
|
||||
const QString &path = pathIn.isEmpty() ? fileDialogInitialDirectory() : pathIn;
|
||||
const QStringList files = QFileDialog::getOpenFileNames(ICore::dialogParent(),
|
||||
tr("Open File"),
|
||||
path, filters,
|
||||
|
Reference in New Issue
Block a user