public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xconfig: Don't forget changed string value on focus lost
@ 2014-11-04  9:50 Peter Kümmel
  2014-11-04 20:08 ` Paul Bolle
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Kümmel @ 2014-11-04  9:50 UTC (permalink / raw)
  To: linux-kbuild; +Cc: yann.morin.1998, Peter Kümmel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xconfig: Don't forget changed string value on focus lost
  2014-11-04  9:50 [PATCH] xconfig: Don't forget changed string value on focus lost Peter Kümmel
@ 2014-11-04 20:08 ` Paul Bolle
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Bolle @ 2014-11-04 20:08 UTC (permalink / raw)
  To: Peter Kümmel; +Cc: linux-kbuild, yann.morin.1998

On Tue, 2014-11-04 at 10:50 +0100, Peter Kümmel wrote:

Even though I don't use qconf, I think I can say this patch is not
obviously trivial. So, could you please add a few lines describing
current behavior, why it's wrong, and how this patch fixes it? That
might increase the chance this patch gets some review.

> 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;

Thanks,


Paul Bolle


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-04 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04  9:50 [PATCH] xconfig: Don't forget changed string value on focus lost Peter Kümmel
2014-11-04 20:08 ` Paul Bolle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox