aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2018-12-30 20:30:56 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-01-04 12:00:57 +0000
commit393b22047be82dcf1194800e56a9df481759a9b6 (patch)
tree02fe24fa9ca91681f81f46f6b24db15855cc1d85
parent2fe46f29c48641b622614faa60a3a7f02bd05274 (diff)
Qt: Add "Show in Finder/Folder" for plugins.
Add a menu item for "Show in Finder/Folder" for plugins in cases where Wireshark loads plugins from other folders than is listed in "Folders". Change-Id: I8cc42d9992d885f1ca37f5769d7292bed1584f4b Reviewed-on: https://code.wireshark.org/review/31270 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--ui/qt/about_dialog.cpp28
-rw-r--r--ui/qt/about_dialog.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp
index 1497398751..0097e8f99a 100644
--- a/ui/qt/about_dialog.cpp
+++ b/ui/qt/about_dialog.cpp
@@ -487,6 +487,18 @@ void AboutDialog::handleCopyMenu(QPoint pos)
QMenu * menu = new QMenu(this);
+ if (ui->tabWidget->currentWidget() == ui->tab_plugins)
+ {
+#ifdef Q_OS_MAC
+ QString show_in_str = tr("Show in Finder");
+#else
+ QString show_in_str = tr("Show in Folder");
+#endif
+ QAction * showInFolderAction = menu->addAction(show_in_str);
+ showInFolderAction->setData(VariantPointer<QTreeView>::asQVariant(tree));
+ connect(showInFolderAction, SIGNAL(triggered()), this, SLOT(showInFolderActionTriggered()));
+ }
+
QAction * copyColumnAction = menu->addAction(tr("Copy"));
copyColumnAction->setData(VariantPointer<QTreeView>::asQVariant(tree));
connect(copyColumnAction, SIGNAL(triggered()), this, SLOT(copyActionTriggered()));
@@ -499,6 +511,22 @@ void AboutDialog::handleCopyMenu(QPoint pos)
menu->popup(tree->viewport()->mapToGlobal(pos));
}
+void AboutDialog::showInFolderActionTriggered()
+{
+ QAction * sendingAction = qobject_cast<QAction *>(sender());
+ if (!sendingAction)
+ return;
+
+ QTreeView * tree = VariantPointer<QTreeView>::asPtr(sendingAction->data());
+ QModelIndexList selectedRows = tree->selectionModel()->selectedRows();
+
+ foreach (QModelIndex index, selectedRows)
+ {
+ QString cf_path = tree->model()->index(index.row(), 3).data().toString();
+ desktop_show_in_folder(cf_path);
+ }
+}
+
void AboutDialog::copyRowActionTriggered()
{
copyActionTriggered(true);
diff --git a/ui/qt/about_dialog.h b/ui/qt/about_dialog.h
index f19193dff9..c647112bbe 100644
--- a/ui/qt/about_dialog.h
+++ b/ui/qt/about_dialog.h
@@ -96,6 +96,7 @@ private:
private slots:
void urlDoubleClicked(const QModelIndex &);
void handleCopyMenu(QPoint);
+ void showInFolderActionTriggered();
void copyActionTriggered(bool row = false);
void copyRowActionTriggered();
void on_tblPlugins_doubleClicked(const QModelIndex &index);