author | clem <clem> | 2004-10-05 23:58:38 (UTC) |
---|---|---|
committer | clem <clem> | 2004-10-05 23:58:38 (UTC) |
commit | 637e5e26c5d30778234c03412f1bf44ed7b38a8e (patch) (unidiff) | |
tree | 7a5dc05ca871be0fa264765a7541830edb7ed5fc /libopie2 | |
parent | c09e45b02053c61b4e195c9d79a573ebfed2c521 (diff) | |
download | opie-637e5e26c5d30778234c03412f1bf44ed7b38a8e.zip opie-637e5e26c5d30778234c03412f1bf44ed7b38a8e.tar.gz opie-637e5e26c5d30778234c03412f1bf44ed7b38a8e.tar.bz2 |
at the beginning of the test mode, tell the user she can skip the steps she fails
-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 fb720bb..e60d245 100644 --- a/libopie2/opiesecurity/multiauthmainwindow.cpp +++ b/libopie2/opiesecurity/multiauthmainwindow.cpp | |||
@@ -1,144 +1,144 @@ | |||
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 argument (false by default) and explanScreens config | 9 | /// Initializes widgets according to allowBypass argument (false by default) and explanScreens config |
10 | /** | 10 | /** |
11 | * \note if allowBypass is true, we will show explanatory screens anyway | 11 | * \note if allowBypass is true, we will show explanatory screens anyway |
12 | */ | 12 | */ |
13 | MultiauthMainWindow::MultiauthMainWindow(bool allowBypass = false) | 13 | MultiauthMainWindow::MultiauthMainWindow(bool allowBypass = false) |
14 | : QDialog(0, "main Opie multiauth modal dialog", TRUE, | 14 | : QDialog(0, "main Opie multiauth modal dialog", TRUE, |
15 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) | 15 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) |
16 | 16 | ||
17 | { | 17 | { |
18 | alreadyDone = false; | 18 | alreadyDone = false; |
19 | // initializes widget pointers which not always point to an object | 19 | // initializes widget pointers which not always point to an object |
20 | quit = 0; | 20 | quit = 0; |
21 | message2 = 0; | 21 | message2 = 0; |
22 | 22 | ||
23 | if (allowBypass == true) | 23 | if (allowBypass == true) |
24 | explanScreens = true; | 24 | explanScreens = true; |
25 | else | 25 | else |
26 | { | 26 | { |
27 | Config *pcfg = new Config("Security"); | 27 | Config *pcfg = new Config("Security"); |
28 | pcfg->setGroup("Misc"); | 28 | pcfg->setGroup("Misc"); |
29 | explanScreens = pcfg->readBoolEntry("explanScreens", true); | 29 | explanScreens = pcfg->readBoolEntry("explanScreens", true); |
30 | delete pcfg; | 30 | delete pcfg; |
31 | } | 31 | } |
32 | 32 | ||
33 | layout = new QVBoxLayout(this); | 33 | layout = new QVBoxLayout(this); |
34 | layout->setSpacing(11); | 34 | layout->setSpacing(11); |
35 | layout->setMargin(11); | 35 | layout->setMargin(11); |
36 | layout->setAlignment( Qt::AlignTop ); | 36 | layout->setAlignment( Qt::AlignTop ); |
37 | 37 | ||
38 | // if explanScreens is false, we don't show any text in the QDialog, | 38 | // if explanScreens is false, we don't show any text in the QDialog, |
39 | // and we proceed directly | 39 | // and we proceed directly |
40 | if ( explanScreens == true ) | 40 | if ( explanScreens == true ) |
41 | { | 41 | { |
42 | title = new QLabel("<center><h1>" + tr("Welcome to Opie Multi-authentication Framework") + "</h1></center>", this); | 42 | title = new QLabel("<center><h1>" + tr("Welcome to Opie Multi-authentication Framework") + "</h1></center>", this); |
43 | message = new QLabel("<center><h3>" + tr("Launching authentication plugins...") + "</h3></center>", this); | 43 | message = new QLabel("<center><h3>" + tr("Launching authentication plugins...") + "</h3></center>", this); |
44 | } else { | 44 | } else { |
45 | title = new QLabel("", this); | 45 | title = new QLabel("", this); |
46 | message = new QLabel("", this); | 46 | message = new QLabel("", this); |
47 | } | 47 | } |
48 | 48 | ||
49 | layout->addWidget(title); | 49 | layout->addWidget(title); |
50 | layout->addWidget(message); | 50 | layout->addWidget(message); |
51 | proceedButton = new QPushButton(tr("Proceed..."), this); | 51 | proceedButton = new QPushButton(tr("Proceed..."), this); |
52 | layout->addWidget(proceedButton, 0, Qt::AlignHCenter); | 52 | layout->addWidget(proceedButton, 0, Qt::AlignHCenter); |
53 | 53 | ||
54 | QObject::connect(proceedButton, SIGNAL(clicked()), this, SLOT(proceed())); | 54 | QObject::connect(proceedButton, SIGNAL(clicked()), this, SLOT(proceed())); |
55 | 55 | ||
56 | if ( explanScreens == true ) | 56 | if ( explanScreens == true ) |
57 | { | 57 | { |
58 | quit = new QPushButton("Exit", this); | 58 | quit = new QPushButton("Exit", this); |
59 | layout->addWidget(quit, 0, Qt::AlignHCenter); | 59 | layout->addWidget(quit, 0, Qt::AlignHCenter); |
60 | if ( allowBypass == true ) | 60 | if ( allowBypass == true ) |
61 | { | 61 | { |
62 | // very important: we can close the widget through the quit button, and bypass authentication, only if allowBypass is set! | 62 | // very important: we can close the widget through the quit button, and bypass authentication, only if allowBypass is set! |
63 | message2 = new QLabel("<center><i>" + tr("Note: this 'exit' button only appears during <b>simulations</b>, like the one we are in.") + "</i></center>", this); | 63 | message2 = new QLabel("<center><i>" + tr("Note: this 'exit' button only appears during <b>simulations</b>, like the one we are in. If you don't succeed an authentication step at some point, it will keep on asking you to authenticate, but remember you can <b>skip</b> it too (and have access to this button again).") + "</i></center>", this); |
64 | layout->addWidget(message2); | 64 | layout->addWidget(message2); |
65 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); | 65 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); |
66 | } | 66 | } |
67 | else | 67 | else |
68 | { | 68 | { |
69 | quit->hide(); | 69 | quit->hide(); |
70 | } | 70 | } |
71 | 71 | ||
72 | } | 72 | } |
73 | else | 73 | else |
74 | { | 74 | { |
75 | // we will need this button only if runPlugins() fails in proceed() | 75 | // we will need this button only if runPlugins() fails in proceed() |
76 | proceedButton->hide(); | 76 | proceedButton->hide(); |
77 | // let's proceed now | 77 | // let's proceed now |
78 | proceed(); | 78 | proceed(); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | /// nothing to do | 82 | /// nothing to do |
83 | MultiauthMainWindow::~MultiauthMainWindow() { | 83 | MultiauthMainWindow::~MultiauthMainWindow() { |
84 | } | 84 | } |
85 | 85 | ||
86 | /// launch the authentication | 86 | /// launch the authentication |
87 | void MultiauthMainWindow::proceed() { | 87 | void MultiauthMainWindow::proceed() { |
88 | int result = Internal::runPlugins(); | 88 | int result = Internal::runPlugins(); |
89 | 89 | ||
90 | 90 | ||
91 | if ( (result == 0) && !explanScreens ) | 91 | if ( (result == 0) && !explanScreens ) |
92 | { | 92 | { |
93 | // the authentication has succeeded, we can exit directly | 93 | // the authentication has succeeded, we can exit directly |
94 | // this will work if we haven't been called by the constructor of MultiauthMainWindow | 94 | // this will work if we haven't been called by the constructor of MultiauthMainWindow |
95 | close(); | 95 | close(); |
96 | // and if we've been called by this constructor, we use this variable to tell our | 96 | // and if we've been called by this constructor, we use this variable to tell our |
97 | // caller we're already done | 97 | // caller we're already done |
98 | alreadyDone = true; | 98 | alreadyDone = true; |
99 | return; | 99 | return; |
100 | } | 100 | } |
101 | else | 101 | else |
102 | { | 102 | { |
103 | 103 | ||
104 | proceedButton->setText("Another try?"); | 104 | proceedButton->setText("Another try?"); |
105 | QString resultMessage; | 105 | QString resultMessage; |
106 | 106 | ||
107 | if (result == 0) | 107 | if (result == 0) |
108 | { | 108 | { |
109 | // authentication has succeeded, adapt interface then | 109 | // authentication has succeeded, adapt interface then |
110 | message->setText( "<center><h3>" + tr("Congratulations! Your authentication has been successful.") + "</h3></center>" ); | 110 | message->setText( "<center><h3>" + tr("Congratulations! Your authentication has been successful.") + "</h3></center>" ); |
111 | quit->setText("Enter Opie"); | 111 | quit->setText("Enter Opie"); |
112 | if ( quit->isHidden() ) | 112 | if ( quit->isHidden() ) |
113 | { | 113 | { |
114 | // that means we don't allow to bypass, but now we can show and connect this button | 114 | // that means we don't allow to bypass, but now we can show and connect this button |
115 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); | 115 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); |
116 | quit->show(); | 116 | quit->show(); |
117 | } else { | 117 | } else { |
118 | if ( message2 != 0 ) message2->hide(); | 118 | if ( message2 != 0 ) message2->hide(); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | else | 121 | else |
122 | { | 122 | { |
123 | // authentication has failed, explain that according to allowBypass | 123 | // authentication has failed, explain that according to allowBypass |
124 | message->setText( "<center><h3>" + tr("You have <b>not</b> succeeded enough authentication steps!") + "</h3></center>" ); | 124 | message->setText( "<center><h3>" + tr("You have <b>not</b> succeeded enough authentication steps!") + "</h3></center>" ); |
125 | proceedButton->show(); | 125 | proceedButton->show(); |
126 | if ( allowBypass == true ) | 126 | if ( allowBypass == true ) |
127 | { | 127 | { |
128 | message2->setText( "<center><p>" + tr("Be careful: if this was not a <b>simulation</b>, you would have to go back through all the steps now.") + "</p></center>" ); | 128 | message2->setText( "<center><p>" + tr("Be careful: if this was not a <b>simulation</b>, you would have to go back through all the steps now.") + "</p></center>" ); |
129 | message2->show(); | 129 | message2->show(); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | /** When we don't show explanatory screens and we succeed authentication, | 134 | /** When we don't show explanatory screens and we succeed authentication, |
135 | * as early as during the proceed() call of the constructor, the caller must know | 135 | * as early as during the proceed() call of the constructor, the caller must know |
136 | * (through this function) authentication has already been succeeded.. | 136 | * (through this function) authentication has already been succeeded.. |
137 | * \todo try to avoid this hack? | 137 | * \todo try to avoid this hack? |
138 | */ | 138 | */ |
139 | bool MultiauthMainWindow::isAlreadyDone() { | 139 | bool MultiauthMainWindow::isAlreadyDone() { |
140 | return alreadyDone; | 140 | return alreadyDone; |
141 | } | 141 | } |
142 | 142 | ||
143 | } | 143 | } |
144 | } | 144 | } |