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
Kleopatra
Commits
cc33eb2e
Commit
cc33eb2e
authored
Jul 14, 2022
by
Ingo Klöcker
Browse files
Give keyboard focus to the checked radio button when showing dialog
GnuPG-bug-id: 6080
parent
f3c14393
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/dialogs/expirydialog.cpp
View file @
cc33eb2e
...
...
@@ -13,6 +13,7 @@
#include
"expirydialog.h"
#include
"utils/gui-helper.h"
#include
"utils/qt-cxx20-compat.h"
#include
<KDateComboBox>
...
...
@@ -110,10 +111,12 @@ private:
private:
QDate
inDate
()
const
;
int
inAmountByDate
(
const
QDate
&
date
)
const
;
void
setInitialFocus
();
private:
ExpiryDialog
::
Mode
mode
;
int
inUnit
;
bool
initialFocusWasSet
=
false
;
struct
UI
{
QRadioButton
*
neverRB
;
...
...
@@ -271,6 +274,16 @@ int ExpiryDialog::Private::inAmountByDate(const QDate &selected) const
return
-
1
;
}
void
ExpiryDialog
::
Private
::
setInitialFocus
()
{
if
(
initialFocusWasSet
)
{
return
;
}
// give focus to the checked radio button
(
void
)
focusFirstCheckedButton
({
ui
.
neverRB
,
ui
.
inRB
,
ui
.
onRB
});
initialFocusWasSet
=
true
;
}
ExpiryDialog
::
ExpiryDialog
(
Mode
mode
,
QWidget
*
p
)
:
QDialog
{
p
}
,
d
{
new
Private
{
mode
,
this
}}
...
...
@@ -311,4 +324,10 @@ bool ExpiryDialog::updateExpirationOfAllSubkeys() const
return
d
->
ui
.
updateSubkeysCheckBox
->
isChecked
();
}
void
ExpiryDialog
::
showEvent
(
QShowEvent
*
event
)
{
d
->
setInitialFocus
();
QDialog
::
showEvent
(
event
);
}
#include
"moc_expirydialog.cpp"
src/dialogs/expirydialog.h
View file @
cc33eb2e
...
...
@@ -16,6 +16,7 @@
#include
<memory.h>
class
QDate
;
class
QShowEvent
;
namespace
Kleo
{
...
...
@@ -42,6 +43,9 @@ public:
void
setUpdateExpirationOfAllSubkeys
(
bool
update
);
bool
updateExpirationOfAllSubkeys
()
const
;
protected:
void
showEvent
(
QShowEvent
*
event
)
override
;
private:
class
Private
;
std
::
unique_ptr
<
Private
>
d
;
...
...
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