-rw-r--r-- | core/applets/homeapplet/home.cpp | 11 | ||||
-rw-r--r-- | core/applets/homeapplet/home.h | 2 | ||||
-rw-r--r-- | core/applets/logoutapplet/logout.cpp | 29 | ||||
-rw-r--r-- | core/applets/logoutapplet/logout.h | 6 | ||||
-rw-r--r-- | core/applets/suspendapplet/suspend.cpp | 11 | ||||
-rw-r--r-- | core/applets/suspendapplet/suspend.h | 2 |
6 files changed, 49 insertions, 12 deletions
diff --git a/core/applets/homeapplet/home.cpp b/core/applets/homeapplet/home.cpp index f94bc14..017de27 100644 --- a/core/applets/homeapplet/home.cpp +++ b/core/applets/homeapplet/home.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 "home.h" | 8 | #include "home.h" |
8 | 9 | ||
9 | 10 | ||
10 | HomeApplet::HomeApplet ( ) | 11 | HomeApplet::HomeApplet ( ) |
11 | : QObject ( 0, "HomeApplet" ), ref ( 0 ) | 12 | : QObject ( 0, "HomeApplet" ), ref ( 0 ) |
12 | { | 13 | { |
13 | } | 14 | } |
14 | 15 | ||
15 | HomeApplet::~HomeApplet ( ) | 16 | HomeApplet::~HomeApplet ( ) |
16 | { | 17 | { |
17 | } | 18 | } |
18 | 19 | ||
19 | int HomeApplet::position ( ) const | 20 | int HomeApplet::position ( ) const |
20 | { | 21 | { |
21 | return 4; | 22 | return 4; |
22 | } | 23 | } |
23 | 24 | ||
24 | QString HomeApplet::name ( ) const | 25 | QString HomeApplet::name ( ) const |
25 | { | 26 | { |
26 | return tr( "Home shortcut" ); | 27 | return tr( "Home shortcut" ); |
27 | } | 28 | } |
28 | 29 | ||
29 | QString HomeApplet::text ( ) const | 30 | QString HomeApplet::text ( ) const |
30 | { | 31 | { |
31 | return tr( "Desktop" ); | 32 | return tr( "Desktop" ); |
32 | } | 33 | } |
33 | 34 | ||
35 | QString HomeApplet::tr( const char* s ) const | ||
36 | { | ||
37 | return qApp->translate( "HomeApplet", s, 0 ); | ||
38 | } | ||
39 | |||
40 | QString HomeApplet::tr( const char* s, const char* p ) const | ||
41 | { | ||
42 | return qApp->translate( "HomeApplet", s, p ); | ||
43 | } | ||
44 | |||
34 | QIconSet HomeApplet::icon ( ) const | 45 | QIconSet HomeApplet::icon ( ) const |
35 | { | 46 | { |
36 | QPixmap pix; | 47 | QPixmap pix; |
37 | QImage img = Resource::loadImage ( "home" ); | 48 | QImage img = Resource::loadImage ( "home" ); |
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 *HomeApplet::popup ( QWidget * ) const | 55 | QPopupMenu *HomeApplet::popup ( QWidget * ) const |
45 | { | 56 | { |
46 | return 0; | 57 | return 0; |
47 | } | 58 | } |
48 | 59 | ||
49 | void HomeApplet::activated ( ) | 60 | void HomeApplet::activated ( ) |
50 | { | 61 | { |
51 | // to desktop (home) | 62 | // to desktop (home) |
52 | QCopEnvelope ( "QPE/Application/qpe", "raise()" ); | 63 | QCopEnvelope ( "QPE/Application/qpe", "raise()" ); |
53 | } | 64 | } |
54 | 65 | ||
55 | 66 | ||
56 | QRESULT HomeApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 67 | QRESULT HomeApplet::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( HomeApplet ) | 82 | Q_CREATE_INSTANCE( HomeApplet ) |
72 | } | 83 | } |
73 | 84 | ||
74 | 85 | ||
diff --git a/core/applets/homeapplet/home.h b/core/applets/homeapplet/home.h index 7f4b630..64af97d 100644 --- a/core/applets/homeapplet/home.h +++ b/core/applets/homeapplet/home.h | |||
@@ -1,47 +1,49 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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_HOME_APPLET_H__ | 20 | #ifndef __OPIE_HOME_APPLET_H__ |
21 | #define __OPIE_HOME_APPLET_H__ | 21 | #define __OPIE_HOME_APPLET_H__ |
22 | 22 | ||
23 | #include <qpe/menuappletinterface.h> | 23 | #include <qpe/menuappletinterface.h> |
24 | 24 | ||
25 | class HomeApplet : public QObject, public MenuAppletInterface | 25 | class HomeApplet : public QObject, public MenuAppletInterface |
26 | { | 26 | { |
27 | public: | 27 | public: |
28 | HomeApplet ( ); | 28 | HomeApplet ( ); |
29 | virtual ~HomeApplet ( ); | 29 | virtual ~HomeApplet ( ); |
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 |
diff --git a/core/applets/logoutapplet/logout.cpp b/core/applets/logoutapplet/logout.cpp index 9470401..1769ae6 100644 --- a/core/applets/logoutapplet/logout.cpp +++ b/core/applets/logoutapplet/logout.cpp | |||
@@ -1,115 +1,124 @@ | |||
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 <qapplication.h> |
5 | #include <qiconset.h> | 5 | #include <qiconset.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | 8 | ||
9 | #include <unistd.h> | 9 | #include <unistd.h> |
10 | 10 | ||
11 | #include "logout.h" | 11 | #include "logout.h" |
12 | 12 | ||
13 | 13 | ||
14 | LogoutApplet::LogoutApplet ( ) | 14 | LogoutApplet::LogoutApplet ( ) |
15 | : QObject ( 0, "LogoutApplet" ), ref ( 0 ) | 15 | : QObject ( 0, "LogoutApplet" ), ref ( 0 ) |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | LogoutApplet::~LogoutApplet ( ) | 19 | LogoutApplet::~LogoutApplet ( ) |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | int LogoutApplet::position ( ) const | 23 | int LogoutApplet::position ( ) const |
24 | { | 24 | { |
25 | return 0; | 25 | return 0; |
26 | } | 26 | } |
27 | 27 | ||
28 | QString LogoutApplet::name ( ) const | 28 | QString LogoutApplet::name ( ) const |
29 | { | 29 | { |
30 | return tr( "Logout shortcut" ); | 30 | return tr( "Logout shortcut" ); |
31 | } | 31 | } |
32 | 32 | ||
33 | QString LogoutApplet::text ( ) const | 33 | QString LogoutApplet::text ( ) const |
34 | { | 34 | { |
35 | return tr( "Logout" ); | 35 | return tr( "Logout" ); |
36 | } | 36 | } |
37 | 37 | ||
38 | QString LogoutApplet::tr( const char* s ) const | ||
39 | { | ||
40 | return qApp->translate( "LogoutApplet", s, 0 ); | ||
41 | } | ||
42 | |||
43 | QString LogoutApplet::tr( const char* s, const char* p ) const | ||
44 | { | ||
45 | return qApp->translate( "LogoutApplet", s, p ); | ||
46 | } | ||
47 | |||
38 | QIconSet LogoutApplet::icon ( ) const | 48 | QIconSet LogoutApplet::icon ( ) const |
39 | { | 49 | { |
40 | QPixmap pix; | 50 | QPixmap pix; |
41 | QImage img = Resource::loadImage ( "logout" ); | 51 | QImage img = Resource::loadImage ( "logout" ); |
42 | 52 | ||
43 | if ( !img. isNull ( )) | 53 | if ( !img. isNull ( )) |
44 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); | 54 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); |
45 | return pix; | 55 | return pix; |
46 | } | 56 | } |
47 | 57 | ||
48 | QPopupMenu *LogoutApplet::popup ( QWidget * ) const | 58 | QPopupMenu *LogoutApplet::popup ( QWidget * ) const |
49 | { | 59 | { |
50 | return 0; | 60 | return 0; |
51 | } | 61 | } |
52 | 62 | ||
53 | // This is a workaround for a Qt bug | 63 | // This is a workaround for a Qt bug |
54 | // clipboard applet has to stop its poll timer, or Qt/E | 64 | // clipboard applet has to stop its poll timer, or Qt/E |
55 | // will hang on quit() right before it emits aboutToQuit() | 65 | // will hang on quit() right before it emits aboutToQuit() |
56 | 66 | ||
57 | class HackApplication : public QApplication { | 67 | class HackApplication : public QApplication { |
58 | public: | 68 | public: |
59 | HackApplication ( ) : QApplication ( dummy, 0 ) | 69 | HackApplication ( ) : QApplication ( dummy, 0 ) |
60 | { | 70 | { |
61 | } | 71 | } |
62 | 72 | ||
63 | void emit_about_to_quit ( ) | 73 | void emit_about_to_quit ( ) |
64 | { | 74 | { |
65 | emit aboutToQuit ( ); | 75 | emit aboutToQuit ( ); |
66 | } | 76 | } |
67 | 77 | ||
68 | int dummy; | 78 | int dummy; |
69 | }; | 79 | }; |
70 | 80 | ||
71 | 81 | ||
72 | void LogoutApplet::activated ( ) | 82 | void LogoutApplet::activated ( ) |
73 | { | 83 | { |
74 | QMessageBox mb ( tr( "Logout" ), | 84 | QMessageBox mb ( tr( "Logout" ), |
75 | tr( "Do you really want to\nend this session ?" ), | 85 | tr( "Do you really want to\nend this session ?" ), |
76 | QMessageBox::NoIcon, | 86 | QMessageBox::NoIcon, |
77 | QMessageBox::Yes | QMessageBox::Default, | 87 | QMessageBox::Yes | QMessageBox::Default, |
78 | QMessageBox::No | QMessageBox::Escape, | 88 | QMessageBox::No | QMessageBox::Escape, |
79 | QMessageBox::NoButton ); | 89 | QMessageBox::NoButton ); |
80 | 90 | ||
81 | mb. setButtonText ( QMessageBox::Yes, "Yes" ); | 91 | mb. setButtonText ( QMessageBox::Yes, "Yes" ); |
82 | mb. setButtonText ( QMessageBox::No, "No" ); | 92 | mb. setButtonText ( QMessageBox::No, "No" ); |
83 | mb. setIconPixmap ( icon ( ). pixmap ( )); | 93 | mb. setIconPixmap ( icon ( ). pixmap ( )); |
84 | 94 | ||
85 | if ( mb. exec ( ) == QMessageBox::Yes ) { | 95 | if ( mb. exec ( ) == QMessageBox::Yes ) { |
86 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); } | 96 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); } |
87 | 97 | ||
88 | qApp-> processEvents ( ); // ensure the message goes out. | 98 | qApp-> processEvents ( ); // ensure the message goes out. |
89 | sleep ( 1 ); // You have 1 second to comply. | 99 | sleep ( 1 ); // You have 1 second to comply. |
90 | 100 | ||
91 | ((HackApplication *) qApp )-> emit_about_to_quit ( ); | 101 | ((HackApplication *) qApp )-> emit_about_to_quit ( ); |
92 | qApp-> quit(); | 102 | qApp-> quit(); |
93 | } | 103 | } |
94 | } | 104 | } |
95 | 105 | ||
96 | 106 | ||
97 | QRESULT LogoutApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 107 | QRESULT LogoutApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
98 | { | 108 | { |
99 | *iface = 0; | 109 | *iface = 0; |
100 | if ( uuid == IID_QUnknown ) | 110 | if ( uuid == IID_QUnknown ) |
101 | *iface = this; | 111 | *iface = this; |
102 | else if ( uuid == IID_MenuApplet ) | 112 | else if ( uuid == IID_MenuApplet ) |
103 | *iface = this; | 113 | *iface = this; |
104 | 114 | ||
105 | if ( *iface ) | 115 | if ( *iface ) |
106 | (*iface)-> addRef ( ); | 116 | (*iface)-> addRef ( ); |
107 | return QS_OK; | 117 | return QS_OK; |
108 | } | 118 | } |
109 | 119 | ||
110 | Q_EXPORT_INTERFACE( ) | 120 | Q_EXPORT_INTERFACE( ) |
111 | { | 121 | { |
112 | Q_CREATE_INSTANCE( LogoutApplet ) | 122 | Q_CREATE_INSTANCE( LogoutApplet ) |
113 | } | 123 | } |
114 | 124 | ||
115 | |||
diff --git a/core/applets/logoutapplet/logout.h b/core/applets/logoutapplet/logout.h index e45f3ba..3fcb295 100644 --- a/core/applets/logoutapplet/logout.h +++ b/core/applets/logoutapplet/logout.h | |||
@@ -1,47 +1,49 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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_LOGOUT_APPLET_H__ | 20 | #ifndef __OPIE_LOGOUT_APPLET_H__ |
21 | #define __OPIE_LOGOUT_APPLET_H__ | 21 | #define __OPIE_LOGOUT_APPLET_H__ |
22 | 22 | ||
23 | #include <qpe/menuappletinterface.h> | 23 | #include <qpe/menuappletinterface.h> |
24 | 24 | ||
25 | class LogoutApplet : public QObject, public MenuAppletInterface | 25 | class LogoutApplet : public QObject, public MenuAppletInterface |
26 | { | 26 | { |
27 | public: | 27 | public: |
28 | LogoutApplet ( ); | 28 | LogoutApplet ( ); |
29 | virtual ~LogoutApplet ( ); | 29 | virtual ~LogoutApplet ( ); |
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 |
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 | ||
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 | |||
@@ -1,47 +1,49 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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 |