summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/homeapplet/home.cpp4
-rw-r--r--core/applets/logoutapplet/logout.cpp115
-rw-r--r--core/applets/logoutapplet/logout.h47
-rw-r--r--core/applets/logoutapplet/logoutapplet.pro25
-rw-r--r--core/applets/suspendapplet/suspend.cpp6
5 files changed, 192 insertions, 5 deletions
diff --git a/core/applets/homeapplet/home.cpp b/core/applets/homeapplet/home.cpp
index 2b726ae..3670e6d 100644
--- a/core/applets/homeapplet/home.cpp
+++ b/core/applets/homeapplet/home.cpp
@@ -18,7 +18,7 @@ HomeApplet::~HomeApplet ( )
18 18
19int HomeApplet::position ( ) const 19int HomeApplet::position ( ) const
20{ 20{
21 return 0; 21 return 4;
22} 22}
23 23
24QString HomeApplet::name ( ) const 24QString HomeApplet::name ( ) const
@@ -37,7 +37,7 @@ QIconSet HomeApplet::icon ( ) const
37 QImage img = Resource::loadImage ( "home" ); 37 QImage img = Resource::loadImage ( "home" );
38 38
39 if ( !img. isNull ( )) 39 if ( !img. isNull ( ))
40 pix. convertFromImage ( img. smoothScale ( 16, 16 )); 40 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
41 return pix; 41 return pix;
42} 42}
43 43
diff --git a/core/applets/logoutapplet/logout.cpp b/core/applets/logoutapplet/logout.cpp
new file mode 100644
index 0000000..9470401
--- a/dev/null
+++ b/core/applets/logoutapplet/logout.cpp
@@ -0,0 +1,115 @@
1#include <qpe/resource.h>
2#include <qpe/qcopenvelope_qws.h>
3
4#include <qapplication.h>
5#include <qiconset.h>
6#include <qpopupmenu.h>
7#include <qmessagebox.h>
8
9#include <unistd.h>
10
11#include "logout.h"
12
13
14LogoutApplet::LogoutApplet ( )
15 : QObject ( 0, "LogoutApplet" ), ref ( 0 )
16{
17}
18
19LogoutApplet::~LogoutApplet ( )
20{
21}
22
23int LogoutApplet::position ( ) const
24{
25 return 0;
26}
27
28QString LogoutApplet::name ( ) const
29{
30 return tr( "Logout shortcut" );
31}
32
33QString LogoutApplet::text ( ) const
34{
35 return tr( "Logout" );
36}
37
38QIconSet LogoutApplet::icon ( ) const
39{
40 QPixmap pix;
41 QImage img = Resource::loadImage ( "logout" );
42
43 if ( !img. isNull ( ))
44 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
45 return pix;
46}
47
48QPopupMenu *LogoutApplet::popup ( QWidget * ) const
49{
50 return 0;
51}
52
53// This is a workaround for a Qt bug
54// clipboard applet has to stop its poll timer, or Qt/E
55// will hang on quit() right before it emits aboutToQuit()
56
57class HackApplication : public QApplication {
58public:
59 HackApplication ( ) : QApplication ( dummy, 0 )
60 {
61 }
62
63 void emit_about_to_quit ( )
64 {
65 emit aboutToQuit ( );
66 }
67
68 int dummy;
69};
70
71
72void LogoutApplet::activated ( )
73{
74 QMessageBox mb ( tr( "Logout" ),
75 tr( "Do you really want to\nend this session ?" ),
76 QMessageBox::NoIcon,
77 QMessageBox::Yes | QMessageBox::Default,
78 QMessageBox::No | QMessageBox::Escape,
79 QMessageBox::NoButton );
80
81 mb. setButtonText ( QMessageBox::Yes, "Yes" );
82 mb. setButtonText ( QMessageBox::No, "No" );
83 mb. setIconPixmap ( icon ( ). pixmap ( ));
84
85 if ( mb. exec ( ) == QMessageBox::Yes ) {
86 { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); }
87
88 qApp-> processEvents ( ); // ensure the message goes out.
89 sleep ( 1 ); // You have 1 second to comply.
90
91 ((HackApplication *) qApp )-> emit_about_to_quit ( );
92 qApp-> quit();
93 }
94}
95
96
97QRESULT LogoutApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
98{
99 *iface = 0;
100 if ( uuid == IID_QUnknown )
101 *iface = this;
102 else if ( uuid == IID_MenuApplet )
103 *iface = this;
104
105 if ( *iface )
106 (*iface)-> addRef ( );
107 return QS_OK;
108}
109
110Q_EXPORT_INTERFACE( )
111{
112 Q_CREATE_INSTANCE( LogoutApplet )
113}
114
115
diff --git a/core/applets/logoutapplet/logout.h b/core/applets/logoutapplet/logout.h
new file mode 100644
index 0000000..e45f3ba
--- a/dev/null
+++ b/core/applets/logoutapplet/logout.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_LOGOUT_APPLET_H__
21#define __OPIE_LOGOUT_APPLET_H__
22
23#include <qpe/menuappletinterface.h>
24
25class LogoutApplet : public QObject, public MenuAppletInterface
26{
27public:
28 LogoutApplet ( );
29 virtual ~LogoutApplet ( );
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/logoutapplet/logoutapplet.pro b/core/applets/logoutapplet/logoutapplet.pro
new file mode 100644
index 0000000..9adfea5
--- a/dev/null
+++ b/core/applets/logoutapplet/logoutapplet.pro
@@ -0,0 +1,25 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3HEADERS = logout.h
4SOURCES = logout.cpp
5TARGET = logoutapplet
6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe
10VERSION = 1.0.0
11
12TRANSLATIONS = ../../../i18n/de/liblogoutapplet.ts \
13 ../../../i18n/en/liblogoutapplet.ts \
14 ../../../i18n/es/liblogoutapplet.ts \
15 ../../../i18n/fr/liblogoutapplet.ts \
16 ../../../i18n/hu/liblogoutapplet.ts \
17 ../../../i18n/ja/liblogoutapplet.ts \
18 ../../../i18n/ko/liblogoutapplet.ts \
19 ../../../i18n/no/liblogoutapplet.ts \
20 ../../../i18n/pl/liblogoutapplet.ts \
21 ../../../i18n/pt/liblogoutapplet.ts \
22 ../../../i18n/pt_BR/liblogoutapplet.ts \
23 ../../../i18n/sl/liblogoutapplet.ts \
24 ../../../i18n/zh_CN/liblogoutapplet.ts \
25 ../../../i18n/zh_TW/liblogoutapplet.ts
diff --git a/core/applets/suspendapplet/suspend.cpp b/core/applets/suspendapplet/suspend.cpp
index 5966a84..e9861e8 100644
--- a/core/applets/suspendapplet/suspend.cpp
+++ b/core/applets/suspendapplet/suspend.cpp
@@ -18,7 +18,7 @@ SuspendApplet::~SuspendApplet ( )
18 18
19int SuspendApplet::position ( ) const 19int SuspendApplet::position ( ) const
20{ 20{
21 return 0; 21 return 2;
22} 22}
23 23
24QString SuspendApplet::name ( ) const 24QString SuspendApplet::name ( ) const
@@ -34,10 +34,10 @@ QString SuspendApplet::text ( ) const
34QIconSet SuspendApplet::icon ( ) const 34QIconSet SuspendApplet::icon ( ) const
35{ 35{
36 QPixmap pix; 36 QPixmap pix;
37 QImage img = Resource::loadImage ( "Shutdown" ); 37 QImage img = Resource::loadImage ( "suspend" );
38 38
39 if ( !img. isNull ( )) 39 if ( !img. isNull ( ))
40 pix. convertFromImage ( img. smoothScale ( 16, 16 )); 40 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
41 return pix; 41 return pix;
42} 42}
43 43