From patchwork Sun Mar 10 16:13:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 160024 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp11000172jad; Sun, 10 Mar 2019 09:13:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJSlI5OrrYZiG+fmnaWoMnM5dPtHaaTTXkZGw+oNvRQfGlKhCxoFI08mSXzNckvxf8lH43 X-Received: by 2002:a65:43c7:: with SMTP id n7mr13419407pgp.173.1552234421095; Sun, 10 Mar 2019 09:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552234421; cv=none; d=google.com; s=arc-20160816; b=U/XWz/oziPJQcN4SvrtS4KR0EmxBcPiJyJcdCf2Bx5KVwURlQ34aibW9YLs0BLXfWy FbnkTO/6mEJRN71A5r5USi8GyKCOvfJN9029VfgeyNNpu/aeKplaLIRPWkHrUUWydQYe OPk4LJxrELqvw5XP4a23uH8Kj4D7MiHVJABYTNK7MidZUL2++d74odAfT0gO1coKupen Dd8XJV8xdoZQDP+cfGq/Qz3rHEJzvbfX/nYMBfkOjWAOk2X/CKZBukV8mJVKxNaneqnn 1IkqZ+i9YQYcRgDcR9EUw7EYKuD725GGDo0/KcO83dlzyLKIIjDkSJqPFvGJ02QmdtdJ D3eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=HpclfvC1mOug+KZhRP4YucgS6tqNenH8uIH104xvA48=; b=dMH5HYSMC55IXm/OWy/dxmzOyfUmAQQqCqt2u7QcvNAXSteiTMwRYWfdX/Ff8I3U7l o43A9wlzAO17GROqPXOvNjFz97Nf5RLel+Hbs4xL0C+9SaFtQAIVGc5pMAQvUtEbXtH7 VeFUfgInSjLTcf9i69YcRi3vXgoKUGf1w9uMH13kP2BWWhm8hpUMf+F0KGQUMmU4a711 ed5MH5jaGNS0h4B020CFImb1mQhObVJ3mmtGA4nnI9jRrQU9rbMdmLvpJy68Oh+kGmTG n27FooLVWndYfgOWWDXzFVqwxs3BzGl8kzFN+ykp5MwPm3oNGM4CGyCNdraxlhYgrdTa PRmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=R0ZjBz3T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si2961079pgm.311.2019.03.10.09.13.40; Sun, 10 Mar 2019 09:13:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=R0ZjBz3T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726655AbfCJQNj (ORCPT + 31 others); Sun, 10 Mar 2019 12:13:39 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:40955 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726000AbfCJQNi (ORCPT ); Sun, 10 Mar 2019 12:13:38 -0400 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-10.nifty.com with ESMTP id x2AGDIYg028844; Mon, 11 Mar 2019 01:13:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x2AGDIYg028844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1552234399; bh=HpclfvC1mOug+KZhRP4YucgS6tqNenH8uIH104xvA48=; h=From:To:Cc:Subject:Date:From; b=R0ZjBz3T1AEPdw1x/0+dHZ8GiRG2LC+SYXVvC8UCB9C1IPwRfBv0O+Us71ns79MB6 GAlKrBDmBoaz4LhaaUdSZS+ccsj8y7TgNc3korFyWg+Sp5FG0lHdldOl0hE1Q6pgVH RijN1kPfDgmScgTD/ymwq5ISXzFqsQoHKEaiJ75it0jydA4VP1GMVq8oRX4YbCz2J5 xbzVMxaSsfpS++n+L9/mE0BqLgArwJf8X0wbQC+GSvuWh3s1d41u/HOBDm11G4MJ6N ke8UcCrWyh7UnDp6YLJ44vXWgaZfRf7ngEbYOUzAKRCKYnYnssjS1CExMPhUNlt5x+ A5zzJ34NN8Tew== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ulf Magnusson , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH] kconfig: fix 'Save As' menu of xconfig Date: Mon, 11 Mar 2019 01:13:15 +0900 Message-Id: <1552234395-7699-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- scripts/kconfig/qconf.cc | 42 +++++++++++++++++++++++++++++++++++------- scripts/kconfig/qconf.h | 1 + 2 files changed, 36 insertions(+), 7 deletions(-) -- 2.7.4 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: