summaryrefslogtreecommitdiff
path: root/core/applets/suspendapplet
Unidiff
Diffstat (limited to 'core/applets/suspendapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/suspendapplet/suspend.cpp74
-rw-r--r--core/applets/suspendapplet/suspend.h47
-rw-r--r--core/applets/suspendapplet/suspendapplet.pro25
3 files changed, 146 insertions, 0 deletions
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
10SuspendApplet::SuspendApplet ( )
11 : QObject ( 0, "SuspendApplet" ), ref ( 0 )
12{
13}
14
15SuspendApplet::~SuspendApplet ( )
16{
17}
18
19int SuspendApplet::position ( ) const
20{
21 return 0;
22}
23
24QString SuspendApplet::name ( ) const
25{
26 return tr( "Suspend shortcut" );
27}
28
29QString SuspendApplet::text ( ) const
30{
31 return tr( "Suspend" );
32}
33
34QIconSet 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
44QPopupMenu *SuspendApplet::popup ( QWidget * ) const
45{
46 return 0;
47}
48
49void SuspendApplet::activated ( )
50{
51 // suspend
52 QCopEnvelope ( "QPE/Desktop", "suspend()" );
53}
54
55
56QRESULT 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
69Q_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
25class SuspendApplet : public QObject, public MenuAppletInterface
26{
27public:
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
43private:
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 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3HEADERS = suspend.h
4SOURCES = suspend.cpp
5TARGET = suspendapplet
6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe
10VERSION = 1.0.0
11
12TRANSLATIONS = ../../../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