mirror of
https://github.com/KDE/konsole.git
synced 2025-12-23 23:38:08 -05:00
Add ability to Open With the current working directory
This makes it convenient to open programs like VSCode in the current terminal window.
This commit is contained in:
committed by
Tomaz Canabrava
parent
5919c1fd0a
commit
8022b26c3b
@@ -47,6 +47,7 @@
|
||||
|
||||
#include <KIO/JobUiDelegate>
|
||||
#include <KIO/OpenUrlJob>
|
||||
#include <KFileItemListProperties>
|
||||
|
||||
#include <kconfigwidgets_version.h>
|
||||
#include <kwidgetsaddons_version.h>
|
||||
@@ -1826,7 +1827,22 @@ void SessionController::showDisplayContextMenu(const QPoint &position)
|
||||
copy->setShortcut(Konsole::ACCEL | Qt::SHIFT | Qt::Key_C);
|
||||
#endif
|
||||
|
||||
QList<QAction *> toRemove;
|
||||
const QUrl currentUrl = url().isLocalFile() ? url() : QUrl::fromLocalFile(QDir::homePath());
|
||||
KFileItem item(currentUrl);
|
||||
|
||||
const auto old = popup->actions();
|
||||
|
||||
const KFileItemListProperties props({item});
|
||||
QScopedPointer<KFileItemActions> ac(new KFileItemActions(popup));
|
||||
ac->setItemListProperties(props);
|
||||
ac->insertOpenWithActionsTo(popup->actions().value(4, nullptr), popup, QStringList{qApp->desktopFileName()});
|
||||
|
||||
auto neu = popup->actions();
|
||||
for (auto* elm : old) {
|
||||
neu.removeAll(elm);
|
||||
}
|
||||
|
||||
QList<QAction *> toRemove = std::move(neu);
|
||||
// prepend content-specific actions such as "Open Link", "Copy Email Address" etc
|
||||
QSharedPointer<HotSpot> hotSpot = view()->filterActions(position);
|
||||
if (hotSpot != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user