Suggest verifying your own device in Devices settings
This button is currently hidden under the user menu, but it should be shown more prominently - especially under the Devices settings. The button under the user menu and this new one is now hidden when your device is already verified.
This commit is contained in:
@@ -88,9 +88,10 @@ KirigamiComponents.ConvergentContextMenu {
|
||||
})
|
||||
}
|
||||
|
||||
QQC2.Action {
|
||||
Kirigami.Action {
|
||||
text: i18nc("@action:inmenu", "Verify This Device")
|
||||
icon.name: "security-low"
|
||||
visible: !root.connection.isVerifiedSession()
|
||||
onTriggered: {
|
||||
root.connection.startSelfVerification();
|
||||
const dialog = Qt.createComponent("org.kde.kirigami", "PromptDialog").createObject(QQC2.Overlay.overlay, {
|
||||
|
||||
@@ -558,4 +558,9 @@ bool NeoChatConnection::enablePushNotifications() const
|
||||
return m_pushNotificationsEnabled;
|
||||
}
|
||||
|
||||
bool NeoChatConnection::isVerifiedSession() const
|
||||
{
|
||||
return isVerifiedDevice(userId(), deviceId());
|
||||
}
|
||||
|
||||
#include "moc_neochatconnection.cpp"
|
||||
|
||||
@@ -206,6 +206,11 @@ public:
|
||||
|
||||
LinkPreviewer *previewerForLink(const QUrl &link);
|
||||
|
||||
/**
|
||||
* @return True if this connection is a verified session.
|
||||
*/
|
||||
Q_INVOKABLE bool isVerifiedSession() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void globalUrlPreviewEnabledChanged();
|
||||
void labelChanged();
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.kde.neochat
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
default property alias delegates: devicesCard.delegates
|
||||
required property string title
|
||||
required property var type
|
||||
required property bool showVerifyButton
|
||||
|
||||
@@ -33,6 +33,25 @@ FormCard.FormCardPage {
|
||||
title: i18nc("@info:group", "This Device")
|
||||
type: DevicesModel.This
|
||||
showVerifyButton: false
|
||||
|
||||
FormCard.FormButtonDelegate {
|
||||
icon.name: "security-low"
|
||||
text: i18nc("@action:button", "Verify This Device")
|
||||
description: i18nc("@info:description", "This device is marked as insecure until it's verified by another device. It's recommended to verify as soon as possible.")
|
||||
visible: !root.connection.isVerifiedSession()
|
||||
onClicked: {
|
||||
root.connection.startSelfVerification();
|
||||
const dialog = Qt.createComponent("org.kde.kirigami", "PromptDialog").createObject(QQC2.Overlay.overlay, {
|
||||
title: i18nc("@title", "Verification Request Sent"),
|
||||
subtitle: i18nc("@info:label", "To proceed, accept the verification request on another device."),
|
||||
standardButtons: Kirigami.Dialog.Ok
|
||||
})
|
||||
dialog.open();
|
||||
root.connection.onNewKeyVerificationSession.connect(() => {
|
||||
dialog.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
DevicesCard {
|
||||
title: i18nc("@info:group", "Verified Devices")
|
||||
|
||||
Reference in New Issue
Block a user