Commit 98e695e3 authored by con's avatar con
Browse files

Remember last "File -> Open" location, start with home directory.

In case we have no open document or "current file", the file dialog
was opening at the creator install location.
Reviewed-by: default avatarThorbjorn Lindeijer <>
Task-number: 249004
parent cb71de60
...@@ -1147,17 +1147,21 @@ bool EditorManager::openExternalEditor(const QString &fileName, const QString &e ...@@ -1147,17 +1147,21 @@ bool EditorManager::openExternalEditor(const QString &fileName, const QString &e
QStringList EditorManager::getOpenFileNames() const QStringList EditorManager::getOpenFileNames() const
{ {
QString dir; static QString dir = QDir::homePath();
if (m_d->fileFilters.isEmpty()) if (m_d->fileFilters.isEmpty())
m_d->fileFilters = formatFileFilters(m_d->m_core, &m_d->selectedFilter); m_d->fileFilters = formatFileFilters(m_d->m_core, &m_d->selectedFilter);
if (IEditor *curEditor = currentEditor()) { QString currentFile = ICore::instance()->fileManager()->currentFile();
const QFileInfo fi(curEditor->file()->fileName()); if (!currentFile.isEmpty()) {
const QFileInfo fi(currentFile);
dir = fi.absolutePath(); dir = fi.absolutePath();
} }
return QFileDialog::getOpenFileNames(m_d->m_core->mainWindow(), tr("Open File"), QStringList files = QFileDialog::getOpenFileNames(m_d->m_core->mainWindow(), tr("Open File"),
dir, m_d->fileFilters, &m_d->selectedFilter); dir, m_d->fileFilters, &m_d->selectedFilter);
if (!files.isEmpty())
dir = QFileInfo(;
return files;
} }
void EditorManager::ensureEditorManagerVisible() void EditorManager::ensureEditorManagerVisible()
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