Commit c6fa286c authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Fix passing focus to next recipient widget if removed had focus

Now that recipient widget is a composite widget we have to check whether
any of its children has focus.

GnuPG-bug-id: 5845
parent ac79b61b
......@@ -497,6 +497,15 @@ QString SignEncryptWidget::currentOp() const
return mOp;
}
namespace
{
bool recipientWidgetHasFocus(CertificateLineEdit *w)
{
// check if w (or its focus proxy) or a child widget of w has focus
return w->hasFocus() || w->isAncestorOf(qApp->focusWidget());
}
}
void SignEncryptWidget::recpRemovalRequested(CertificateLineEdit *w)
{
if (!w) {
......@@ -506,7 +515,7 @@ void SignEncryptWidget::recpRemovalRequested(CertificateLineEdit *w)
std::count_if(std::cbegin(mRecpWidgets), std::cend(mRecpWidgets),
[](auto w) { return w->isEmpty(); });
if (emptyEdits > 1) {
if (w->hasFocus()) {
if (recipientWidgetHasFocus(w)) {
const int index = mRecpLayout->indexOf(w);
const auto focusWidget = (index < mRecpLayout->count() - 1) ?
mRecpLayout->itemAt(index + 1)->widget() :
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment