author | mickeyl <mickeyl> | 2003-03-16 19:07:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-16 19:07:50 (UTC) |
commit | ae6b3de789726af3928664ef03eac81950e716e4 (patch) (unidiff) | |
tree | 687455725b5dafcfc7851563bf8203c25060e102 /core/applets/suspendapplet | |
parent | 917fb7d2dca76f5c2c5c86553be0fcc2832c3435 (diff) | |
download | opie-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.
-rw-r--r-- | core/applets/suspendapplet/suspend.cpp | 11 | ||||
-rw-r--r-- | core/applets/suspendapplet/suspend.h | 2 |
2 files changed, 13 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 | ||
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 | { |
diff --git a/core/applets/suspendapplet/suspend.h b/core/applets/suspendapplet/suspend.h index 629430d..0c92bcb 100644 --- a/core/applets/suspendapplet/suspend.h +++ b/core/applets/suspendapplet/suspend.h | |||
@@ -15,33 +15,35 @@ | |||
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef __OPIE_SUSPEND_APPLET_H__ | 20 | #ifndef __OPIE_SUSPEND_APPLET_H__ |
21 | #define __OPIE_SUSPEND_APPLET_H__ | 21 | #define __OPIE_SUSPEND_APPLET_H__ |
22 | 22 | ||
23 | #include <qpe/menuappletinterface.h> | 23 | #include <qpe/menuappletinterface.h> |
24 | 24 | ||
25 | class SuspendApplet : public QObject, public MenuAppletInterface | 25 | class SuspendApplet : public QObject, public MenuAppletInterface |
26 | { | 26 | { |
27 | public: | 27 | public: |
28 | SuspendApplet ( ); | 28 | SuspendApplet ( ); |
29 | virtual ~SuspendApplet ( ); | 29 | virtual ~SuspendApplet ( ); |
30 | 30 | ||
31 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | 31 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); |
32 | Q_REFCOUNT | 32 | Q_REFCOUNT |
33 | 33 | ||
34 | virtual int position() const; | 34 | virtual int position() const; |
35 | 35 | ||
36 | virtual QString name ( ) const; | 36 | virtual QString name ( ) const; |
37 | virtual QIconSet icon ( ) const; | 37 | virtual QIconSet icon ( ) const; |
38 | virtual QString text ( ) const; | 38 | virtual QString text ( ) const; |
39 | virtual QString tr( const char* ) const; | ||
40 | virtual QString tr( const char*, const char* ) const; | ||
39 | virtual QPopupMenu *popup ( QWidget *parent ) const; | 41 | virtual QPopupMenu *popup ( QWidget *parent ) const; |
40 | 42 | ||
41 | virtual void activated ( ); | 43 | virtual void activated ( ); |
42 | 44 | ||
43 | private: | 45 | private: |
44 | ulong ref; | 46 | ulong ref; |
45 | }; | 47 | }; |
46 | 48 | ||
47 | #endif | 49 | #endif |