Commit b68c0587 authored by jhammen's avatar jhammen
Browse files

do not show editor widget if file load fails

parent cc682234
......@@ -153,16 +153,18 @@ void MainWindow::createOrOpenEditor(NamedFile &file) {
} else {
// new editor for this file
editor = new EditorWidget(file);
ui->tabWidget->addTab(editor, file.name);
ui->tabWidget->setCurrentWidget(editor);
editor->load();
connect(editor->document(), SIGNAL(modificationChanged(bool)), this, SLOT(markDirty(bool)));
connect(editor, SIGNAL(undoAvailable(bool)), ui->actionUndo, SLOT(setEnabled(bool)));
connect(editor, SIGNAL(redoAvailable(bool)), ui->actionRedo, SLOT(setEnabled(bool)));
connect(editor, SIGNAL(copyAvailable(bool)), ui->actionCut, SLOT(setEnabled(bool)));
connect(editor, SIGNAL(copyAvailable(bool)), ui->actionCopy, SLOT(setEnabled(bool)));
// add to project list as open file
projectList.currentProject().openFile(file.path);
if (editor->load()) {
ui->tabWidget->addTab(editor, file.name);
ui->tabWidget->setCurrentWidget(editor);
connect(editor->document(), SIGNAL(modificationChanged(bool)), this,
SLOT(markDirty(bool)));
connect(editor, SIGNAL(undoAvailable(bool)), ui->actionUndo, SLOT(setEnabled(bool)));
connect(editor, SIGNAL(redoAvailable(bool)), ui->actionRedo, SLOT(setEnabled(bool)));
connect(editor, SIGNAL(copyAvailable(bool)), ui->actionCut, SLOT(setEnabled(bool)));
connect(editor, SIGNAL(copyAvailable(bool)), ui->actionCopy, SLOT(setEnabled(bool)));
// add to project list as open file
projectList.currentProject().openFile(file.path);
}
}
selectedFolder = nullptr;
enableFileActions(editor);
......
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