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
Graphics
KolourPaint
Commits
10d18265
Commit
10d18265
authored
Oct 16, 2022
by
Laurent Montel
Browse files
Adapt to new api (scripted)
parent
0edaf22c
Pipeline
#248822
passed with stage
in 2 minutes and 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
mainWindow/kpMainWindow_Colors.cpp
View file @
10d18265
...
...
@@ -41,6 +41,7 @@
#include
<QFileDialog>
#include
<QAction>
#include
<kwidgetsaddons_version.h>
//---------------------------------------------------------------------
...
...
@@ -196,7 +197,11 @@ bool kpMainWindow::queryCloseColors ()
if
(
!
colorCells
()
->
url
().
isEmpty
())
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
result
=
KMessageBox
::
warningTwoActionsCancel
(
this
,
#else
result
=
KMessageBox
::
warningYesNoCancel
(
this
,
#endif
i18n
(
"The color palette
\"
%1
\"
has been modified.
\n
"
"Do you want to save it?"
,
kpUrlFormatter
::
PrettyFilename
(
colorCells
()
->
url
())),
...
...
@@ -208,7 +213,11 @@ bool kpMainWindow::queryCloseColors ()
const
QString
name
=
colorCells
()
->
colorCollection
()
->
name
();
if
(
!
name
.
isEmpty
())
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
result
=
KMessageBox
::
warningTwoActionsCancel
(
this
,
#else
result
=
KMessageBox
::
warningYesNoCancel
(
this
,
#endif
i18n
(
"The KDE color palette
\"
%1
\"
has been modified.
\n
"
"Do you want to save it to a file?"
,
name
),
...
...
@@ -217,7 +226,11 @@ bool kpMainWindow::queryCloseColors ()
}
else
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
result
=
KMessageBox
::
warningTwoActionsCancel
(
this
,
#else
result
=
KMessageBox
::
warningYesNoCancel
(
this
,
#endif
i18n
(
"The default color palette has been modified.
\n
"
"Do you want to save it to a file?"
),
QString
()
/*caption*/
,
...
...
@@ -227,9 +240,17 @@ bool kpMainWindow::queryCloseColors ()
switch
(
result
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case
KMessageBox
::
ButtonCode
::
PrimaryAction
:
#else
case
KMessageBox
::
Yes
:
#endif
return
slotColorsSave
();
// close only if save succeeds
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case
KMessageBox
::
ButtonCode
::
SecondaryAction
:
#else
case
KMessageBox
::
No
:
#endif
return
true
;
// close without saving
default:
return
false
;
// don't close current doc
...
...
mainWindow/kpMainWindow_File.cpp
View file @
10d18265
...
...
@@ -76,6 +76,7 @@
#if HAVE_KSANE
#include
"../scan/sanedialog.h"
#include
<kwidgetsaddons_version.h>
#endif // HAVE_KSANE
// private
...
...
@@ -1404,13 +1405,21 @@ void kpMainWindow::slotMail ()
!
(
d
->
document
->
isFromExistingURL
()
&&
d
->
document
->
urlExists
(
d
->
document
->
url
()))
||
d
->
document
->
isModified
()
/*needs to be saved*/
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int
result
=
KMessageBox
::
questionTwoActions
(
this
,
#else
int
result
=
KMessageBox
::
questionYesNo
(
this
,
#endif
i18n
(
"You must save this image before sending it.
\n
"
"Do you want to save it?"
),
QString
(),
KStandardGuiItem
::
save
(),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
result
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
#else
if
(
result
==
KMessageBox
::
Yes
)
#endif
{
if
(
!
save
())
{
...
...
@@ -1442,7 +1451,11 @@ bool kpMainWindow::queryCloseDocument ()
return
true
;
// ok to close current doc
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int
result
=
KMessageBox
::
warningTwoActionsCancel
(
this
,
#else
int
result
=
KMessageBox
::
warningYesNoCancel
(
this
,
#endif
i18n
(
"The document
\"
%1
\"
has been modified.
\n
"
"Do you want to save it?"
,
d
->
document
->
prettyFilename
()),
...
...
@@ -1451,9 +1464,17 @@ bool kpMainWindow::queryCloseDocument ()
switch
(
result
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case
KMessageBox
::
ButtonCode
::
PrimaryAction
:
#else
case
KMessageBox
::
Yes
:
#endif
return
slotSave
();
// close only if save succeeds
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case
KMessageBox
::
ButtonCode
::
SecondaryAction
:
#else
case
KMessageBox
::
No
:
#endif
return
true
;
// close without saving
default:
return
false
;
// don't close current doc
...
...
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