Open url using QDesktopServices from Qml
This fixes some weirdness on some platforms, where Qt.openUrlExternally
does weird stuff.
3 files changed, 10 insertions, 1 deletions
diff --git a/resources/qml/MatrixText.qml b/resources/qml/MatrixText.qml
index 9a4f7348..d56143dd 100644
--- a/resources/qml/MatrixText.qml
+++ b/resources/qml/MatrixText.qml
@@ -16,7 +16,7 @@ TextEdit {
timelineManager.setHistoryView(match[1])
chat.positionViewAtIndex(chat.model.idToIndex(match[2]), ListView.Contain)
}
- else Qt.openUrlExternally(link)
+ else timelineManager.openLink(link)
}
MouseArea
{
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 64af8afb..060f52fe 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -1,5 +1,6 @@
#include "TimelineViewManager.h"
+#include <QDesktopServices>
#include <QMetaType>
#include <QPalette>
#include <QQmlContext>
@@ -220,6 +221,12 @@ TimelineViewManager::openImageOverlay(QString mxcUrl, QString eventId) const
}
void
+TimelineViewManager::openLink(QString link) const
+{
+ QDesktopServices::openUrl(link);
+}
+
+void
TimelineViewManager::updateReadReceipts(const QString &room_id,
const std::vector<QString> &event_ids)
{
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index ed095058..81a8b9b4 100644
--- a/src/timeline/TimelineViewManager.h
+++ b/src/timeline/TimelineViewManager.h
@@ -47,6 +47,8 @@ public:
Q_INVOKABLE QString userPresence(QString id) const;
Q_INVOKABLE QString userStatus(QString id) const;
+ Q_INVOKABLE void openLink(QString link) const;
+
signals:
void clearRoomMessageCount(QString roomid);
void updateRoomsLastMessage(QString roomid, const DescInfo &info);
|