From 6b3b81988ea37207eeeb2994761e307c6b6fb340 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Mar 2018 02:10:06 +0300 Subject: Dont allow select/delete character if any pincode modes active. --- src/gui/windows/charselectdialog.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/gui') 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; -- cgit v1.2.3-70-g09d2