public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Arnaud Lacombe <lacombar@gmail.com>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hiromu Yakura <hiromu1996@gmail.com>
Subject: Re: [PATCH] xconfig: merge code path to conf_write()
Date: Mon, 25 Jul 2011 15:53:53 +0200	[thread overview]
Message-ID: <4E2D7571.8030108@suse.cz> (raw)
In-Reply-To: <20110525131854.GF2276@sepie.suse.cz>

On 25.5.2011 15:18, Michal Marek wrote:
> The following patch avoids the data loss if the configuration cannot be
> saved.
>
> Michal
>
> Subject: [PATCH] xconfig: Abort close if configuration cannot be saved
>
> Give the user an opportunity to fix the error or save the configuration
> under a different path.
>
> Reported-by: Hiromu Yakura<hiromu1996@gmail.com>
> Signed-off-by: Michal Marek<mmarek@suse.cz>

I completely forgot about this patch. It's applied now and will be in 3.1.

Michal
>
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index c2796b8..92bf576 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -1478,10 +1478,13 @@ void ConfigMainWindow::loadConfig(void)
>   	ConfigView::updateListAll();
>   }
>
> -void ConfigMainWindow::saveConfig(void)
> +bool ConfigMainWindow::saveConfig(void)
>   {
> -	if (conf_write(NULL))
> +	if (conf_write(NULL)) {
>   		QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
> +		return false;
> +	}
> +	return true;
>   }
>
>   void ConfigMainWindow::saveConfigAs(void)
> @@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
>   	mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
>   	switch (mb.exec()) {
>   	case QMessageBox::Yes:
> -		saveConfig();
> +		if (saveConfig())
> +			e->accept();
> +		else
> +			e->ignore();
> +		break;
>   	case QMessageBox::No:
>   		e->accept();
>   		break;
> diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
> index 91677d9..3715b3e 100644
> --- a/scripts/kconfig/qconf.h
> +++ b/scripts/kconfig/qconf.h
> @@ -311,7 +311,7 @@ public slots:
>   	void listFocusChanged(void);
>   	void goBack(void);
>   	void loadConfig(void);
> -	void saveConfig(void);
> +	bool saveConfig(void);
>   	void saveConfigAs(void);
>   	void searchConfig(void);
>   	void showSingleView(void);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2011-07-25 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24 18:16 [PATCH] xconfig: merge code path to conf_write() Arnaud Lacombe
2011-05-25 13:18 ` Michal Marek
2011-07-25 13:53   ` Michal Marek [this message]
2011-07-25 15:25     ` Arnaud Lacombe
2011-07-25 21:24       ` Michal Marek

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=4E2D7571.8030108@suse.cz \
    --to=mmarek@suse.cz \
    --cc=hiromu1996@gmail.com \
    --cc=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --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