summaryrefslogtreecommitdiff
path: root/libopie2
authorclem <clem>2004-10-08 22:50:28 (UTC)
committer clem <clem>2004-10-08 22:50:28 (UTC)
commit2f29d0ec4bb2355f193d744c890add203bd6f2b2 (patch) (unidiff)
treea703b00b673b9be036415393b53d9c95a5bb87cd /libopie2
parentdec031cc21181d70e0c806bcf6c228044f7df90b (diff)
downloadopie-2f29d0ec4bb2355f193d744c890add203bd6f2b2.zip
opie-2f29d0ec4bb2355f193d744c890add203bd6f2b2.tar.gz
opie-2f29d0ec4bb2355f193d744c890add203bd6f2b2.tar.bz2
Big commit thanks to a little feature request :-) We now have an O-menu applet
to lock the PDA immediately, and the internal way to ask for an authentication (on resume, on start up, on demand or for a simple test) is much cleaner: it's through MultiauthPassword(int lockMode) (instead of the old bool at_poweron)
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiesecurity/multiauthpassword.cpp47
-rw-r--r--libopie2/opiesecurity/multiauthpassword.h10
2 files changed, 48 insertions, 9 deletions
diff --git a/libopie2/opiesecurity/multiauthpassword.cpp b/libopie2/opiesecurity/multiauthpassword.cpp
index 42341f7..8eda554 100644
--- a/libopie2/opiesecurity/multiauthpassword.cpp
+++ b/libopie2/opiesecurity/multiauthpassword.cpp
@@ -55,5 +55,7 @@ namespace Security {
55/** 55/**
56 * If the users requires authentication... #fixme 56 * Tells if the users requires authentication (used internally to
57 * know whether to repaint the screen on resume)
57 * 58 *
58 * @todo fix up at_poweron attribute 59 * \param at_poweron true if we are booting Opie, false if we are resuming it
60 * \return true if authenticate() launched right now would trigger an authentication
59 */ 61 */
@@ -72,4 +74,5 @@ bool MultiauthPassword::needToAuthenticate(bool at_poweron)
72 74
75
73/** 76/**
74 * \brief Require user authentication to unlock and continue 77 * \brief Require (if configured so) user authentication to unlock and continue
75 * 78 *
@@ -82,6 +85,36 @@ bool MultiauthPassword::needToAuthenticate(bool at_poweron)
82 */ 85 */
83void MultiauthPassword::authenticate(bool at_poweron) 86void MultiauthPassword::authenticate(int lockMode)
84{ 87{
85 if ( ! needToAuthenticate(at_poweron) ) 88 /**
86 return; 89 * \par Conditions
90 *
91 * If lockMode is an If, it's conditional:
92 * \li IfPowerOn will not trigger an authentication if
93 * onStart is set to false in Security.conf,
94 * \li IfResume will not trigger an authentication if
95 * onResume is set to false in Security.conf.
96 */
97 if ( (lockMode == IfPowerOn) || (lockMode == IfResume) )
98 {
99 Config cfg("Security");
100 cfg.setGroup("Misc");
101 if ( (
102 (lockMode == IfPowerOn) && cfg.readBoolEntry("onStart", false)
103 ) || (
104 (lockMode == IfResume) && cfg.readBoolEntry("onResume", false)
105 ) )
106 return;
107 }
108
109 /**
110 * \li TestNow will ensure that the authentication window will let
111 * people escape through the last screen (which they can reach skipping
112 * all the authentication steps)
113 * \li LockNow will always go on with the authentication, and won't let
114 * people escape.
115 */
116 bool allowByPass = false;
117
118 if (lockMode == TestNow)
119 allowByPass = true;
87 120
@@ -90,3 +123,3 @@ void MultiauthPassword::authenticate(bool at_poweron)
90 */ 123 */
91 MultiauthMainWindow win; 124 MultiauthMainWindow win(allowByPass);
92 125
diff --git a/libopie2/opiesecurity/multiauthpassword.h b/libopie2/opiesecurity/multiauthpassword.h
index fe276da..effdaa1 100644
--- a/libopie2/opiesecurity/multiauthpassword.h
+++ b/libopie2/opiesecurity/multiauthpassword.h
@@ -40,2 +40,7 @@ namespace Security {
40 40
41enum lockMode {
42 IfPowerOn,
43 IfResume,
44 TestNow,
45 LockNow };
41/** 46/**
@@ -50,5 +55,6 @@ namespace Security {
50class MultiauthPassword { 55class MultiauthPassword {
56
51public: 57public:
52 static bool needToAuthenticate( bool atpoweron = false ); 58 static void authenticate(int authMode = LockNow);
53 static void authenticate(bool atpoweron = false); 59 static bool needToAuthenticate( bool atpoweron = false );
54}; 60};