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
Games
KsirK
Commits
331e5580
Commit
331e5580
authored
Oct 20, 2022
by
Friedrich W. H. Kossebau
Browse files
Remove manual overwrite dialog, duplicating QFileDialog behaviour
parent
00ee7b1c
Pipeline
#252179
passed with stage
in 2 minutes and 28 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
ksirk/kgamewinslots.cpp
View file @
331e5580
...
...
@@ -59,7 +59,7 @@
#include
<KLocalizedString>
#include
<KConfig>
#include
"ksirk_debug.h"
#include
<KMessageBox>
#include
<KGamePopupItem>
#include
<KPasswordDialog>
#include
<tcpconnectwidget.h>
...
...
@@ -452,10 +452,7 @@ void KGameWindow::slotSaveGame()
if
(
m_fileName
.
isEmpty
())
{
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
i18nc
(
"@title:window"
,
"KsirK - Save Game"
),
QString
(),
"*.xml"
);
if
(
QFile
::
exists
(
fileName
)
&&
(
KMessageBox
::
questionYesNo
(
this
,
i18n
(
"%1 exists.
\n
Do you really want to overwrite it?"
,
fileName
),
i18n
(
"Overwrite file?"
))
==
KMessageBox
::
No
)
)
if
(
fileName
.
isEmpty
())
{
m_message
->
setMessageTimeout
(
3000
);
m_message
->
showMessage
(
i18n
(
"Saving canceled"
),
KGamePopupItem
::
TopLeft
,
...
...
@@ -464,17 +461,14 @@ void KGameWindow::slotSaveGame()
}
m_fileName
=
fileName
;
}
if
(
!
m_fileName
.
isEmpty
())
{
QFile
file
(
m_fileName
);
file
.
open
(
QIODevice
::
WriteOnly
);
QTextStream
ofs
(
&
file
);
ofs
.
setCodec
(
"UTF-8"
);
saveXml
(
ofs
);
m_message
->
setMessageTimeout
(
3000
);
m_message
->
showMessage
(
i18n
(
"Game saved to %1"
,
m_fileName
),
KGamePopupItem
::
TopLeft
,
KGamePopupItem
::
ReplacePrevious
);
}
QFile
file
(
m_fileName
);
file
.
open
(
QIODevice
::
WriteOnly
);
QTextStream
ofs
(
&
file
);
ofs
.
setCodec
(
"UTF-8"
);
saveXml
(
ofs
);
m_message
->
setMessageTimeout
(
3000
);
m_message
->
showMessage
(
i18n
(
"Game saved to %1"
,
m_fileName
),
KGamePopupItem
::
TopLeft
,
KGamePopupItem
::
ReplacePrevious
);
}
else
{
...
...
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