mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 14:18:49 +03:00
Open url using QDesktopServices from Qml
This fixes some weirdness on some platforms, where Qt.openUrlExternally does weird stuff.
This commit is contained in:
parent
d72eb5eb2d
commit
8d3ab300b6
3 changed files with 10 additions and 1 deletions
|
@ -16,7 +16,7 @@ TextEdit {
|
||||||
timelineManager.setHistoryView(match[1])
|
timelineManager.setHistoryView(match[1])
|
||||||
chat.positionViewAtIndex(chat.model.idToIndex(match[2]), ListView.Contain)
|
chat.positionViewAtIndex(chat.model.idToIndex(match[2]), ListView.Contain)
|
||||||
}
|
}
|
||||||
else Qt.openUrlExternally(link)
|
else timelineManager.openLink(link)
|
||||||
}
|
}
|
||||||
MouseArea
|
MouseArea
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "TimelineViewManager.h"
|
#include "TimelineViewManager.h"
|
||||||
|
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
|
@ -219,6 +220,12 @@ TimelineViewManager::openImageOverlay(QString mxcUrl, QString eventId) const
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimelineViewManager::openLink(QString link) const
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl(link);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineViewManager::updateReadReceipts(const QString &room_id,
|
TimelineViewManager::updateReadReceipts(const QString &room_id,
|
||||||
const std::vector<QString> &event_ids)
|
const std::vector<QString> &event_ids)
|
||||||
|
|
|
@ -47,6 +47,8 @@ public:
|
||||||
Q_INVOKABLE QString userPresence(QString id) const;
|
Q_INVOKABLE QString userPresence(QString id) const;
|
||||||
Q_INVOKABLE QString userStatus(QString id) const;
|
Q_INVOKABLE QString userStatus(QString id) const;
|
||||||
|
|
||||||
|
Q_INVOKABLE void openLink(QString link) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void clearRoomMessageCount(QString roomid);
|
void clearRoomMessageCount(QString roomid);
|
||||||
void updateRoomsLastMessage(QString roomid, const DescInfo &info);
|
void updateRoomsLastMessage(QString roomid, const DescInfo &info);
|
||||||
|
|
Loading…
Reference in a new issue