From 679426abc1260f30addb893a69be6352570a553c Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 24 Apr 2022 20:55:06 +0200 Subject: [PATCH] xdg-open doesn't seem to work anymore on SFOS 4.4 --- qml/harbour-fernschreiber.qml | 7 +++++++ src/tdlibwrapper.cpp | 9 +-------- src/tdlibwrapper.h | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qml/harbour-fernschreiber.qml b/qml/harbour-fernschreiber.qml index f2b8cdb..db0608c 100644 --- a/qml/harbour-fernschreiber.qml +++ b/qml/harbour-fernschreiber.qml @@ -40,6 +40,13 @@ ApplicationWindow } } + Connections { + target: tdLibWrapper + onOpenFileExternally: { + Qt.openUrlExternally(filePath); + } + } + AppNotification { id: appNotification parent: pageStack.currentPage diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 8b7018e..762be00 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -1511,14 +1511,7 @@ void TDLibWrapper::copyFileToDownloads(const QString &filePath, bool openAfterCo void TDLibWrapper::openFileOnDevice(const QString &filePath) { LOG("Open file on device:" << filePath); - QStringList argumentsList; - argumentsList.append(filePath); - bool successfullyStarted = QProcess::startDetached("xdg-open", argumentsList); - if (successfullyStarted) { - LOG("Successfully opened file " << filePath); - } else { - LOG("Error opening file " << filePath); - } + emit openFileExternally(filePath); } void TDLibWrapper::controlScreenSaver(bool enabled) diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 81b48e1..1174a22 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -311,6 +311,7 @@ signals: void messageInteractionInfoUpdated(qlonglong chatId, qlonglong messageId, const QVariantMap &updatedInfo); void okReceived(const QString &request); void sessionsReceived(const QVariantList &sessions); + void openFileExternally(const QString &filePath); public slots: void handleVersionDetected(const QString &version);