-rw-r--r-- | libopie2/opiesecurity/multiauthmainwindow.cpp | 29 | ||||
-rw-r--r-- | libopie2/opiesecurity/multiauthmainwindow.h | 2 |
2 files changed, 20 insertions, 11 deletions
diff --git a/libopie2/opiesecurity/multiauthmainwindow.cpp b/libopie2/opiesecurity/multiauthmainwindow.cpp index fa247ab..fb720bb 100644 --- a/libopie2/opiesecurity/multiauthmainwindow.cpp +++ b/libopie2/opiesecurity/multiauthmainwindow.cpp @@ -5,10 +5,13 @@ namespace Opie { namespace Security { -/// Initializes widgets according to allowBypass and explanScreens config -MultiauthMainWindow::MultiauthMainWindow() +/// Initializes widgets according to allowBypass argument (false by default) and explanScreens config +/** + * \note if allowBypass is true, we will show explanatory screens anyway + */ +MultiauthMainWindow::MultiauthMainWindow(bool allowBypass = false) : QDialog(0, "main Opie multiauth modal dialog", TRUE, Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) { @@ -16,13 +19,17 @@ MultiauthMainWindow::MultiauthMainWindow() // initializes widget pointers which not always point to an object quit = 0; message2 = 0; - Config *pcfg = new Config("Security"); - pcfg->setGroup("Misc"); - explanScreens = pcfg->readBoolEntry("explanScreens", true); - allowBypass = pcfg->readBoolEntry("allowBypass", false); - delete pcfg; + if (allowBypass == true) + explanScreens = true; + else + { + Config *pcfg = new Config("Security"); + pcfg->setGroup("Misc"); + explanScreens = pcfg->readBoolEntry("explanScreens", true); + delete pcfg; + } layout = new QVBoxLayout(this); layout->setSpacing(11); layout->setMargin(11); @@ -52,9 +59,9 @@ MultiauthMainWindow::MultiauthMainWindow() layout->addWidget(quit, 0, Qt::AlignHCenter); if ( allowBypass == true ) { // very important: we can close the widget through the quit button, and bypass authentication, only if allowBypass is set! - message2 = new QLabel("<center><i>" + tr("Note: the 'exit' button should be removed for real protection, through Security config dialog") + ".</i></center>", this); + 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); layout->addWidget(message2); QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); } else @@ -113,12 +120,14 @@ void MultiauthMainWindow::proceed() { } else { // authentication has failed, explain that according to allowBypass - message->setText( "<center><h3>" + tr("You have not succeeded enough authentication steps!") + "</h3></center>" ); + message->setText( "<center><h3>" + tr("You have <b>not</b> succeeded enough authentication steps!") + "</h3></center>" ); proceedButton->show(); if ( allowBypass == true ) - 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>" ); + { + 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>" ); + message2->show(); } } } diff --git a/libopie2/opiesecurity/multiauthmainwindow.h b/libopie2/opiesecurity/multiauthmainwindow.h index 626b8b3..9d2376b 100644 --- a/libopie2/opiesecurity/multiauthmainwindow.h +++ b/libopie2/opiesecurity/multiauthmainwindow.h @@ -54,9 +54,9 @@ namespace Security { class MultiauthMainWindow : public QDialog { Q_OBJECT public: - MultiauthMainWindow(); + MultiauthMainWindow(bool allowBypass = false); ~MultiauthMainWindow(); bool isAlreadyDone(); private: |