Commit 8476d0e2 authored by Ahmad Samir's avatar Ahmad Samir Committed by Christoph Cullmann
Browse files

KateFileTree: don't use sender()

Instead capture the sender with a lambda.
parent c1be554f
......@@ -347,7 +347,9 @@ void KateFileTree::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(m_filelistPrintDocument);
menu.addAction(m_filelistPrintDocumentPreview);
QMenu *openWithMenu = menu.addMenu(i18nc("@action:inmenu", "Open With"));
connect(openWithMenu, &QMenu::aboutToShow, this, &KateFileTree::slotFixOpenWithMenu);
connect(openWithMenu, &QMenu::aboutToShow, this, [this, openWithMenu]() {
slotFixOpenWithMenu(openWithMenu);
});
connect(openWithMenu, &QMenu::triggered, this, &KateFileTree::slotOpenWithMenuAction);
const bool hasFileName = doc->url().isValid();
......@@ -379,9 +381,8 @@ void KateFileTree::contextMenuEvent(QContextMenuEvent *event)
event->accept();
}
void KateFileTree::slotFixOpenWithMenu()
void KateFileTree::slotFixOpenWithMenu(QMenu *menu)
{
QMenu *menu = static_cast<QMenu *>(sender());
menu->clear();
KTextEditor::Document *doc = m_proxyModel->docFromIndex(m_indexContextMenu);
......
......@@ -71,7 +71,7 @@ private Q_SLOTS:
void slotSortName();
void slotSortPath();
void slotSortOpeningOrder();
void slotFixOpenWithMenu();
void slotFixOpenWithMenu(QMenu *menu);
void slotOpenWithMenuAction(QAction *a);
void slotRenameFile();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment