00001 #include "lock.h" 00002 00003 /* OPIE */ 00004 #include <opie2/multiauthpassword.h> 00005 #include <opie2/oresource.h> 00006 00007 #include <qpe/applnk.h> 00008 00009 /* QT */ 00010 #include <qiconset.h> 00011 #include <qpopupmenu.h> 00012 #include <qmessagebox.h> 00013 00014 00015 LockMenuApplet::LockMenuApplet() 00016 :QObject( 0, "LockMenuApplet" ) 00017 { 00018 } 00019 00020 LockMenuApplet::~LockMenuApplet ( ) 00021 {} 00022 00023 int LockMenuApplet::position() const 00024 { 00025 return 3; 00026 } 00027 00028 QString LockMenuApplet::name() const 00029 { 00030 return tr( "Lock shortcut" ); 00031 } 00032 00033 QString LockMenuApplet::text() const 00034 { 00035 return tr( "Lock" ); 00036 } 00037 00038 00039 QIconSet LockMenuApplet::icon() const 00040 { 00041 QPixmap pix = Opie::Core::OResource::loadPixmap( "security/lock", Opie::Core::OResource::SmallIcon ); 00042 return pix; 00043 } 00044 00045 QPopupMenu* LockMenuApplet::popup(QWidget*) const 00046 { 00047 /* no subdir */ 00048 return 0; 00049 } 00050 00051 void LockMenuApplet::activated() 00052 { 00053 /* 00054 QMessageBox::information(0,tr("No white rabbit found"), 00055 tr("<qt>No white rabbit was seen near Opie." 00056 "Only the beautiful OpieZilla is available" 00057 "for your pleassure</qt>")); 00058 */ 00059 Opie::Security::MultiauthPassword::authenticate(Opie::Security::LockNow); 00060 } 00061 00062 00063 QRESULT LockMenuApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 00064 { 00065 *iface = 0; 00066 if ( uuid == IID_QUnknown ) 00067 *iface = this; 00068 else if ( uuid == IID_MenuApplet ) 00069 *iface = this; 00070 else 00071 return QS_FALSE; 00072 00073 if ( *iface ) 00074 (*iface)->addRef(); 00075 return QS_OK; 00076 } 00077 00078 Q_EXPORT_INTERFACE() 00079 { 00080 Q_CREATE_INSTANCE( LockMenuApplet ) 00081 }
1.4.2