mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Show verification status in memberlist
This commit is contained in:
parent
18ea01e198
commit
9bad584931
8 changed files with 59 additions and 16 deletions
|
@ -13,6 +13,7 @@ ApplicationWindow {
|
||||||
id: roomMembersRoot
|
id: roomMembersRoot
|
||||||
|
|
||||||
property MemberList members
|
property MemberList members
|
||||||
|
property Room room
|
||||||
|
|
||||||
title: qsTr("Members of %1").arg(members.roomName)
|
title: qsTr("Members of %1").arg(members.roomName)
|
||||||
height: 650
|
height: 650
|
||||||
|
@ -83,9 +84,14 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: RowLayout {
|
delegate: RowLayout {
|
||||||
|
id: del
|
||||||
|
|
||||||
|
width: ListView.view.width
|
||||||
spacing: Nheko.paddingMedium
|
spacing: Nheko.paddingMedium
|
||||||
|
|
||||||
Avatar {
|
Avatar {
|
||||||
|
id: avatar
|
||||||
|
|
||||||
width: Nheko.avatarSize
|
width: Nheko.avatarSize
|
||||||
height: Nheko.avatarSize
|
height: Nheko.avatarSize
|
||||||
userid: model.mxid
|
userid: model.mxid
|
||||||
|
@ -97,16 +103,18 @@ ApplicationWindow {
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: Nheko.paddingSmall
|
spacing: Nheko.paddingSmall
|
||||||
|
|
||||||
Label {
|
ElidedLabel {
|
||||||
text: model.displayName
|
fullText: model.displayName
|
||||||
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
|
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
|
||||||
font.pointSize: fontMetrics.font.pointSize
|
font.pixelSize: fontMetrics.font.pixelSize
|
||||||
|
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
ElidedLabel {
|
||||||
text: model.mxid
|
fullText: model.mxid
|
||||||
color: Nheko.colors.buttonText
|
color: Nheko.colors.buttonText
|
||||||
font.pointSize: fontMetrics.font.pointSize * 0.9
|
font.pixelSize: Math.ceil(fontMetrics.font.pixelSize * 0.9)
|
||||||
|
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -116,6 +124,28 @@ ApplicationWindow {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EncryptionIndicator {
|
||||||
|
id: encryptInd
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
visible: room.isEncrypted
|
||||||
|
encrypted: room.isEncrypted
|
||||||
|
trust: encrypted ? model.trustlevel : Crypto.Unverified
|
||||||
|
ToolTip.text: {
|
||||||
|
if (!encrypted)
|
||||||
|
return qsTr("This room is not encrypted!");
|
||||||
|
|
||||||
|
switch (trust) {
|
||||||
|
case Crypto.Verified:
|
||||||
|
return qsTr("This user is verified.");
|
||||||
|
case Crypto.TOFU:
|
||||||
|
return qsTr("This user isn't verified, but is still using the same master key from the first time you met.");
|
||||||
|
default:
|
||||||
|
return qsTr("This user has unverified devices!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: Item {
|
footer: Item {
|
||||||
|
|
|
@ -153,10 +153,10 @@ Page {
|
||||||
packSet.show();
|
packSet.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOpenRoomMembersDialog(members) {
|
function onOpenRoomMembersDialog(members, room) {
|
||||||
var membersDialog = roomMembersComponent.createObject(timelineRoot, {
|
var membersDialog = roomMembersComponent.createObject(timelineRoot, {
|
||||||
"members": members,
|
"members": members,
|
||||||
"roomName": Rooms.currentRoom.roomName
|
"room": room
|
||||||
});
|
});
|
||||||
membersDialog.show();
|
membersDialog.show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ Rectangle {
|
||||||
|
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
text: qsTr("Members")
|
text: qsTr("Members")
|
||||||
onTriggered: TimelineManager.openRoomMembers(room.roomId)
|
onTriggered: TimelineManager.openRoomMembers(room)
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
|
|
|
@ -3584,8 +3584,6 @@ Cache::roomMembers(const std::string &room_id)
|
||||||
crypto::Trust
|
crypto::Trust
|
||||||
Cache::roomVerificationStatus(const std::string &room_id)
|
Cache::roomVerificationStatus(const std::string &room_id)
|
||||||
{
|
{
|
||||||
std::string_view keys;
|
|
||||||
|
|
||||||
crypto::Trust trust = crypto::Verified;
|
crypto::Trust trust = crypto::Verified;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -53,6 +53,7 @@ MemberList::roleNames() const
|
||||||
{Mxid, "mxid"},
|
{Mxid, "mxid"},
|
||||||
{DisplayName, "displayName"},
|
{DisplayName, "displayName"},
|
||||||
{AvatarUrl, "avatarUrl"},
|
{AvatarUrl, "avatarUrl"},
|
||||||
|
{Trustlevel, "trustlevel"},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +70,17 @@ MemberList::data(const QModelIndex &index, int role) const
|
||||||
return m_memberList[index.row()].first.display_name;
|
return m_memberList[index.row()].first.display_name;
|
||||||
case AvatarUrl:
|
case AvatarUrl:
|
||||||
return m_memberList[index.row()].second;
|
return m_memberList[index.row()].second;
|
||||||
|
case Trustlevel: {
|
||||||
|
auto stat =
|
||||||
|
cache::verificationStatus(m_memberList[index.row()].first.user_id.toStdString());
|
||||||
|
|
||||||
|
if (!stat)
|
||||||
|
return crypto::Unverified;
|
||||||
|
if (stat->unverified_device_count)
|
||||||
|
return crypto::Unverified;
|
||||||
|
else
|
||||||
|
return stat->user_verified;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
Mxid,
|
Mxid,
|
||||||
DisplayName,
|
DisplayName,
|
||||||
AvatarUrl,
|
AvatarUrl,
|
||||||
|
Trustlevel,
|
||||||
};
|
};
|
||||||
MemberList(const QString &room_id, QObject *parent = nullptr);
|
MemberList(const QString &room_id, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -375,10 +375,12 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineViewManager::openRoomMembers(QString room_id)
|
TimelineViewManager::openRoomMembers(TimelineModel *room)
|
||||||
{
|
{
|
||||||
MemberList *memberList = new MemberList(room_id, this);
|
if (!room)
|
||||||
emit openRoomMembersDialog(memberList);
|
return;
|
||||||
|
MemberList *memberList = new MemberList(room->roomId(), this);
|
||||||
|
emit openRoomMembersDialog(memberList, room);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -66,7 +66,7 @@ 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 openRoomMembers(QString room_id);
|
Q_INVOKABLE void openRoomMembers(TimelineModel *room);
|
||||||
Q_INVOKABLE void openRoomSettings(QString room_id);
|
Q_INVOKABLE void openRoomSettings(QString room_id);
|
||||||
Q_INVOKABLE void openInviteUsers(QString roomId);
|
Q_INVOKABLE void openInviteUsers(QString roomId);
|
||||||
Q_INVOKABLE void openGlobalUserProfile(QString userId);
|
Q_INVOKABLE void openGlobalUserProfile(QString userId);
|
||||||
|
@ -92,7 +92,7 @@ signals:
|
||||||
void focusChanged();
|
void focusChanged();
|
||||||
void focusInput();
|
void focusInput();
|
||||||
void openImageOverlayInternalCb(QString eventId, QImage img);
|
void openImageOverlayInternalCb(QString eventId, QImage img);
|
||||||
void openRoomMembersDialog(MemberList *members);
|
void openRoomMembersDialog(MemberList *members, TimelineModel *room);
|
||||||
void openRoomSettingsDialog(RoomSettings *settings);
|
void openRoomSettingsDialog(RoomSettings *settings);
|
||||||
void openInviteUsersDialog(InviteesModel *invitees);
|
void openInviteUsersDialog(InviteesModel *invitees);
|
||||||
void openProfile(UserProfile *profile);
|
void openProfile(UserProfile *profile);
|
||||||
|
|
Loading…
Reference in a new issue