Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

multiauthpassword.cpp

Go to the documentation of this file.
00001 
00006 /*
00007                =.            This file is part of the Opie Project
00008              .=l.            Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
00009            .>+-=
00010  _;:,     .>    :=|.         This library is free software; you can
00011 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00012 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00013 .="- .-=="i,     .._         License as published by the Free Software
00014  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00015      ._= =}       :          or (at your option) any later version.
00016     .%`+i>       _;_.
00017     .i_,=:_.      -<s.       This library is distributed in the hope that
00018      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00019     : ..    .:,     . . .    without even the implied warranty of
00020     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00021   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00022 ..}^=.=       =       ;      Library General Public License for more
00023 ++=   -.     .`     .:       details.
00024  :     =  ...= . :.=-
00025  -.   .:....=;==+<;          You should have received a copy of the GNU
00026   -_. . .   )=.  =           Library General Public License along with
00027     --        :-=`           this library; see the file COPYING.LIB.
00028                              If not, write to the Free Software Foundation,
00029                              Inc., 59 Temple Place - Suite 330,
00030                              Boston, MA 02111-1307, USA.
00031 
00032 */
00033 
00034 
00035 /* OPIE */
00036 #include <opie2/multiauthcommon.h>
00037 #include <opie2/multiauthmainwindow.h>
00038 #include <qpe/config.h>
00039 #include <qpe/qlibrary.h>
00040 #include <qpe/qcom.h>
00041 
00042 /* QT */
00043 #include <qapplication.h>
00044 #include <qvbox.h>
00045 #include <qpushbutton.h>
00046 #include <qlabel.h>
00047 #include <qdir.h>
00048 
00049 #include "multiauthpassword.h"
00050 
00051 namespace Opie {
00052 namespace Security {
00053 
00054 
00062 bool MultiauthPassword::needToAuthenticate(bool at_poweron)
00063 {
00064     Config cfg("Security");
00065     cfg.setGroup("Misc");
00066     if ( !at_poweron && cfg.readBoolEntry("onStart", false) )
00067         return true;
00068     else if ( at_poweron && cfg.readBoolEntry("onResume", false) )
00069         return true;
00070     else
00071         return false;
00072 }
00073 
00074 
00075 
00086 void MultiauthPassword::authenticate(int lockMode)
00087 {
00097     if ( (lockMode == IfPowerOn) || (lockMode == IfResume) )
00098     {
00099         Config cfg("Security");
00100         cfg.setGroup("Misc");
00101         if ( (
00102               (lockMode == IfPowerOn) && !cfg.readBoolEntry("onStart", false)
00103             ) || (
00104               (lockMode == IfResume) && !cfg.readBoolEntry("onResume", false)
00105             ) )
00106             return;
00107     }
00108 
00116     bool allowByPass = false;
00117 
00118     if (lockMode == TestNow)
00119         allowByPass = true;
00120 
00121     /* Constructs the main window, which displays messages and blocks
00122      * access to the desktop
00123      */
00124     MultiauthMainWindow win(allowByPass);
00125 
00126     // resize the QDialog object so it fills all the screen
00127     QRect desk = qApp->desktop()->geometry();
00128     win.setGeometry( 0, 0, desk.width(), desk.height() );
00129 
00130     // the authentication has already succeeded (without win interactions)
00131     if ( win.isAlreadyDone() )
00132         return;
00133 
00134     win.exec();
00135 }
00136 
00137 }
00138 }

Generated on Sat Nov 5 16:16:23 2005 for OPIE by  doxygen 1.4.2