1 // 2 // This file is part of libyacurs. 3 // Copyright (C) 2013 Rafael Ostertag 4 // 5 // This program is free software: you can redistribute it and/or 6 // modify it under the terms of the GNU General Public License as 7 // published by the Free Software Foundation, either version 3 of the 8 // License, or (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, but 11 // WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 // General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with this program. If not, see 17 // <http://www.gnu.org/licenses/>. 18 // 19 // 20 // $Id$ 21 22 #ifdef HAVE_CONFIG_H 23 #include "config.h" 24 #endif 25 26 #include "gettext.h" 27 28 #include <cassert> 29 30 #include "unlockdiadefault.h" 31 32 using namespace YACURS; 33 34 // 35 // Private 36 // 37 38 // 39 // Protected 40 // UnlockDialogDefault(const std::string & secret)41UnlockDialogDefault::UnlockDialogDefault(const std::string& secret) 42 : UnlockDialog(_("Unlock Screen")), 43 _secret(secret), 44 _vpack(), 45 _text(_("Please enter password in order to unlock screen")), 46 _secret_input() { 47 _vpack.always_dynamic(true); 48 _text.color(DIALOG); 49 _secret_input.obscure_input(true); 50 51 _vpack.add_back(&_text); 52 _vpack.add_back(&_secret_input); 53 widget(&_vpack); 54 } 55 ~UnlockDialogDefault()56UnlockDialogDefault::~UnlockDialogDefault() {} 57 unlock()58bool UnlockDialogDefault::unlock() { 59 if (dialog_state() == DIALOG_OK && _secret_input.input() == _secret) 60 return true; 61 62 return false; 63 } 64 clear()65void UnlockDialogDefault::clear() { _secret_input.clear(); } 66 67 // 68 // Public 69 // 70