ResolveResource

Use ResolveResource rather than calling individual functions like visit user and room
This commit is contained in:
James Graham
2023-11-26 12:23:28 +00:00
parent bb8ffb02d1
commit 27c9c62564
21 changed files with 123 additions and 82 deletions

View File

@@ -235,7 +235,7 @@ QList<ActionsModel::Action> actions{
return QString();
}
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Joining room <roomname>.", "Joining room %1.", text));
RoomManager::instance().openResource(text, "join"_ls);
RoomManager::instance().resolveResource(text, "join"_ls);
return QString();
},
false,
@@ -290,7 +290,7 @@ QList<ActionsModel::Action> actions{
return QString();
}
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Joining room <roomname>.", "Joining room %1.", text));
RoomManager::instance().openResource(text, "join"_ls);
RoomManager::instance().resolveResource(text, "join"_ls);
return QString();
},
false,

View File

@@ -5,6 +5,7 @@
#include <Quotient/connection.h>
#include <Quotient/events/event.h>
#include <Quotient/uri.h>
#include "eventhandler.h"
#include "neochatroom.h"
@@ -49,6 +50,9 @@ QVariant NotificationsModel::data(const QModelIndex &index, int role) const
if (role == RoomDisplayNameRole) {
return m_notifications[row].roomDisplayName;
}
if (role == UriRole) {
return Uri(m_notifications[row].roomId.toLatin1(), m_notifications[row].eventId.toLatin1()).toUrl();
}
return {};
}
@@ -62,6 +66,7 @@ QHash<int, QByteArray> NotificationsModel::roleNames() const
{RoomRole, "room"},
{EventIdRole, "eventId"},
{RoomDisplayNameRole, "roomDisplayName"},
{UriRole, "uri"},
};
}

View File

@@ -28,6 +28,7 @@ public:
RoomRole,
EventIdRole,
RoomDisplayNameRole,
UriRole,
};
Q_ENUM(Roles);