From 100482fe10e3526910d5759e0c8c60f6afe09c35 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 24 Mar 2004 21:09:19 +0000 Subject: [PATCH] Fixed some selection issues in the environment variable list. --- ChangeLog | 12 ++++++++++++ kdbg/pgmargs.cpp | 46 +++++++++++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36eb349..ec1176d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Version 1.9.5 + + Fixed some issues when the items in the environment variable list + are selected. + +Version 1.9.4 + + Updated the build system to the latest auto* tools. + + Worked around the problem that gdb reports "Using host libthread_db" + on Fedora Core when it processes the file command. + Version 1.9.3 Improved editing of values; it is now possible to edit variables also diff --git a/kdbg/pgmargs.cpp b/kdbg/pgmargs.cpp index d4ca68b..7c2fb63 100644 --- a/kdbg/pgmargs.cpp +++ b/kdbg/pgmargs.cpp @@ -114,7 +114,7 @@ PgmArgs::PgmArgs(QWidget* parent, const QString& pgm, QDict& envVars, m_envList.setMinimumSize(330, 40); m_envList.addColumn(i18n("Name"), 100); m_envList.addColumn(i18n("Value"), 260); - connect(&m_envList, SIGNAL(currentChanged(QListViewItem*)), + connect(&m_envList, SIGNAL(selectionChanged(QListViewItem*)), SLOT(envListCurrentChanged(QListViewItem*))); initEnvList(); @@ -230,32 +230,36 @@ void PgmArgs::modifyVar() val->item = new QListViewItem(&m_envList, name, value); // inserts itself m_envVars.insert(name, val); } + m_envList.setSelected(val->item, true); + m_buttonDelete.setEnabled(true); } +// delete the selected item void PgmArgs::deleteVar() { - QString name, value; - parseEnvInput(name, value); + QListViewItem* item = m_envList.selectedItem(); + if (item == 0) + return; + QString name = item->text(0); // lookup the value in the dictionary EnvVar* val = m_envVars[name]; - if (val == 0) - return; - - // delete from list - QListViewItem* item = val->item; - val->item = 0; - delete item; - // if this is a new item, delete it completely, otherwise zombie-ize it - if (val->status == EnvVar::EVnew) { - m_envVars.remove(name); - delete val; - } else { - // mark value deleted - val->status = EnvVar::EVdeleted; + if (val != 0) + { + // delete from list + val->item = 0; + // if this is a new item, delete it completely, otherwise zombie-ize it + if (val->status == EnvVar::EVnew) { + m_envVars.remove(name); + delete val; + } else { + // mark value deleted + val->status = EnvVar::EVdeleted; + } } - // clear the input - m_envVar.setText(""); + delete item; + // there is no selected item anymore + m_buttonDelete.setEnabled(false); } void PgmArgs::parseEnvInput(QString& name, QString& value) @@ -282,10 +286,14 @@ void PgmArgs::initEnvList() name = it.currentKey(); val->item = new QListViewItem(&m_envList, name, val->value); // inserts itself } + + m_envList.setAllColumnsShowFocus(true); + m_buttonDelete.setEnabled(m_envList.selectedItem() != 0); } void PgmArgs::envListCurrentChanged(QListViewItem* item) { + m_buttonDelete.setEnabled(item != 0); if (item == 0) return; -- 2.11.4.GIT