summaryrefslogtreecommitdiff
authorzecke <zecke>2004-01-27 18:48:09 (UTC)
committer zecke <zecke>2004-01-27 18:48:09 (UTC)
commitfbe767bcc9f46f1d9bf680dc91eba983bc39fdeb (patch) (unidiff)
tree453b0a48a4e40316ea377b0b4a05a39a16849136
parent068604863e009b20790cd2aa482e216eb40b8876 (diff)
downloadopie-fbe767bcc9f46f1d9bf680dc91eba983bc39fdeb.zip
opie-fbe767bcc9f46f1d9bf680dc91eba983bc39fdeb.tar.gz
opie-fbe767bcc9f46f1d9bf680dc91eba983bc39fdeb.tar.bz2
Funny what my SDK all triggers
Ok the reason to use a bool as return type is that you can say that something worked or not worked. So if we don't implement the given interface don't lie!!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/batteryappletimpl.cpp2
-rw-r--r--core/applets/cardmon/cardmonimpl.cpp2
-rw-r--r--core/applets/clipboardapplet/clipboardappletimpl.cpp2
-rw-r--r--core/applets/clockapplet/clockappletimpl.cpp2
-rw-r--r--core/applets/homeapplet/home.cpp2
-rw-r--r--core/applets/irdaapplet/irdaappletimpl.cpp4
-rw-r--r--core/applets/logoutapplet/logout.cpp2
-rw-r--r--core/applets/multikeyapplet/multikeyappletimpl.cpp2
-rw-r--r--core/applets/restartapplet/restartappletimpl.cpp4
-rw-r--r--core/applets/restartapplet2/restart.cpp2
-rw-r--r--core/applets/rotateapplet/rotate.cpp2
-rw-r--r--core/applets/screenshotapplet/screenshotappletimpl.cpp4
-rw-r--r--core/applets/suspendapplet/suspend.cpp2
-rw-r--r--core/applets/vmemo/vmemoimpl.cpp2
-rw-r--r--core/applets/volumeapplet/volumeappletimpl.cpp2
-rw-r--r--core/applets/vtapplet/vt.cpp2
-rw-r--r--core/obex/obeximpl.cpp2
17 files changed, 37 insertions, 3 deletions
diff --git a/core/applets/batteryapplet/batteryappletimpl.cpp b/core/applets/batteryapplet/batteryappletimpl.cpp
index 3f3079a..9ad0382 100644
--- a/core/applets/batteryapplet/batteryappletimpl.cpp
+++ b/core/applets/batteryapplet/batteryappletimpl.cpp
@@ -1,63 +1,65 @@
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#include "battery.h" 20#include "battery.h"
21#include "batteryappletimpl.h" 21#include "batteryappletimpl.h"
22 22
23 23
24BatteryAppletImpl::BatteryAppletImpl() 24BatteryAppletImpl::BatteryAppletImpl()
25 : battery(0), ref(0) 25 : battery(0), ref(0)
26{ 26{
27} 27}
28 28
29BatteryAppletImpl::~BatteryAppletImpl() 29BatteryAppletImpl::~BatteryAppletImpl()
30{ 30{
31 delete battery; 31 delete battery;
32} 32}
33 33
34QWidget *BatteryAppletImpl::applet( QWidget *parent ) 34QWidget *BatteryAppletImpl::applet( QWidget *parent )
35{ 35{
36 if ( !battery ) 36 if ( !battery )
37 battery = new BatteryMeter( parent ); 37 battery = new BatteryMeter( parent );
38 return battery; 38 return battery;
39} 39}
40 40
41int BatteryAppletImpl::position() const 41int BatteryAppletImpl::position() const
42{ 42{
43 return 8; 43 return 8;
44} 44}
45 45
46QRESULT BatteryAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 46QRESULT BatteryAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
47{ 47{
48 *iface = 0; 48 *iface = 0;
49 if ( uuid == IID_QUnknown ) 49 if ( uuid == IID_QUnknown )
50 *iface = this; 50 *iface = this;
51 else if ( uuid == IID_TaskbarApplet ) 51 else if ( uuid == IID_TaskbarApplet )
52 *iface = this; 52 *iface = this;
53 else
54 return QS_FALSE;
53 55
54 if ( *iface ) 56 if ( *iface )
55 (*iface)->addRef(); 57 (*iface)->addRef();
56 return QS_OK; 58 return QS_OK;
57} 59}
58 60
59Q_EXPORT_INTERFACE() 61Q_EXPORT_INTERFACE()
60{ 62{
61 Q_CREATE_INSTANCE( BatteryAppletImpl ) 63 Q_CREATE_INSTANCE( BatteryAppletImpl )
62} 64}
63 65
diff --git a/core/applets/cardmon/cardmonimpl.cpp b/core/applets/cardmon/cardmonimpl.cpp
index 0aa55de..265214e 100644
--- a/core/applets/cardmon/cardmonimpl.cpp
+++ b/core/applets/cardmon/cardmonimpl.cpp
@@ -1,40 +1,42 @@
1#include "cardmon.h" 1#include "cardmon.h"
2#include "cardmonimpl.h" 2#include "cardmonimpl.h"
3 3
4 4
5CardMonitorImpl::CardMonitorImpl() 5CardMonitorImpl::CardMonitorImpl()
6 : cardMonitor(0), ref(0) { 6 : cardMonitor(0), ref(0) {
7} 7}
8 8
9CardMonitorImpl::~CardMonitorImpl() { 9CardMonitorImpl::~CardMonitorImpl() {
10 delete cardMonitor; 10 delete cardMonitor;
11} 11}
12 12
13QWidget *CardMonitorImpl::applet( QWidget *parent ) { 13QWidget *CardMonitorImpl::applet( QWidget *parent ) {
14 if ( !cardMonitor ) { 14 if ( !cardMonitor ) {
15 cardMonitor = new CardMonitor( parent ); 15 cardMonitor = new CardMonitor( parent );
16 } 16 }
17 return cardMonitor; 17 return cardMonitor;
18} 18}
19 19
20int CardMonitorImpl::position() const { 20int CardMonitorImpl::position() const {
21 return 7; 21 return 7;
22} 22}
23 23
24QRESULT CardMonitorImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 24QRESULT CardMonitorImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
25 *iface = 0; 25 *iface = 0;
26 if ( uuid == IID_QUnknown ) { 26 if ( uuid == IID_QUnknown ) {
27 *iface = this; 27 *iface = this;
28 } else if ( uuid == IID_TaskbarApplet ) { 28 } else if ( uuid == IID_TaskbarApplet ) {
29 *iface = this; 29 *iface = this;
30 } else {
31 return QS_FALSE;
30 } 32 }
31 33
32 if ( *iface ) { 34 if ( *iface ) {
33 (*iface)->addRef(); 35 (*iface)->addRef();
34 } 36 }
35 return QS_OK; 37 return QS_OK;
36} 38}
37 39
38Q_EXPORT_INTERFACE() { 40Q_EXPORT_INTERFACE() {
39 Q_CREATE_INSTANCE( CardMonitorImpl ) 41 Q_CREATE_INSTANCE( CardMonitorImpl )
40} 42}
diff --git a/core/applets/clipboardapplet/clipboardappletimpl.cpp b/core/applets/clipboardapplet/clipboardappletimpl.cpp
index 8080690..8fcf117 100644
--- a/core/applets/clipboardapplet/clipboardappletimpl.cpp
+++ b/core/applets/clipboardapplet/clipboardappletimpl.cpp
@@ -1,64 +1,66 @@
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#include "clipboard.h" 20#include "clipboard.h"
21#include "clipboardappletimpl.h" 21#include "clipboardappletimpl.h"
22 22
23 23
24ClipboardAppletImpl::ClipboardAppletImpl() 24ClipboardAppletImpl::ClipboardAppletImpl()
25 : clipboard(0), ref(0) 25 : clipboard(0), ref(0)
26{ 26{
27} 27}
28 28
29ClipboardAppletImpl::~ClipboardAppletImpl() 29ClipboardAppletImpl::~ClipboardAppletImpl()
30{ 30{
31 delete clipboard; 31 delete clipboard;
32} 32}
33 33
34QWidget *ClipboardAppletImpl::applet( QWidget *parent ) 34QWidget *ClipboardAppletImpl::applet( QWidget *parent )
35{ 35{
36 if ( !clipboard ) 36 if ( !clipboard )
37 clipboard = new ClipboardApplet( parent ); 37 clipboard = new ClipboardApplet( parent );
38 return clipboard; 38 return clipboard;
39} 39}
40 40
41int ClipboardAppletImpl::position() const 41int ClipboardAppletImpl::position() const
42{ 42{
43 return 6; 43 return 6;
44} 44}
45 45
46QRESULT ClipboardAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 46QRESULT ClipboardAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
47{ 47{
48 *iface = 0; 48 *iface = 0;
49 if ( uuid == IID_QUnknown ) 49 if ( uuid == IID_QUnknown )
50 *iface = this; 50 *iface = this;
51 else if ( uuid == IID_TaskbarApplet ) 51 else if ( uuid == IID_TaskbarApplet )
52 *iface = this; 52 *iface = this;
53 else
54 return QS_FALSE;
53 55
54 if ( *iface ) 56 if ( *iface )
55 (*iface)->addRef(); 57 (*iface)->addRef();
56 return QS_OK; 58 return QS_OK;
57} 59}
58 60
59Q_EXPORT_INTERFACE() 61Q_EXPORT_INTERFACE()
60{ 62{
61 Q_CREATE_INSTANCE( ClipboardAppletImpl ) 63 Q_CREATE_INSTANCE( ClipboardAppletImpl )
62} 64}
63 65
64 66
diff --git a/core/applets/clockapplet/clockappletimpl.cpp b/core/applets/clockapplet/clockappletimpl.cpp
index 8bf1baf..2b9cc05 100644
--- a/core/applets/clockapplet/clockappletimpl.cpp
+++ b/core/applets/clockapplet/clockappletimpl.cpp
@@ -1,65 +1,67 @@
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#include "clock.h" 20#include "clock.h"
21#include "clockappletimpl.h" 21#include "clockappletimpl.h"
22 22
23 23
24ClockAppletImpl::ClockAppletImpl() 24ClockAppletImpl::ClockAppletImpl()
25 : clock(0), ref(0) 25 : clock(0), ref(0)
26{ 26{
27} 27}
28 28
29ClockAppletImpl::~ClockAppletImpl() 29ClockAppletImpl::~ClockAppletImpl()
30{ 30{
31 delete clock; 31 delete clock;
32} 32}
33 33
34QWidget *ClockAppletImpl::applet( QWidget *parent ) 34QWidget *ClockAppletImpl::applet( QWidget *parent )
35{ 35{
36 if ( !clock ) 36 if ( !clock )
37 clock = new LauncherClock( parent ); 37 clock = new LauncherClock( parent );
38 return clock; 38 return clock;
39} 39}
40 40
41int ClockAppletImpl::position() const 41int ClockAppletImpl::position() const
42{ 42{
43 return 10; 43 return 10;
44} 44}
45 45
46#ifndef QT_NO_COMPONENT 46#ifndef QT_NO_COMPONENT
47QRESULT ClockAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 47QRESULT ClockAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
48{ 48{
49 *iface = 0; 49 *iface = 0;
50 if ( uuid == IID_QUnknown ) 50 if ( uuid == IID_QUnknown )
51 *iface = this; 51 *iface = this;
52 else if ( uuid == IID_TaskbarApplet ) 52 else if ( uuid == IID_TaskbarApplet )
53 *iface = this; 53 *iface = this;
54 else
55 return QS_FALSE;
54 56
55 if ( *iface ) 57 if ( *iface )
56 (*iface)->addRef(); 58 (*iface)->addRef();
57 return QS_OK; 59 return QS_OK;
58} 60}
59 61
60Q_EXPORT_INTERFACE() 62Q_EXPORT_INTERFACE()
61{ 63{
62 Q_CREATE_INSTANCE( ClockAppletImpl ) 64 Q_CREATE_INSTANCE( ClockAppletImpl )
63} 65}
64#endif 66#endif
65 67
diff --git a/core/applets/homeapplet/home.cpp b/core/applets/homeapplet/home.cpp
index 017de27..36307ab 100644
--- a/core/applets/homeapplet/home.cpp
+++ b/core/applets/homeapplet/home.cpp
@@ -1,85 +1,87 @@
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 7
8#include "home.h" 8#include "home.h"
9 9
10 10
11HomeApplet::HomeApplet ( ) 11HomeApplet::HomeApplet ( )
12 : QObject ( 0, "HomeApplet" ), ref ( 0 ) 12 : QObject ( 0, "HomeApplet" ), ref ( 0 )
13{ 13{
14} 14}
15 15
16HomeApplet::~HomeApplet ( ) 16HomeApplet::~HomeApplet ( )
17{ 17{
18} 18}
19 19
20int HomeApplet::position ( ) const 20int HomeApplet::position ( ) const
21{ 21{
22 return 4; 22 return 4;
23} 23}
24 24
25QString HomeApplet::name ( ) const 25QString HomeApplet::name ( ) const
26{ 26{
27 return tr( "Home shortcut" ); 27 return tr( "Home shortcut" );
28} 28}
29 29
30QString HomeApplet::text ( ) const 30QString HomeApplet::text ( ) const
31{ 31{
32 return tr( "Desktop" ); 32 return tr( "Desktop" );
33} 33}
34 34
35QString HomeApplet::tr( const char* s ) const 35QString HomeApplet::tr( const char* s ) const
36{ 36{
37 return qApp->translate( "HomeApplet", s, 0 ); 37 return qApp->translate( "HomeApplet", s, 0 );
38} 38}
39 39
40QString HomeApplet::tr( const char* s, const char* p ) const 40QString HomeApplet::tr( const char* s, const char* p ) const
41{ 41{
42 return qApp->translate( "HomeApplet", s, p ); 42 return qApp->translate( "HomeApplet", s, p );
43} 43}
44 44
45QIconSet HomeApplet::icon ( ) const 45QIconSet HomeApplet::icon ( ) const
46{ 46{
47 QPixmap pix; 47 QPixmap pix;
48 QImage img = Resource::loadImage ( "home" ); 48 QImage img = Resource::loadImage ( "home" );
49 49
50 if ( !img. isNull ( )) 50 if ( !img. isNull ( ))
51 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 51 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
52 return pix; 52 return pix;
53} 53}
54 54
55QPopupMenu *HomeApplet::popup ( QWidget * ) const 55QPopupMenu *HomeApplet::popup ( QWidget * ) const
56{ 56{
57 return 0; 57 return 0;
58} 58}
59 59
60void HomeApplet::activated ( ) 60void HomeApplet::activated ( )
61{ 61{
62 // to desktop (home) 62 // to desktop (home)
63 QCopEnvelope ( "QPE/Application/qpe", "raise()" ); 63 QCopEnvelope ( "QPE/Application/qpe", "raise()" );
64} 64}
65 65
66 66
67QRESULT HomeApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 67QRESULT HomeApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
68{ 68{
69 *iface = 0; 69 *iface = 0;
70 if ( uuid == IID_QUnknown ) 70 if ( uuid == IID_QUnknown )
71 *iface = this; 71 *iface = this;
72 else if ( uuid == IID_MenuApplet ) 72 else if ( uuid == IID_MenuApplet )
73 *iface = this; 73 *iface = this;
74 else
75 return QS_FALSE;
74 76
75 if ( *iface ) 77 if ( *iface )
76 (*iface)-> addRef ( ); 78 (*iface)-> addRef ( );
77 return QS_OK; 79 return QS_OK;
78} 80}
79 81
80Q_EXPORT_INTERFACE( ) 82Q_EXPORT_INTERFACE( )
81{ 83{
82 Q_CREATE_INSTANCE( HomeApplet ) 84 Q_CREATE_INSTANCE( HomeApplet )
83} 85}
84 86
85 87
diff --git a/core/applets/irdaapplet/irdaappletimpl.cpp b/core/applets/irdaapplet/irdaappletimpl.cpp
index 02443db..3617698 100644
--- a/core/applets/irdaapplet/irdaappletimpl.cpp
+++ b/core/applets/irdaapplet/irdaappletimpl.cpp
@@ -1,64 +1,66 @@
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#include "irda.h" 20#include "irda.h"
21#include "irdaappletimpl.h" 21#include "irdaappletimpl.h"
22 22
23 23
24IrdaAppletImpl::IrdaAppletImpl() 24IrdaAppletImpl::IrdaAppletImpl()
25 : irda(0), ref(0) 25 : irda(0), ref(0)
26{ 26{
27} 27}
28 28
29IrdaAppletImpl::~IrdaAppletImpl() 29IrdaAppletImpl::~IrdaAppletImpl()
30{ 30{
31 delete irda; 31 delete irda;
32} 32}
33 33
34QWidget *IrdaAppletImpl::applet( QWidget *parent ) 34QWidget *IrdaAppletImpl::applet( QWidget *parent )
35{ 35{
36 if ( !irda ) 36 if ( !irda )
37 irda = new IrdaApplet( parent ); 37 irda = new IrdaApplet( parent );
38 return irda; 38 return irda;
39} 39}
40 40
41int IrdaAppletImpl::position() const 41int IrdaAppletImpl::position() const
42{ 42{
43 return 6; 43 return 6;
44} 44}
45 45
46QRESULT IrdaAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 46QRESULT IrdaAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
47{ 47{
48 *iface = 0; 48 *iface = 0;
49 if ( uuid == IID_QUnknown ) 49 if ( uuid == IID_QUnknown )
50 *iface = this; 50 *iface = this;
51 else if ( uuid == IID_TaskbarApplet ) 51 else if ( uuid == IID_TaskbarApplet )
52 *iface = this; 52 *iface = this;
53 53 else
54 return QS_FALSE;
55
54 if ( *iface ) 56 if ( *iface )
55 (*iface)->addRef(); 57 (*iface)->addRef();
56 return QS_OK; 58 return QS_OK;
57} 59}
58 60
59Q_EXPORT_INTERFACE() 61Q_EXPORT_INTERFACE()
60{ 62{
61 Q_CREATE_INSTANCE( IrdaAppletImpl ) 63 Q_CREATE_INSTANCE( IrdaAppletImpl )
62} 64}
63 65
64 66
diff --git a/core/applets/logoutapplet/logout.cpp b/core/applets/logoutapplet/logout.cpp
index 1769ae6..8d3cdba 100644
--- a/core/applets/logoutapplet/logout.cpp
+++ b/core/applets/logoutapplet/logout.cpp
@@ -1,124 +1,126 @@
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
14LogoutApplet::LogoutApplet ( ) 14LogoutApplet::LogoutApplet ( )
15 : QObject ( 0, "LogoutApplet" ), ref ( 0 ) 15 : QObject ( 0, "LogoutApplet" ), ref ( 0 )
16{ 16{
17} 17}
18 18
19LogoutApplet::~LogoutApplet ( ) 19LogoutApplet::~LogoutApplet ( )
20{ 20{
21} 21}
22 22
23int LogoutApplet::position ( ) const 23int LogoutApplet::position ( ) const
24{ 24{
25 return 0; 25 return 0;
26} 26}
27 27
28QString LogoutApplet::name ( ) const 28QString LogoutApplet::name ( ) const
29{ 29{
30 return tr( "Logout shortcut" ); 30 return tr( "Logout shortcut" );
31} 31}
32 32
33QString LogoutApplet::text ( ) const 33QString LogoutApplet::text ( ) const
34{ 34{
35 return tr( "Logout" ); 35 return tr( "Logout" );
36} 36}
37 37
38QString LogoutApplet::tr( const char* s ) const 38QString LogoutApplet::tr( const char* s ) const
39{ 39{
40 return qApp->translate( "LogoutApplet", s, 0 ); 40 return qApp->translate( "LogoutApplet", s, 0 );
41} 41}
42 42
43QString LogoutApplet::tr( const char* s, const char* p ) const 43QString LogoutApplet::tr( const char* s, const char* p ) const
44{ 44{
45 return qApp->translate( "LogoutApplet", s, p ); 45 return qApp->translate( "LogoutApplet", s, p );
46} 46}
47 47
48QIconSet LogoutApplet::icon ( ) const 48QIconSet LogoutApplet::icon ( ) const
49{ 49{
50 QPixmap pix; 50 QPixmap pix;
51 QImage img = Resource::loadImage ( "logout" ); 51 QImage img = Resource::loadImage ( "logout" );
52 52
53 if ( !img. isNull ( )) 53 if ( !img. isNull ( ))
54 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 54 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
55 return pix; 55 return pix;
56} 56}
57 57
58QPopupMenu *LogoutApplet::popup ( QWidget * ) const 58QPopupMenu *LogoutApplet::popup ( QWidget * ) const
59{ 59{
60 return 0; 60 return 0;
61} 61}
62 62
63// This is a workaround for a Qt bug 63// This is a workaround for a Qt bug
64// clipboard applet has to stop its poll timer, or Qt/E 64// clipboard applet has to stop its poll timer, or Qt/E
65// will hang on quit() right before it emits aboutToQuit() 65// will hang on quit() right before it emits aboutToQuit()
66 66
67class HackApplication : public QApplication { 67class HackApplication : public QApplication {
68public: 68public:
69 HackApplication ( ) : QApplication ( dummy, 0 ) 69 HackApplication ( ) : QApplication ( dummy, 0 )
70 { 70 {
71 } 71 }
72 72
73 void emit_about_to_quit ( ) 73 void emit_about_to_quit ( )
74 { 74 {
75 emit aboutToQuit ( ); 75 emit aboutToQuit ( );
76 } 76 }
77 77
78 int dummy; 78 int dummy;
79}; 79};
80 80
81 81
82void LogoutApplet::activated ( ) 82void LogoutApplet::activated ( )
83{ 83{
84 QMessageBox mb ( tr( "Logout" ), 84 QMessageBox mb ( tr( "Logout" ),
85 tr( "Do you really want to\nend this session ?" ), 85 tr( "Do you really want to\nend this session ?" ),
86 QMessageBox::NoIcon, 86 QMessageBox::NoIcon,
87 QMessageBox::Yes | QMessageBox::Default, 87 QMessageBox::Yes | QMessageBox::Default,
88 QMessageBox::No | QMessageBox::Escape, 88 QMessageBox::No | QMessageBox::Escape,
89 QMessageBox::NoButton ); 89 QMessageBox::NoButton );
90 90
91 mb. setButtonText ( QMessageBox::Yes, "Yes" ); 91 mb. setButtonText ( QMessageBox::Yes, "Yes" );
92 mb. setButtonText ( QMessageBox::No, "No" ); 92 mb. setButtonText ( QMessageBox::No, "No" );
93 mb. setIconPixmap ( icon ( ). pixmap ( )); 93 mb. setIconPixmap ( icon ( ). pixmap ( ));
94 94
95 if ( mb. exec ( ) == QMessageBox::Yes ) { 95 if ( mb. exec ( ) == QMessageBox::Yes ) {
96 { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); } 96 { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); }
97 97
98 qApp-> processEvents ( ); // ensure the message goes out. 98 qApp-> processEvents ( ); // ensure the message goes out.
99 sleep ( 1 ); // You have 1 second to comply. 99 sleep ( 1 ); // You have 1 second to comply.
100 100
101 ((HackApplication *) qApp )-> emit_about_to_quit ( ); 101 ((HackApplication *) qApp )-> emit_about_to_quit ( );
102 qApp-> quit(); 102 qApp-> quit();
103 } 103 }
104} 104}
105 105
106 106
107QRESULT LogoutApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 107QRESULT LogoutApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
108{ 108{
109 *iface = 0; 109 *iface = 0;
110 if ( uuid == IID_QUnknown ) 110 if ( uuid == IID_QUnknown )
111 *iface = this; 111 *iface = this;
112 else if ( uuid == IID_MenuApplet ) 112 else if ( uuid == IID_MenuApplet )
113 *iface = this; 113 *iface = this;
114 else
115 return QS_FALSE;
114 116
115 if ( *iface ) 117 if ( *iface )
116 (*iface)-> addRef ( ); 118 (*iface)-> addRef ( );
117 return QS_OK; 119 return QS_OK;
118} 120}
119 121
120Q_EXPORT_INTERFACE( ) 122Q_EXPORT_INTERFACE( )
121{ 123{
122 Q_CREATE_INSTANCE( LogoutApplet ) 124 Q_CREATE_INSTANCE( LogoutApplet )
123} 125}
124 126
diff --git a/core/applets/multikeyapplet/multikeyappletimpl.cpp b/core/applets/multikeyapplet/multikeyappletimpl.cpp
index 4644556..adf92c4 100644
--- a/core/applets/multikeyapplet/multikeyappletimpl.cpp
+++ b/core/applets/multikeyapplet/multikeyappletimpl.cpp
@@ -1,57 +1,59 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru 2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14#include "multikey.h" 14#include "multikey.h"
15#include "multikeyappletimpl.h" 15#include "multikeyappletimpl.h"
16 16
17MultikeyAppletImpl::MultikeyAppletImpl() 17MultikeyAppletImpl::MultikeyAppletImpl()
18 : kbd(0), ref(0) 18 : kbd(0), ref(0)
19{ 19{
20} 20}
21 21
22MultikeyAppletImpl::~MultikeyAppletImpl() 22MultikeyAppletImpl::~MultikeyAppletImpl()
23{ 23{
24 delete kbd; 24 delete kbd;
25} 25}
26 26
27QWidget *MultikeyAppletImpl::applet( QWidget *parent ) 27QWidget *MultikeyAppletImpl::applet( QWidget *parent )
28{ 28{
29 if ( !kbd ) 29 if ( !kbd )
30 kbd = new Multikey(parent); 30 kbd = new Multikey(parent);
31 return kbd; 31 return kbd;
32} 32}
33 33
34int MultikeyAppletImpl::position() const 34int MultikeyAppletImpl::position() const
35{ 35{
36 return 10; 36 return 10;
37} 37}
38 38
39#ifndef QT_NO_COMPONENT 39#ifndef QT_NO_COMPONENT
40QRESULT MultikeyAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 40QRESULT MultikeyAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
41{ 41{
42 *iface = 0; 42 *iface = 0;
43 if ( uuid == IID_QUnknown ) 43 if ( uuid == IID_QUnknown )
44 *iface = this; 44 *iface = this;
45 else if ( uuid == IID_TaskbarApplet ) 45 else if ( uuid == IID_TaskbarApplet )
46 *iface = this; 46 *iface = this;
47 else
48 return QS_FALSE;
47 49
48 if ( *iface ) 50 if ( *iface )
49 (*iface)->addRef(); 51 (*iface)->addRef();
50 return QS_OK; 52 return QS_OK;
51} 53}
52 54
53Q_EXPORT_INTERFACE() 55Q_EXPORT_INTERFACE()
54{ 56{
55 Q_CREATE_INSTANCE( MultikeyAppletImpl ) 57 Q_CREATE_INSTANCE( MultikeyAppletImpl )
56} 58}
57#endif 59#endif
diff --git a/core/applets/restartapplet/restartappletimpl.cpp b/core/applets/restartapplet/restartappletimpl.cpp
index e675c0b..5b0092d 100644
--- a/core/applets/restartapplet/restartappletimpl.cpp
+++ b/core/applets/restartapplet/restartappletimpl.cpp
@@ -1,65 +1,67 @@
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#include "restart.h" 20#include "restart.h"
21#include "restartappletimpl.h" 21#include "restartappletimpl.h"
22 22
23 23
24RestartAppletImpl::RestartAppletImpl() 24RestartAppletImpl::RestartAppletImpl()
25 : restart(0), ref(0) 25 : restart(0), ref(0)
26{ 26{
27} 27}
28 28
29RestartAppletImpl::~RestartAppletImpl() 29RestartAppletImpl::~RestartAppletImpl()
30{ 30{
31 delete restart; 31 delete restart;
32} 32}
33 33
34QWidget *RestartAppletImpl::applet( QWidget *parent ) 34QWidget *RestartAppletImpl::applet( QWidget *parent )
35{ 35{
36 qDebug("restart applet"); 36 qDebug("restart applet");
37 if ( !restart ) 37 if ( !restart )
38 restart = new RestartApplet( parent ); 38 restart = new RestartApplet( parent );
39 return restart; 39 return restart;
40} 40}
41 41
42int RestartAppletImpl::position() const 42int RestartAppletImpl::position() const
43{ 43{
44 return 6; 44 return 6;
45} 45}
46 46
47QRESULT RestartAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 47QRESULT RestartAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
48{ 48{
49 *iface = 0; 49 *iface = 0;
50 if ( uuid == IID_QUnknown ) 50 if ( uuid == IID_QUnknown )
51 *iface = this; 51 *iface = this;
52 else if ( uuid == IID_TaskbarApplet ) 52 else if ( uuid == IID_TaskbarApplet )
53 *iface = this; 53 *iface = this;
54 54 else
55 return QS_FALSE;
56
55 if ( *iface ) 57 if ( *iface )
56 (*iface)->addRef(); 58 (*iface)->addRef();
57 return QS_OK; 59 return QS_OK;
58} 60}
59 61
60Q_EXPORT_INTERFACE() 62Q_EXPORT_INTERFACE()
61{ 63{
62 Q_CREATE_INSTANCE( RestartAppletImpl ) 64 Q_CREATE_INSTANCE( RestartAppletImpl )
63} 65}
64 66
65 67
diff --git a/core/applets/restartapplet2/restart.cpp b/core/applets/restartapplet2/restart.cpp
index caed9e5..576087b 100644
--- a/core/applets/restartapplet2/restart.cpp
+++ b/core/applets/restartapplet2/restart.cpp
@@ -1,107 +1,109 @@
1// coptright Mon 10-21-2002 01:14:03 by L. Potter <ljp@llornkcor.com> 1// coptright Mon 10-21-2002 01:14:03 by L. Potter <ljp@llornkcor.com>
2 2
3#include <qpe/qpeapplication.h> 3#include <qpe/qpeapplication.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6 6
7#include "restart.h" 7#include "restart.h"
8 8
9// #include <stdlib.h> 9// #include <stdlib.h>
10// #include <unistd.h> 10// #include <unistd.h>
11// #include <sys/stat.h> 11// #include <sys/stat.h>
12//#include <dirent.h> 12//#include <dirent.h>
13/* XPM */ 13/* XPM */
14static char *restart_xpm[] = { 14static char *restart_xpm[] = {
15"16 16 11 1", 15"16 16 11 1",
16" c None", 16" c None",
17". c #000000", 17". c #000000",
18"+ c #DCDCDC", 18"+ c #DCDCDC",
19"@ c #A0A0A0", 19"@ c #A0A0A0",
20"# c #C3C3C3", 20"# c #C3C3C3",
21"$ c #808080", 21"$ c #808080",
22"% c #FFA858", 22"% c #FFA858",
23"& c #FFDCA8", 23"& c #FFDCA8",
24"* c #FFFFC0", 24"* c #FFFFC0",
25"= c #FFFFFF", 25"= c #FFFFFF",
26"- c #585858", 26"- c #585858",
27" .. ", 27" .. ",
28" .. .++. .. ", 28" .. .++. .. ",
29" .+@.@##@.@+. ", 29" .+@.@##@.@+. ",
30" .@+$@%%@$+@. ", 30" .@+$@%%@$+@. ",
31" .$%%&%&%$. ", 31" .$%%&%&%$. ",
32" ..+@%&$$%&@+.. ", 32" ..+@%&$$%&@+.. ",
33".+#@%&%@@&*%@#+.", 33".+#@%&%@@&*%@#+.",
34".$@+$&*&&=*$+@$.", 34".$@+$&*&&=*$+@$.",
35" .--+$&*=&$+--. ", 35" .--+$&*=&$+--. ",
36" .$#++$$++#$. ", 36" .$#++$$++#$. ",
37" .@=$-$++$-$=@. ", 37" .@=$-$++$-$=@. ",
38" .+@-..@@..-@+. ", 38" .+@-..@@..-@+. ",
39" ... .+=. ... ", 39" ... .+=. ... ",
40" .-$. ", 40" .-$. ",
41" .. ", 41" .. ",
42" "}; 42" "};
43 43
44RestartApplet::RestartApplet ( ) 44RestartApplet::RestartApplet ( )
45 : QObject ( 0, "RestartApplet" ), ref ( 0 ) 45 : QObject ( 0, "RestartApplet" ), ref ( 0 )
46{ 46{
47} 47}
48 48
49RestartApplet::~RestartApplet ( ) 49RestartApplet::~RestartApplet ( )
50{ 50{
51} 51}
52 52
53int RestartApplet::position ( ) const 53int RestartApplet::position ( ) const
54{ 54{
55 return 4; 55 return 4;
56} 56}
57 57
58QString RestartApplet::name ( ) const 58QString RestartApplet::name ( ) const
59{ 59{
60 return tr( "Restart" ); 60 return tr( "Restart" );
61} 61}
62 62
63QString RestartApplet::text ( ) const 63QString RestartApplet::text ( ) const
64{ 64{
65 return tr( "Restart Opie" ); 65 return tr( "Restart Opie" );
66} 66}
67 67
68QIconSet RestartApplet::icon ( ) const 68QIconSet RestartApplet::icon ( ) const
69{ 69{
70 QPixmap pix; 70 QPixmap pix;
71 QImage img = ( const char** ) restart_xpm ;//Resource::loadImage ( "Run" ); 71 QImage img = ( const char** ) restart_xpm ;//Resource::loadImage ( "Run" );
72 72
73 if ( !img. isNull ( )) 73 if ( !img. isNull ( ))
74 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 74 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
75 return pix; 75 return pix;
76} 76}
77 77
78QPopupMenu *RestartApplet::popup ( QWidget * ) const 78QPopupMenu *RestartApplet::popup ( QWidget * ) const
79{ 79{
80 return 0; 80 return 0;
81} 81}
82 82
83void RestartApplet::activated ( ) 83void RestartApplet::activated ( )
84{ 84{
85 QCopEnvelope e("QPE/System", "restart()"); 85 QCopEnvelope e("QPE/System", "restart()");
86} 86}
87 87
88 88
89QRESULT RestartApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 89QRESULT RestartApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
90{ 90{
91 *iface = 0; 91 *iface = 0;
92 if ( uuid == IID_QUnknown ) 92 if ( uuid == IID_QUnknown )
93 *iface = this; 93 *iface = this;
94 else if ( uuid == IID_MenuApplet ) 94 else if ( uuid == IID_MenuApplet )
95 *iface = this; 95 *iface = this;
96 else
97 return QS_FALSE;
96 98
97 if ( *iface ) 99 if ( *iface )
98 (*iface)-> addRef ( ); 100 (*iface)-> addRef ( );
99 return QS_OK; 101 return QS_OK;
100} 102}
101 103
102Q_EXPORT_INTERFACE( ) 104Q_EXPORT_INTERFACE( )
103{ 105{
104 Q_CREATE_INSTANCE( RestartApplet ) 106 Q_CREATE_INSTANCE( RestartApplet )
105} 107}
106 108
107 109
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index 906063e..b676c74 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -53,202 +53,204 @@ RotateApplet::RotateApplet()
53#if !defined(QT_NO_COP) 53#if !defined(QT_NO_COP)
54 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); 54 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this );
55 connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 55 connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
56 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 56 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
57#endif 57#endif
58 58
59} 59}
60 60
61RotateApplet::~RotateApplet ( ) 61RotateApplet::~RotateApplet ( )
62{} 62{}
63 63
64/** 64/**
65 * Qcop receive method. 65 * Qcop receive method.
66 */ 66 */
67void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) 67void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data )
68{ 68{
69 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg ); 69 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg );
70 70
71 if ( ODevice::inst()->hasHingeSensor() ) 71 if ( ODevice::inst()->hasHingeSensor() )
72 { 72 {
73 struct timespec interval; 73 struct timespec interval;
74 struct timespec remain; 74 struct timespec remain;
75 interval.tv_sec = 0; 75 interval.tv_sec = 0;
76 interval.tv_nsec = 600000; 76 interval.tv_nsec = 600000;
77 ::nanosleep( &interval, &remain ); 77 ::nanosleep( &interval, &remain );
78 OHingeStatus status = ODevice::inst()->readHingeSensor(); 78 OHingeStatus status = ODevice::inst()->readHingeSensor();
79 qDebug( "RotateApplet::readHingeSensor = %d", (int) status ); 79 qDebug( "RotateApplet::readHingeSensor = %d", (int) status );
80 80
81 Config cfg( "apm" ); 81 Config cfg( "apm" );
82 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); 82 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" );
83 int action = cfg.readNumEntry( "CloseHingeAction", 0 ); 83 int action = cfg.readNumEntry( "CloseHingeAction", 0 );
84 84
85 if ( status == CASE_CLOSED ) 85 if ( status == CASE_CLOSED )
86 { 86 {
87 switch ( action ) 87 switch ( action )
88 { 88 {
89 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break; 89 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break;
90 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break; 90 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break;
91 default: /* IGNORE */ break; 91 default: /* IGNORE */ break;
92 } 92 }
93 } 93 }
94 else /* status != CASE_CLOSED */ 94 else /* status != CASE_CLOSED */
95 { 95 {
96 switch ( action ) 96 switch ( action )
97 { 97 {
98 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break; 98 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break;
99 case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break; 99 case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break;
100 default: /* IGNORE */ break; 100 default: /* IGNORE */ break;
101 } 101 }
102 } 102 }
103 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) ); 103 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) );
104 } 104 }
105 105
106 QDataStream stream( data, IO_ReadOnly ); 106 QDataStream stream( data, IO_ReadOnly );
107 if ( msg == "flip()" ) 107 if ( msg == "flip()" )
108 { 108 {
109 activated ( ); 109 activated ( );
110 } 110 }
111 else if ( msg == "rotateDefault()") 111 else if ( msg == "rotateDefault()")
112 { 112 {
113 rotateDefault(); 113 rotateDefault();
114 } 114 }
115} 115}
116 116
117int RotateApplet::position() const 117int RotateApplet::position() const
118{ 118{
119 return 3; 119 return 3;
120} 120}
121 121
122QString RotateApplet::name() const 122QString RotateApplet::name() const
123{ 123{
124 return tr( "Rotate shortcut" ); 124 return tr( "Rotate shortcut" );
125} 125}
126 126
127QString RotateApplet::text() const 127QString RotateApplet::text() const
128{ 128{
129 return tr( "Rotate" ); 129 return tr( "Rotate" );
130} 130}
131 131
132/*QString RotateApplet::tr( const char* s ) const 132/*QString RotateApplet::tr( const char* s ) const
133{ 133{
134 return qApp->translate( "RotateApplet", s, 0 ); 134 return qApp->translate( "RotateApplet", s, 0 );
135} 135}
136 136
137QString RotateApplet::tr( const char* s, const char* p ) const 137QString RotateApplet::tr( const char* s, const char* p ) const
138{ 138{
139 return qApp->translate( "RotateApplet", s, p ); 139 return qApp->translate( "RotateApplet", s, p );
140} 140}
141*/ 141*/
142 142
143QIconSet RotateApplet::icon() const 143QIconSet RotateApplet::icon() const
144{ 144{
145 QPixmap pix; 145 QPixmap pix;
146 QImage img = Resource::loadImage( "Rotation" ); 146 QImage img = Resource::loadImage( "Rotation" );
147 if ( !img.isNull() ) 147 if ( !img.isNull() )
148 pix.convertFromImage( img.smoothScale( 14, 14 ) ); 148 pix.convertFromImage( img.smoothScale( 14, 14 ) );
149 return pix; 149 return pix;
150} 150}
151 151
152QPopupMenu* RotateApplet::popup(QWidget*) const 152QPopupMenu* RotateApplet::popup(QWidget*) const
153{ 153{
154 return 0; 154 return 0;
155} 155}
156 156
157void RotateApplet::rotateDefault() 157void RotateApplet::rotateDefault()
158{ 158{
159 int rot = ODevice::inst()->rotation(); 159 int rot = ODevice::inst()->rotation();
160 160
161 switch (rot) 161 switch (rot)
162 { 162 {
163 case Rot0: rot=0; break; 163 case Rot0: rot=0; break;
164 case Rot90: rot=90; break; 164 case Rot90: rot=90; break;
165 case Rot180: rot=180; break; 165 case Rot180: rot=180; break;
166 case Rot270: rot=270; break; 166 case Rot270: rot=270; break;
167 default: rot=0; break; 167 default: rot=0; break;
168 } 168 }
169 169
170 Config cfg( "qpe" ); 170 Config cfg( "qpe" );
171 cfg.setGroup( "Appearance" ); 171 cfg.setGroup( "Appearance" );
172 172
173 bool rotateEnabled = cfg.readBoolEntry( "rotateEnabled",true ); 173 bool rotateEnabled = cfg.readBoolEntry( "rotateEnabled",true );
174 174
175 if ( !rotateEnabled) return; 175 if ( !rotateEnabled) return;
176 176
177 // hide inputs methods before rotation 177 // hide inputs methods before rotation
178 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); 178 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" );
179 179
180 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); 180 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" );
181 env << rot; 181 env << rot;
182 182
183 m_flipped = false; 183 m_flipped = false;
184 184
185} 185}
186void RotateApplet::activated() 186void RotateApplet::activated()
187{ 187{
188 int defaultRotation = QPEApplication::defaultRotation(); 188 int defaultRotation = QPEApplication::defaultRotation();
189 int newRotation = defaultRotation; 189 int newRotation = defaultRotation;
190 190
191 Config cfg( "qpe" ); 191 Config cfg( "qpe" );
192 cfg.setGroup( "Appearance" ); 192 cfg.setGroup( "Appearance" );
193 193
194 int rotDirection = cfg.readNumEntry( "rotatedir" ); 194 int rotDirection = cfg.readNumEntry( "rotatedir" );
195 ODirection rot = CW; 195 ODirection rot = CW;
196 196
197 if (rotDirection == -1) 197 if (rotDirection == -1)
198 { 198 {
199 rot = ODevice::inst()->direction(); 199 rot = ODevice::inst()->direction();
200 } 200 }
201 else 201 else
202 { 202 {
203 rot = (ODirection) rotDirection; 203 rot = (ODirection) rotDirection;
204 } 204 }
205 205
206 // hide inputs methods before rotation 206 // hide inputs methods before rotation
207 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); 207 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" );
208 208
209 if ( m_flipped ) 209 if ( m_flipped )
210 { 210 {
211 // if flipped, flip back to the original state, 211 // if flipped, flip back to the original state,
212 // regardless of rotation direction 212 // regardless of rotation direction
213 newRotation = defaultRotation; 213 newRotation = defaultRotation;
214 } 214 }
215 else 215 else
216 { 216 {
217 if ( rot == CCW ) 217 if ( rot == CCW )
218 { 218 {
219 newRotation = ( defaultRotation + 90 ) % 360; 219 newRotation = ( defaultRotation + 90 ) % 360;
220 } 220 }
221 else if ( rot == CW ) 221 else if ( rot == CW )
222 { 222 {
223 newRotation = ( defaultRotation + 270 ) % 360; 223 newRotation = ( defaultRotation + 270 ) % 360;
224 } 224 }
225 else if ( rot == Flip ) 225 else if ( rot == Flip )
226 { 226 {
227 newRotation = ( defaultRotation + 180 ) % 360; 227 newRotation = ( defaultRotation + 180 ) % 360;
228 } 228 }
229 } 229 }
230 230
231 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); 231 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" );
232 env << newRotation; 232 env << newRotation;
233 233
234 m_flipped = !m_flipped; 234 m_flipped = !m_flipped;
235} 235}
236 236
237 237
238QRESULT RotateApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 238QRESULT RotateApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
239{ 239{
240 *iface = 0; 240 *iface = 0;
241 if ( uuid == IID_QUnknown ) 241 if ( uuid == IID_QUnknown )
242 *iface = this; 242 *iface = this;
243 else if ( uuid == IID_MenuApplet ) 243 else if ( uuid == IID_MenuApplet )
244 *iface = this; 244 *iface = this;
245 else
246 return QS_FALSE;
245 247
246 if ( *iface ) 248 if ( *iface )
247 (*iface)->addRef(); 249 (*iface)->addRef();
248 return QS_OK; 250 return QS_OK;
249} 251}
250 252
251Q_EXPORT_INTERFACE() 253Q_EXPORT_INTERFACE()
252{ 254{
253 Q_CREATE_INSTANCE( RotateApplet ) 255 Q_CREATE_INSTANCE( RotateApplet )
254} 256}
diff --git a/core/applets/screenshotapplet/screenshotappletimpl.cpp b/core/applets/screenshotapplet/screenshotappletimpl.cpp
index a537162..4a7512e 100644
--- a/core/applets/screenshotapplet/screenshotappletimpl.cpp
+++ b/core/applets/screenshotapplet/screenshotappletimpl.cpp
@@ -1,64 +1,66 @@
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#include "screenshot.h" 20#include "screenshot.h"
21#include "screenshotappletimpl.h" 21#include "screenshotappletimpl.h"
22 22
23 23
24ScreenshotAppletImpl::ScreenshotAppletImpl() 24ScreenshotAppletImpl::ScreenshotAppletImpl()
25 : screenshot(0), ref(0) 25 : screenshot(0), ref(0)
26{ 26{
27} 27}
28 28
29ScreenshotAppletImpl::~ScreenshotAppletImpl() 29ScreenshotAppletImpl::~ScreenshotAppletImpl()
30{ 30{
31 delete screenshot; 31 delete screenshot;
32} 32}
33 33
34QWidget *ScreenshotAppletImpl::applet( QWidget *parent ) 34QWidget *ScreenshotAppletImpl::applet( QWidget *parent )
35{ 35{
36 if ( !screenshot ) 36 if ( !screenshot )
37 screenshot = new ScreenshotApplet( parent ); 37 screenshot = new ScreenshotApplet( parent );
38 return screenshot; 38 return screenshot;
39} 39}
40 40
41int ScreenshotAppletImpl::position() const 41int ScreenshotAppletImpl::position() const
42{ 42{
43 return 6; 43 return 6;
44} 44}
45 45
46QRESULT ScreenshotAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 46QRESULT ScreenshotAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
47{ 47{
48 *iface = 0; 48 *iface = 0;
49 if ( uuid == IID_QUnknown ) 49 if ( uuid == IID_QUnknown )
50 *iface = this; 50 *iface = this;
51 else if ( uuid == IID_TaskbarApplet ) 51 else if ( uuid == IID_TaskbarApplet )
52 *iface = this; 52 *iface = this;
53 53 else
54 return QS_FALSE;
55
54 if ( *iface ) 56 if ( *iface )
55 (*iface)->addRef(); 57 (*iface)->addRef();
56 return QS_OK; 58 return QS_OK;
57} 59}
58 60
59Q_EXPORT_INTERFACE() 61Q_EXPORT_INTERFACE()
60{ 62{
61 Q_CREATE_INSTANCE( ScreenshotAppletImpl ) 63 Q_CREATE_INSTANCE( ScreenshotAppletImpl )
62} 64}
63 65
64 66
diff --git a/core/applets/suspendapplet/suspend.cpp b/core/applets/suspendapplet/suspend.cpp
index 4bdc8fb..63f16b8 100644
--- a/core/applets/suspendapplet/suspend.cpp
+++ b/core/applets/suspendapplet/suspend.cpp
@@ -1,85 +1,87 @@
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 7
8#include "suspend.h" 8#include "suspend.h"
9 9
10 10
11SuspendApplet::SuspendApplet ( ) 11SuspendApplet::SuspendApplet ( )
12 : QObject ( 0, "SuspendApplet" ), ref ( 0 ) 12 : QObject ( 0, "SuspendApplet" ), ref ( 0 )
13{ 13{
14} 14}
15 15
16SuspendApplet::~SuspendApplet ( ) 16SuspendApplet::~SuspendApplet ( )
17{ 17{
18} 18}
19 19
20int SuspendApplet::position ( ) const 20int SuspendApplet::position ( ) const
21{ 21{
22 return 2; 22 return 2;
23} 23}
24 24
25QString SuspendApplet::name ( ) const 25QString SuspendApplet::name ( ) const
26{ 26{
27 return tr( "Suspend shortcut" ); 27 return tr( "Suspend shortcut" );
28} 28}
29 29
30QString SuspendApplet::text ( ) const 30QString SuspendApplet::text ( ) const
31{ 31{
32 return tr( "Suspend" ); 32 return tr( "Suspend" );
33} 33}
34 34
35QString SuspendApplet::tr( const char* s ) const 35QString SuspendApplet::tr( const char* s ) const
36{ 36{
37 return qApp->translate( "SuspendApplet", s, 0 ); 37 return qApp->translate( "SuspendApplet", s, 0 );
38} 38}
39 39
40QString SuspendApplet::tr( const char* s, const char* p ) const 40QString SuspendApplet::tr( const char* s, const char* p ) const
41{ 41{
42 return qApp->translate( "SuspendApplet", s, p ); 42 return qApp->translate( "SuspendApplet", s, p );
43} 43}
44 44
45QIconSet SuspendApplet::icon ( ) const 45QIconSet SuspendApplet::icon ( ) const
46{ 46{
47 QPixmap pix; 47 QPixmap pix;
48 QImage img = Resource::loadImage ( "suspend" ); 48 QImage img = Resource::loadImage ( "suspend" );
49 49
50 if ( !img. isNull ( )) 50 if ( !img. isNull ( ))
51 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 51 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
52 return pix; 52 return pix;
53} 53}
54 54
55QPopupMenu *SuspendApplet::popup ( QWidget * ) const 55QPopupMenu *SuspendApplet::popup ( QWidget * ) const
56{ 56{
57 return 0; 57 return 0;
58} 58}
59 59
60void SuspendApplet::activated ( ) 60void SuspendApplet::activated ( )
61{ 61{
62 // suspend 62 // suspend
63 QCopEnvelope ( "QPE/System", "suspend()" ); 63 QCopEnvelope ( "QPE/System", "suspend()" );
64} 64}
65 65
66 66
67QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 67QRESULT SuspendApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
68{ 68{
69 *iface = 0; 69 *iface = 0;
70 if ( uuid == IID_QUnknown ) 70 if ( uuid == IID_QUnknown )
71 *iface = this; 71 *iface = this;
72 else if ( uuid == IID_MenuApplet ) 72 else if ( uuid == IID_MenuApplet )
73 *iface = this; 73 *iface = this;
74 else
75 return QS_FALSE;
74 76
75 if ( *iface ) 77 if ( *iface )
76 (*iface)-> addRef ( ); 78 (*iface)-> addRef ( );
77 return QS_OK; 79 return QS_OK;
78} 80}
79 81
80Q_EXPORT_INTERFACE( ) 82Q_EXPORT_INTERFACE( )
81{ 83{
82 Q_CREATE_INSTANCE( SuspendApplet ) 84 Q_CREATE_INSTANCE( SuspendApplet )
83} 85}
84 86
85 87
diff --git a/core/applets/vmemo/vmemoimpl.cpp b/core/applets/vmemo/vmemoimpl.cpp
index ef4a3a6..71d47e5 100644
--- a/core/applets/vmemo/vmemoimpl.cpp
+++ b/core/applets/vmemo/vmemoimpl.cpp
@@ -1,59 +1,61 @@
1/**************************************************************************************94x78** 1/**************************************************************************************94x78**
2 ** 2 **
3 ** This file may be distributed and/or modified under the terms of the 3 ** This file may be distributed and/or modified under the terms of the
4 ** GNU General Public License version 2 as published by the Free Software 4 ** GNU General Public License version 2 as published by the Free Software
5 ** Foundation and appearing in the file LICENSE.GPL included in the 5 ** Foundation and appearing in the file LICENSE.GPL included in the
6 ** packaging of this file. 6 ** packaging of this file.
7 ** 7 **
8 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 ** 10 **
11 *********************************************************************************************/ 11 *********************************************************************************************/
12 12
13/* 13/*
14 * $Id$ 14 * $Id$
15 */ 15 */
16 16
17#include "vmemo.h" 17#include "vmemo.h"
18#include "vmemoimpl.h" 18#include "vmemoimpl.h"
19 19
20 20
21VMemoAppletImpl::VMemoAppletImpl() 21VMemoAppletImpl::VMemoAppletImpl()
22 : vmemo(0), ref(0) 22 : vmemo(0), ref(0)
23{ 23{
24} 24}
25 25
26VMemoAppletImpl::~VMemoAppletImpl() 26VMemoAppletImpl::~VMemoAppletImpl()
27{ 27{
28 delete vmemo; 28 delete vmemo;
29} 29}
30 30
31QWidget *VMemoAppletImpl::applet( QWidget *parent ) 31QWidget *VMemoAppletImpl::applet( QWidget *parent )
32{ 32{
33 if ( !vmemo ) 33 if ( !vmemo )
34 vmemo = new VMemo( parent ); 34 vmemo = new VMemo( parent );
35 return vmemo; 35 return vmemo;
36} 36}
37 37
38int VMemoAppletImpl::position() const 38int VMemoAppletImpl::position() const
39{ 39{
40 return 6; 40 return 6;
41} 41}
42 42
43QRESULT VMemoAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 43QRESULT VMemoAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
44{ 44{
45 *iface = 0; 45 *iface = 0;
46 if ( uuid == IID_QUnknown ) 46 if ( uuid == IID_QUnknown )
47 *iface = this; 47 *iface = this;
48 else if ( uuid == IID_TaskbarApplet ) 48 else if ( uuid == IID_TaskbarApplet )
49 *iface = this; 49 *iface = this;
50 else
51 return QS_FALSE;
50 52
51 if ( *iface ) 53 if ( *iface )
52 (*iface)->addRef(); 54 (*iface)->addRef();
53 return QS_OK; 55 return QS_OK;
54} 56}
55 57
56Q_EXPORT_INTERFACE() 58Q_EXPORT_INTERFACE()
57{ 59{
58 Q_CREATE_INSTANCE( VMemoAppletImpl ) 60 Q_CREATE_INSTANCE( VMemoAppletImpl )
59 } 61 }
diff --git a/core/applets/volumeapplet/volumeappletimpl.cpp b/core/applets/volumeapplet/volumeappletimpl.cpp
index 47506cc..80b3e74 100644
--- a/core/applets/volumeapplet/volumeappletimpl.cpp
+++ b/core/applets/volumeapplet/volumeappletimpl.cpp
@@ -1,65 +1,67 @@
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#include "volume.h" 20#include "volume.h"
21#include "volumeappletimpl.h" 21#include "volumeappletimpl.h"
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24 24
25VolumeAppletImpl::VolumeAppletImpl() 25VolumeAppletImpl::VolumeAppletImpl()
26 : volume(0), ref(0) 26 : volume(0), ref(0)
27{ 27{
28} 28}
29 29
30VolumeAppletImpl::~VolumeAppletImpl() 30VolumeAppletImpl::~VolumeAppletImpl()
31{ 31{
32 delete volume; 32 delete volume;
33} 33}
34 34
35QWidget *VolumeAppletImpl::applet( QWidget *parent ) 35QWidget *VolumeAppletImpl::applet( QWidget *parent )
36{ 36{
37 if ( !volume ) 37 if ( !volume )
38 volume = new VolumeApplet( parent ); 38 volume = new VolumeApplet( parent );
39 return volume; 39 return volume;
40} 40}
41 41
42int VolumeAppletImpl::position() const 42int VolumeAppletImpl::position() const
43{ 43{
44 return 6; 44 return 6;
45} 45}
46 46
47QRESULT VolumeAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 47QRESULT VolumeAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
48{ 48{
49 *iface = 0; 49 *iface = 0;
50 if ( uuid == IID_QUnknown ) 50 if ( uuid == IID_QUnknown )
51 *iface = this; 51 *iface = this;
52 else if ( uuid == IID_TaskbarApplet ) 52 else if ( uuid == IID_TaskbarApplet )
53 *iface = this; 53 *iface = this;
54 else
55 return QS_FALSE;
54 56
55 if ( *iface ) 57 if ( *iface )
56 (*iface)->addRef(); 58 (*iface)->addRef();
57 return QS_OK; 59 return QS_OK;
58} 60}
59 61
60Q_EXPORT_INTERFACE() 62Q_EXPORT_INTERFACE()
61{ 63{
62 Q_CREATE_INSTANCE( VolumeAppletImpl ) 64 Q_CREATE_INSTANCE( VolumeAppletImpl )
63} 65}
64 66
65 67
diff --git a/core/applets/vtapplet/vt.cpp b/core/applets/vtapplet/vt.cpp
index 4cc2d60..cdd3c97 100644
--- a/core/applets/vtapplet/vt.cpp
+++ b/core/applets/vtapplet/vt.cpp
@@ -1,162 +1,164 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** Contact me @ mickeyl@handhelds.org 4** Contact me @ mickeyl@handhelds.org
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**********************************************************************/ 14**********************************************************************/
15 15
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <qpe/qcopenvelope_qws.h> 17#include <qpe/qcopenvelope_qws.h>
18 18
19#include <qapplication.h> 19#include <qapplication.h>
20#include <qiconset.h> 20#include <qiconset.h>
21#include <qpopupmenu.h> 21#include <qpopupmenu.h>
22 22
23#include <fcntl.h> 23#include <fcntl.h>
24#include <unistd.h> 24#include <unistd.h>
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/stat.h> 26#include <sys/stat.h>
27#include <sys/ioctl.h> 27#include <sys/ioctl.h>
28#include <linux/vt.h> 28#include <linux/vt.h>
29 29
30#include "vt.h" 30#include "vt.h"
31 31
32VTApplet::VTApplet ( ) 32VTApplet::VTApplet ( )
33 : QObject ( 0, "VTApplet" ), ref ( 0 ) 33 : QObject ( 0, "VTApplet" ), ref ( 0 )
34{ 34{
35} 35}
36 36
37VTApplet::~VTApplet ( ) 37VTApplet::~VTApplet ( )
38{ 38{
39} 39}
40 40
41int VTApplet::position ( ) const 41int VTApplet::position ( ) const
42{ 42{
43 return 2; 43 return 2;
44} 44}
45 45
46QString VTApplet::name ( ) const 46QString VTApplet::name ( ) const
47{ 47{
48 return tr( "VT shortcut" ); 48 return tr( "VT shortcut" );
49} 49}
50 50
51QString VTApplet::text ( ) const 51QString VTApplet::text ( ) const
52{ 52{
53 return tr( "Terminal" ); 53 return tr( "Terminal" );
54} 54}
55 55
56/* 56/*
57QString VTApplet::tr( const char* s ) const 57QString VTApplet::tr( const char* s ) const
58{ 58{
59 return qApp->translate( "VTApplet", s, 0 ); 59 return qApp->translate( "VTApplet", s, 0 );
60} 60}
61 61
62QString VTApplet::tr( const char* s, const char* p ) const 62QString VTApplet::tr( const char* s, const char* p ) const
63{ 63{
64 return qApp->translate( "VTApplet", s, p ); 64 return qApp->translate( "VTApplet", s, p );
65} 65}
66*/ 66*/
67 67
68QIconSet VTApplet::icon ( ) const 68QIconSet VTApplet::icon ( ) const
69{ 69{
70 QPixmap pix; 70 QPixmap pix;
71 QImage img = Resource::loadImage ( "terminal" ); 71 QImage img = Resource::loadImage ( "terminal" );
72 72
73 if ( !img. isNull ( )) 73 if ( !img. isNull ( ))
74 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 74 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
75 return pix; 75 return pix;
76} 76}
77 77
78QPopupMenu *VTApplet::popup ( QWidget* parent ) const 78QPopupMenu *VTApplet::popup ( QWidget* parent ) const
79{ 79{
80 qDebug( "VTApplet::popup" ); 80 qDebug( "VTApplet::popup" );
81 81
82 struct vt_stat vtstat; 82 struct vt_stat vtstat;
83 int fd = ::open( "/dev/tty0", O_RDWR ); 83 int fd = ::open( "/dev/tty0", O_RDWR );
84 if ( fd == -1 ) return 0; 84 if ( fd == -1 ) return 0;
85 if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; 85 if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0;
86 86
87 submenu = new QPopupMenu( parent ); 87 submenu = new QPopupMenu( parent );
88 submenu->setCheckable( true ); 88 submenu->setCheckable( true );
89 for ( int i = 1; i < 10; ++i ) 89 for ( int i = 1; i < 10; ++i )
90 { 90 {
91 int id = submenu->insertItem( QString::number( i ), 500+i ); 91 int id = submenu->insertItem( QString::number( i ), 500+i );
92 submenu->setItemChecked( id, id-500 == vtstat.v_active ); 92 submenu->setItemChecked( id, id-500 == vtstat.v_active );
93 } 93 }
94 ::close( fd ); 94 ::close( fd );
95 95
96 connect( submenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) ); 96 connect( submenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) );
97 connect( submenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) ); 97 connect( submenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) );
98 98
99 return submenu; 99 return submenu;
100} 100}
101 101
102 102
103void VTApplet::changeVT( int index ) 103void VTApplet::changeVT( int index )
104{ 104{
105 //qDebug( "VTApplet::changeVT( %d )", index-500 ); 105 //qDebug( "VTApplet::changeVT( %d )", index-500 );
106 106
107 int fd = ::open("/dev/tty0", O_RDWR); 107 int fd = ::open("/dev/tty0", O_RDWR);
108 if ( fd == -1 ) return; 108 if ( fd == -1 ) return;
109 ioctl( fd, VT_ACTIVATE, index-500 ); 109 ioctl( fd, VT_ACTIVATE, index-500 );
110} 110}
111 111
112 112
113void VTApplet::updateMenu() 113void VTApplet::updateMenu()
114{ 114{
115 //qDebug( "VTApplet::updateMenu()" ); 115 //qDebug( "VTApplet::updateMenu()" );
116 116
117 int fd = ::open( "/dev/console", O_RDONLY ); 117 int fd = ::open( "/dev/console", O_RDONLY );
118 if ( fd == -1 ) return; 118 if ( fd == -1 ) return;
119 119
120 for ( int i = 1; i < 10; ++i ) 120 for ( int i = 1; i < 10; ++i )
121 { 121 {
122 int result = ioctl( fd, VT_DISALLOCATE, i ); 122 int result = ioctl( fd, VT_DISALLOCATE, i );
123 123
124 /* 124 /*
125 if ( result == -1 ) 125 if ( result == -1 )
126 qDebug( "VT %d disallocated == free", i ); 126 qDebug( "VT %d disallocated == free", i );
127 else 127 else
128 qDebug( "VT %d _not_ disallocated == busy", i ); 128 qDebug( "VT %d _not_ disallocated == busy", i );
129 */ 129 */
130 130
131 submenu->setItemEnabled( 500+i, result == -1 ); 131 submenu->setItemEnabled( 500+i, result == -1 );
132 } 132 }
133 133
134 ::close( fd ); 134 ::close( fd );
135} 135}
136 136
137 137
138void VTApplet::activated() 138void VTApplet::activated()
139{ 139{
140 qDebug( "VTApplet::activated()" ); 140 qDebug( "VTApplet::activated()" );
141} 141}
142 142
143 143
144QRESULT VTApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 144QRESULT VTApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
145{ 145{
146 *iface = 0; 146 *iface = 0;
147 if ( uuid == IID_QUnknown ) 147 if ( uuid == IID_QUnknown )
148 *iface = this; 148 *iface = this;
149 else if ( uuid == IID_MenuApplet ) 149 else if ( uuid == IID_MenuApplet )
150 *iface = this; 150 *iface = this;
151 else
152 return QS_FALSE;
151 153
152 if ( *iface ) 154 if ( *iface )
153 (*iface)-> addRef ( ); 155 (*iface)-> addRef ( );
154 return QS_OK; 156 return QS_OK;
155} 157}
156 158
157Q_EXPORT_INTERFACE( ) 159Q_EXPORT_INTERFACE( )
158{ 160{
159 Q_CREATE_INSTANCE( VTApplet ) 161 Q_CREATE_INSTANCE( VTApplet )
160} 162}
161 163
162 164
diff --git a/core/obex/obeximpl.cpp b/core/obex/obeximpl.cpp
index 5bfc779..5b53644 100644
--- a/core/obex/obeximpl.cpp
+++ b/core/obex/obeximpl.cpp
@@ -1,30 +1,32 @@
1#include "obexhandler.h" 1#include "obexhandler.h"
2#include "obeximpl.h" 2#include "obeximpl.h"
3 3
4using namespace OpieObex; 4using namespace OpieObex;
5 5
6/* TRANSLATOR OpieObex::ObexImpl */ 6/* TRANSLATOR OpieObex::ObexImpl */
7 7
8ObexImpl::ObexImpl() { 8ObexImpl::ObexImpl() {
9 m_handler = new ObexHandler; 9 m_handler = new ObexHandler;
10} 10}
11ObexImpl::~ObexImpl() { 11ObexImpl::~ObexImpl() {
12 delete m_handler; 12 delete m_handler;
13} 13}
14QRESULT ObexImpl::queryInterface( const QUuid& uuid, QUnknownInterface **iface ) { 14QRESULT ObexImpl::queryInterface( const QUuid& uuid, QUnknownInterface **iface ) {
15 *iface = 0; 15 *iface = 0;
16 if ( uuid == IID_QUnknown ) { 16 if ( uuid == IID_QUnknown ) {
17 *iface = this; 17 *iface = this;
18 }else if ( uuid == IID_ObexInterface ) 18 }else if ( uuid == IID_ObexInterface )
19 *iface = this; 19 *iface = this;
20 else
21 return QS_FALSE;
20 22
21 if (*iface) 23 if (*iface)
22 (*iface)->addRef(); 24 (*iface)->addRef();
23 25
24 return QS_OK; 26 return QS_OK;
25} 27}
26 28
27 29
28Q_EXPORT_INTERFACE() { 30Q_EXPORT_INTERFACE() {
29 Q_CREATE_INSTANCE( ObexImpl ) 31 Q_CREATE_INSTANCE( ObexImpl )
30} 32}