Diffstat (limited to 'core/applets/suspendapplet/suspend.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/suspendapplet/suspend.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/core/applets/suspendapplet/suspend.cpp b/core/applets/suspendapplet/suspend.cpp new file mode 100644 index 0000000..5966a84 --- a/dev/null +++ b/core/applets/suspendapplet/suspend.cpp @@ -0,0 +1,74 @@ +#include <qpe/resource.h> +#include <qpe/qcopenvelope_qws.h> + +#include <qiconset.h> +#include <qpopupmenu.h> + +#include "suspend.h" + + +SuspendApplet::SuspendApplet ( ) + : QObject ( 0, "SuspendApplet" ), ref ( 0 ) +{ +} + +SuspendApplet::~SuspendApplet ( ) +{ +} + +int SuspendApplet::position ( ) const +{ + return 0; +} + +QString SuspendApplet::name ( ) const +{ + return tr( "Suspend shortcut" ); +} + +QString SuspendApplet::text ( ) const +{ + return tr( "Suspend" ); +} + +QIconSet SuspendApplet::icon ( ) const +{ + QPixmap pix; + QImage img = Resource::loadImage ( "Shutdown" ); + + if ( !img. isNull ( )) + pix. convertFromImage ( img. smoothScale ( 16, 16 )); + return pix; +} + +QPopupMenu *SuspendApplet::popup ( QWidget * ) const +{ + return 0; +} + +void SuspendApplet::activated ( ) +{ + // suspend + QCopEnvelope ( "QPE/Desktop", "suspend()" ); +} + + +QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +{ + *iface = 0; + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_MenuApplet ) + *iface = this; + + if ( *iface ) + (*iface)-> addRef ( ); + return QS_OK; +} + +Q_EXPORT_INTERFACE( ) +{ + Q_CREATE_INSTANCE( SuspendApplet ) +} + + |