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 @@ | |||
1 | #include <qpe/resource.h> | ||
2 | #include <qpe/qcopenvelope_qws.h> | ||
3 | |||
4 | #include <qiconset.h> | ||
5 | #include <qpopupmenu.h> | ||
6 | |||
7 | #include "suspend.h" | ||
8 | |||
9 | |||
10 | SuspendApplet::SuspendApplet ( ) | ||
11 | : QObject ( 0, "SuspendApplet" ), ref ( 0 ) | ||
12 | { | ||
13 | } | ||
14 | |||
15 | SuspendApplet::~SuspendApplet ( ) | ||
16 | { | ||
17 | } | ||
18 | |||
19 | int SuspendApplet::position ( ) const | ||
20 | { | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | QString SuspendApplet::name ( ) const | ||
25 | { | ||
26 | return tr( "Suspend shortcut" ); | ||
27 | } | ||
28 | |||
29 | QString SuspendApplet::text ( ) const | ||
30 | { | ||
31 | return tr( "Suspend" ); | ||
32 | } | ||
33 | |||
34 | QIconSet SuspendApplet::icon ( ) const | ||
35 | { | ||
36 | QPixmap pix; | ||
37 | QImage img = Resource::loadImage ( "Shutdown" ); | ||
38 | |||
39 | if ( !img. isNull ( )) | ||
40 | pix. convertFromImage ( img. smoothScale ( 16, 16 )); | ||
41 | return pix; | ||
42 | } | ||
43 | |||
44 | QPopupMenu *SuspendApplet::popup ( QWidget * ) const | ||
45 | { | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | void SuspendApplet::activated ( ) | ||
50 | { | ||
51 | // suspend | ||
52 | QCopEnvelope ( "QPE/Desktop", "suspend()" ); | ||
53 | } | ||
54 | |||
55 | |||
56 | QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
57 | { | ||
58 | *iface = 0; | ||
59 | if ( uuid == IID_QUnknown ) | ||
60 | *iface = this; | ||
61 | else if ( uuid == IID_MenuApplet ) | ||
62 | *iface = this; | ||
63 | |||
64 | if ( *iface ) | ||
65 | (*iface)-> addRef ( ); | ||
66 | return QS_OK; | ||
67 | } | ||
68 | |||
69 | Q_EXPORT_INTERFACE( ) | ||
70 | { | ||
71 | Q_CREATE_INSTANCE( SuspendApplet ) | ||
72 | } | ||
73 | |||
74 | |||