Commit 38bb7aa2 authored by Tomaz  Canabrava's avatar Tomaz Canabrava
Browse files

Remove Ghost Entries of the Open Folder With

There were two bugs with the previous implementation
one is that it didn't took in consideration the
Profile -> Mouse -> Advanced -> Underline Files
With that enabled, right click on the name of the folder
would give you a Open Folder With entry, so we would
end with two actions.

The other bug also triggered when that setting is enabled:
we never marked the Open Folder With for removal, after
inserting the menu for the underlined file.
parent 372c14da
......@@ -1827,6 +1827,7 @@ void SessionController::showDisplayContextMenu(const QPoint &position)
copy->setShortcut(Konsole::ACCEL | Qt::SHIFT | Qt::Key_C);
#endif
// Adds a "Open Folder With" action
const QUrl currentUrl = url().isLocalFile() ? url() : QUrl::fromLocalFile(QDir::homePath());
KFileItem item(currentUrl);
......@@ -1841,14 +1842,26 @@ void SessionController::showDisplayContextMenu(const QPoint &position)
for (auto* elm : old) {
neu.removeAll(elm);
}
// Finish Ading the "Open Folder With" action.
QList<QAction *> toRemove = std::move(neu);
QList<QAction *> toRemove;
// prepend content-specific actions such as "Open Link", "Copy Email Address" etc
QSharedPointer<HotSpot> hotSpot = view()->filterActions(position);
if (hotSpot != nullptr) {
popup->insertActions(popup->actions().value(0, nullptr), hotSpot->actions() << contentSeparator);
popup->addAction(contentSeparator);
toRemove = hotSpot->setupMenu(popup.data());
// Can happen if we click on a right click, on a folder.
// if this happens, we need to remove this action as we have
// already added the action before this if.
if (toRemove[0]->text() == i18n("&Open Folder With")) {
delete toRemove[0];
toRemove.removeFirst();
}
toRemove = toRemove + neu;
} else {
toRemove = neu;
}
// always update this submenu before showing the context menu,
......
Markdown is supported
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