Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KAlarm
Commits
39f69ae9
Commit
39f69ae9
authored
Aug 24, 2014
by
David Jarvie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge 99ca0fbf08670ed2c243089486a4b6e6db9f61b9 from KDE/4.14
parent
daf9afd2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
57 deletions
+42
-57
kalarmapp.cpp
kalarmapp.cpp
+6
-5
lib/messagebox.cpp
lib/messagebox.cpp
+1
-29
lib/messagebox.h
lib/messagebox.h
+35
-23
No files found.
kalarmapp.cpp
View file @
39f69ae9
...
...
@@ -658,18 +658,19 @@ bool KAlarmApp::quitIf(int exitCode, bool force)
void
KAlarmApp
::
doQuit
(
QWidget
*
parent
)
{
qDebug
();
if
(
KAMessageBox
::
warningContinue
Cancel
(
parent
,
KMessageBox
::
Cancel
,
if
(
KAMessageBox
::
warningC
ancelC
ontinue
(
parent
,
i18nc
(
"@info"
,
"Quitting will disable alarms (once any alarm message windows are closed)."
),
QString
(),
KStandardGuiItem
::
quit
(),
Preferences
::
QUIT_WARN
)
!=
KMessageBox
::
Yes
)
QString
(),
KStandardGuiItem
::
quit
(),
KStandardGuiItem
::
cancel
(),
Preferences
::
QUIT_WARN
)
!=
KMessageBox
::
Continue
)
return
;
if
(
!
KAlarm
::
checkRtcWakeConfig
(
true
).
isEmpty
())
{
// A wake-on-suspend alarm is set
if
(
KAMessageBox
::
warningContinue
Cancel
(
parent
,
KMessageBox
::
Cancel
,
if
(
KAMessageBox
::
warningC
ancelC
ontinue
(
parent
,
i18nc
(
"@info"
,
"Quitting will cancel the scheduled Wake from Suspend."
),
QString
(),
KStandardGuiItem
::
quit
()
)
!=
KMessageBox
::
Yes
)
)
!=
KMessageBox
::
Continue
)
return
;
mCancelRtcWake
=
true
;
}
...
...
lib/messagebox.cpp
View file @
39f69ae9
/*
* messagebox.cpp - enhanced KMessageBox class
* Program: kalarm
* Copyright © 2004,2005,2007,2008,2011 by David Jarvie <djarvie@kde.org>
* Copyright © 2004,2005,2007,2008,2011
,2014
by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -55,34 +55,6 @@ KMessageBox::ButtonCode KAMessageBox::getContinueDefault(const QString& dontAskA
return
defaultButton
;
}
/******************************************************************************
* Continue/cancel message box with the option as to which button is the default.
* If 'dontAskAgainName' is specified, the message box will only be suppressed
* if the user chose Continue last time.
*/
int
KAMessageBox
::
warningContinueCancel
(
QWidget
*
parent
,
KMessageBox
::
ButtonCode
defaultButton
,
const
QString
&
text
,
const
QString
&
caption
,
const
KGuiItem
&
buttonContinue
,
const
QString
&
dontAskAgainName
)
{
setContinueDefault
(
dontAskAgainName
,
defaultButton
);
if
(
defaultButton
!=
KMessageBox
::
Cancel
)
return
KMessageBox
::
warningContinueCancel
(
parent
,
text
,
caption
,
buttonContinue
,
KStandardGuiItem
::
cancel
(),
dontAskAgainName
);
// Cancel is the default button, so we have to use KMessageBox::warningYesNo()
if
(
!
dontAskAgainName
.
isEmpty
())
{
KMessageBox
::
ButtonCode
b
;
if
(
!
shouldBeShownYesNo
(
dontAskAgainName
,
b
)
&&
b
!=
KMessageBox
::
Yes
)
{
// Notification has been suppressed, but No (alias Cancel) is the default,
// so unsuppress notification.
saveDontShowAgain
(
dontAskAgainName
,
true
,
false
);
}
}
return
warningYesNo
(
parent
,
text
,
caption
,
buttonContinue
,
KStandardGuiItem
::
cancel
(),
dontAskAgainName
);
}
/******************************************************************************
* If there is no current setting for whether a non-yes/no message box should be
* shown, set it to 'defaultShow'.
...
...
lib/messagebox.h
View file @
39f69ae9
/*
* messagebox.h - enhanced KMessageBox class
* Program: kalarm
* Copyright © 2004,2007,2011 by David Jarvie <djarvie@kde.org>
* Copyright © 2004,2007,2011
,2014
by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -59,19 +59,6 @@ class KAMessageBox
* @param defaultButton The default button for the message box. Valid values are Continue or Cancel.
*/
static
void
setContinueDefault
(
const
QString
&
dontAskAgainName
,
KMessageBox
::
ButtonCode
defaultButton
);
/** Displays a Continue/Cancel message box with the option as to which button is the default.
* @param parent Parent widget
* @param defaultButton The default button for the message box. Valid values are Continue or Cancel.
* @param text Message string
* @param caption Caption (window title) of the message box
* @param buttonContinue The text for the first button (default = "Continue")
* @param dontAskAgainName If specified, the message box will only be suppressed
* if the user chose Continue last time.
*/
static
int
warningContinueCancel
(
QWidget
*
parent
,
KMessageBox
::
ButtonCode
defaultButton
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
KGuiItem
&
buttonContinue
=
KStandardGuiItem
::
cont
(),
const
QString
&
dontAskAgainName
=
QString
());
/** If there is no current setting for whether a non-Yes/No message box should be
* shown, sets it to @p defaultShow.
* If a Continue/Cancel message box has Cancel as the default button, either
...
...
@@ -105,13 +92,15 @@ class KAMessageBox
/** Same as KMessageBox::detailedError() except that it defaults to window-modal,
* not application-modal. */
static
void
detailedError
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
details
,
const
QString
&
caption
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
const
QString
&
caption
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
KMessageBox
::
detailedError
(
parent
,
text
,
details
,
caption
,
options
);
}
/** Same as KMessageBox::detailedSorry() except that it defaults to window-modal,
* not application-modal. */
static
void
detailedSorry
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
details
,
const
QString
&
caption
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
const
QString
&
caption
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
KMessageBox
::
detailedSorry
(
parent
,
text
,
details
,
caption
,
options
);
}
/** Same as KMessageBox::error() except that it defaults to window-modal,
...
...
@@ -123,7 +112,8 @@ class KAMessageBox
/** Same as KMessageBox::information() except that it defaults to window-modal,
* not application-modal. */
static
void
information
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
QString
&
dontShowAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
const
QString
&
dontShowAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
KMessageBox
::
information
(
parent
,
text
,
caption
,
dontShowAgainName
,
options
);
}
/** Same as KMessageBox::sorry() except that it defaults to window-modal,
...
...
@@ -137,7 +127,8 @@ class KAMessageBox
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
))
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
questionYesNo
(
parent
,
text
,
caption
,
buttonYes
,
buttonNo
,
dontAskAgainName
,
options
);
}
/** Same as KMessageBox::questionYesNoCancel() except that it defaults
...
...
@@ -146,15 +137,35 @@ class KAMessageBox
const
KGuiItem
&
buttonYes
=
KStandardGuiItem
::
yes
(),
const
KGuiItem
&
buttonNo
=
KStandardGuiItem
::
no
(),
const
KGuiItem
&
buttonCancel
=
KStandardGuiItem
::
cancel
(),
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
questionYesNoCancel
(
parent
,
text
,
caption
,
buttonYes
,
buttonNo
,
buttonCancel
,
dontAskAgainName
,
options
);
}
/** Same as KMessageBox::warningContinueCancel() except that it defaults to window-modal,
* not application-modal. */
/** Same as KMessageBox::warningContinueCancel() except that the
* default button is Cancel, and it defaults to window-modal, not
* application-modal.
* @param parent Parent widget
* @param text Message string
* @param caption Caption (window title) of the message box
* @param buttonContinue The text for the first button (default = "Continue")
* @param buttonCancel The text for the second button (default = "Cancel")
* @param dontAskAgainName If specified, the message box will only be suppressed
* if the user chose Continue last time.
*/
static
int
warningCancelContinue
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
KGuiItem
&
buttonContinue
=
KStandardGuiItem
::
cont
(),
const
KGuiItem
&
buttonCancel
=
KStandardGuiItem
::
cancel
(),
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
warningContinueCancel
(
parent
,
text
,
caption
,
buttonContinue
,
buttonCancel
,
dontAskAgainName
,
KMessageBox
::
Options
(
options
|
KMessageBox
::
Dangerous
));
}
/** Same as KMessageBox::warningContinueCancel() except that it
* defaults to window-modal, not application-modal. */
static
int
warningContinueCancel
(
QWidget
*
parent
,
const
QString
&
text
,
const
QString
&
caption
=
QString
(),
const
KGuiItem
&
buttonContinue
=
KStandardGuiItem
::
cont
(),
const
KGuiItem
&
buttonCancel
=
KStandardGuiItem
::
cancel
(),
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
const
QString
&
dontAskAgainName
=
QString
(),
KMessageBox
::
Options
options
=
KMessageBox
::
Options
(
KMessageBox
::
Notify
|
KMessageBox
::
WindowModal
))
{
return
KMessageBox
::
warningContinueCancel
(
parent
,
text
,
caption
,
buttonContinue
,
buttonCancel
,
dontAskAgainName
,
options
);
}
/** Same as KMessageBox::warningYesNo() except that it defaults to window-modal,
...
...
@@ -162,7 +173,8 @@ class KAMessageBox
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
))
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
);
}
/** Shortcut to represent Options(Notify | WindowModal). */
...
...
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