mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-23 11:28:49 +03:00
Warn about room name and topic not being encrypted
This commit is contained in:
parent
b86221bdbe
commit
c1038a3e4a
3 changed files with 77 additions and 34 deletions
|
@ -130,7 +130,7 @@ ApplicationWindow {
|
||||||
color: palette.text
|
color: palette.text
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.maximumWidth: parent.width - (Nheko.paddingSmall * 2) - nameChangeButton.anchors.leftMargin - (nameChangeButton.width * 2)
|
Layout.maximumWidth: parent.width - (Nheko.paddingSmall + roomNameButtons.anchors.leftMargin + roomNameButtons.implicitWidth) * 2
|
||||||
horizontalAlignment: TextEdit.AlignHCenter
|
horizontalAlignment: TextEdit.AlignHCenter
|
||||||
wrapMode: TextEdit.Wrap
|
wrapMode: TextEdit.Wrap
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
|
@ -144,27 +144,43 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButton {
|
RowLayout {
|
||||||
id: nameChangeButton
|
id: roomNameButtons
|
||||||
visible: roomSettings.canChangeName
|
|
||||||
anchors.leftMargin: Nheko.paddingSmall
|
anchors.leftMargin: Nheko.paddingSmall
|
||||||
anchors.left: roomName.right
|
anchors.left: roomName.right
|
||||||
anchors.verticalCenter: roomName.verticalCenter
|
anchors.verticalCenter: roomName.verticalCenter
|
||||||
hoverEnabled: true
|
|
||||||
ToolTip.visible: hovered
|
ImageButton {
|
||||||
ToolTip.text: qsTr("Change name of this room")
|
id: nameChangeButton
|
||||||
ToolTip.delay: Nheko.tooltipDelay
|
visible: roomSettings.canChangeName
|
||||||
image: roomName.isNameEditingAllowed ? ":/icons/icons/ui/checkmark.svg" : ":/icons/icons/ui/edit.svg"
|
hoverEnabled: true
|
||||||
onClicked: {
|
ToolTip.visible: hovered
|
||||||
if (roomName.isNameEditingAllowed) {
|
ToolTip.text: qsTr("Change name of this room")
|
||||||
roomSettings.changeName(roomName.text);
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
roomName.isNameEditingAllowed = false;
|
image: roomName.isNameEditingAllowed ? ":/icons/icons/ui/checkmark.svg" : ":/icons/icons/ui/edit.svg"
|
||||||
} else {
|
onClicked: {
|
||||||
roomName.isNameEditingAllowed = true;
|
if (roomName.isNameEditingAllowed) {
|
||||||
roomName.focus = true;
|
roomSettings.changeName(roomName.text);
|
||||||
roomName.selectAll();
|
roomName.isNameEditingAllowed = false;
|
||||||
|
} else {
|
||||||
|
roomName.isNameEditingAllowed = true;
|
||||||
|
roomName.focus = true;
|
||||||
|
roomName.selectAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EncryptionIndicator {
|
||||||
|
Layout.preferredHeight: 16
|
||||||
|
Layout.preferredWidth: 16
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
|
encrypted: true
|
||||||
|
visible: roomSettings.isEncryptionEnabled && (roomSettings.isRoomNameSet || !roomName.readOnly)
|
||||||
|
trust: Crypto.Unverified
|
||||||
|
ToolTip.text: qsTr("Since room state can't be encrypted, make sure no confidential information is stored in the room name!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -220,26 +236,42 @@ ApplicationWindow {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButton {
|
RowLayout {
|
||||||
id: topicChangeButton
|
spacing: Nheko.paddingMedium
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
visible: roomSettings.canChangeTopic
|
|
||||||
hoverEnabled: true
|
ImageButton {
|
||||||
ToolTip.visible: hovered
|
id: topicChangeButton
|
||||||
ToolTip.text: qsTr("Change topic of this room")
|
|
||||||
ToolTip.delay: Nheko.tooltipDelay
|
visible: roomSettings.canChangeTopic
|
||||||
image: roomTopic.isTopicEditingAllowed ? ":/icons/icons/ui/checkmark.svg" : ":/icons/icons/ui/edit.svg"
|
hoverEnabled: true
|
||||||
onClicked: {
|
ToolTip.visible: hovered
|
||||||
if (roomTopic.isTopicEditingAllowed) {
|
ToolTip.text: qsTr("Change topic of this room")
|
||||||
roomSettings.changeTopic(roomTopic.text);
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
roomTopic.isTopicEditingAllowed = false;
|
image: roomTopic.isTopicEditingAllowed ? ":/icons/icons/ui/checkmark.svg" : ":/icons/icons/ui/edit.svg"
|
||||||
} else {
|
onClicked: {
|
||||||
roomTopic.isTopicEditingAllowed = true;
|
if (roomTopic.isTopicEditingAllowed) {
|
||||||
roomTopic.showMore = true;
|
roomSettings.changeTopic(roomTopic.text);
|
||||||
roomTopic.focus = true;
|
roomTopic.isTopicEditingAllowed = false;
|
||||||
//roomTopic.selectAll();
|
} else {
|
||||||
|
roomTopic.isTopicEditingAllowed = true;
|
||||||
|
roomTopic.showMore = true;
|
||||||
|
roomTopic.focus = true;
|
||||||
|
//roomTopic.selectAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EncryptionIndicator {
|
||||||
|
Layout.preferredHeight: 16
|
||||||
|
Layout.preferredWidth: 16
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
|
encrypted: true
|
||||||
|
visible: roomSettings.isEncryptionEnabled && (roomSettings.plainRoomTopic != "" || !roomTopic.readOnly)
|
||||||
|
trust: Crypto.Unverified
|
||||||
|
ToolTip.text: qsTr("Since room state can't be encrypted, make sure no confidential information is stored in the room topic!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -81,6 +81,15 @@ RoomSettings::RoomSettings(QString roomid, QObject *parent)
|
||||||
this->allowedRoomsModel = new RoomSettingsAllowedRoomsModel(this);
|
this->allowedRoomsModel = new RoomSettingsAllowedRoomsModel(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
RoomSettings::isRoomNameSet() const
|
||||||
|
{
|
||||||
|
return !cache::client()
|
||||||
|
->getStateEvent<mtx::events::state::Name>(roomid_.toStdString())
|
||||||
|
.value_or(mtx::events::StateEvent<mtx::events::state::Name>{})
|
||||||
|
.content.name.empty();
|
||||||
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
RoomSettings::roomName() const
|
RoomSettings::roomName() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,6 +100,7 @@ class RoomSettings final : public QObject
|
||||||
Q_PROPERTY(bool supportsKnocking READ supportsKnocking CONSTANT)
|
Q_PROPERTY(bool supportsKnocking READ supportsKnocking CONSTANT)
|
||||||
Q_PROPERTY(bool supportsRestricted READ supportsRestricted CONSTANT)
|
Q_PROPERTY(bool supportsRestricted READ supportsRestricted CONSTANT)
|
||||||
Q_PROPERTY(bool supportsKnockRestricted READ supportsKnockRestricted CONSTANT)
|
Q_PROPERTY(bool supportsKnockRestricted READ supportsKnockRestricted CONSTANT)
|
||||||
|
Q_PROPERTY(bool isRoomNameSet READ isRoomNameSet NOTIFY roomNameChanged)
|
||||||
Q_PROPERTY(
|
Q_PROPERTY(
|
||||||
QStringList allowedRooms READ allowedRooms WRITE setAllowedRooms NOTIFY allowedRoomsChanged)
|
QStringList allowedRooms READ allowedRooms WRITE setAllowedRooms NOTIFY allowedRoomsChanged)
|
||||||
Q_PROPERTY(RoomSettingsAllowedRoomsModel *allowedRoomsModel MEMBER allowedRoomsModel CONSTANT)
|
Q_PROPERTY(RoomSettingsAllowedRoomsModel *allowedRoomsModel MEMBER allowedRoomsModel CONSTANT)
|
||||||
|
@ -128,6 +129,7 @@ public:
|
||||||
QString roomAvatarUrl();
|
QString roomAvatarUrl();
|
||||||
int memberCount() const;
|
int memberCount() const;
|
||||||
int notifications();
|
int notifications();
|
||||||
|
bool isRoomNameSet() const;
|
||||||
bool privateAccess() const;
|
bool privateAccess() const;
|
||||||
bool guestAccess() const;
|
bool guestAccess() const;
|
||||||
bool knockingEnabled() const;
|
bool knockingEnabled() const;
|
||||||
|
|
Loading…
Reference in a new issue