From c09e45b02053c61b4e195c9d79a573ebfed2c521 Mon Sep 17 00:00:00 2001 From: clem Date: Tue, 05 Oct 2004 23:38:06 +0000 Subject: Changed the way to test authentication: instead of having a hardcoded config option, allowByPass, we now have a "Test now" button in the configuration interface. We add to change both the config app and the libopie2security files for that, since the MultiauthMainWindow constructor has to know whether to implement a debug mode (with an new argument, false by default). We also had to give MultiauthGeneralConfig a link to MultiauthConfig, since the test button triggers the writing of the whole configuration. Some cleaning too (m_ on *all* member attributes, removal of obsolete allowByPass / explanScreens checking code. --- (limited to 'libopie2/opiesecurity/multiauthmainwindow.cpp') 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 @@ -6,8 +6,11 @@ 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) @@ -17,11 +20,15 @@ MultiauthMainWindow::MultiauthMainWindow() 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); @@ -53,7 +60,7 @@ MultiauthMainWindow::MultiauthMainWindow() 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("
" + tr("Note: the 'exit' button should be removed for real protection, through Security config dialog") + ".
", this); + message2 = new QLabel("
" + tr("Note: this 'exit' button only appears during simulations, like the one we are in.") + "
", this); layout->addWidget(message2); QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); } @@ -114,10 +121,12 @@ void MultiauthMainWindow::proceed() { else { // authentication has failed, explain that according to allowBypass - message->setText( "

" + tr("You have not succeeded enough authentication steps!") + "

" ); + message->setText( "

" + tr("You have not succeeded enough authentication steps!") + "

" ); proceedButton->show(); if ( allowBypass == true ) - message2->setText( "

" + tr("Note: if 'allow to bypass' was uncheck in Security config, you would have to go back through all the steps now.") + "

" ); + { + message2->setText( "

" + tr("Be careful: if this was not a simulation, you would have to go back through all the steps now.") + "

" ); + message2->show(); } } } -- cgit v0.9.0.2