From patchwork Wed Oct 28 22:53:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Kaindl X-Patchwork-Id: 56371 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9SN3rfi002139 for ; Wed, 28 Oct 2009 23:03:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753697AbZJ1XDs (ORCPT ); Wed, 28 Oct 2009 19:03:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754224AbZJ1XDs (ORCPT ); Wed, 28 Oct 2009 19:03:48 -0400 Received: from mail-bw0-f219.google.com ([209.85.218.219]:35075 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753697AbZJ1XDr (ORCPT ); Wed, 28 Oct 2009 19:03:47 -0400 Received: by bwz19 with SMTP id 19so1587508bwz.28 for ; Wed, 28 Oct 2009 16:03:51 -0700 (PDT) Received: by 10.204.154.216 with SMTP id p24mr1140670bkw.16.1256771030333; Wed, 28 Oct 2009 16:03:50 -0700 (PDT) Received: from localhost.localdomain (84-119-93-210.static.xdsl-line.inode.at [84.119.93.210]) by mx.google.com with ESMTPS id 13sm413600bwz.2.2009.10.28.16.03.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 28 Oct 2009 16:03:49 -0700 (PDT) From: Bernhard Kaindl To: Sam Ravnborg Cc: linux-kbuild@vger.kernel.org, Bernhard Kaindl Subject: [remarks 2/4] menuconfig: allow editing of remarks for config symbols Date: Wed, 28 Oct 2009 23:53:48 +0100 Message-Id: <4ae8cdd5.0d1abc0a.0bd6.3d1f@mx.google.com> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: References: In-Reply-To: References: Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index fa9d633..6b6bc48 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c @@ -383,6 +383,7 @@ do_resize: case 'n': case 'm': case '/': + case '<': /* save scroll info */ *s_scroll = scroll; delwin(menu); @@ -402,6 +403,8 @@ do_resize: return 6; case '/': return 7; + case '<': + return 8; } return 0; case 'h': diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index d829535..50a9b10 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -276,6 +276,7 @@ static int single_menu_mode; static void conf(struct menu *menu); static void conf_choice(struct menu *menu); static void conf_string(struct menu *menu); +static void conf_remark(struct menu *menu); static void conf_load(void); static void conf_save(void); static void show_textbox(const char *title, const char *text, int r, int c); @@ -619,6 +620,9 @@ static void conf(struct menu *menu) case 7: search_conf(); break; + case 8: + conf_remark(submenu); + break; } } } @@ -743,6 +747,53 @@ static void conf_string(struct menu *menu) } } +/** + * Based on conf_string(), this edits the remark for a config symbol + */ +static void conf_remark(struct menu *menu) +{ + const char *prompt = menu_get_prompt(menu); + + if (!prompt || !menu->sym) { + show_textbox(NULL, + N_("Editing comments for menus without a config symbol\n" + "is currently not supported."), 6, 63); + return; + } + + while (1) { + int res; + dialog_clear(); + res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"), + _("Edit the remark below"), 10, 75, + menu->sym->remark); + switch (res) { + case 0: + if (!dialog_input_result[0] && !menu->sym->remark) + return; + if (menu->sym->remark) { + if (!strcmp(menu->sym->remark, dialog_input_result)) + return; + free(menu->sym->remark); + } + if (dialog_input_result[0]) { + menu->sym->remark = strdup(dialog_input_result); + } else { + menu->sym->remark = NULL; + } + /* Write new .config{,-remarks} on exit: */ + sym_add_change_count(1); + sym_clear_all_valid(); + return; + case 1: + show_help(menu); + break; + case KEY_ESC: + return; + } + } +} + static void conf_load(void) {