From d1b8b4c2cf4fc2012f22c40d5bcac3fda87ce0cb Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 1 Jul 2020 21:28:06 +0200 Subject: [PATCH] Move the actions to open_with to the top --- src/Filter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Filter.cpp b/src/Filter.cpp index 6989a0b1..26699fb5 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -614,6 +614,16 @@ void FileFilter::HotSpot::setupMenu(QMenu *menu) _menuActions.setParent(this); _menuActions.setItemListProperties(itemProperties); _menuActions.addOpenWithActionsTo(menu); + + // Here we added the actions to the last part of the menu, but we need to move them up. + // TODO: As soon as addOpenWithActionsTo accepts a index, change this. + QAction *firstAction = menu->actions().at(0); + for (auto *action : menu->actions()) { + if (action->text().toLower().remove(QLatin1Char('&')).contains(i18n("open with"))) { + menu->removeAction(action); + menu->insertAction(firstAction, action); + } + } } // Static variables for the HotSpot