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);