From fd232b1f4a6d55b566ee138b30cfcc272129fabb Mon Sep 17 00:00:00 2001 From: CH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com> Date: Thu, 25 Jun 2020 22:38:48 +0530 Subject: [PATCH] Some more fixes --- resources/qml/UserProfile.qml | 30 +++++++++++++++++------------- src/DeviceVerificationFlow.cpp | 12 ++++++++++-- src/DeviceVerificationFlow.h | 1 + 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml index a7ff8a35..e5d01625 100644 --- a/resources/qml/UserProfile.qml +++ b/resources/qml/UserProfile.qml @@ -13,7 +13,7 @@ ApplicationWindow{ id:userProfileDialog height: 500 - width: 400 + width: 420 modality:Qt.WindowModal Layout.alignment: Qt.AlignHCenter palette: colors @@ -42,9 +42,8 @@ ApplicationWindow{ id: userProfileItem width: userProfileDialog.width height: userProfileDialog.height - anchors.margins: { - top:20 - } + + Layout.fillHeight : true ColumnLayout{ anchors.fill: userProfileItem @@ -57,15 +56,18 @@ ApplicationWindow{ height: 130 width: 130 displayName: modelData.userName - userid: modelData.userId + userid: modelData.userId Layout.alignment: Qt.AlignHCenter + Layout.margins : { + top: 10 + } } Label{ id: userProfileName text: user_data.userName fontSizeMode: Text.HorizontalFit - font.pixelSize: 16 + font.pixelSize: 20 color:TimelineManager.userColor(modelData.userId, colors.window) font.bold: true Layout.alignment: Qt.AlignHCenter @@ -75,7 +77,7 @@ ApplicationWindow{ id: matrixUserID text: user_data.userId fontSizeMode: Text.HorizontalFit - font.pixelSize: 16 + font.pixelSize: 15 color:colors.text Layout.alignment: Qt.AlignHCenter } @@ -90,7 +92,7 @@ ApplicationWindow{ id: deviceList anchors.fill: parent clip: true - spacing: 10 + spacing: 4 model: UserProfileModel{ id: modelDeviceList @@ -98,6 +100,9 @@ ApplicationWindow{ delegate: RowLayout{ width: parent.width + Layout.margins : { + top : 50 + } ColumnLayout{ Text{ Layout.fillWidth: true @@ -124,6 +129,9 @@ ApplicationWindow{ {flow: newFlow}); dialog.show(); } + Layout.margins:{ + right: 10 + } palette { button: "white" } @@ -142,12 +150,8 @@ ApplicationWindow{ id: okbutton text:"OK" onClicked: userProfileDialog.close() - anchors { - right: parent.right - bottom: parent.bottom - } - anchors.margins : { + Layout.margins : { right : 10 bottom : 10 } diff --git a/src/DeviceVerificationFlow.cpp b/src/DeviceVerificationFlow.cpp index db76aeb1..9f120a00 100644 --- a/src/DeviceVerificationFlow.cpp +++ b/src/DeviceVerificationFlow.cpp @@ -164,7 +164,10 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *) // uncomment this in future to be compatible with the // MSC2366 this->sendVerificationDone(); and remoeve the // below line - emit this->deviceVerified(); + if (this->isMacVerified == true) + emit this->deviceVerified(); + else + this->isMacVerified = true; } else { this->cancelVerification(); } @@ -503,11 +506,16 @@ DeviceVerificationFlow::sendVerificationMac() http::client() ->send_to_device( - this->transaction_id, body, [](mtx::http::RequestErr err) { + this->transaction_id, body, [this](mtx::http::RequestErr err) { if (err) nhlog::net()->warn("failed to send verification MAC: {} {}", err->matrix_error.error, static_cast(err->status_code)); + + if (this->isMacVerified == true) + emit this->deviceVerified(); + else + this->isMacVerified = true; }); } //! Completes the verification flow diff --git a/src/DeviceVerificationFlow.h b/src/DeviceVerificationFlow.h index 81ab9c99..5830e705 100644 --- a/src/DeviceVerificationFlow.h +++ b/src/DeviceVerificationFlow.h @@ -78,6 +78,7 @@ private: QTimer *timeout = nullptr; sas_ptr sas; + bool isMacVerified; std::string mac_method; std::string transaction_id; std::string commitment;