summaryrefslogtreecommitdiff
path: root/core/applets/lockapplet/lock.cpp
Unidiff
Diffstat (limited to 'core/applets/lockapplet/lock.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/applets/lockapplet/lock.cpp84
1 files changed, 84 insertions, 0 deletions
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
15LockMenuApplet::LockMenuApplet()
16 :QObject( 0, "LockMenuApplet" )
17{
18}
19
20LockMenuApplet::~LockMenuApplet ( )
21{}
22
23int LockMenuApplet::position() const
24{
25 return 3;
26}
27
28QString LockMenuApplet::name() const
29{
30 return tr( "Lock shortcut" );
31}
32
33QString LockMenuApplet::text() const
34{
35 return tr( "Lock" );
36}
37
38
39QIconSet 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
48QPopupMenu* LockMenuApplet::popup(QWidget*) const
49{
50 /* no subdir */
51 return 0;
52}
53
54void 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
66QRESULT 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
81Q_EXPORT_INTERFACE()
82{
83 Q_CREATE_INSTANCE( LockMenuApplet )
84}