summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/taskbar.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 9f397eb..988d072 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,323 +1,323 @@
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 "runningappbar.h" 24#include "runningappbar.h"
25#include "systray.h" 25#include "systray.h"
26#include "calibrate.h" 26#include "calibrate.h"
27#include "wait.h" 27#include "wait.h"
28#include "appicons.h" 28#include "appicons.h"
29 29
30#include "taskbar.h" 30#include "taskbar.h"
31#include "desktop.h" 31#include "desktop.h"
32 32
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
35#include <qpe/global.h> 35#include <qpe/global.h>
36 36
37#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) 37#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
38#include <qpe/custom.h> 38#include <qpe/custom.h>
39#endif 39#endif
40 40
41#include <opie/odevice.h> 41#include <opie/odevice.h>
42 42
43#include <qlabel.h> 43#include <qlabel.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qtimer.h> 45#include <qtimer.h>
46#include <qwindowsystem_qws.h> 46#include <qwindowsystem_qws.h>
47#include <qwidgetstack.h> 47#include <qwidgetstack.h>
48 48
49#if defined( Q_WS_QWS ) 49#if defined( Q_WS_QWS )
50#include <qwsdisplay_qws.h> 50#include <qwsdisplay_qws.h>
51#include <qgfx_qws.h> 51#include <qgfx_qws.h>
52#endif 52#endif
53 53
54 54
55#define FACTORY(T) \ 55#define FACTORY(T) \
56 static QWidget *new##T( bool maximized ) { \ 56 static QWidget *new##T( bool maximized ) { \
57 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 57 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
58 if ( maximized ) { \ 58 if ( maximized ) { \
59 if ( qApp->desktop()->width() <= 350 ) { \ 59 if ( qApp->desktop()->width() <= 350 ) { \
60 w->showMaximized(); \ 60 w->showMaximized(); \
61 } else { \ 61 } else { \
62 w->resize( QSize( 300, 300 ) ); \ 62 w->resize( QSize( 300, 300 ) ); \
63 } \ 63 } \
64 } \ 64 } \
65 w->show(); \ 65 w->show(); \
66 return w; \ 66 return w; \
67 } 67 }
68 68
69 69
70#ifdef SINGLE_APP 70#ifdef SINGLE_APP
71#define APP(a,b,c,d) FACTORY(b) 71#define APP(a,b,c,d) FACTORY(b)
72#include "../launcher/apps.h" 72#include "../launcher/apps.h"
73#undef APP 73#undef APP
74#endif // SINGLE_APP 74#endif // SINGLE_APP
75 75
76static Global::Command builtins[] = { 76static Global::Command builtins[] = {
77 77
78#ifdef SINGLE_APP 78#ifdef SINGLE_APP
79#define APP(a,b,c,d) { a, new##b, c }, 79#define APP(a,b,c,d) { a, new##b, c },
80#include "../launcher/apps.h" 80#include "../launcher/apps.h"
81#undef APP 81#undef APP
82#endif 82#endif
83 83
84#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)
85 { "calibrate", TaskBar::calibrate, 1, 0 }, 85 { "calibrate", TaskBar::calibrate, 1, 0 },
86#endif 86#endif
87#if !defined(QT_QWS_CASSIOPEIA) 87#if !defined(QT_QWS_CASSIOPEIA)
88 { "shutdown", Global::shutdown, 1, 0 }, 88 { "shutdown", Global::shutdown, 1, 0 },
89// { "run", run, 1, 0 }, 89// { "run", run, 1, 0 },
90#endif 90#endif
91 91
92 { 0, TaskBar::calibrate, 0, 0 }, 92 { 0, TaskBar::calibrate, 0, 0 },
93}; 93};
94 94
95static bool initNumLock() 95static bool initNumLock()
96{ 96{
97#ifdef QPE_INITIAL_NUMLOCK_STATE 97#ifdef QPE_INITIAL_NUMLOCK_STATE
98 QPE_INITIAL_NUMLOCK_STATE 98 QPE_INITIAL_NUMLOCK_STATE
99#endif 99#endif
100 return FALSE; 100 return FALSE;
101} 101}
102 102
103class LockKeyState : public QWidget 103class LockKeyState : public QWidget
104{ 104{
105public: 105public:
106 LockKeyState( QWidget *parent ) : 106 LockKeyState( QWidget *parent ) :
107 QWidget(parent), 107 QWidget(parent),
108 nl(initNumLock()), cl(FALSE) 108 nl(initNumLock()), cl(FALSE)
109 { 109 {
110 nl_pm = Resource::loadPixmap("numlock"); 110 nl_pm = Resource::loadPixmap("numlock");
111 cl_pm = Resource::loadPixmap("capslock"); 111 cl_pm = Resource::loadPixmap("capslock");
112 } 112 }
113 QSize sizeHint() const 113 QSize sizeHint() const
114 { 114 {
115 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);
116 } 116 }
117 void toggleNumLockState() 117 void toggleNumLockState()
118 { 118 {
119 nl = !nl; repaint(); 119 nl = !nl; repaint();
120 } 120 }
121 void toggleCapsLockState() 121 void toggleCapsLockState()
122 { 122 {
123 cl = !cl; repaint(); 123 cl = !cl; repaint();
124 } 124 }
125 void paintEvent( QPaintEvent * ) 125 void paintEvent( QPaintEvent * )
126 { 126 {
127 int y = (height()-sizeHint().height())/2; 127 int y = (height()-sizeHint().height())/2;
128 QPainter p(this); 128 QPainter p(this);
129 if ( nl ) 129 if ( nl )
130 p.drawPixmap(1,y,nl_pm); 130 p.drawPixmap(1,y,nl_pm);
131 if ( cl ) 131 if ( cl )
132 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 132 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
133 } 133 }
134private: 134private:
135 QPixmap nl_pm, cl_pm; 135 QPixmap nl_pm, cl_pm;
136 bool nl, cl; 136 bool nl, cl;
137}; 137};
138 138
139TaskBar::~TaskBar() 139TaskBar::~TaskBar()
140{ 140{
141} 141}
142 142
143 143
144TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 144TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
145{ 145{
146 Global::setBuiltinCommands(builtins); 146 Global::setBuiltinCommands(builtins);
147 147
148 sm = new StartMenu( this ); 148 sm = new StartMenu( this );
149 149
150 inputMethods = new InputMethods( this ); 150 inputMethods = new InputMethods( this );
151 connect( inputMethods, SIGNAL(inputToggled(bool)), 151 connect( inputMethods, SIGNAL(inputToggled(bool)),
152 this, SLOT(calcMaxWindowRect()) ); 152 this, SLOT(calcMaxWindowRect()) );
153 //new QuickLauncher( this ); 153 //new QuickLauncher( this );
154 154
155 stack = new QWidgetStack( this ); 155 stack = new QWidgetStack( this );
156 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 156 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
157 label = new QLabel(stack); 157 label = new QLabel(stack);
158 158
159 //mru = new MRUList( stack ); 159 //mru = new MRUList( stack );
160 //stack->raiseWidget( mru ); 160 //stack->raiseWidget( mru );
161 161
162 runningAppBar = new RunningAppBar(stack); 162 runningAppBar = new RunningAppBar(stack);
163 stack->raiseWidget(runningAppBar); 163 stack->raiseWidget(runningAppBar);
164 164
165 waitIcon = new Wait( this ); 165 waitIcon = new Wait( this );
166 (void) new AppIcons( this ); 166 (void) new AppIcons( this );
167 167
168 sysTray = new SysTray( this ); 168 sysTray = new SysTray( this );
169 169
170 // ## make customizable in some way? 170 // ## make customizable in some way?
171#ifdef QT_QWS_CUSTOM 171#ifdef QT_QWS_CUSTOM
172 lockState = new LockKeyState( this ); 172 lockState = new LockKeyState( this );
173y#else 173#else
174 lockState = 0; 174 lockState = 0;
175#endif 175#endif
176 176
177#if defined(Q_WS_QWS) 177#if defined(Q_WS_QWS)
178#if !defined(QT_NO_COP) 178#if !defined(QT_NO_COP)
179 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 179 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
180 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 180 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
181 this, SLOT(receive(const QCString&, const QByteArray&)) ); 181 this, SLOT(receive(const QCString&, const QByteArray&)) );
182#endif 182#endif
183#endif 183#endif
184 waitTimer = new QTimer( this ); 184 waitTimer = new QTimer( this );
185 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 185 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
186 clearer = new QTimer( this ); 186 clearer = new QTimer( this );
187 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 187 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
188 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); 188 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
189} 189}
190 190
191void TaskBar::setStatusMessage( const QString &text ) 191void TaskBar::setStatusMessage( const QString &text )
192{ 192{
193 label->setText( text ); 193 label->setText( text );
194 stack->raiseWidget( label ); 194 stack->raiseWidget( label );
195 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 195 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
196 sysTray->hide(); 196 sysTray->hide();
197 clearer->start( 3000 ); 197 clearer->start( 3000 );
198} 198}
199 199
200void TaskBar::clearStatusBar() 200void TaskBar::clearStatusBar()
201{ 201{
202 label->clear(); 202 label->clear();
203 stack->raiseWidget(runningAppBar); 203 stack->raiseWidget(runningAppBar);
204 // stack->raiseWidget( mru ); 204 // stack->raiseWidget( mru );
205} 205}
206 206
207void TaskBar::startWait() 207void TaskBar::startWait()
208{ 208{
209 waitIcon->setWaiting( true ); 209 waitIcon->setWaiting( true );
210 // a catchall stop after 10 seconds... 210 // a catchall stop after 10 seconds...
211 waitTimer->start( 10 * 1000, true ); 211 waitTimer->start( 10 * 1000, true );
212} 212}
213 213
214void TaskBar::stopWait(const QString& app) 214void TaskBar::stopWait(const QString& app)
215{ 215{
216 waitTimer->stop(); 216 waitTimer->stop();
217 //mru->addTask(sm->execToLink(app)); 217 //mru->addTask(sm->execToLink(app));
218 waitIcon->setWaiting( false ); 218 waitIcon->setWaiting( false );
219} 219}
220 220
221void TaskBar::stopWait() 221void TaskBar::stopWait()
222{ 222{
223 waitTimer->stop(); 223 waitTimer->stop();
224 224
225 waitIcon->setWaiting( false ); 225 waitIcon->setWaiting( false );
226} 226}
227 227
228void TaskBar::resizeEvent( QResizeEvent *e ) 228void TaskBar::resizeEvent( QResizeEvent *e )
229{ 229{
230 QHBox::resizeEvent( e ); 230 QHBox::resizeEvent( e );
231 calcMaxWindowRect(); 231 calcMaxWindowRect();
232} 232}
233 233
234void TaskBar::styleChange( QStyle &s ) 234void TaskBar::styleChange( QStyle &s )
235{ 235{
236 QHBox::styleChange( s ); 236 QHBox::styleChange( s );
237 calcMaxWindowRect(); 237 calcMaxWindowRect();
238} 238}
239 239
240void TaskBar::calcMaxWindowRect() 240void TaskBar::calcMaxWindowRect()
241{ 241{
242#ifdef Q_WS_QWS 242#ifdef Q_WS_QWS
243 QRect wr; 243 QRect wr;
244 int displayWidth = qApp->desktop()->width(); 244 int displayWidth = qApp->desktop()->width();
245 QRect ir = inputMethods->inputRect(); 245 QRect ir = inputMethods->inputRect();
246 if ( ir.isValid() ) { 246 if ( ir.isValid() ) {
247 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 247 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
248 } else { 248 } else {
249 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 249 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
250 } 250 }
251 251
252#if QT_VERSION < 300 252#if QT_VERSION < 300
253 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 253 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
254 QSize(qt_screen->width(),qt_screen->height())) 254 QSize(qt_screen->width(),qt_screen->height()))
255 ); 255 );
256#else 256#else
257 QWSServer::setMaxWindowRect( wr ); 257 QWSServer::setMaxWindowRect( wr );
258#endif 258#endif
259#endif 259#endif
260} 260}
261 261
262void TaskBar::receive( const QCString &msg, const QByteArray &data ) 262void TaskBar::receive( const QCString &msg, const QByteArray &data )
263{ 263{
264 QDataStream stream( data, IO_ReadOnly ); 264 QDataStream stream( data, IO_ReadOnly );
265 if ( msg == "message(QString)" ) { 265 if ( msg == "message(QString)" ) {
266 QString text; 266 QString text;
267 stream >> text; 267 stream >> text;
268 setStatusMessage( text ); 268 setStatusMessage( text );
269 } else if ( msg == "hideInputMethod()" ) { 269 } else if ( msg == "hideInputMethod()" ) {
270 inputMethods->hideInputMethod(); 270 inputMethods->hideInputMethod();
271 } else if ( msg == "showInputMethod()" ) { 271 } else if ( msg == "showInputMethod()" ) {
272 inputMethods->showInputMethod(); 272 inputMethods->showInputMethod();
273 } else if ( msg == "reloadInputMethods()" ) { 273 } else if ( msg == "reloadInputMethods()" ) {
274 inputMethods->loadInputMethods(); 274 inputMethods->loadInputMethods();
275 } else if ( msg == "reloadApplets()" ) { 275 } else if ( msg == "reloadApplets()" ) {
276 sysTray->loadApplets(); 276 sysTray->loadApplets();
277 } else if ( msg == "soundAlarm()" ) { 277 } else if ( msg == "soundAlarm()" ) {
278 Desktop::soundAlarm(); 278 Desktop::soundAlarm();
279 } 279 }
280 else if ( msg == "setLed(int,bool)" ) { 280 else if ( msg == "setLed(int,bool)" ) {
281 int led, status; 281 int led, status;
282 stream >> led >> status; 282 stream >> led >> status;
283 283
284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); 284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off );
285 } 285 }
286} 286}
287 287
288QWidget *TaskBar::calibrate(bool) 288QWidget *TaskBar::calibrate(bool)
289{ 289{
290#ifdef Q_WS_QWS 290#ifdef Q_WS_QWS
291 Calibrate *c = new Calibrate; 291 Calibrate *c = new Calibrate;
292 c->show(); 292 c->show();
293 return c; 293 return c;
294#else 294#else
295 return 0; 295 return 0;
296#endif 296#endif
297} 297}
298 298
299void TaskBar::toggleNumLockState() 299void TaskBar::toggleNumLockState()
300{ 300{
301 if ( lockState ) lockState->toggleNumLockState(); 301 if ( lockState ) lockState->toggleNumLockState();
302} 302}
303 303
304void TaskBar::toggleCapsLockState() 304void TaskBar::toggleCapsLockState()
305{ 305{
306 if ( lockState ) lockState->toggleCapsLockState(); 306 if ( lockState ) lockState->toggleCapsLockState();
307} 307}
308 308
309void TaskBar::toggleSymbolInput() 309void TaskBar::toggleSymbolInput()
310{ 310{
311 if ( inputMethods->currentShown() == "Unicode" ) { 311 if ( inputMethods->currentShown() == "Unicode" ) {
312 inputMethods->hideInputMethod(); 312 inputMethods->hideInputMethod();
313 } else { 313 } else {
314 inputMethods->showInputMethod("Unicode"); 314 inputMethods->showInputMethod("Unicode");
315 } 315 }
316} 316}
317 317
318bool TaskBar::recoverMemory() 318bool TaskBar::recoverMemory()
319{ 319{
320 //eturn mru->quitOldApps(); 320 //eturn mru->quitOldApps();
321 return true; 321 return true;
322} 322}
323 323