summaryrefslogtreecommitdiff
path: root/src/pincodemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-03-08 01:35:19 +0300
committerAndrei Karas <akaras@inbox.ru>2018-03-08 01:35:19 +0300
commit676c5e978cbb312fbf4df8ec396c0f8b08944a96 (patch)
tree3336dda58d228fdada40453d80769e5186dab845 /src/pincodemanager.cpp
parent0d9e625499c18a4eaf79d38dfb1ef6abf0c553bd (diff)
downloadmv-676c5e978cbb312fbf4df8ec396c0f8b08944a96.tar.gz
mv-676c5e978cbb312fbf4df8ec396c0f8b08944a96.tar.bz2
mv-676c5e978cbb312fbf4df8ec396c0f8b08944a96.tar.xz
mv-676c5e978cbb312fbf4df8ec396c0f8b08944a96.zip
Add support for enter auth pincode.
Diffstat (limited to 'src/pincodemanager.cpp')
-rw-r--r--src/pincodemanager.cpp40
1 files changed, 35 insertions, 5 deletions
diff --git a/src/pincodemanager.cpp b/src/pincodemanager.cpp
index 4ee8abd3a..541726f9c 100644
--- a/src/pincodemanager.cpp
+++ b/src/pincodemanager.cpp
@@ -27,6 +27,7 @@
#include "listeners/newpincodelistener.h"
#include "listeners/newpincoderetrylistener.h"
+#include "listeners/pincodelistener.h"
#include "net/charserverhandler.h"
@@ -66,10 +67,17 @@ void PincodeManager::updateState()
{
switch (mState)
{
- case PincodeState::None:
case PincodeState::Ask:
- case PincodeState::Change:
- default:
+ CREATEWIDGETV(mDialog, PincodeDialog,
+ // TRANSLATORS: dialog caption
+ _("Pincode"),
+ // TRANSLATORS: dialog label
+ _("Enter pincode"),
+ mSeed,
+ nullptr);
+ mDialog->requestFocus();
+ mDialog->setActionEventId("ok");
+ mDialog->addActionListener(&pincodeListener);
break;
case PincodeState::Create:
CREATEWIDGETV(mDialog, PincodeDialog,
@@ -83,6 +91,10 @@ void PincodeManager::updateState()
mDialog->setActionEventId("ok");
mDialog->addActionListener(&newPincodeListener);
break;
+ case PincodeState::Change:
+ case PincodeState::None:
+ default:
+ break;
}
}
@@ -107,7 +119,7 @@ void PincodeManager::setNewPincode(const std::string &pincode)
if (mNewPincode != pincode)
{
mNewPincode.clear();
- OkDialog *const dialog = CREATEWIDGETR(OkDialog,
+ CREATEWIDGETV(mDialog, OkDialog,
// TRANSLATORS: error header
_("Pincode"),
// TRANSLATORS: error message
@@ -119,7 +131,7 @@ void PincodeManager::setNewPincode(const std::string &pincode)
ShowCenter_true,
nullptr,
260);
- dialog->addActionListener(&newPincodeRetryListener);
+ mDialog->addActionListener(&newPincodeRetryListener);
}
else
{
@@ -130,10 +142,28 @@ void PincodeManager::setNewPincode(const std::string &pincode)
}
}
+void PincodeManager::sendPincode(const std::string &pincode)
+{
+ charServerHandler->sendCheckPincode(mAccountId,
+ pincode);
+}
+
void PincodeManager::pinOk()
{
+ mState = PincodeState::None;
}
void PincodeManager::wrongPin()
{
+ mState = PincodeState::Ask;
+ updateState();
+}
+
+void PincodeManager::closeDialogs()
+{
+ if (mDialog)
+ {
+ mDialog->scheduleDelete();
+ mDialog = nullptr;
+ }
}