diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-03-08 02:10:06 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-03-08 02:10:06 +0300 |
commit | 6b3b81988ea37207eeeb2994761e307c6b6fb340 (patch) | |
tree | 7882a30bfb0e7a855e671af9a10d574c89bfd26f /src | |
parent | 5d190c3ae47aef32c1f1fe48f36dd27cec721cf3 (diff) | |
download | plus-6b3b81988ea37207eeeb2994761e307c6b6fb340.tar.gz plus-6b3b81988ea37207eeeb2994761e307c6b6fb340.tar.bz2 plus-6b3b81988ea37207eeeb2994761e307c6b6fb340.tar.xz plus-6b3b81988ea37207eeeb2994761e307c6b6fb340.zip |
Dont allow select/delete character if any pincode modes active.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/charselectdialog.cpp | 15 | ||||
-rw-r--r-- | src/pincodemanager.cpp | 5 | ||||
-rw-r--r-- | src/pincodemanager.h | 2 |
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; |