-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,87 +1,87 @@ | |||
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 |