linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kconfig: fix 'Save As' menu of xconfig
@ 2019-03-10 16:13 Masahiro Yamada
  2019-05-06 19:10 ` Robert Gadsdon
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2019-03-10 16:13 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Ulf Magnusson, Masahiro Yamada, linux-kernel

The 'Save As' menu of xconfig is not working; it always saves the
kernel configuration into the default file irrespective of the file
chosen in the dialog box.

The 'Save' menu always writes into the default file, but it would
make more sense to write into the file previously chosen by 'Load'
or 'Save As'.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kconfig/qconf.cc | 42 +++++++++++++++++++++++++++++++++++-------
 scripts/kconfig/qconf.h  |  1 +
 2 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 8be8a70..ce7fc87 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1392,6 +1392,8 @@ ConfigMainWindow::ConfigMainWindow(void)
 	conf_set_changed_callback(conf_changed);
 	// Set saveAction's initial state
 	conf_changed();
+	configname = xstrdup(conf_get_configname());
+
 	QAction *saveAsAction = new QAction("Save &As...", this);
 	  connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs()));
 	QAction *searchAction = new QAction("&Find", this);
@@ -1520,17 +1522,29 @@ ConfigMainWindow::ConfigMainWindow(void)
 
 void ConfigMainWindow::loadConfig(void)
 {
-	QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname());
-	if (s.isNull())
+	QString str;
+	QByteArray ba;
+	const char *name;
+
+	str = QFileDialog::getOpenFileName(this, "", configname);
+	if (str.isNull())
 		return;
-	if (conf_read(QFile::encodeName(s)))
+
+	ba = str.toLocal8Bit();
+	name = ba.data();
+
+	if (conf_read(name))
 		QMessageBox::information(this, "qconf", "Unable to load configuration!");
+
+	free(configname);
+	configname = xstrdup(name);
+
 	ConfigView::updateListAll();
 }
 
 bool ConfigMainWindow::saveConfig(void)
 {
-	if (conf_write(NULL)) {
+	if (conf_write(configname)) {
 		QMessageBox::information(this, "qconf", "Unable to save configuration!");
 		return false;
 	}
@@ -1541,10 +1555,24 @@ bool ConfigMainWindow::saveConfig(void)
 
 void ConfigMainWindow::saveConfigAs(void)
 {
-	QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname());
-	if (s.isNull())
+	QString str;
+	QByteArray ba;
+	const char *name;
+
+	str = QFileDialog::getSaveFileName(this, "", configname);
+	if (str.isNull())
 		return;
-	saveConfig();
+
+	ba = str.toLocal8Bit();
+	name = ba.data();
+
+	if (conf_write(name)) {
+		QMessageBox::information(this, "qconf", "Unable to save configuration!");
+	}
+	conf_write_autoconf(0);
+
+	free(configname);
+	configname = xstrdup(name);
 }
 
 void ConfigMainWindow::searchConfig(void)
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 41df466..45bfe9b 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -291,6 +291,7 @@ public slots:
 class ConfigMainWindow : public QMainWindow {
 	Q_OBJECT
 
+	char *configname;
 	static QAction *saveAction;
 	static void conf_changed(void);
 public:
-- 
2.7.4


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

* Re: [PATCH] kconfig: fix 'Save As' menu of xconfig
  2019-03-10 16:13 [PATCH] kconfig: fix 'Save As' menu of xconfig Masahiro Yamada
@ 2019-05-06 19:10 ` Robert Gadsdon
  2019-05-07  3:01   ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Gadsdon @ 2019-05-06 19:10 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Ulf Magnusson, linux-kernel

On 03/10/2019 09:13 AM, Masahiro Yamada wrote:
> The 'Save As' menu of xconfig is not working; it always saves the
> kernel configuration into the default file irrespective of the file
> chosen in the dialog box.
> 
> The 'Save' menu always writes into the default file, but it would
> make more sense to write into the file previously chosen by 'Load'
> or 'Save As'.
> 
> Signed-off-by: Masahiro Yamada<yamada.masahiro@socionext.com>
> ---

The 'save as' may be used for out-of-tree kernel config saves, but the 
default 'save' should always save to the in-tree .config file, as before 
(and for the past 10+ years..)  If the kernel config was loaded from an 
out-of-tree location, it now saves back to that out-of-tree location, 
which is useless for the kernel compile..

I have always kept my hardware/system-specific kernel configs 
out-of-tree, and then applied them in-tree before compiling.

Now, I have to use 'save as' and type in the entire in-tree path 
(/usr/src/linux-5.1/.config) each time, in order to apply the specific 
config to the kernel, ready for compilation.

Robert Gadsdon.
rglinuxtech.com

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

* Re: [PATCH] kconfig: fix 'Save As' menu of xconfig
  2019-05-06 19:10 ` Robert Gadsdon
@ 2019-05-07  3:01   ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2019-05-07  3:01 UTC (permalink / raw)
  To: Robert Gadsdon
  Cc: Linux Kbuild mailing list, Ulf Magnusson, Linux Kernel Mailing List

On Tue, May 7, 2019 at 4:10 AM Robert Gadsdon <rhgadsdon@gmail.com> wrote:
>
> On 03/10/2019 09:13 AM, Masahiro Yamada wrote:
> > The 'Save As' menu of xconfig is not working; it always saves the
> > kernel configuration into the default file irrespective of the file
> > chosen in the dialog box.
> >
> > The 'Save' menu always writes into the default file, but it would
> > make more sense to write into the file previously chosen by 'Load'
> > or 'Save As'.
> >
> > Signed-off-by: Masahiro Yamada<yamada.masahiro@socionext.com>
> > ---
>
> The 'save as' may be used for out-of-tree kernel config saves, but the
> default 'save' should always save to the in-tree .config file, as before
> (and for the past 10+ years..)  If the kernel config was loaded from an
> out-of-tree location, it now saves back to that out-of-tree location,
> which is useless for the kernel compile..


I think it is quite natural that
"save" overwrites the file being edited.

And, that is how the 'save' of menuconfig/nconfig works.


> I have always kept my hardware/system-specific kernel configs
> out-of-tree, and then applied them in-tree before compiling.
>
> Now, I have to use 'save as' and type in the entire in-tree path
> (/usr/src/linux-5.1/.config) each time, in order to apply the specific
> config to the kernel, ready for compilation.


It is easy to do it without using xconfig.

cp /your/custom/config .config




> Robert Gadsdon.
> rglinuxtech.com



-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2019-05-07  3:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-10 16:13 [PATCH] kconfig: fix 'Save As' menu of xconfig Masahiro Yamada
2019-05-06 19:10 ` Robert Gadsdon
2019-05-07  3:01   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).