Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
94745b55
Commit
94745b55
authored
Aug 05, 2022
by
Kurt Hindenburg
Browse files
Cancelling save/loadLayoutFile dialog should not show an error dialog
Also, add .json to save filename if missing.
parent
ecddbd11
Pipeline
#213687
passed with stage
in 3 minutes and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/ViewManager.cpp
View file @
94745b55
...
...
@@ -1006,8 +1006,18 @@ QJsonObject saveSessionsRecurse(QSplitter *splitter)
void
ViewManager
::
saveLayoutFile
()
{
Q
File
fil
e
(
QFileDialog
::
getSaveFileName
(
this
->
widget
(),
i18nc
(
"@title:window"
,
"Save File"
),
QStringLiteral
(
"~/"
),
i18nc
(
"@item:inlistbox"
,
"Konsole View Layout (*.json)"
)));
Q
String
fileNam
e
(
QFileDialog
::
getSaveFileName
(
this
->
widget
(),
i18nc
(
"@title:window"
,
"Save File"
),
QStringLiteral
(
"~/"
),
i18nc
(
"@item:inlistbox"
,
"Konsole View Layout (*.json)"
)));
// User pressed cancel in dialog
if
(
fileName
.
isEmpty
())
{
return
;
}
if
(
!
fileName
.
endsWith
(
QStringLiteral
(
".json"
)))
{
fileName
.
append
(
QStringLiteral
(
".json"
));
}
QFile
file
(
fileName
);
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
KMessageBox
::
error
(
this
->
widget
(),
i18nc
(
"@label:textbox"
,
"A problem occurred when saving the Layout.
\n
%1"
,
file
.
fileName
()));
}
...
...
@@ -1062,6 +1072,11 @@ ViewSplitter *restoreSessionsSplitterRecurse(const QJsonObject &jsonSplitter, Vi
}
// namespace
void
ViewManager
::
loadLayout
(
QString
file
)
{
// User pressed cancel in dialog
if
(
file
.
isEmpty
())
{
return
;
}
QFile
jsonFile
(
file
);
if
(
!
jsonFile
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
...
...
Toni Asensi Esteve
@asensi
mentioned in merge request
!375 (merged)
·
Aug 23, 2022
mentioned in merge request
!375 (merged)
mentioned in merge request !375
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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