From 393b22047be82dcf1194800e56a9df481759a9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Sun, 30 Dec 2018 20:30:56 +0100 Subject: Qt: Add "Show in Finder/Folder" for plugins. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu --- ui/qt/about_dialog.cpp | 28 ++++++++++++++++++++++++++++ ui/qt/about_dialog.h | 1 + 2 files changed, 29 insertions(+) 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::asQVariant(tree)); + connect(showInFolderAction, SIGNAL(triggered()), this, SLOT(showInFolderActionTriggered())); + } + QAction * copyColumnAction = menu->addAction(tr("Copy")); copyColumnAction->setData(VariantPointer::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(sender()); + if (!sendingAction) + return; + + QTreeView * tree = VariantPointer::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); -- cgit v1.2.3