author | zecke <zecke> | 2004-07-17 20:03:12 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-17 20:03:12 (UTC) |
commit | d68baedc489a7ab4ab1419144608d28d5336a884 (patch) (unidiff) | |
tree | 487ee1528b6696a7bd1954eeae0d6b600cd57e9f /libopie2/opiesecurity | |
parent | 658ea4b6442d26b4ef0cbde5e9f98433b01dff57 (diff) | |
download | opie-d68baedc489a7ab4ab1419144608d28d5336a884.zip opie-d68baedc489a7ab4ab1419144608d28d5336a884.tar.gz opie-d68baedc489a7ab4ab1419144608d28d5336a884.tar.bz2 |
Add Clements reworked and OMAF capable Security Settings application
This adds configuration of OMAF
For now it disables quicklaunch which will be changed
Also a demo application is added
-rw-r--r-- | libopie2/opiesecurity/multiauthmainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiesecurity/multiauthmainwindow.cpp b/libopie2/opiesecurity/multiauthmainwindow.cpp index c6229c7..fa247ab 100644 --- a/libopie2/opiesecurity/multiauthmainwindow.cpp +++ b/libopie2/opiesecurity/multiauthmainwindow.cpp | |||
@@ -1,135 +1,135 @@ | |||
1 | #include "multiauthmainwindow.h" | 1 | #include "multiauthmainwindow.h" |
2 | 2 | ||
3 | #include "multiauthcommon.h" | 3 | #include "multiauthcommon.h" |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | 5 | ||
6 | namespace Opie { | 6 | namespace Opie { |
7 | namespace Security { | 7 | namespace Security { |
8 | 8 | ||
9 | /// Initializes widgets according to allowBypass and explanScreens config | 9 | /// Initializes widgets according to allowBypass and explanScreens config |
10 | MultiauthMainWindow::MultiauthMainWindow() | 10 | MultiauthMainWindow::MultiauthMainWindow() |
11 | : QDialog(0, "main Opie multiauth modal dialog", TRUE, | 11 | : QDialog(0, "main Opie multiauth modal dialog", TRUE, |
12 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) | 12 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) |
13 | 13 | ||
14 | { | 14 | { |
15 | alreadyDone = false; | 15 | alreadyDone = false; |
16 | // initializes widget pointers which not always point to an object | 16 | // initializes widget pointers which not always point to an object |
17 | quit = 0; | 17 | quit = 0; |
18 | message2 = 0; | 18 | message2 = 0; |
19 | 19 | ||
20 | Config *pcfg = new Config("Security"); | 20 | Config *pcfg = new Config("Security"); |
21 | pcfg->setGroup("Misc"); | 21 | pcfg->setGroup("Misc"); |
22 | explanScreens = pcfg->readBoolEntry("explanScreens", true); | 22 | explanScreens = pcfg->readBoolEntry("explanScreens", true); |
23 | allowBypass = pcfg->readBoolEntry("allowBypass", true); | 23 | allowBypass = pcfg->readBoolEntry("allowBypass", false); |
24 | delete pcfg; | 24 | delete pcfg; |
25 | 25 | ||
26 | layout = new QVBoxLayout(this); | 26 | layout = new QVBoxLayout(this); |
27 | layout->setSpacing(11); | 27 | layout->setSpacing(11); |
28 | layout->setMargin(11); | 28 | layout->setMargin(11); |
29 | layout->setAlignment( Qt::AlignTop ); | 29 | layout->setAlignment( Qt::AlignTop ); |
30 | 30 | ||
31 | // if explanScreens is false, we don't show any text in the QDialog, | 31 | // if explanScreens is false, we don't show any text in the QDialog, |
32 | // and we proceed directly | 32 | // and we proceed directly |
33 | if ( explanScreens == true ) | 33 | if ( explanScreens == true ) |
34 | { | 34 | { |
35 | title = new QLabel("<center><h1>" + tr("Welcome to Opie Multi-authentication Framework") + "</h1></center>", this); | 35 | title = new QLabel("<center><h1>" + tr("Welcome to Opie Multi-authentication Framework") + "</h1></center>", this); |
36 | message = new QLabel("<center><h3>" + tr("Launching authentication plugins...") + "</h3></center>", this); | 36 | message = new QLabel("<center><h3>" + tr("Launching authentication plugins...") + "</h3></center>", this); |
37 | } else { | 37 | } else { |
38 | title = new QLabel("", this); | 38 | title = new QLabel("", this); |
39 | message = new QLabel("", this); | 39 | message = new QLabel("", this); |
40 | } | 40 | } |
41 | 41 | ||
42 | layout->addWidget(title); | 42 | layout->addWidget(title); |
43 | layout->addWidget(message); | 43 | layout->addWidget(message); |
44 | proceedButton = new QPushButton(tr("Proceed..."), this); | 44 | proceedButton = new QPushButton(tr("Proceed..."), this); |
45 | layout->addWidget(proceedButton, 0, Qt::AlignHCenter); | 45 | layout->addWidget(proceedButton, 0, Qt::AlignHCenter); |
46 | 46 | ||
47 | QObject::connect(proceedButton, SIGNAL(clicked()), this, SLOT(proceed())); | 47 | QObject::connect(proceedButton, SIGNAL(clicked()), this, SLOT(proceed())); |
48 | 48 | ||
49 | if ( explanScreens == true ) | 49 | if ( explanScreens == true ) |
50 | { | 50 | { |
51 | quit = new QPushButton("Exit", this); | 51 | quit = new QPushButton("Exit", this); |
52 | layout->addWidget(quit, 0, Qt::AlignHCenter); | 52 | layout->addWidget(quit, 0, Qt::AlignHCenter); |
53 | if ( allowBypass == true ) | 53 | if ( allowBypass == true ) |
54 | { | 54 | { |
55 | // very important: we can close the widget through the quit button, and bypass authentication, only if allowBypass is set! | 55 | // very important: we can close the widget through the quit button, and bypass authentication, only if allowBypass is set! |
56 | message2 = new QLabel("<center><i>" + tr("Note: the 'exit' button should be removed for real protection, through Security config dialog") + ".</i></center>", this); | 56 | message2 = new QLabel("<center><i>" + tr("Note: the 'exit' button should be removed for real protection, through Security config dialog") + ".</i></center>", this); |
57 | layout->addWidget(message2); | 57 | layout->addWidget(message2); |
58 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); | 58 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); |
59 | } | 59 | } |
60 | else | 60 | else |
61 | { | 61 | { |
62 | quit->hide(); | 62 | quit->hide(); |
63 | } | 63 | } |
64 | 64 | ||
65 | } | 65 | } |
66 | else | 66 | else |
67 | { | 67 | { |
68 | // we will need this button only if runPlugins() fails in proceed() | 68 | // we will need this button only if runPlugins() fails in proceed() |
69 | proceedButton->hide(); | 69 | proceedButton->hide(); |
70 | // let's proceed now | 70 | // let's proceed now |
71 | proceed(); | 71 | proceed(); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | /// nothing to do | 75 | /// nothing to do |
76 | MultiauthMainWindow::~MultiauthMainWindow() { | 76 | MultiauthMainWindow::~MultiauthMainWindow() { |
77 | } | 77 | } |
78 | 78 | ||
79 | /// launch the authentication | 79 | /// launch the authentication |
80 | void MultiauthMainWindow::proceed() { | 80 | void MultiauthMainWindow::proceed() { |
81 | int result = Internal::runPlugins(); | 81 | int result = Internal::runPlugins(); |
82 | 82 | ||
83 | 83 | ||
84 | if ( (result == 0) && !explanScreens ) | 84 | if ( (result == 0) && !explanScreens ) |
85 | { | 85 | { |
86 | // the authentication has succeeded, we can exit directly | 86 | // the authentication has succeeded, we can exit directly |
87 | // this will work if we haven't been called by the constructor of MultiauthMainWindow | 87 | // this will work if we haven't been called by the constructor of MultiauthMainWindow |
88 | close(); | 88 | close(); |
89 | // and if we've been called by this constructor, we use this variable to tell our | 89 | // and if we've been called by this constructor, we use this variable to tell our |
90 | // caller we're already done | 90 | // caller we're already done |
91 | alreadyDone = true; | 91 | alreadyDone = true; |
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | else | 94 | else |
95 | { | 95 | { |
96 | 96 | ||
97 | proceedButton->setText("Another try?"); | 97 | proceedButton->setText("Another try?"); |
98 | QString resultMessage; | 98 | QString resultMessage; |
99 | 99 | ||
100 | if (result == 0) | 100 | if (result == 0) |
101 | { | 101 | { |
102 | // authentication has succeeded, adapt interface then | 102 | // authentication has succeeded, adapt interface then |
103 | message->setText( "<center><h3>" + tr("Congratulations! Your authentication has been successful.") + "</h3></center>" ); | 103 | message->setText( "<center><h3>" + tr("Congratulations! Your authentication has been successful.") + "</h3></center>" ); |
104 | quit->setText("Enter Opie"); | 104 | quit->setText("Enter Opie"); |
105 | if ( quit->isHidden() ) | 105 | if ( quit->isHidden() ) |
106 | { | 106 | { |
107 | // that means we don't allow to bypass, but now we can show and connect this button | 107 | // that means we don't allow to bypass, but now we can show and connect this button |
108 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); | 108 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); |
109 | quit->show(); | 109 | quit->show(); |
110 | } else { | 110 | } else { |
111 | if ( message2 != 0 ) message2->hide(); | 111 | if ( message2 != 0 ) message2->hide(); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | else | 114 | else |
115 | { | 115 | { |
116 | // authentication has failed, explain that according to allowBypass | 116 | // authentication has failed, explain that according to allowBypass |
117 | message->setText( "<center><h3>" + tr("You have not succeeded enough authentication steps!") + "</h3></center>" ); | 117 | message->setText( "<center><h3>" + tr("You have not succeeded enough authentication steps!") + "</h3></center>" ); |
118 | proceedButton->show(); | 118 | proceedButton->show(); |
119 | if ( allowBypass == true ) | 119 | if ( allowBypass == true ) |
120 | message2->setText( "<center><p>" + tr("Note: if 'allow to bypass' was uncheck in Security config, you would have to go back through all the steps now.") + "</p></center>" ); | 120 | message2->setText( "<center><p>" + tr("Note: if 'allow to bypass' was uncheck in Security config, you would have to go back through all the steps now.") + "</p></center>" ); |
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | /** When we don't show explanatory screens and we succeed authentication, | 125 | /** When we don't show explanatory screens and we succeed authentication, |
126 | * as early as during the proceed() call of the constructor, the caller must know | 126 | * as early as during the proceed() call of the constructor, the caller must know |
127 | * (through this function) authentication has already been succeeded.. | 127 | * (through this function) authentication has already been succeeded.. |
128 | * \todo try to avoid this hack? | 128 | * \todo try to avoid this hack? |
129 | */ | 129 | */ |
130 | bool MultiauthMainWindow::isAlreadyDone() { | 130 | bool MultiauthMainWindow::isAlreadyDone() { |
131 | return alreadyDone; | 131 | return alreadyDone; |
132 | } | 132 | } |
133 | 133 | ||
134 | } | 134 | } |
135 | } | 135 | } |