1 /*
2  * Copyright (C) 2018 Rafael Ostertag
3  *
4  * This file is part of YAPET.
5  *
6  * YAPET is free software: you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation, either version 3 of the License, or (at your option) any later
9  * version.
10  *
11  * YAPET is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * YAPET.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Additional permission under GNU GPL version 3 section 7
20  *
21  * If you modify this program, or any covered work, by linking or combining it
22  * with the OpenSSL project's OpenSSL library (or a modified version of that
23  * library), containing parts covered by the terms of the OpenSSL or SSLeay
24  * licenses, Rafael Ostertag grants you additional permission to convey the
25  * resulting work.  Corresponding Source for a non-source form of such a
26  * combination shall include the source code for the parts of OpenSSL used as
27  * well as that of the covered work.
28  */
29 
30 #ifndef _YAPETUNLOCKDIALOG_H
31 #define _YAPETUNLOCKDIALOG_H 1
32 
33 #ifdef HAVE_CONFIG_H
34 #include "config.h"
35 #endif
36 
37 #include <yacurs.h>
38 #include "mainwindow.h"
39 
40 class YapetUnlockDialog : public YACURS::UnlockDialog {
41    private:
42     const MainWindow& _mainWindow;
43 
44     YACURS::VPack* _vpack;
45     YACURS::DynLabel* _text1;
46     YACURS::DynLabel* _text2;
47     YACURS::DynLabel* _text3;
48     YACURS::Input<>* _secret_input;
49     YACURS::Button* _quit;
50     YACURS::Spacer* _quit_spacer;
51 
52    protected:
53     void window_show_handler(YACURS::Event& _e);
54 
55     // From dialog
56     void button_press_handler(YACURS::Event& _e);
57 
58    public:
59     YapetUnlockDialog(const YACURS::Window& mainWindow);
60     ~YapetUnlockDialog();
61 
62     YapetUnlockDialog(const YapetUnlockDialog&) = delete;
63     YapetUnlockDialog& operator=(const YapetUnlockDialog&) = delete;
64     YapetUnlockDialog(YapetUnlockDialog&&) = delete;
65     YapetUnlockDialog& operator=(YapetUnlockDialog&&) = delete;
66 
67     bool unlock();
68 
69     void clear();
70 };
71 
72 #endif  // _YAPETUNLOCKDIALOG_H
73