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