summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-07-09 00:45:37 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-07-09 00:45:37 +0200
commit8d3ab300b650dcef3d12fe1e5a4bb14855e8495a (patch)
tree309dc5145a30395afef3808130dc6f4ac9c8f3df
parentUpdate dependencies (diff)
downloadnheko-8d3ab300b650dcef3d12fe1e5a4bb14855e8495a.tar.xz
Open url using QDesktopServices from Qml
This fixes some weirdness on some platforms, where Qt.openUrlExternally
does weird stuff.
-rw-r--r--resources/qml/MatrixText.qml2
-rw-r--r--src/timeline/TimelineViewManager.cpp7
-rw-r--r--src/timeline/TimelineViewManager.h2
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);