summary refs log tree commit diff
path: root/src/DeviceVerificationFlow.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-03-13 21:05:18 +0100
committerCH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com>2020-07-30 22:10:27 +0530
commit2088053d26fc124058fafb434d41b7c9516f0da0 (patch)
tree8b7831e522a839f5c7674d87d3e4fec6b9518a03 /src/DeviceVerificationFlow.cpp
parentFirst design iteration of device verification dialogs (diff)
downloadnheko-2088053d26fc124058fafb434d41b7c9516f0da0.tar.xz
Add DeviceVerificationFlow dummy and verification test button
Diffstat (limited to 'src/DeviceVerificationFlow.cpp')
-rw-r--r--src/DeviceVerificationFlow.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/DeviceVerificationFlow.cpp b/src/DeviceVerificationFlow.cpp
new file mode 100644

index 00000000..69d6ab9c --- /dev/null +++ b/src/DeviceVerificationFlow.cpp
@@ -0,0 +1,36 @@ +#include "DeviceVerificationFlow.h" + +#include <QTimer> + +static constexpr int TIMEOUT = 2 * 60 * 1000; // 2 minutes + +DeviceVerificationFlow::DeviceVerificationFlow(QObject *) +{ + timeout = new QTimer(this); + timeout->setSingleShot(true); + connect(timeout, &QTimer::timeout, this, [this]() { + emit timedout(); + this->deleteLater(); + }); + timeout->start(TIMEOUT); +} + +//! accepts a verification and starts the verification flow +void +DeviceVerificationFlow::acceptVerificationRequest() +{ + emit verificationRequestAccepted(rand() % 2 ? Emoji : Decimal); +} +//! cancels a verification flow +void +DeviceVerificationFlow::cancelVerification() +{ + this->deleteLater(); +} +//! Completes the verification flow +void +DeviceVerificationFlow::acceptDevice() +{ + emit deviceVerified(); + this->deleteLater(); +}