Diffstat (limited to 'core/applets/suspendapplet/suspend.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/suspendapplet/suspend.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/applets/suspendapplet/suspend.cpp b/core/applets/suspendapplet/suspend.cpp index b502e87..4bdc8fb 100644 --- a/core/applets/suspendapplet/suspend.cpp +++ b/core/applets/suspendapplet/suspend.cpp | |||
@@ -1,74 +1,85 @@ | |||
1 | #include <qpe/resource.h> | 1 | #include <qpe/resource.h> |
2 | #include <qpe/qcopenvelope_qws.h> | 2 | #include <qpe/qcopenvelope_qws.h> |
3 | 3 | ||
4 | #include <qapplication.h> | ||
4 | #include <qiconset.h> | 5 | #include <qiconset.h> |
5 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
6 | 7 | ||
7 | #include "suspend.h" | 8 | #include "suspend.h" |
8 | 9 | ||
9 | 10 | ||
10 | SuspendApplet::SuspendApplet ( ) | 11 | SuspendApplet::SuspendApplet ( ) |
11 | : QObject ( 0, "SuspendApplet" ), ref ( 0 ) | 12 | : QObject ( 0, "SuspendApplet" ), ref ( 0 ) |
12 | { | 13 | { |
13 | } | 14 | } |
14 | 15 | ||
15 | SuspendApplet::~SuspendApplet ( ) | 16 | SuspendApplet::~SuspendApplet ( ) |
16 | { | 17 | { |
17 | } | 18 | } |
18 | 19 | ||
19 | int SuspendApplet::position ( ) const | 20 | int SuspendApplet::position ( ) const |
20 | { | 21 | { |
21 | return 2; | 22 | return 2; |
22 | } | 23 | } |
23 | 24 | ||
24 | QString SuspendApplet::name ( ) const | 25 | QString SuspendApplet::name ( ) const |
25 | { | 26 | { |
26 | return tr( "Suspend shortcut" ); | 27 | return tr( "Suspend shortcut" ); |
27 | } | 28 | } |
28 | 29 | ||
29 | QString SuspendApplet::text ( ) const | 30 | QString SuspendApplet::text ( ) const |
30 | { | 31 | { |
31 | return tr( "Suspend" ); | 32 | return tr( "Suspend" ); |
32 | } | 33 | } |
33 | 34 | ||
35 | QString SuspendApplet::tr( const char* s ) const | ||
36 | { | ||
37 | return qApp->translate( "SuspendApplet", s, 0 ); | ||
38 | } | ||
39 | |||
40 | QString SuspendApplet::tr( const char* s, const char* p ) const | ||
41 | { | ||
42 | return qApp->translate( "SuspendApplet", s, p ); | ||
43 | } | ||
44 | |||
34 | QIconSet SuspendApplet::icon ( ) const | 45 | QIconSet SuspendApplet::icon ( ) const |
35 | { | 46 | { |
36 | QPixmap pix; | 47 | QPixmap pix; |
37 | QImage img = Resource::loadImage ( "suspend" ); | 48 | QImage img = Resource::loadImage ( "suspend" ); |
38 | 49 | ||
39 | if ( !img. isNull ( )) | 50 | if ( !img. isNull ( )) |
40 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); | 51 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); |
41 | return pix; | 52 | return pix; |
42 | } | 53 | } |
43 | 54 | ||
44 | QPopupMenu *SuspendApplet::popup ( QWidget * ) const | 55 | QPopupMenu *SuspendApplet::popup ( QWidget * ) const |
45 | { | 56 | { |
46 | return 0; | 57 | return 0; |
47 | } | 58 | } |
48 | 59 | ||
49 | void SuspendApplet::activated ( ) | 60 | void SuspendApplet::activated ( ) |
50 | { | 61 | { |
51 | // suspend | 62 | // suspend |
52 | QCopEnvelope ( "QPE/System", "suspend()" ); | 63 | QCopEnvelope ( "QPE/System", "suspend()" ); |
53 | } | 64 | } |
54 | 65 | ||
55 | 66 | ||
56 | QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 67 | QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
57 | { | 68 | { |
58 | *iface = 0; | 69 | *iface = 0; |
59 | if ( uuid == IID_QUnknown ) | 70 | if ( uuid == IID_QUnknown ) |
60 | *iface = this; | 71 | *iface = this; |
61 | else if ( uuid == IID_MenuApplet ) | 72 | else if ( uuid == IID_MenuApplet ) |
62 | *iface = this; | 73 | *iface = this; |
63 | 74 | ||
64 | if ( *iface ) | 75 | if ( *iface ) |
65 | (*iface)-> addRef ( ); | 76 | (*iface)-> addRef ( ); |
66 | return QS_OK; | 77 | return QS_OK; |
67 | } | 78 | } |
68 | 79 | ||
69 | Q_EXPORT_INTERFACE( ) | 80 | Q_EXPORT_INTERFACE( ) |
70 | { | 81 | { |
71 | Q_CREATE_INSTANCE( SuspendApplet ) | 82 | Q_CREATE_INSTANCE( SuspendApplet ) |
72 | } | 83 | } |
73 | 84 | ||
74 | 85 | ||