Add basic cross-signing support

(cherry picked from commit e1795076c8c41a34b91c31df35d1e344d0b14887)
This commit is contained in:
Tobias Fella
2024-05-06 21:12:54 +02:00
parent 3d433762b1
commit fd8725f649
5 changed files with 48 additions and 6 deletions

View File

@@ -417,3 +417,12 @@ bool Controller::ssssSupported() const
return false; return false;
#endif #endif
} }
bool Controller::csSupported() const
{
#if Quotient_VERSION_MINOR > 9
return true;
#else
return false;
#endif
}

View File

@@ -51,6 +51,7 @@ class Controller : public QObject
Q_PROPERTY(QStringList accountsLoading MEMBER m_accountsLoading NOTIFY accountsLoadingChanged) Q_PROPERTY(QStringList accountsLoading MEMBER m_accountsLoading NOTIFY accountsLoadingChanged)
Q_PROPERTY(bool ssssSupported READ ssssSupported CONSTANT) Q_PROPERTY(bool ssssSupported READ ssssSupported CONSTANT)
Q_PROPERTY(bool csSupported READ csSupported CONSTANT)
public: public:
static Controller &instance(); static Controller &instance();
@@ -97,6 +98,7 @@ public:
Q_INVOKABLE void removeConnection(const QString &userId); Q_INVOKABLE void removeConnection(const QString &userId);
bool ssssSupported() const; bool ssssSupported() const;
bool csSupported() const;
private: private:
explicit Controller(QObject *parent = nullptr); explicit Controller(QObject *parent = nullptr);

View File

@@ -72,6 +72,12 @@ QQC2.Menu {
}) })
enabled: Controller.ssssSupported enabled: Controller.ssssSupported
} }
QQC2.MenuItem {
text: i18nc("@action:inmenu", "Verify this Device")
icon.name: "security-low"
onTriggered: root.connection.startSelfVerification()
enabled: Controller.csSupported
}
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Logout") text: i18n("Logout")
icon.name: "list-remove-user" icon.name: "list-remove-user"

View File

@@ -59,12 +59,27 @@ ColumnLayout {
} }
} }
Kirigami.Heading { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
type: Kirigami.Heading.Type.Primary Layout.alignment: Qt.AlignHCenter
wrapMode: QQC2.Label.Wrap Kirigami.Icon {
text: root.room.displayName id: securityIcon
textFormat: Text.PlainText //TODO figure out how to make this update
horizontalAlignment: Text.AlignHCenter source: room.connection.isUserVerified(root.room.directChatRemoteMember.id) ?
(room.connection.allSessionsSelfVerified(root.room.directChatRemoteMember.id) ? "security-high" : "security-medium")
: "security-low"
}
Kirigami.Heading {
type: Kirigami.Heading.Type.Primary
wrapMode: QQC2.Label.Wrap
text: root.room.displayName
textFormat: Text.PlainText
horizontalAlignment: Text.AlignHCenter
}
Item {
Layout.preferredWidth: visible ? securityIcon.width : 0
visible: securityIcon.visible
}
} }
} }

View File

@@ -89,6 +89,16 @@ QQC2.ScrollView {
} }
} }
Delegates.RoundedItemDelegate {
visible: root.room.isDirectChat() && Controller.csSupported
icon.name: "security-low-symbolic"
text: i18nc("@action:button", "Verify user")
onClicked: root.room.startVerification()
Layout.fillWidth: true
}
Delegates.RoundedItemDelegate { Delegates.RoundedItemDelegate {
id: favouriteButton id: favouriteButton
visible: !root.room.isSpace visible: !root.room.isSpace