RoomManager: Unify the resolveResource overloads
Every time I look at how resource resolving works, I always trip over
this unused overload. This behaves *different* than the other overload,
which has special cases for handling invalid Uris.
Now whether you pass in a Uri or a QString, it should behave the same.
(cherry picked from commit 55362c5573)
This commit is contained in:
@@ -134,16 +134,15 @@ void RoomManager::activateUserModel()
|
||||
m_userListModel->activate();
|
||||
}
|
||||
|
||||
UriResolveResult RoomManager::resolveResource(const Uri &uri)
|
||||
{
|
||||
return UriResolverBase::visitResource(m_connection, uri);
|
||||
}
|
||||
|
||||
void RoomManager::resolveResource(const QString &idOrUri, const QString &action)
|
||||
{
|
||||
Uri uri{idOrUri};
|
||||
resolveResource(Uri{idOrUri}, action);
|
||||
}
|
||||
|
||||
void RoomManager::resolveResource(Uri uri, const QString &action)
|
||||
{
|
||||
if (!uri.isValid()) {
|
||||
Q_EMIT showMessage(MessageType::Warning, i18n("Malformed or empty Matrix id<br />%1 is not a correct Matrix identifier", idOrUri));
|
||||
Q_EMIT showMessage(MessageType::Warning, i18n("Malformed or empty Matrix id<br />%1 is not a correct Matrix identifier", uri.toDisplayString()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,16 +168,6 @@ public:
|
||||
UserListModel *userListModel() const;
|
||||
Q_INVOKABLE void activateUserModel();
|
||||
|
||||
/**
|
||||
* @brief Resolve the given URI resource.
|
||||
*
|
||||
* @note It's actually Quotient::UriResolverBase::visitResource() but with Q_INVOKABLE
|
||||
* and the connection grabbed from RoomManager.
|
||||
*
|
||||
* @sa Quotient::UriResolverBase::visitResource()
|
||||
*/
|
||||
Q_INVOKABLE UriResolveResult resolveResource(const Uri &uri);
|
||||
|
||||
/**
|
||||
* @brief Resolve the given resource.
|
||||
*
|
||||
@@ -188,6 +178,16 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE void resolveResource(const QString &idOrUri, const QString &action = {});
|
||||
|
||||
/**
|
||||
* @brief Resolve the given resource URI.
|
||||
*
|
||||
* @note It's actually Quotient::UriResolverBase::visitResource() but with Q_INVOKABLE
|
||||
* and the connection grabbed from RoomManager.
|
||||
*
|
||||
* @sa Quotient::UriResolverBase::visitResource()
|
||||
*/
|
||||
Q_INVOKABLE void resolveResource(Uri uri, const QString &action = {});
|
||||
|
||||
bool hasOpenRoom() const;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user