summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/windows/charselectdialog.cpp15
-rw-r--r--src/pincodemanager.cpp5
-rw-r--r--src/pincodemanager.h2
3 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 817ecd908..d48a1a162 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -24,6 +24,7 @@
#include "client.h"
#include "configuration.h"
+#include "pincodemanager.h"
#include "listeners/charrenamelistener.h"
@@ -195,9 +196,12 @@ void CharSelectDialog::action(const ActionEvent &event)
selected = mCharacterView->getSelected();
const std::string &eventId = event.getId();
+ const bool blocked = pincodeManager.isBlocked();
if (selected >= 0)
{
+ if (blocked)
+ return;
if (eventId == "use")
{
use(selected);
@@ -273,14 +277,20 @@ void CharSelectDialog::action(const ActionEvent &event)
}
else if (eventId == "change_password")
{
+ if (blocked)
+ return;
client->setState(State::CHANGEPASSWORD);
}
else if (eventId == "change_email")
{
+ if (blocked)
+ return;
client->setState(State::CHANGEEMAIL);
}
else if (eventId == "try delete character")
{
+ if (blocked)
+ return;
if ((mDeleteDialog != nullptr) && mDeleteIndex != -1)
{
if (serverFeatures->haveEmailOnDelete())
@@ -331,6 +341,7 @@ void CharSelectDialog::use(const int selected)
void CharSelectDialog::keyPressed(KeyEvent &event)
{
const InputActionT actionId = event.getActionId();
+ const bool blocked = pincodeManager.isBlocked();
PRAGMA45(GCC diagnostic push)
PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
switch (actionId)
@@ -403,6 +414,8 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
case InputAction::GUI_DELETE:
{
+ if (blocked)
+ return;
event.consume();
const int idx = mCharacterView->getSelected();
if (idx >= 0 && (mCharacterEntries[idx] != nullptr)
@@ -415,6 +428,8 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
case InputAction::GUI_SELECT:
{
+ if (blocked)
+ return;
event.consume();
use(mCharacterView->getSelected());
break;
diff --git a/src/pincodemanager.cpp b/src/pincodemanager.cpp
index 6b254ba52..d8f2cea5a 100644
--- a/src/pincodemanager.cpp
+++ b/src/pincodemanager.cpp
@@ -171,3 +171,8 @@ void PincodeManager::closeDialogs()
mDialog = nullptr;
}
}
+
+bool PincodeManager::isBlocked()
+{
+ return mState != PincodeState::None;
+}
diff --git a/src/pincodemanager.h b/src/pincodemanager.h
index b05e09af8..671333e59 100644
--- a/src/pincodemanager.h
+++ b/src/pincodemanager.h
@@ -66,6 +66,8 @@ class PincodeManager final
void closeDialogs();
+ bool isBlocked();
+
protected:
std::string mNewPincode;
uint32_t mSeed;