Commit a158926a authored by Tomaz  Canabrava's avatar Tomaz Canabrava Committed by Tomaz Canabrava
Browse files

Launch dolphin on "Open With File Manager" under a file

parent b3eb91d3
......@@ -33,6 +33,7 @@ class TerminalDisplay;
class FileFilterHotSpot : public RegExpFilterHotSpot
FileFilterHotSpot(int startLine, int startColumn, int endLine, int endColumn, const QStringList &capturedTexts, const QString &filePath, Session *session);
~FileFilterHotSpot() override;
......@@ -46,6 +47,7 @@ public:
QList<QAction *> setupMenu(QMenu *menu) override;
KFileItem fileItem() const;
void requestThumbnail(Qt::KeyboardModifiers modifiers, const QPoint &pos);
void thumbnailRequested();
......@@ -65,6 +65,7 @@
#include "filterHotSpots/ColorFilter.h"
#include "filterHotSpots/EscapeSequenceUrlFilter.h"
#include "filterHotSpots/FileFilter.h"
#include "filterHotSpots/FileFilterHotspot.h"
#include "filterHotSpots/Filter.h"
#include "filterHotSpots/FilterChain.h"
#include "filterHotSpots/HotSpot.h"
......@@ -1109,6 +1110,23 @@ void SessionController::closeSession()
// 2) transform url to get the desired result (ssh -> sftp, etc)
void SessionController::openBrowser()
// if we requested the browser on a file, we can't use OpenUrlJob
// because it does not open the file in a browser, it opens another program
// based on it's mime type.
// so force open dolphin with it selected.
// TODO: and for people that have other default file browsers such as
// konqueror and krusader?
if (_currentHotSpot && _currentHotSpot->type() == HotSpot::File) {
auto *fileHotSpot = qobject_cast<FileFilterHotSpot *>(_currentHotSpot.get());
auto job = new KIO::CommandLauncherJob(QStringLiteral("dolphin"), {fileHotSpot->fileItem().url().toLocalFile(), QStringLiteral("--select")});
const QUrl currentUrl = url().isLocalFile() ? url() : QUrl::fromLocalFile(QDir::homePath());
auto *job = new KIO::OpenUrlJob(currentUrl);
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