author | sandman <sandman> | 2002-10-02 22:02:20 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-02 22:02:20 (UTC) |
commit | 8708473ed5d4c04007ad3caa00fc2e67e76da3fe (patch) (unidiff) | |
tree | ce4e7c62e3b7d26a5d2a0c0af6913858abd0ce02 | |
parent | 608c4065319799edd2365a78790d5db1463a747d (diff) | |
download | opie-8708473ed5d4c04007ad3caa00fc2e67e76da3fe.zip opie-8708473ed5d4c04007ad3caa00fc2e67e76da3fe.tar.gz opie-8708473ed5d4c04007ad3caa00fc2e67e76da3fe.tar.bz2 |
New menubar applets for Home and Suspend -- replaces the __* entries
in OPIEDIR/apps/
-rw-r--r-- | core/applets/homeapplet/home.cpp | 74 | ||||
-rw-r--r-- | core/applets/homeapplet/home.h | 47 | ||||
-rw-r--r-- | core/applets/homeapplet/homeapplet.pro | 25 | ||||
-rw-r--r-- | core/applets/suspendapplet/suspend.cpp | 74 | ||||
-rw-r--r-- | core/applets/suspendapplet/suspend.h | 47 | ||||
-rw-r--r-- | core/applets/suspendapplet/suspendapplet.pro | 25 |
6 files changed, 292 insertions, 0 deletions
diff --git a/core/applets/homeapplet/home.cpp b/core/applets/homeapplet/home.cpp new file mode 100644 index 0000000..2b726ae --- a/dev/null +++ b/core/applets/homeapplet/home.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 "home.h" | ||
8 | |||
9 | |||
10 | HomeApplet::HomeApplet ( ) | ||
11 | : QObject ( 0, "HomeApplet" ), ref ( 0 ) | ||
12 | { | ||
13 | } | ||
14 | |||
15 | HomeApplet::~HomeApplet ( ) | ||
16 | { | ||
17 | } | ||
18 | |||
19 | int HomeApplet::position ( ) const | ||
20 | { | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | QString HomeApplet::name ( ) const | ||
25 | { | ||
26 | return tr( "Home shortcut" ); | ||
27 | } | ||
28 | |||
29 | QString HomeApplet::text ( ) const | ||
30 | { | ||
31 | return tr( "Home" ); | ||
32 | } | ||
33 | |||
34 | QIconSet HomeApplet::icon ( ) const | ||
35 | { | ||
36 | QPixmap pix; | ||
37 | QImage img = Resource::loadImage ( "home" ); | ||
38 | |||
39 | if ( !img. isNull ( )) | ||
40 | pix. convertFromImage ( img. smoothScale ( 16, 16 )); | ||
41 | return pix; | ||
42 | } | ||
43 | |||
44 | QPopupMenu *HomeApplet::popup ( QWidget * ) const | ||
45 | { | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | void HomeApplet::activated ( ) | ||
50 | { | ||
51 | // to desktop (home) | ||
52 | QCopEnvelope ( "QPE/Desktop", "home()" ); | ||
53 | } | ||
54 | |||
55 | |||
56 | QRESULT HomeApplet::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( HomeApplet ) | ||
72 | } | ||
73 | |||
74 | |||
diff --git a/core/applets/homeapplet/home.h b/core/applets/homeapplet/home.h new file mode 100644 index 0000000..7f4b630 --- a/dev/null +++ b/core/applets/homeapplet/home.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef __OPIE_HOME_APPLET_H__ | ||
21 | #define __OPIE_HOME_APPLET_H__ | ||
22 | |||
23 | #include <qpe/menuappletinterface.h> | ||
24 | |||
25 | class HomeApplet : public QObject, public MenuAppletInterface | ||
26 | { | ||
27 | public: | ||
28 | HomeApplet ( ); | ||
29 | virtual ~HomeApplet ( ); | ||
30 | |||
31 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
32 | Q_REFCOUNT | ||
33 | |||
34 | virtual int position() const; | ||
35 | |||
36 | virtual QString name ( ) const; | ||
37 | virtual QIconSet icon ( ) const; | ||
38 | virtual QString text ( ) const; | ||
39 | virtual QPopupMenu *popup ( QWidget *parent ) const; | ||
40 | |||
41 | virtual void activated ( ); | ||
42 | |||
43 | private: | ||
44 | ulong ref; | ||
45 | }; | ||
46 | |||
47 | #endif | ||
diff --git a/core/applets/homeapplet/homeapplet.pro b/core/applets/homeapplet/homeapplet.pro new file mode 100644 index 0000000..2c591f9 --- a/dev/null +++ b/core/applets/homeapplet/homeapplet.pro | |||
@@ -0,0 +1,25 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | HEADERS = home.h | ||
4 | SOURCES = home.cpp | ||
5 | TARGET = homeapplet | ||
6 | DESTDIR = $(OPIEDIR)/plugins/applets | ||
7 | INCLUDEPATH += $(OPIEDIR)/include | ||
8 | DEPENDPATH += $(OPIEDIR)/include | ||
9 | LIBS += -lqpe | ||
10 | VERSION = 1.0.0 | ||
11 | |||
12 | TRANSLATIONS = ../../../i18n/de/libhomeapplet.ts \ | ||
13 | ../../../i18n/en/libhomeapplet.ts \ | ||
14 | ../../../i18n/es/libhomeapplet.ts \ | ||
15 | ../../../i18n/fr/libhomeapplet.ts \ | ||
16 | ../../../i18n/hu/libhomeapplet.ts \ | ||
17 | ../../../i18n/ja/libhomeapplet.ts \ | ||
18 | ../../../i18n/ko/libhomeapplet.ts \ | ||
19 | ../../../i18n/no/libhomeapplet.ts \ | ||
20 | ../../../i18n/pl/libhomeapplet.ts \ | ||
21 | ../../../i18n/pt/libhomeapplet.ts \ | ||
22 | ../../../i18n/pt_BR/libhomeapplet.ts \ | ||
23 | ../../../i18n/sl/libhomeapplet.ts \ | ||
24 | ../../../i18n/zh_CN/libhomeapplet.ts \ | ||
25 | ../../../i18n/zh_TW/libhomeapplet.ts | ||
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 | |||
diff --git a/core/applets/suspendapplet/suspend.h b/core/applets/suspendapplet/suspend.h new file mode 100644 index 0000000..629430d --- a/dev/null +++ b/core/applets/suspendapplet/suspend.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef __OPIE_SUSPEND_APPLET_H__ | ||
21 | #define __OPIE_SUSPEND_APPLET_H__ | ||
22 | |||
23 | #include <qpe/menuappletinterface.h> | ||
24 | |||
25 | class SuspendApplet : public QObject, public MenuAppletInterface | ||
26 | { | ||
27 | public: | ||
28 | SuspendApplet ( ); | ||
29 | virtual ~SuspendApplet ( ); | ||
30 | |||
31 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
32 | Q_REFCOUNT | ||
33 | |||
34 | virtual int position() const; | ||
35 | |||
36 | virtual QString name ( ) const; | ||
37 | virtual QIconSet icon ( ) const; | ||
38 | virtual QString text ( ) const; | ||
39 | virtual QPopupMenu *popup ( QWidget *parent ) const; | ||
40 | |||
41 | virtual void activated ( ); | ||
42 | |||
43 | private: | ||
44 | ulong ref; | ||
45 | }; | ||
46 | |||
47 | #endif | ||
diff --git a/core/applets/suspendapplet/suspendapplet.pro b/core/applets/suspendapplet/suspendapplet.pro new file mode 100644 index 0000000..44ff273 --- a/dev/null +++ b/core/applets/suspendapplet/suspendapplet.pro | |||
@@ -0,0 +1,25 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | HEADERS = suspend.h | ||
4 | SOURCES = suspend.cpp | ||
5 | TARGET = suspendapplet | ||
6 | DESTDIR = $(OPIEDIR)/plugins/applets | ||
7 | INCLUDEPATH += $(OPIEDIR)/include | ||
8 | DEPENDPATH += $(OPIEDIR)/include | ||
9 | LIBS += -lqpe | ||
10 | VERSION = 1.0.0 | ||
11 | |||
12 | TRANSLATIONS = ../../../i18n/de/libsuspendapplet.ts \ | ||
13 | ../../../i18n/en/libsuspendapplet.ts \ | ||
14 | ../../../i18n/es/libsuspendapplet.ts \ | ||
15 | ../../../i18n/fr/libsuspendapplet.ts \ | ||
16 | ../../../i18n/hu/libsuspendapplet.ts \ | ||
17 | ../../../i18n/ja/libsuspendapplet.ts \ | ||
18 | ../../../i18n/ko/libsuspendapplet.ts \ | ||
19 | ../../../i18n/no/libsuspendapplet.ts \ | ||
20 | ../../../i18n/pl/libsuspendapplet.ts \ | ||
21 | ../../../i18n/pt/libsuspendapplet.ts \ | ||
22 | ../../../i18n/pt_BR/libsuspendapplet.ts \ | ||
23 | ../../../i18n/sl/libsuspendapplet.ts \ | ||
24 | ../../../i18n/zh_CN/libsuspendapplet.ts \ | ||
25 | ../../../i18n/zh_TW/libsuspendapplet.ts | ||