Qt: only "Comment" column should be editable in Local Interfaces management tab
authorPascal Quantin <pascal.quantin@gmail.com>
Fri, 19 Feb 2016 18:47:16 +0000 (19:47 +0100)
committerAlexis La Goutte <alexis.lagoutte@gmail.com>
Sat, 20 Feb 2016 14:26:46 +0000 (14:26 +0000)
Bug: 12146
Change-Id: Ife481b7c0b201a54749e212416571aa3dcaf7542
Reviewed-on: https://code.wireshark.org/review/14017
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
ui/qt/manage_interfaces_dialog.cpp
ui/qt/manage_interfaces_dialog.h

index ef216b1f801f42564a1d85a062ffd57841ec40e8..5a3e263b5c950256ee44a3e363e1fac426614450 100644 (file)
@@ -102,6 +102,7 @@ ManageInterfacesDialog::ManageInterfacesDialog(QWidget *parent) :
 #ifndef Q_OS_WIN
     ui->localList->setColumnHidden(col_l_friendly_name_, true);
 #endif
+    ui->localList->setEditTriggers(QAbstractItemView::NoEditTriggers);
 
     ui->pipeList->setItemDelegateForColumn(col_p_pipe_, &new_pipe_item_delegate_);
     new_pipe_item_delegate_.setTree(ui->pipeList);
@@ -122,6 +123,7 @@ ManageInterfacesDialog::ManageInterfacesDialog(QWidget *parent) :
 
     connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateWidgets()));
     connect(this, SIGNAL(ifsChanged()), parent, SIGNAL(ifsChanged()));
+    connect(ui->localList, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(localListItemDoubleClicked(QTreeWidgetItem *, int)));
 
 #ifdef HAVE_PCAP_REMOTE
     connect(this, SIGNAL(remoteAdded(GList*, remote_options*)), this, SLOT(addRemoteInterfaces(GList*, remote_options*)));
@@ -455,7 +457,7 @@ void ManageInterfacesDialog::localAccepted()
         /* write new description string to preferences */
         if (prefs.capture_devices_descr)
             g_free(prefs.capture_devices_descr);
-        prefs.capture_devices_descr = qstring_strdup(comment_list.join(","));;
+        prefs.capture_devices_descr = qstring_strdup(comment_list.join(","));
     }
 }
 
@@ -464,6 +466,13 @@ void ManageInterfacesDialog::on_buttonBox_helpRequested()
     wsApp->helpTopicAction(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG);
 }
 
+void ManageInterfacesDialog::localListItemDoubleClicked(QTreeWidgetItem * item, int column)
+{
+    if (column == col_l_comment_) {
+        ui->localList->editItem(item, column);
+    }
+}
+
 #ifdef HAVE_PCAP_REMOTE
 void ManageInterfacesDialog::remoteSelectionChanged(QTreeWidgetItem*, int)
 {
index 57883dedc8ce5df7aca39daf9d2f292d238c4689..89ddfcee112100d3409ac3f004a9beaa0612108f 100644 (file)
@@ -106,6 +106,8 @@ private slots:
     void on_pipeList_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
 
     void localAccepted();
+    void localListItemDoubleClicked(QTreeWidgetItem * item, int column);
+
 #ifdef HAVE_PCAP_REMOTE
     void on_addRemote_clicked();
     void on_delRemote_clicked();