-
Notifications
You must be signed in to change notification settings - Fork 1
/
PluginUI.h
82 lines (67 loc) · 2.61 KB
/
PluginUI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* esteid-browser-plugin - a browser plugin for Estonian EID card
*
* Copyright (C) 2010 Estonian Informatics Centre
* Copyright (C) 2010 Smartlink OÜ
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef H_ESTEID_PLUGINUI
#define H_ESTEID_PLUGINUI
#include <string>
#include <boost/shared_ptr.hpp>
#include "PluginWindow.h"
#include "PluginSettings.h"
// Forward declaration
class EsteidAPI;
/** A base class for different UI implementations */
class PluginUI
{
public:
class UICallbacks {
public:
UICallbacks() {}
virtual void onPinEntered(const std::string& pin) = 0;
virtual void onPinCancelled() = 0;
};
/** Prompt for Signature PIN */
virtual void pinDialog(const std::string& subject,
const std::string& docUrl,
const std::string& docHash) = 0;
virtual void pinpadDialog(const std::string& subject,
const std::string& docUrl,
const std::string& docHash,
int pinPadTimeout) = 0;
/** Prompt for Signature PIN again */
virtual void retryPinDialog(int triesLeft) = 0;
virtual void retryPinpadDialog(int triesLeft) = 0;
/** Close Signature PIN dialog */
virtual void closePinDialog() = 0;
virtual void closePinpadDialog() = 0;
/** Inform user that the PIN has been blocked */
virtual void pinBlockedMessage(int pin) = 0;
/** Open Settings dialog */
virtual void settingsDialog(PluginSettings& conf,
const std::string& pageUrl = "") = 0;
/** Run a single iteration of the underlying platform's event loop */
virtual void iteration() = 0;
PluginUI(boost::shared_ptr<UICallbacks>);
virtual ~PluginUI();
virtual void setWindow(FB::PluginWindow*);
protected:
boost::shared_ptr<UICallbacks> m_callbacks;
FB::PluginWindow* m_window;
};
#endif // H_ESTEID_PLUGINUI