author | clem <clem> | 2004-10-08 22:50:28 (UTC) |
---|---|---|
committer | clem <clem> | 2004-10-08 22:50:28 (UTC) |
commit | 2f29d0ec4bb2355f193d744c890add203bd6f2b2 (patch) (unidiff) | |
tree | a703b00b673b9be036415393b53d9c95a5bb87cd /core/applets/lockapplet | |
parent | dec031cc21181d70e0c806bcf6c228044f7df90b (diff) | |
download | opie-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)
-rw-r--r-- | core/applets/lockapplet/.cvsignore | 4 | ||||
-rw-r--r-- | core/applets/lockapplet/config.in | 4 | ||||
-rw-r--r-- | core/applets/lockapplet/lock.cpp | 84 | ||||
-rw-r--r-- | core/applets/lockapplet/lock.h | 36 | ||||
-rw-r--r-- | core/applets/lockapplet/lockapplet.pro | 12 | ||||
-rw-r--r-- | core/applets/lockapplet/opie-lockapplet.control | 11 |
6 files changed, 151 insertions, 0 deletions
diff --git a/core/applets/lockapplet/.cvsignore b/core/applets/lockapplet/.cvsignore new file mode 100644 index 0000000..5e2908c --- a/dev/null +++ b/core/applets/lockapplet/.cvsignore | |||
@@ -0,0 +1,4 @@ | |||
1 | Makefile* | ||
2 | .moc | ||
3 | .obj | ||
4 | |||
diff --git a/core/applets/lockapplet/config.in b/core/applets/lockapplet/config.in new file mode 100644 index 0000000..ddc3522 --- a/dev/null +++ b/core/applets/lockapplet/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config LOCKAPPLET | ||
2 | boolean "opie-lockapplet (button in the Opie menu to lock the PDA)" | ||
3 | default "y" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && SECURITY | ||
diff --git a/core/applets/lockapplet/lock.cpp b/core/applets/lockapplet/lock.cpp new file mode 100644 index 0000000..89f27bb --- a/dev/null +++ b/core/applets/lockapplet/lock.cpp | |||
@@ -0,0 +1,84 @@ | |||
1 | #include "lock.h" | ||
2 | |||
3 | /* OPIE */ | ||
4 | #include <opie2/multiauthpassword.h> | ||
5 | |||
6 | #include <qpe/applnk.h> | ||
7 | #include <qpe/resource.h> | ||
8 | |||
9 | /* QT */ | ||
10 | #include <qiconset.h> | ||
11 | #include <qpopupmenu.h> | ||
12 | #include <qmessagebox.h> | ||
13 | |||
14 | |||
15 | LockMenuApplet::LockMenuApplet() | ||
16 | :QObject( 0, "LockMenuApplet" ) | ||
17 | { | ||
18 | } | ||
19 | |||
20 | LockMenuApplet::~LockMenuApplet ( ) | ||
21 | {} | ||
22 | |||
23 | int LockMenuApplet::position() const | ||
24 | { | ||
25 | return 3; | ||
26 | } | ||
27 | |||
28 | QString LockMenuApplet::name() const | ||
29 | { | ||
30 | return tr( "Lock shortcut" ); | ||
31 | } | ||
32 | |||
33 | QString LockMenuApplet::text() const | ||
34 | { | ||
35 | return tr( "Lock" ); | ||
36 | } | ||
37 | |||
38 | |||
39 | QIconSet LockMenuApplet::icon() const | ||
40 | { | ||
41 | QPixmap pix; | ||
42 | QImage img = Resource::loadImage( "security/lock" ); | ||
43 | if ( !img.isNull() ) | ||
44 | pix.convertFromImage( img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
45 | return pix; | ||
46 | } | ||
47 | |||
48 | QPopupMenu* LockMenuApplet::popup(QWidget*) const | ||
49 | { | ||
50 | /* no subdir */ | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | void LockMenuApplet::activated() | ||
55 | { | ||
56 | /* | ||
57 | QMessageBox::information(0,tr("No white rabbit found"), | ||
58 | tr("<qt>No white rabbit was seen near Opie." | ||
59 | "Only the beautiful OpieZilla is available" | ||
60 | "for your pleassure</qt>")); | ||
61 | */ | ||
62 | Opie::Security::MultiauthPassword::authenticate(Opie::Security::LockNow); | ||
63 | } | ||
64 | |||
65 | |||
66 | QRESULT LockMenuApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
67 | { | ||
68 | *iface = 0; | ||
69 | if ( uuid == IID_QUnknown ) | ||
70 | *iface = this; | ||
71 | else if ( uuid == IID_MenuApplet ) | ||
72 | *iface = this; | ||
73 | else | ||
74 | return QS_FALSE; | ||
75 | |||
76 | if ( *iface ) | ||
77 | (*iface)->addRef(); | ||
78 | return QS_OK; | ||
79 | } | ||
80 | |||
81 | Q_EXPORT_INTERFACE() | ||
82 | { | ||
83 | Q_CREATE_INSTANCE( LockMenuApplet ) | ||
84 | } | ||
diff --git a/core/applets/lockapplet/lock.h b/core/applets/lockapplet/lock.h new file mode 100644 index 0000000..ff94bce --- a/dev/null +++ b/core/applets/lockapplet/lock.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /** | ||
2 | * \file lock.h | ||
3 | * \brief defines a lock button that goes in the 'O' Opie menu | ||
4 | * It's based on the examples/menuapplet code of 2004/10/06. | ||
5 | */ | ||
6 | #ifndef CORE_SETTINGS_SECURITY_LOCKAPPLET_LOCK_H | ||
7 | #define CORE_SETTINGS_SECURITY_LOCKAPPLET_LOCK_H | ||
8 | |||
9 | #include <qpe/menuappletinterface.h> | ||
10 | #include <qobject.h> | ||
11 | |||
12 | class LockMenuApplet: public QObject, public MenuAppletInterface | ||
13 | { | ||
14 | |||
15 | Q_OBJECT | ||
16 | |||
17 | public: | ||
18 | LockMenuApplet ( ); | ||
19 | virtual ~LockMenuApplet ( ); | ||
20 | |||
21 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
22 | Q_REFCOUNT | ||
23 | |||
24 | virtual int position() const; | ||
25 | |||
26 | virtual QString name ( ) const; | ||
27 | virtual QIconSet icon ( ) const; | ||
28 | virtual QString text ( ) const; | ||
29 | /* virtual QString tr( const char* ) const; | ||
30 | virtual QString tr( const char*, const char* ) const; | ||
31 | */ | ||
32 | virtual QPopupMenu *popup ( QWidget *parent ) const; | ||
33 | virtual void activated ( ); | ||
34 | }; | ||
35 | |||
36 | #endif | ||
diff --git a/core/applets/lockapplet/lockapplet.pro b/core/applets/lockapplet/lockapplet.pro new file mode 100644 index 0000000..e0ee780 --- a/dev/null +++ b/core/applets/lockapplet/lockapplet.pro | |||
@@ -0,0 +1,12 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt plugn warn_on | ||
3 | HEADERS = lock.h | ||
4 | SOURCES = lock.cpp | ||
5 | TARGET = lockapplet | ||
6 | DESTDIR = $(OPIEDIR)/plugins/applets | ||
7 | INCLUDEPATH += $(OPIEDIR)/include | ||
8 | DEPENDPATH += $(OPIEDIR)/include | ||
9 | LIBS += -lqpe | ||
10 | VERSION = 1.0.0 | ||
11 | |||
12 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/core/applets/lockapplet/opie-lockapplet.control b/core/applets/lockapplet/opie-lockapplet.control new file mode 100644 index 0000000..e175a3e --- a/dev/null +++ b/core/applets/lockapplet/opie-lockapplet.control | |||
@@ -0,0 +1,11 @@ | |||
1 | Package: opie-lockapplet | ||
2 | Files: plugins/applets/liblockapplet.so* | ||
3 | Priority: optional | ||
4 | Section: opie/applets | ||
5 | Maintainer: Opie Team <opie@handhelds.org> | ||
6 | Architecture: arm | ||
7 | Depends: task-opie-minimal, opie-security | ||
8 | Description: Lock Opie now | ||
9 | Button to lock Opie (as configured in the Security | ||
10 | settings) on demand. | ||
11 | Version: $QPE_VERSION$EXTRAVERSION | ||