summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-22 13:00:46 (UTC)
committer llornkcor <llornkcor>2002-05-22 13:00:46 (UTC)
commit492c5c3c07a192b3a00e76f227e40d98459db1aa (patch) (unidiff)
tree0c07a9c56b528d693ff14b4fc3e4cba4407a682b
parentd3466b66bd9189219b6dff7fd248169b5725a1b8 (diff)
downloadopie-492c5c3c07a192b3a00e76f227e40d98459db1aa.zip
opie-492c5c3c07a192b3a00e76f227e40d98459db1aa.tar.gz
opie-492c5c3c07a192b3a00e76f227e40d98459db1aa.tar.bz2
added #include custom-ipaq.h for ipaq builds for ipaq sounds
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp3
-rw-r--r--core/launcher/taskbar.cpp92
2 files changed, 51 insertions, 44 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 85ba160..649862b 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -1,235 +1,238 @@
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 20
21#include "desktop.h" 21#include "desktop.h"
22#include "info.h" 22#include "info.h"
23#include "launcher.h" 23#include "launcher.h"
24#include "mrulist.h" 24#include "mrulist.h"
25#include "qcopbridge.h" 25#include "qcopbridge.h"
26#include "shutdownimpl.h" 26#include "shutdownimpl.h"
27#include "startmenu.h" 27#include "startmenu.h"
28#include "taskbar.h" 28#include "taskbar.h"
29#include "transferserver.h" 29#include "transferserver.h"
30#include "irserver.h" 30#include "irserver.h"
31#include "packageslave.h" 31#include "packageslave.h"
32 32
33#include <qpe/applnk.h> 33#include <qpe/applnk.h>
34#include <qpe/mimetype.h> 34#include <qpe/mimetype.h>
35#include <qpe/password.h> 35#include <qpe/password.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/power.h> 37#include <qpe/power.h>
38#include <qpe/timeconversion.h> 38#include <qpe/timeconversion.h>
39#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
40#include <qpe/global.h> 40#include <qpe/global.h>
41#ifdef QT_QWS_CUSTOM 41#ifdef QT_QWS_CUSTOM
42#include "qpe/custom.h" 42#include "qpe/custom.h"
43#endif 43#endif
44#if defined(QT_QWS_IPAQ)
45#include "qpe/custom-ipaq.h"
46#endif
44 47
45#include <qgfx_qws.h> 48#include <qgfx_qws.h>
46#include <qmainwindow.h> 49#include <qmainwindow.h>
47#include <qmessagebox.h> 50#include <qmessagebox.h>
48#include <qtimer.h> 51#include <qtimer.h>
49#include <qwindowsystem_qws.h> 52#include <qwindowsystem_qws.h>
50 53
51#include <qvaluelist.h> 54#include <qvaluelist.h>
52 55
53#include <stdlib.h> 56#include <stdlib.h>
54#include <unistd.h> 57#include <unistd.h>
55 58
56class QCopKeyRegister 59class QCopKeyRegister
57{ 60{
58public: 61public:
59 QCopKeyRegister() : keyCode(0) { } 62 QCopKeyRegister() : keyCode(0) { }
60 QCopKeyRegister(int k, const QString &c, const QString &m) 63 QCopKeyRegister(int k, const QString &c, const QString &m)
61 : keyCode(k), channel(c), message(m) { } 64 : keyCode(k), channel(c), message(m) { }
62 65
63 int getKeyCode() const { return keyCode; } 66 int getKeyCode() const { return keyCode; }
64 QString getChannel() const { return channel; } 67 QString getChannel() const { return channel; }
65 QString getMessage() const { return message; } 68 QString getMessage() const { return message; }
66 69
67private: 70private:
68 int keyCode; 71 int keyCode;
69 QString channel, message; 72 QString channel, message;
70}; 73};
71 74
72typedef QValueList<QCopKeyRegister> KeyRegisterList; 75typedef QValueList<QCopKeyRegister> KeyRegisterList;
73KeyRegisterList keyRegisterList; 76KeyRegisterList keyRegisterList;
74 77
75static Desktop* qpedesktop = 0; 78static Desktop* qpedesktop = 0;
76static int loggedin=0; 79static int loggedin=0;
77static void login(bool at_poweron) 80static void login(bool at_poweron)
78{ 81{
79 if ( !loggedin ) { 82 if ( !loggedin ) {
80 Global::terminateBuiltin("calibrate"); 83 Global::terminateBuiltin("calibrate");
81 Password::authenticate(at_poweron); 84 Password::authenticate(at_poweron);
82 loggedin=1; 85 loggedin=1;
83 QCopEnvelope e( "QPE/Desktop", "unlocked()" ); 86 QCopEnvelope e( "QPE/Desktop", "unlocked()" );
84 } 87 }
85} 88}
86 89
87bool Desktop::screenLocked() 90bool Desktop::screenLocked()
88{ 91{
89 return loggedin == 0; 92 return loggedin == 0;
90} 93}
91 94
92/* 95/*
93 Priority is number of alerts that are needed to pop up 96 Priority is number of alerts that are needed to pop up
94 alert. 97 alert.
95 */ 98 */
96class DesktopPowerAlerter : public QMessageBox 99class DesktopPowerAlerter : public QMessageBox
97{ 100{
98public: 101public:
99 DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) 102 DesktopPowerAlerter( QWidget *parent, const char *name = 0 )
100 : QMessageBox( tr("Battery Status"), "Low Battery", 103 : QMessageBox( tr("Battery Status"), "Low Battery",
101 QMessageBox::Critical, 104 QMessageBox::Critical,
102 QMessageBox::Ok | QMessageBox::Default, 105 QMessageBox::Ok | QMessageBox::Default,
103 QMessageBox::NoButton, QMessageBox::NoButton, 106 QMessageBox::NoButton, QMessageBox::NoButton,
104 parent, name, FALSE ) 107 parent, name, FALSE )
105 { 108 {
106 currentPriority = INT_MAX; 109 currentPriority = INT_MAX;
107 alertCount = 0; 110 alertCount = 0;
108 } 111 }
109 112
110 void alert( const QString &text, int priority ); 113 void alert( const QString &text, int priority );
111 void hideEvent( QHideEvent * ); 114 void hideEvent( QHideEvent * );
112private: 115private:
113 int currentPriority; 116 int currentPriority;
114 int alertCount; 117 int alertCount;
115}; 118};
116 119
117void DesktopPowerAlerter::alert( const QString &text, int priority ) 120void DesktopPowerAlerter::alert( const QString &text, int priority )
118{ 121{
119 alertCount++; 122 alertCount++;
120 if ( alertCount < priority ) 123 if ( alertCount < priority )
121 return; 124 return;
122 if ( priority > currentPriority ) 125 if ( priority > currentPriority )
123 return; 126 return;
124 currentPriority = priority; 127 currentPriority = priority;
125 setText( text ); 128 setText( text );
126 show(); 129 show();
127} 130}
128 131
129 132
130void DesktopPowerAlerter::hideEvent( QHideEvent *e ) 133void DesktopPowerAlerter::hideEvent( QHideEvent *e )
131{ 134{
132 QMessageBox::hideEvent( e ); 135 QMessageBox::hideEvent( e );
133 alertCount = 0; 136 alertCount = 0;
134 currentPriority = INT_MAX; 137 currentPriority = INT_MAX;
135} 138}
136 139
137 140
138 141
139DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) 142DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
140 : QPEApplication( argc, argv, appType ) 143 : QPEApplication( argc, argv, appType )
141{ 144{
142 145
143 QTimer *t = new QTimer( this ); 146 QTimer *t = new QTimer( this );
144 connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); 147 connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) );
145 t->start( 10000 ); 148 t->start( 10000 );
146 ps = new PowerStatus; 149 ps = new PowerStatus;
147 pa = new DesktopPowerAlerter( 0 ); 150 pa = new DesktopPowerAlerter( 0 );
148 151
149 channel = new QCopChannel( "QPE/Desktop", this ); 152 channel = new QCopChannel( "QPE/Desktop", this );
150 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 153 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
151 this, SLOT(receive(const QCString&, const QByteArray&)) ); 154 this, SLOT(receive(const QCString&, const QByteArray&)) );
152} 155}
153 156
154 157
155DesktopApplication::~DesktopApplication() 158DesktopApplication::~DesktopApplication()
156{ 159{
157 delete ps; 160 delete ps;
158 delete pa; 161 delete pa;
159} 162}
160 163
161void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) 164void DesktopApplication::receive( const QCString &msg, const QByteArray &data )
162{ 165{
163 QDataStream stream( data, IO_ReadOnly ); 166 QDataStream stream( data, IO_ReadOnly );
164 if (msg == "keyRegister(int key, QString channel, QString message)") 167 if (msg == "keyRegister(int key, QString channel, QString message)")
165 { 168 {
166 int k; 169 int k;
167 QString c, m; 170 QString c, m;
168 171
169 stream >> k; 172 stream >> k;
170 stream >> c; 173 stream >> c;
171 stream >> m; 174 stream >> m;
172 175
173 qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); 176 qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m);
174 keyRegisterList.append(QCopKeyRegister(k,c,m)); 177 keyRegisterList.append(QCopKeyRegister(k,c,m));
175 } 178 }
176 else if (msg == "suspend()"){ 179 else if (msg == "suspend()"){
177 emit power(); 180 emit power();
178 } 181 }
179 182
180} 183}
181 184
182enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; 185enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown;
183 186
184#ifdef Q_WS_QWS 187#ifdef Q_WS_QWS
185bool DesktopApplication::qwsEventFilter( QWSEvent *e ) 188bool DesktopApplication::qwsEventFilter( QWSEvent *e )
186{ 189{
187 qpedesktop->checkMemory(); 190 qpedesktop->checkMemory();
188 191
189 if ( e->type == QWSEvent::Key ) { 192 if ( e->type == QWSEvent::Key ) {
190 QWSKeyEvent *ke = (QWSKeyEvent *)e; 193 QWSKeyEvent *ke = (QWSKeyEvent *)e;
191 if ( !loggedin && ke->simpleData.keycode != Key_F34 ) 194 if ( !loggedin && ke->simpleData.keycode != Key_F34 )
192 return TRUE; 195 return TRUE;
193 bool press = ke->simpleData.is_press; 196 bool press = ke->simpleData.is_press;
194 bool autoRepeat = ke ->simpleData.is_auto_repeat; 197 bool autoRepeat = ke ->simpleData.is_auto_repeat;
195 if (!keyRegisterList.isEmpty()) 198 if (!keyRegisterList.isEmpty())
196 { 199 {
197 KeyRegisterList::Iterator it; 200 KeyRegisterList::Iterator it;
198 for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) 201 for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it )
199 { 202 {
200 if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) 203 if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat)
201 QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); 204 QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8());
202 } 205 }
203 } 206 }
204 207
205 if ( !keyboardGrabbed() ) { 208 if ( !keyboardGrabbed() ) {
206 if ( ke->simpleData.keycode == Key_F9 ) { 209 if ( ke->simpleData.keycode == Key_F9 ) {
207 if ( press ) emit datebook(); 210 if ( press ) emit datebook();
208 return TRUE; 211 return TRUE;
209 } 212 }
210 if ( ke->simpleData.keycode == Key_F10 ) { 213 if ( ke->simpleData.keycode == Key_F10 ) {
211 if ( !press && cardSendTimer ) { 214 if ( !press && cardSendTimer ) {
212 emit contacts(); 215 emit contacts();
213 delete cardSendTimer; 216 delete cardSendTimer;
214 } else if ( press ) { 217 } else if ( press ) {
215 cardSendTimer = new QTimer(); 218 cardSendTimer = new QTimer();
216 cardSendTimer->start( 2000, TRUE ); 219 cardSendTimer->start( 2000, TRUE );
217 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); 220 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) );
218 } 221 }
219 return TRUE; 222 return TRUE;
220 } 223 }
221 /* menu key now opens application menu/toolbar 224 /* menu key now opens application menu/toolbar
222 if ( ke->simpleData.keycode == Key_F11 ) { 225 if ( ke->simpleData.keycode == Key_F11 ) {
223 if ( press ) emit menu(); 226 if ( press ) emit menu();
224 return TRUE; 227 return TRUE;
225 } 228 }
226 */ 229 */
227 if ( ke->simpleData.keycode == Key_F12 ) { 230 if ( ke->simpleData.keycode == Key_F12 ) {
228 while( activePopupWidget() ) 231 while( activePopupWidget() )
229 activePopupWidget()->close(); 232 activePopupWidget()->close();
230 if ( press ) emit launch(); 233 if ( press ) emit launch();
231 return TRUE; 234 return TRUE;
232 } 235 }
233 if ( ke->simpleData.keycode == Key_F13 ) { 236 if ( ke->simpleData.keycode == Key_F13 ) {
234 if ( press ) emit email(); 237 if ( press ) emit email();
235 return TRUE; 238 return TRUE;
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 18d28cb..54777c6 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,314 +1,318 @@
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 20
21#include "startmenu.h" 21#include "startmenu.h"
22#include "inputmethods.h" 22#include "inputmethods.h"
23#include "mrulist.h" 23#include "mrulist.h"
24#include "systray.h" 24#include "systray.h"
25#include "calibrate.h" 25#include "calibrate.h"
26#include "wait.h" 26#include "wait.h"
27#include "appicons.h" 27#include "appicons.h"
28 28
29#include "taskbar.h" 29#include "taskbar.h"
30#include "desktop.h" 30#include "desktop.h"
31 31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/global.h> 34#include <qpe/global.h>
35#ifdef QT_QWS_CUSTOM 35#ifdef QT_QWS_CUSTOM
36#include <qpe/custom.h> 36#include <qpe/custom.h>
37#endif 37#endif
38#if defined(QT_QWS_IPAQ)
39#include "qpe/custom-ipaq.h"
40#endif
41
38 42
39#include <qlabel.h> 43#include <qlabel.h>
40#include <qlayout.h> 44#include <qlayout.h>
41#include <qtimer.h> 45#include <qtimer.h>
42#include <qwindowsystem_qws.h> 46#include <qwindowsystem_qws.h>
43#include <qwidgetstack.h> 47#include <qwidgetstack.h>
44 48
45#if defined( Q_WS_QWS ) 49#if defined( Q_WS_QWS )
46#include <qwsdisplay_qws.h> 50#include <qwsdisplay_qws.h>
47#include <qgfx_qws.h> 51#include <qgfx_qws.h>
48#endif 52#endif
49 53
50 54
51#define FACTORY(T) \ 55#define FACTORY(T) \
52 static QWidget *new##T( bool maximized ) { \ 56 static QWidget *new##T( bool maximized ) { \
53 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 57 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
54 if ( maximized ) { \ 58 if ( maximized ) { \
55 if ( qApp->desktop()->width() <= 350 ) { \ 59 if ( qApp->desktop()->width() <= 350 ) { \
56 w->showMaximized(); \ 60 w->showMaximized(); \
57 } else { \ 61 } else { \
58 w->resize( QSize( 300, 300 ) ); \ 62 w->resize( QSize( 300, 300 ) ); \
59 } \ 63 } \
60 } \ 64 } \
61 w->show(); \ 65 w->show(); \
62 return w; \ 66 return w; \
63 } 67 }
64 68
65 69
66#ifdef SINGLE_APP 70#ifdef SINGLE_APP
67#define APP(a,b,c,d) FACTORY(b) 71#define APP(a,b,c,d) FACTORY(b)
68#include "../launcher/apps.h" 72#include "../launcher/apps.h"
69#undef APP 73#undef APP
70#endif // SINGLE_APP 74#endif // SINGLE_APP
71 75
72static Global::Command builtins[] = { 76static Global::Command builtins[] = {
73 77
74#ifdef SINGLE_APP 78#ifdef SINGLE_APP
75#define APP(a,b,c,d) { a, new##b, c }, 79#define APP(a,b,c,d) { a, new##b, c },
76#include "../launcher/apps.h" 80#include "../launcher/apps.h"
77#undef APP 81#undef APP
78#endif 82#endif
79 83
80#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) 84#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX)
81 { "calibrate", TaskBar::calibrate,1, 0 }, 85 { "calibrate", TaskBar::calibrate, 1, 0 },
82#endif 86#endif
83#if !defined(QT_QWS_CASSIOPEIA) 87#if !defined(QT_QWS_CASSIOPEIA)
84 { "shutdown", Global::shutdown, 1, 0 }, 88 { "shutdown", Global::shutdown, 1, 0 },
85 // { "run", run, 1, 0 }, 89// { "run", run, 1, 0 },
86#endif 90#endif
87 91
88 { 0, TaskBar::calibrate,0, 0 }, 92 { 0, TaskBar::calibrate, 0, 0 },
89}; 93};
90 94
91static bool initNumLock() 95static bool initNumLock()
92{ 96{
93#ifdef QPE_INITIAL_NUMLOCK_STATE 97#ifdef QPE_INITIAL_NUMLOCK_STATE
94 QPE_INITIAL_NUMLOCK_STATE 98 QPE_INITIAL_NUMLOCK_STATE
95#endif 99#endif
96 return FALSE; 100 return FALSE;
97} 101}
98 102
99class LockKeyState : public QWidget 103class LockKeyState : public QWidget
100{ 104{
101public: 105public:
102 LockKeyState( QWidget *parent ) : 106 LockKeyState( QWidget *parent ) :
103 QWidget(parent), 107 QWidget(parent),
104 nl(initNumLock()), cl(FALSE) 108 nl(initNumLock()), cl(FALSE)
105 { 109 {
106 nl_pm = Resource::loadPixmap("numlock"); 110 nl_pm = Resource::loadPixmap("numlock");
107 cl_pm = Resource::loadPixmap("capslock"); 111 cl_pm = Resource::loadPixmap("capslock");
108 } 112 }
109 QSize sizeHint() const 113 QSize sizeHint() const
110 { 114 {
111 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); 115 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
112 } 116 }
113 void toggleNumLockState() 117 void toggleNumLockState()
114 { 118 {
115 nl = !nl; repaint(); 119 nl = !nl; repaint();
116 } 120 }
117 void toggleCapsLockState() 121 void toggleCapsLockState()
118 { 122 {
119 cl = !cl; repaint(); 123 cl = !cl; repaint();
120 } 124 }
121 void paintEvent( QPaintEvent * ) 125 void paintEvent( QPaintEvent * )
122 { 126 {
123 int y = (height()-sizeHint().height())/2; 127 int y = (height()-sizeHint().height())/2;
124 QPainter p(this); 128 QPainter p(this);
125 if ( nl ) 129 if ( nl )
126 p.drawPixmap(1,y,nl_pm); 130 p.drawPixmap(1,y,nl_pm);
127 if ( cl ) 131 if ( cl )
128 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 132 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
129 } 133 }
130private: 134private:
131 QPixmap nl_pm, cl_pm; 135 QPixmap nl_pm, cl_pm;
132 bool nl, cl; 136 bool nl, cl;
133}; 137};
134 138
135TaskBar::~TaskBar() 139TaskBar::~TaskBar()
136{ 140{
137} 141}
138 142
139 143
140TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 144TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
141{ 145{
142 Global::setBuiltinCommands(builtins); 146 Global::setBuiltinCommands(builtins);
143 147
144 sm = new StartMenu( this ); 148 sm = new StartMenu( this );
145 149
146 inputMethods = new InputMethods( this ); 150 inputMethods = new InputMethods( this );
147 connect( inputMethods, SIGNAL(inputToggled(bool)), 151 connect( inputMethods, SIGNAL(inputToggled(bool)),
148 this, SLOT(calcMaxWindowRect()) ); 152 this, SLOT(calcMaxWindowRect()) );
149 //new QuickLauncher( this ); 153 //new QuickLauncher( this );
150 154
151 stack = new QWidgetStack( this ); 155 stack = new QWidgetStack( this );
152 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 156 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
153 label = new QLabel(stack); 157 label = new QLabel(stack);
154 158
155 mru = new MRUList( stack ); 159 mru = new MRUList( stack );
156 stack->raiseWidget( mru ); 160 stack->raiseWidget( mru );
157 161
158 waitIcon = new Wait( this ); 162 waitIcon = new Wait( this );
159 (void) new AppIcons( this ); 163 (void) new AppIcons( this );
160 164
161 sysTray = new SysTray( this ); 165 sysTray = new SysTray( this );
162 166
163 // ## make customizable in some way? 167 // ## make customizable in some way?
164#ifdef QT_QWS_CUSTOM 168#ifdef QT_QWS_CUSTOM
165 lockState = new LockKeyState( this ); 169 lockState = new LockKeyState( this );
166#else 170#else
167 lockState = 0; 171 lockState = 0;
168#endif 172#endif
169 173
170#if defined(Q_WS_QWS) 174#if defined(Q_WS_QWS)
171#if !defined(QT_NO_COP) 175#if !defined(QT_NO_COP)
172 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 176 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
173 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 177 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
174 this, SLOT(receive(const QCString&, const QByteArray&)) ); 178 this, SLOT(receive(const QCString&, const QByteArray&)) );
175#endif 179#endif
176#endif 180#endif
177 waitTimer = new QTimer( this ); 181 waitTimer = new QTimer( this );
178 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 182 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
179 clearer = new QTimer( this ); 183 clearer = new QTimer( this );
180 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 184 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
181 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); 185 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
182} 186}
183 187
184void TaskBar::setStatusMessage( const QString &text ) 188void TaskBar::setStatusMessage( const QString &text )
185{ 189{
186 label->setText( text ); 190 label->setText( text );
187 stack->raiseWidget( label ); 191 stack->raiseWidget( label );
188 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 192 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
189 sysTray->hide(); 193 sysTray->hide();
190 clearer->start( 3000 ); 194 clearer->start( 3000 );
191} 195}
192 196
193void TaskBar::clearStatusBar() 197void TaskBar::clearStatusBar()
194{ 198{
195 label->clear(); 199 label->clear();
196 stack->raiseWidget( mru ); 200 stack->raiseWidget( mru );
197} 201}
198 202
199void TaskBar::startWait() 203void TaskBar::startWait()
200{ 204{
201 waitIcon->setWaiting( true ); 205 waitIcon->setWaiting( true );
202 // a catchall stop after 10 seconds... 206 // a catchall stop after 10 seconds...
203 waitTimer->start( 10 * 1000, true ); 207 waitTimer->start( 10 * 1000, true );
204} 208}
205 209
206void TaskBar::stopWait(const QString& app) 210void TaskBar::stopWait(const QString& app)
207{ 211{
208 waitTimer->stop(); 212 waitTimer->stop();
209 mru->addTask(sm->execToLink(app)); 213 mru->addTask(sm->execToLink(app));
210 waitIcon->setWaiting( false ); 214 waitIcon->setWaiting( false );
211} 215}
212 216
213void TaskBar::stopWait() 217void TaskBar::stopWait()
214{ 218{
215 waitTimer->stop(); 219 waitTimer->stop();
216 waitIcon->setWaiting( false ); 220 waitIcon->setWaiting( false );
217} 221}
218 222
219void TaskBar::resizeEvent( QResizeEvent *e ) 223void TaskBar::resizeEvent( QResizeEvent *e )
220{ 224{
221 QHBox::resizeEvent( e ); 225 QHBox::resizeEvent( e );
222 calcMaxWindowRect(); 226 calcMaxWindowRect();
223} 227}
224 228
225void TaskBar::styleChange( QStyle &s ) 229void TaskBar::styleChange( QStyle &s )
226{ 230{
227 QHBox::styleChange( s ); 231 QHBox::styleChange( s );
228 calcMaxWindowRect(); 232 calcMaxWindowRect();
229} 233}
230 234
231void TaskBar::calcMaxWindowRect() 235void TaskBar::calcMaxWindowRect()
232{ 236{
233#ifdef Q_WS_QWS 237#ifdef Q_WS_QWS
234 QRect wr; 238 QRect wr;
235 int displayWidth = qApp->desktop()->width(); 239 int displayWidth = qApp->desktop()->width();
236 QRect ir = inputMethods->inputRect(); 240 QRect ir = inputMethods->inputRect();
237 if ( ir.isValid() ) { 241 if ( ir.isValid() ) {
238 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 242 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
239 } else { 243 } else {
240 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 244 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
241 } 245 }
242 246
243#if QT_VERSION < 300 247#if QT_VERSION < 300
244 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 248 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
245 QSize(qt_screen->width(),qt_screen->height())) 249 QSize(qt_screen->width(),qt_screen->height()))
246 ); 250 );
247#else 251#else
248 QWSServer::setMaxWindowRect( wr ); 252 QWSServer::setMaxWindowRect( wr );
249#endif 253#endif
250#endif 254#endif
251} 255}
252 256
253void TaskBar::receive( const QCString &msg, const QByteArray &data ) 257void TaskBar::receive( const QCString &msg, const QByteArray &data )
254{ 258{
255 QDataStream stream( data, IO_ReadOnly ); 259 QDataStream stream( data, IO_ReadOnly );
256 if ( msg == "message(QString)" ) { 260 if ( msg == "message(QString)" ) {
257 QString text; 261 QString text;
258 stream >> text; 262 stream >> text;
259 setStatusMessage( text ); 263 setStatusMessage( text );
260 } else if ( msg == "hideInputMethod()" ) { 264 } else if ( msg == "hideInputMethod()" ) {
261 inputMethods->hideInputMethod(); 265 inputMethods->hideInputMethod();
262 } else if ( msg == "showInputMethod()" ) { 266 } else if ( msg == "showInputMethod()" ) {
263 inputMethods->showInputMethod(); 267 inputMethods->showInputMethod();
264 } else if ( msg == "reloadInputMethods()" ) { 268 } else if ( msg == "reloadInputMethods()" ) {
265 inputMethods->loadInputMethods(); 269 inputMethods->loadInputMethods();
266 } else if ( msg == "reloadApplets()" ) { 270 } else if ( msg == "reloadApplets()" ) {
267 sysTray->loadApplets(); 271 sysTray->loadApplets();
268 } else if ( msg == "soundAlarm()" ) { 272 } else if ( msg == "soundAlarm()" ) {
269 Desktop::soundAlarm(); 273 Desktop::soundAlarm();
270 } 274 }
271#ifdef CUSTOM_LEDS 275#ifdef CUSTOM_LEDS
272 else if ( msg == "setLed(int,bool)" ) { 276 else if ( msg == "setLed(int,bool)" ) {
273 int led, status; 277 int led, status;
274 stream >> led >> status; 278 stream >> led >> status;
275 CUSTOM_LEDS( led, status ); 279 CUSTOM_LEDS( led, status );
276 } 280 }
277#endif 281#endif
278} 282}
279 283
280QWidget *TaskBar::calibrate(bool) 284QWidget *TaskBar::calibrate(bool)
281{ 285{
282#ifdef Q_WS_QWS 286#ifdef Q_WS_QWS
283 Calibrate *c = new Calibrate; 287 Calibrate *c = new Calibrate;
284 c->show(); 288 c->show();
285 return c; 289 return c;
286#else 290#else
287 return 0; 291 return 0;
288#endif 292#endif
289} 293}
290 294
291void TaskBar::toggleNumLockState() 295void TaskBar::toggleNumLockState()
292{ 296{
293 if ( lockState ) lockState->toggleNumLockState(); 297 if ( lockState ) lockState->toggleNumLockState();
294} 298}
295 299
296void TaskBar::toggleCapsLockState() 300void TaskBar::toggleCapsLockState()
297{ 301{
298 if ( lockState ) lockState->toggleCapsLockState(); 302 if ( lockState ) lockState->toggleCapsLockState();
299} 303}
300 304
301void TaskBar::toggleSymbolInput() 305void TaskBar::toggleSymbolInput()
302{ 306{
303 if ( inputMethods->currentShown() == "Unicode" ) { 307 if ( inputMethods->currentShown() == "Unicode" ) {
304 inputMethods->hideInputMethod(); 308 inputMethods->hideInputMethod();
305 } else { 309 } else {
306 inputMethods->showInputMethod("Unicode"); 310 inputMethods->showInputMethod("Unicode");
307 } 311 }
308} 312}
309 313
310bool TaskBar::recoverMemory() 314bool TaskBar::recoverMemory()
311{ 315{
312 return mru->quitOldApps(); 316 return mru->quitOldApps();
313} 317}
314 318