summaryrefslogtreecommitdiff
path: root/core/applets/suspendapplet/suspend.cpp
authormickeyl <mickeyl>2003-03-16 19:07:50 (UTC)
committer mickeyl <mickeyl>2003-03-16 19:07:50 (UTC)
commitae6b3de789726af3928664ef03eac81950e716e4 (patch) (unidiff)
tree687455725b5dafcfc7851563bf8203c25060e102 /core/applets/suspendapplet/suspend.cpp
parent917fb7d2dca76f5c2c5c86553be0fcc2832c3435 (diff)
downloadopie-ae6b3de789726af3928664ef03eac81950e716e4.zip
opie-ae6b3de789726af3928664ef03eac81950e716e4.tar.gz
opie-ae6b3de789726af3928664ef03eac81950e716e4.tar.bz2
Enable translations of startmenu-applets. Problem is, in Qt2, moc generates
the necessary tr() functions which adds the context (aka class name) and then calls translate(). The startmenu applets don't use moc and therefore don't get the appropriate tr() functions.
Diffstat (limited to 'core/applets/suspendapplet/suspend.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/suspendapplet/suspend.cpp11
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,57 +1,68 @@
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
10SuspendApplet::SuspendApplet ( ) 11SuspendApplet::SuspendApplet ( )
11 : QObject ( 0, "SuspendApplet" ), ref ( 0 ) 12 : QObject ( 0, "SuspendApplet" ), ref ( 0 )
12{ 13{
13} 14}
14 15
15SuspendApplet::~SuspendApplet ( ) 16SuspendApplet::~SuspendApplet ( )
16{ 17{
17} 18}
18 19
19int SuspendApplet::position ( ) const 20int SuspendApplet::position ( ) const
20{ 21{
21 return 2; 22 return 2;
22} 23}
23 24
24QString SuspendApplet::name ( ) const 25QString SuspendApplet::name ( ) const
25{ 26{
26 return tr( "Suspend shortcut" ); 27 return tr( "Suspend shortcut" );
27} 28}
28 29
29QString SuspendApplet::text ( ) const 30QString SuspendApplet::text ( ) const
30{ 31{
31 return tr( "Suspend" ); 32 return tr( "Suspend" );
32} 33}
33 34
35QString SuspendApplet::tr( const char* s ) const
36{
37 return qApp->translate( "SuspendApplet", s, 0 );
38}
39
40QString SuspendApplet::tr( const char* s, const char* p ) const
41{
42 return qApp->translate( "SuspendApplet", s, p );
43}
44
34QIconSet SuspendApplet::icon ( ) const 45QIconSet 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
44QPopupMenu *SuspendApplet::popup ( QWidget * ) const 55QPopupMenu *SuspendApplet::popup ( QWidget * ) const
45{ 56{
46 return 0; 57 return 0;
47} 58}
48 59
49void SuspendApplet::activated ( ) 60void SuspendApplet::activated ( )
50{ 61{
51 // suspend 62 // suspend
52 QCopEnvelope ( "QPE/System", "suspend()" ); 63 QCopEnvelope ( "QPE/System", "suspend()" );
53} 64}
54 65
55 66
56QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 67QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
57{ 68{