summaryrefslogtreecommitdiff
path: root/core/launcher/taskbar.cpp
Unidiff
Diffstat (limited to 'core/launcher/taskbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/taskbar.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index e38b9fe..9f397eb 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,47 +1,48 @@
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 "systray.h" 25#include "systray.h"
25#include "calibrate.h" 26#include "calibrate.h"
26#include "wait.h" 27#include "wait.h"
27#include "appicons.h" 28#include "appicons.h"
28 29
29#include "taskbar.h" 30#include "taskbar.h"
30#include "desktop.h" 31#include "desktop.h"
31 32
32#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
34#include <qpe/global.h> 35#include <qpe/global.h>
35 36
36#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) 37#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
37#include <qpe/custom.h> 38#include <qpe/custom.h>
38#endif 39#endif
39 40
40#include <opie/odevice.h> 41#include <opie/odevice.h>
41 42
42#include <qlabel.h> 43#include <qlabel.h>
43#include <qlayout.h> 44#include <qlayout.h>
44#include <qtimer.h> 45#include <qtimer.h>
45#include <qwindowsystem_qws.h> 46#include <qwindowsystem_qws.h>
46#include <qwidgetstack.h> 47#include <qwidgetstack.h>
47 48
@@ -134,109 +135,114 @@ private:
134 QPixmap nl_pm, cl_pm; 135 QPixmap nl_pm, cl_pm;
135 bool nl, cl; 136 bool nl, cl;
136}; 137};
137 138
138TaskBar::~TaskBar() 139TaskBar::~TaskBar()
139{ 140{
140} 141}
141 142
142 143
143TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 144TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
144{ 145{
145 Global::setBuiltinCommands(builtins); 146 Global::setBuiltinCommands(builtins);
146 147
147 sm = new StartMenu( this ); 148 sm = new StartMenu( this );
148 149
149 inputMethods = new InputMethods( this ); 150 inputMethods = new InputMethods( this );
150 connect( inputMethods, SIGNAL(inputToggled(bool)), 151 connect( inputMethods, SIGNAL(inputToggled(bool)),
151 this, SLOT(calcMaxWindowRect()) ); 152 this, SLOT(calcMaxWindowRect()) );
152 //new QuickLauncher( this ); 153 //new QuickLauncher( this );
153 154
154 stack = new QWidgetStack( this ); 155 stack = new QWidgetStack( this );
155 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 156 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
156 label = new QLabel(stack); 157 label = new QLabel(stack);
157 158
158 mru = new MRUList( stack ); 159 //mru = new MRUList( stack );
159 stack->raiseWidget( mru ); 160 //stack->raiseWidget( mru );
161
162 runningAppBar = new RunningAppBar(stack);
163 stack->raiseWidget(runningAppBar);
160 164
161 waitIcon = new Wait( this ); 165 waitIcon = new Wait( this );
162 (void) new AppIcons( this ); 166 (void) new AppIcons( this );
163 167
164 sysTray = new SysTray( this ); 168 sysTray = new SysTray( this );
165 169
166 // ## make customizable in some way? 170 // ## make customizable in some way?
167#ifdef QT_QWS_CUSTOM 171#ifdef QT_QWS_CUSTOM
168 lockState = new LockKeyState( this ); 172 lockState = new LockKeyState( this );
169#else 173y#else
170 lockState = 0; 174 lockState = 0;
171#endif 175#endif
172 176
173#if defined(Q_WS_QWS) 177#if defined(Q_WS_QWS)
174#if !defined(QT_NO_COP) 178#if !defined(QT_NO_COP)
175 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 179 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
176 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 180 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
177 this, SLOT(receive(const QCString&, const QByteArray&)) ); 181 this, SLOT(receive(const QCString&, const QByteArray&)) );
178#endif 182#endif
179#endif 183#endif
180 waitTimer = new QTimer( this ); 184 waitTimer = new QTimer( this );
181 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 185 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
182 clearer = new QTimer( this ); 186 clearer = new QTimer( this );
183 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 187 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
184 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); 188 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
185} 189}
186 190
187void TaskBar::setStatusMessage( const QString &text ) 191void TaskBar::setStatusMessage( const QString &text )
188{ 192{
189 label->setText( text ); 193 label->setText( text );
190 stack->raiseWidget( label ); 194 stack->raiseWidget( label );
191 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 195 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
192 sysTray->hide(); 196 sysTray->hide();
193 clearer->start( 3000 ); 197 clearer->start( 3000 );
194} 198}
195 199
196void TaskBar::clearStatusBar() 200void TaskBar::clearStatusBar()
197{ 201{
198 label->clear(); 202 label->clear();
199 stack->raiseWidget( mru ); 203 stack->raiseWidget(runningAppBar);
204 // stack->raiseWidget( mru );
200} 205}
201 206
202void TaskBar::startWait() 207void TaskBar::startWait()
203{ 208{
204 waitIcon->setWaiting( true ); 209 waitIcon->setWaiting( true );
205 // a catchall stop after 10 seconds... 210 // a catchall stop after 10 seconds...
206 waitTimer->start( 10 * 1000, true ); 211 waitTimer->start( 10 * 1000, true );
207} 212}
208 213
209void TaskBar::stopWait(const QString& app) 214void TaskBar::stopWait(const QString& app)
210{ 215{
211 waitTimer->stop(); 216 waitTimer->stop();
212 mru->addTask(sm->execToLink(app)); 217 //mru->addTask(sm->execToLink(app));
213 waitIcon->setWaiting( false ); 218 waitIcon->setWaiting( false );
214} 219}
215 220
216void TaskBar::stopWait() 221void TaskBar::stopWait()
217{ 222{
218 waitTimer->stop(); 223 waitTimer->stop();
224
219 waitIcon->setWaiting( false ); 225 waitIcon->setWaiting( false );
220} 226}
221 227
222void TaskBar::resizeEvent( QResizeEvent *e ) 228void TaskBar::resizeEvent( QResizeEvent *e )
223{ 229{
224 QHBox::resizeEvent( e ); 230 QHBox::resizeEvent( e );
225 calcMaxWindowRect(); 231 calcMaxWindowRect();
226} 232}
227 233
228void TaskBar::styleChange( QStyle &s ) 234void TaskBar::styleChange( QStyle &s )
229{ 235{
230 QHBox::styleChange( s ); 236 QHBox::styleChange( s );
231 calcMaxWindowRect(); 237 calcMaxWindowRect();
232} 238}
233 239
234void TaskBar::calcMaxWindowRect() 240void TaskBar::calcMaxWindowRect()
235{ 241{
236#ifdef Q_WS_QWS 242#ifdef Q_WS_QWS
237 QRect wr; 243 QRect wr;
238 int displayWidth = qApp->desktop()->width(); 244 int displayWidth = qApp->desktop()->width();
239 QRect ir = inputMethods->inputRect(); 245 QRect ir = inputMethods->inputRect();
240 if ( ir.isValid() ) { 246 if ( ir.isValid() ) {
241 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 247 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
242 } else { 248 } else {
@@ -253,64 +259,65 @@ void TaskBar::calcMaxWindowRect()
253#endif 259#endif
254} 260}
255 261
256void TaskBar::receive( const QCString &msg, const QByteArray &data ) 262void TaskBar::receive( const QCString &msg, const QByteArray &data )
257{ 263{
258 QDataStream stream( data, IO_ReadOnly ); 264 QDataStream stream( data, IO_ReadOnly );
259 if ( msg == "message(QString)" ) { 265 if ( msg == "message(QString)" ) {
260 QString text; 266 QString text;
261 stream >> text; 267 stream >> text;
262 setStatusMessage( text ); 268 setStatusMessage( text );
263 } else if ( msg == "hideInputMethod()" ) { 269 } else if ( msg == "hideInputMethod()" ) {
264 inputMethods->hideInputMethod(); 270 inputMethods->hideInputMethod();
265 } else if ( msg == "showInputMethod()" ) { 271 } else if ( msg == "showInputMethod()" ) {
266 inputMethods->showInputMethod(); 272 inputMethods->showInputMethod();
267 } else if ( msg == "reloadInputMethods()" ) { 273 } else if ( msg == "reloadInputMethods()" ) {
268 inputMethods->loadInputMethods(); 274 inputMethods->loadInputMethods();
269 } else if ( msg == "reloadApplets()" ) { 275 } else if ( msg == "reloadApplets()" ) {
270 sysTray->loadApplets(); 276 sysTray->loadApplets();
271 } else if ( msg == "soundAlarm()" ) { 277 } else if ( msg == "soundAlarm()" ) {
272 Desktop::soundAlarm(); 278 Desktop::soundAlarm();
273 } 279 }
274 else if ( msg == "setLed(int,bool)" ) { 280 else if ( msg == "setLed(int,bool)" ) {
275 int led, status; 281 int led, status;
276 stream >> led >> status; 282 stream >> led >> status;
277 283
278 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); 284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off );
279 } 285 }
280} 286}
281 287
282QWidget *TaskBar::calibrate(bool) 288QWidget *TaskBar::calibrate(bool)
283{ 289{
284#ifdef Q_WS_QWS 290#ifdef Q_WS_QWS
285 Calibrate *c = new Calibrate; 291 Calibrate *c = new Calibrate;
286 c->show(); 292 c->show();
287 return c; 293 return c;
288#else 294#else
289 return 0; 295 return 0;
290#endif 296#endif
291} 297}
292 298
293void TaskBar::toggleNumLockState() 299void TaskBar::toggleNumLockState()
294{ 300{
295 if ( lockState ) lockState->toggleNumLockState(); 301 if ( lockState ) lockState->toggleNumLockState();
296} 302}
297 303
298void TaskBar::toggleCapsLockState() 304void TaskBar::toggleCapsLockState()
299{ 305{
300 if ( lockState ) lockState->toggleCapsLockState(); 306 if ( lockState ) lockState->toggleCapsLockState();
301} 307}
302 308
303void TaskBar::toggleSymbolInput() 309void TaskBar::toggleSymbolInput()
304{ 310{
305 if ( inputMethods->currentShown() == "Unicode" ) { 311 if ( inputMethods->currentShown() == "Unicode" ) {
306 inputMethods->hideInputMethod(); 312 inputMethods->hideInputMethod();
307 } else { 313 } else {
308 inputMethods->showInputMethod("Unicode"); 314 inputMethods->showInputMethod("Unicode");
309 } 315 }
310} 316}
311 317
312bool TaskBar::recoverMemory() 318bool TaskBar::recoverMemory()
313{ 319{
314 return mru->quitOldApps(); 320 //eturn mru->quitOldApps();
321 return true;
315} 322}
316 323