From: "Peter Kümmel" <syntheticpp@gmx.net>
To: linux-kernel@vger.kernel.org
Cc: "Peter Kümmel" <syntheticpp@gmx.net>
Subject: [PATCH] xconfig: Set configuration strings on focus lost
Date: Thu, 6 Nov 2014 13:03:02 +0100 [thread overview]
Message-ID: <1415275383-15301-3-git-send-email-syntheticpp@gmx.net> (raw)
In-Reply-To: <1415275383-15301-1-git-send-email-syntheticpp@gmx.net>
A change to a string configuration is currently only
recogniized by pressing enter/return. When you just
click to another entry after the string was edited
the change is not set. Additionally when you come
back to the string configuration your changes are lost.
With this patch the string changes are automatically set
when the focus leaves the edit field. There is still
the possibility to drop any changes by pressing ESC.
Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
---
scripts/kconfig/qconf.cc | 23 +++++++++++++++++++----
scripts/kconfig/qconf.h | 2 ++
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 9d3b04b..f08472e 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -302,13 +302,18 @@ ConfigLineEdit::ConfigLineEdit(ConfigView* parent)
connect(this, SIGNAL(lostFocus()), SLOT(hide()));
}
-void ConfigLineEdit::show(ConfigItem* i)
+void ConfigLineEdit::updateLineEditText(ConfigItem* i)
{
- item = i;
- if (sym_get_string_value(item->menu->sym))
- setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym)));
+ if (sym_get_string_value(i->menu->sym))
+ setText(QString::fromLocal8Bit(sym_get_string_value(i->menu->sym)));
else
setText(QString::null);
+}
+
+void ConfigLineEdit::show(ConfigItem* i)
+{
+ item = i;
+ updateLineEditText(item);
Parent::show();
setFocus();
}
@@ -317,6 +322,7 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
{
switch (e->key()) {
case Qt::Key_Escape:
+ updateLineEditText(item);
break;
case Qt::Key_Return:
case Qt::Key_Enter:
@@ -332,6 +338,15 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
hide();
}
+void ConfigLineEdit::focusOutEvent(QFocusEvent *e)
+{
+ if (e->lostFocus()) {
+ sym_set_string_value(item->menu->sym, text().latin1());
+ parent()->updateList(item);
+ }
+ Parent::focusOutEvent(e);
+}
+
ConfigList::ConfigList(ConfigView* p, const char *name)
: Parent(p, name),
updateAll(false),
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index bde0c6b..11efb71 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -209,8 +209,10 @@ public:
{
return (ConfigView*)Parent::parent();
}
+ void updateLineEditText(ConfigItem *i);
void show(ConfigItem *i);
void keyPressEvent(QKeyEvent *e);
+ void focusOutEvent(QFocusEvent *e);
public:
ConfigItem *item;
--
1.9.1
next prev parent reply other threads:[~2014-11-06 12:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 12:03 [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Peter Kümmel
2014-11-06 12:03 ` [PATCH] xconfig: Don't move focus when clicking on the search button Peter Kümmel
2014-11-06 12:03 ` Peter Kümmel [this message]
2014-11-06 12:03 ` [PATCH] xconfig: Set keyboard focus to line edit whenever the search dialog opens Peter Kümmel
2014-11-06 12:36 ` [PATCH] kconfig: Fix warning "‘jump’ may be used uninitialized" Paul Bolle
2014-11-06 14:13 ` Aw: " Peter Kuemmel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415275383-15301-3-git-send-email-syntheticpp@gmx.net \
--to=syntheticpp@gmx.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®