Add button to encrypt room

This commit is contained in:
Tobias Fella
2022-10-27 20:56:29 +02:00
parent 82ec92b209
commit 4e6aca9a4e
4 changed files with 35 additions and 0 deletions

View File

@@ -67,6 +67,7 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
connect(this, &Room::displaynameChanged, this, &NeoChatRoom::displayNameChanged);
connectSingleShot(this, &Room::baseStateLoaded, this, [this]() {
Q_EMIT canEncryptRoomChanged();
if (this->joinState() != JoinState::Invite) {
return;
}
@@ -80,6 +81,9 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
}
NotificationsManager::instance().postInviteNotification(this, htmlSafeDisplayName(), htmlSafeMemberName(senderId), avatar_image);
});
connect(this, &Room::changed, this, [this] {
Q_EMIT canEncryptRoomChanged();
});
}
void NeoChatRoom::uploadFile(const QUrl &url, const QString &body)
@@ -1165,3 +1169,13 @@ void NeoChatRoom::setSavedText(const QString &savedText)
{
m_savedText = savedText;
}
bool NeoChatRoom::canEncryptRoom() const
{
#ifdef QUOTIENT_07
#ifdef Quotient_E2EE_ENABLED
return !usesEncryption() && canSendState("m.room.encryption");
#endif
#endif
return false;
}