Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Robert Pannick
ide
Commits
b68c0587
Commit
b68c0587
authored
Feb 22, 2021
by
jhammen
Browse files
do not show editor widget if file load fails
parent
cc682234
Changes
1
Hide whitespace changes
Inline
Side-by-side
mainwindow.cpp
View file @
b68c0587
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment