Welcome: Do not open main.cpp when project loading was canceled

When choosing an example from the welcome screen and the user
cancels loading the project:
 * Do not switch to edit mode
 * Do not load main.cpp
 * Do not pop up help

Task-number: QTCREATORBUG-2774
Reviewed-by: Daniel Molkentin
This commit is contained in:
Tobias Hunger
2010-10-19 13:07:19 +02:00
parent a6cfa0ca45
commit 0a5094097d
3 changed files with 19 additions and 8 deletions

View File

@@ -829,16 +829,20 @@ void MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesFlags f
const QFileInfo fi(fileName);
const QString absoluteFilePath = fi.absoluteFilePath();
if (IFileFactory *fileFactory = findFileFactory(nonEditorFileFactories, mimeDatabase(), fi)) {
fileFactory->open(absoluteFilePath);
if (flags && ICore::SwitchMode)
Core::IFile *file = fileFactory->open(absoluteFilePath);
if (!file && (flags & ICore::StopOnLoadFail))
return;
if (file && (flags & ICore::SwitchMode))
Core::ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT);
} else {
QFlags<EditorManager::OpenEditorFlag> emFlags;
if (flags && ICore::SwitchMode)
if (flags & ICore::SwitchMode)
emFlags = EditorManager::ModeSwitch;
if (flags && ICore::CanContainLineNumbers)
if (flags & ICore::CanContainLineNumbers)
emFlags |= EditorManager::CanContainLineNumber;
editorManager()->openEditor(absoluteFilePath, QString(), emFlags);
Core::IEditor *editor = editorManager()->openEditor(absoluteFilePath, QString(), emFlags);
if (!editor && (flags & ICore::StopOnLoadFail))
return;
}
}
}