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
PIM
KAlarm
Commits
79fb283c
Commit
79fb283c
authored
Oct 18, 2022
by
Laurent Montel
Browse files
Make it compile without deprecated methods
parent
2953dcb9
Pipeline
#249904
passed with stage
in 1 minute and 41 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/kalarmapp.cpp
View file @
79fb283c
...
...
@@ -831,13 +831,21 @@ void KAlarmApp::doQuit(QWidget* parent)
#endif
if
(
!
Preferences
::
autoStart
())
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int
option
=
KMessageBox
::
ButtonCode
::
SecondaryAction
;
#else
int
option
=
KMessageBox
::
No
;
#endif
if
(
!
Preferences
::
autoStartChangedByUser
())
{
option
=
KAMessageBox
::
questionYesNoCancel
(
parent
,
xi18nc
(
"@info"
,
"Do you want to start KAlarm at login?<nl/>"
"(Note that alarms will be disabled if KAlarm is not started.)"
),
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
QString
(),
KGuiItem
(
i18n
(
"Yes"
)),
KGuiItem
(
i18n
(
"No"
)),
#else
QString
(),
KStandardGuiItem
::
yes
(),
KStandardGuiItem
::
no
(),
#endif
KStandardGuiItem
::
cancel
(),
Preferences
::
ASK_AUTO_START
);
}
switch
(
option
)
...
...
src/lib/messagebox.cpp
View file @
79fb283c
...
...
@@ -75,7 +75,11 @@ bool KAMessageBox::shouldBeShownContinue(const QString& dontShowAgainName)
return
KMessageBox
::
shouldBeShownContinue
(
dontShowAgainName
);
// Cancel is the default button, so we have to use a yes/no message box
KMessageBox
::
ButtonCode
b
;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
shouldBeShownTwoActions
(
dontShowAgainName
,
b
);
#else
return
shouldBeShownYesNo
(
dontShowAgainName
,
b
);
#endif
}
...
...
@@ -86,7 +90,12 @@ bool KAMessageBox::shouldBeShownContinue(const QString& dontShowAgainName)
*/
void
KAMessageBox
::
saveDontShowAgainYesNo
(
const
QString
&
dontShowAgainName
,
bool
dontShow
,
KMessageBox
::
ButtonCode
result
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
saveDontShowAgain
(
dontShowAgainName
,
true
,
dontShow
,
(
result
==
KMessageBox
::
ButtonCode
::
PrimaryAction
?
"yes"
:
"no"
));
#else
saveDontShowAgain
(
dontShowAgainName
,
true
,
dontShow
,
(
result
==
KMessageBox
::
Yes
?
"yes"
:
"no"
));
#endif
}
/******************************************************************************
...
...
@@ -100,7 +109,11 @@ void KAMessageBox::saveDontShowAgainYesNo(const QString& dontShowAgainName, bool
void
KAMessageBox
::
saveDontShowAgainContinue
(
const
QString
&
dontShowAgainName
,
bool
dontShow
)
{
if
(
getContinueDefault
(
dontShowAgainName
)
==
KMessageBox
::
Cancel
)
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
saveDontShowAgainYesNo
(
dontShowAgainName
,
dontShow
,
KMessageBox
::
ButtonCode
::
PrimaryAction
);
#else
saveDontShowAgainYesNo
(
dontShowAgainName
,
dontShow
,
KMessageBox
::
Yes
);
#endif
else
saveDontShowAgain
(
dontShowAgainName
,
false
,
dontShow
);
}
...
...
src/lib/messagebox.h
View file @
79fb283c
...
...
@@ -10,6 +10,8 @@
#include
<KStandardGuiItem>
#include
<KMessageBox>
#include
<KLocalizedString>
#include
<kwidgetsaddons_version.h>
/**
* @short Enhanced KMessageBox.
...
...
@@ -65,7 +67,11 @@ public:
* @param dontShow If true, the message box will be suppressed and will return @p result.
* @param result The button code to return if the message box is suppressed.
*/
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
static
void
saveDontShowAgainYesNo
(
const
QString
&
dontShowAgainName
,
bool
dontShow
=
true
,
KMessageBox
::
ButtonCode
result
=
KMessageBox
::
ButtonCode
::
SecondaryAction
);
#else
static
void
saveDontShowAgainYesNo
(
const
QString
&
dontShowAgainName
,
bool
dontShow
=
true
,
KMessageBox
::
ButtonCode
result
=
KMessageBox
::
No
);
#endif
/** Stores whether a non-Yes/No message box should or should not be shown again.
* If the message box has Cancel as the default button, either setContinueDefault()
* or warningContinueCancel() must have been called previously to set this for the
...
...
@@ -105,15 +111,33 @@ public:
/** Same as KMessageBox::questionYesNo() except that it defaults to window-modal,
* not application-modal. */
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
static
int
questionYesNo
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
KGuiItem
&
buttonYes
=
KGuiItem
(
i18n
(
"Yes"
)),
const
KGuiItem
&
buttonNo
=
KGuiItem
(
i18n
(
"No"
)),
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
questionTwoActions
(
parent
,
text
,
caption
,
buttonYes
,
buttonNo
,
dontAskAgainName
,
options
);
}
#else
static
int
questionYesNo
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
KGuiItem
&
buttonYes
=
KStandardGuiItem
::
yes
(),
const
KGuiItem
&
buttonNo
=
KStandardGuiItem
::
no
(),
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
questionYesNo
(
parent
,
text
,
caption
,
buttonYes
,
buttonNo
,
dontAskAgainName
,
options
);
}
#endif
/** Same as KMessageBox::questionYesNoCancel() except that it defaults
* to window-modal, not application-modal. */
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
static
int
questionYesNoCancel
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
KGuiItem
&
buttonYes
=
KGuiItem
(
i18n
(
"Yes"
)),
const
KGuiItem
&
buttonNo
=
KGuiItem
(
i18n
(
"No"
)),
const
KGuiItem
&
buttonCancel
=
KStandardGuiItem
::
cancel
(),
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
questionTwoActionsCancel
(
parent
,
text
,
caption
,
buttonYes
,
buttonNo
,
buttonCancel
,
dontAskAgainName
,
options
);
}
#else
static
int
questionYesNoCancel
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
KGuiItem
&
buttonYes
=
KStandardGuiItem
::
yes
(),
const
KGuiItem
&
buttonNo
=
KStandardGuiItem
::
no
(),
...
...
@@ -121,7 +145,7 @@ public:
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
questionYesNoCancel
(
parent
,
text
,
caption
,
buttonYes
,
buttonNo
,
buttonCancel
,
dontAskAgainName
,
options
);
}
#endif
/** Same as KMessageBox::warningContinueCancel() except that the
* default button is Cancel, and it defaults to window-modal, not
* application-modal.
...
...
@@ -152,13 +176,21 @@ public:
/** Same as KMessageBox::warningYesNo() except that it defaults to window-modal,
* not application-modal. */
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
static
int
warningYesNo
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
KGuiItem
&
buttonYes
=
KGuiItem
(
i18n
(
"Yes"
)),
const
KGuiItem
&
buttonNo
=
KGuiItem
(
i18n
(
"No"
)),
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
Dangerous
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
questionTwoActions
(
parent
,
text
,
caption
,
buttonYes
,
buttonNo
,
dontAskAgainName
,
options
);
}
#else
static
int
warningYesNo
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
KGuiItem
&
buttonYes
=
KStandardGuiItem
::
yes
(),
const
KGuiItem
&
buttonNo
=
KStandardGuiItem
::
no
(),
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
Dangerous
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
warningYesNo
(
parent
,
text
,
caption
,
buttonYes
,
buttonNo
,
dontAskAgainName
,
options
);
}
#endif
/** Shortcut to represent Options(Notify | WindowModal). */
static
const
KMessageBox
::
Options
NoAppModal
;
...
...
src/messagewindow.cpp
View file @
79fb283c
...
...
@@ -1072,7 +1072,11 @@ bool MessageWindow::confirmAcknowledgement()
// Ask for confirmation of acknowledgement. Use warningYesNo() because its default is No.
if
(
KAMessageBox
::
warningYesNo
(
this
,
i18nc
(
"@info"
,
"Do you really want to acknowledge this alarm?"
),
i18nc
(
"@action:button"
,
"Acknowledge Alarm"
),
KGuiItem
(
i18nc
(
"@action:button"
,
"Acknowledge"
)),
KStandardGuiItem
::
cancel
())
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
!=
KMessageBox
::
ButtonCode
::
PrimaryAction
)
#else
!=
KMessageBox
::
Yes
)
#endif
{
return
false
;
}
...
...
src/prefdlg.cpp
View file @
79fb283c
...
...
@@ -663,7 +663,11 @@ void MiscPrefTab::slotAutostartClicked()
&&
KAMessageBox
::
warningYesNo
(
topLayout
()
->
parentWidget
(),
xi18nc
(
"@info"
,
"You should not uncheck this option unless you intend to discontinue use of <application>KAlarm</application>"
),
QString
(),
KStandardGuiItem
::
cont
(),
KStandardGuiItem
::
cancel
()
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
)
!=
KMessageBox
::
ButtonCode
::
PrimaryAction
)
#else
)
!=
KMessageBox
::
Yes
)
#endif
mAutoStart
->
setChecked
(
true
);
}
...
...
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