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>
This commit is contained in:
Stig Bjørlykke 2018-12-30 20:30:56 +01:00 committed by Peter Wu
parent 2fe46f29c4
commit 393b22047b
2 changed files with 29 additions and 0 deletions

View File

@ -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);

View File

@ -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);