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