DocumentManager: Treat documents without path as temporary

Treat documents without path as temporary when trying to come up
with a directory to open the file dialog in.

Task-number: QTCREATORBUG-14131
Change-Id: I266fe6608b7c98b479f86412a0892413e1b99bb2
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-03-16 14:06:37 +01:00
parent 1de7c954ef
commit 972a306d56

View File

@@ -1257,8 +1257,9 @@ void readSettings()
QString DocumentManager::fileDialogInitialDirectory()
{
if (EditorManager::currentDocument() && !EditorManager::currentDocument()->isTemporary())
return QFileInfo(EditorManager::currentDocument()->filePath().toString()).absolutePath();
IDocument *doc = EditorManager::currentDocument();
if (doc && !doc->isTemporary() && !doc->filePath().isEmpty())
return doc->filePath().toFileInfo().absolutePath();
if (!d->m_defaultLocationForNewFiles.isEmpty())
return d->m_defaultLocationForNewFiles;
return d->m_lastVisitedDirectory;