summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/taskbar.cpp119
-rw-r--r--core/launcher/taskbar.h2
2 files changed, 45 insertions, 76 deletions
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 8af568d..feeba79 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -32,77 +32,50 @@
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 35
36#if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) 36#if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ )
37#include <qpe/custom.h> 37#include <qpe/custom.h>
38#endif 38#endif
39 39
40#include <opie/odevice.h> 40#include <opie/odevice.h>
41 41
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qtimer.h> 44#include <qtimer.h>
45#include <qwindowsystem_qws.h> 45#include <qwindowsystem_qws.h>
46#include <qwidgetstack.h> 46#include <qwidgetstack.h>
47 47
48#if defined( Q_WS_QWS ) 48#if defined( Q_WS_QWS )
49#include <qwsdisplay_qws.h> 49#include <qwsdisplay_qws.h>
50#include <qgfx_qws.h> 50#include <qgfx_qws.h>
51#endif 51#endif
52 52
53 53
54using namespace Opie; 54using namespace Opie;
55 55
56#define FACTORY(T) \
57 static QWidget *new##T( bool maximized ) { \
58 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
59 if ( maximized ) { \
60 if ( qApp->desktop()->width() <= 350 ) { \
61 w->showMaximized(); \
62 } else { \
63 w->resize( QSize( 300, 300 ) ); \
64 } \
65 } \
66 w->show(); \
67 return w; \
68 }
69
70
71#ifdef SINGLE_APP
72#define APP(a,b,c,d) FACTORY(b)
73#include "../launcher/apps.h"
74#undef APP
75#endif // SINGLE_APP
76
77static Global::Command builtins[] = { 56static Global::Command builtins[] = {
78 57
79#ifdef SINGLE_APP
80#define APP(a,b,c,d) { a, new##b, c },
81#include "../launcher/apps.h"
82#undef APP
83#endif
84
85#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX) 58#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX)
86 { "calibrate", TaskBar::calibrate, 1, 0 }, 59 { "calibrate", TaskBar::calibrate, 1, 0 },
87#endif 60#endif
88#if !defined(QT_QWS_CASSIOPEIA) 61#if !defined(QT_QWS_CASSIOPEIA)
89 { "shutdown", Global::shutdown, 1, 0 }, 62 { "shutdown", Global::shutdown, 1, 0 },
90// { "run", run, 1, 0 }, 63// { "run", run, 1, 0 },
91#endif 64#endif
92 65
93 { 0, TaskBar::calibrate, 0, 0 }, 66 { 0, TaskBar::calibrate, 0, 0 },
94}; 67};
95 68
96static bool initNumLock() 69static bool initNumLock()
97{ 70{
98#ifdef QPE_INITIAL_NUMLOCK_STATE 71#ifdef QPE_INITIAL_NUMLOCK_STATE
99 QPE_INITIAL_NUMLOCK_STATE 72 QPE_INITIAL_NUMLOCK_STATE
100#endif 73#endif
101 return FALSE; 74 return FALSE;
102} 75}
103 76
104class LockKeyState : public QWidget 77class LockKeyState : public QWidget
105{ 78{
106public: 79public:
107 LockKeyState( QWidget *parent ) : 80 LockKeyState( QWidget *parent ) :
108 QWidget(parent), 81 QWidget(parent),
@@ -130,57 +103,53 @@ public:
130 if ( nl ) 103 if ( nl )
131 p.drawPixmap(1,y,nl_pm); 104 p.drawPixmap(1,y,nl_pm);
132 if ( cl ) 105 if ( cl )
133 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 106 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
134 } 107 }
135private: 108private:
136 QPixmap nl_pm, cl_pm; 109 QPixmap nl_pm, cl_pm;
137 bool nl, cl; 110 bool nl, cl;
138}; 111};
139 112
140TaskBar::~TaskBar() 113TaskBar::~TaskBar()
141{ 114{
142} 115}
143 116
144 117
145TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 118TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
146{ 119{
147 Global::setBuiltinCommands(builtins); 120 Global::setBuiltinCommands(builtins);
148 121
149 sm = new StartMenu( this ); 122 sm = new StartMenu( this );
150 123
151 inputMethods = new InputMethods( this ); 124 inputMethods = new InputMethods( this );
152 connect( inputMethods, SIGNAL(inputToggled(bool)), 125 connect( inputMethods, SIGNAL(inputToggled(bool)),
153 this, SLOT(calcMaxWindowRect()) ); 126 this, SLOT(calcMaxWindowRect()) );
154 //new QuickLauncher( this );
155 127
156 stack = new QWidgetStack( this ); 128 stack = new QWidgetStack( this );
157 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 129 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
158 label = new QLabel(stack); 130 label = new QLabel(stack);
159 131
160 //mru = new MRUList( stack );
161 //stack->raiseWidget( mru );
162
163 runningAppBar = new RunningAppBar(stack); 132 runningAppBar = new RunningAppBar(stack);
164 stack->raiseWidget(runningAppBar); 133 stack->raiseWidget(runningAppBar);
165 134
166 waitIcon = new Wait( this ); 135 waitIcon = new Wait( this );
167 (void) new AppIcons( this ); 136 (void) new AppIcons( this );
168 137
169 sysTray = new SysTray( this ); 138 sysTray = new SysTray( this );
170 139
171 // ## make customizable in some way? 140 // ## make customizable in some way?
172 lockState = new LockKeyState( this ); 141 lockState = new LockKeyState( this );
173 142
174#if defined(Q_WS_QWS) 143#if defined(Q_WS_QWS)
175#if !defined(QT_NO_COP) 144#if !defined(QT_NO_COP)
176 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 145 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
177 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 146 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
178 this, SLOT(receive(const QCString&, const QByteArray&)) ); 147 this, SLOT(receive(const QCString&, const QByteArray&)) );
179#endif 148#endif
180#endif 149#endif
181 waitTimer = new QTimer( this ); 150 waitTimer = new QTimer( this );
182 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 151 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
183 clearer = new QTimer( this ); 152 clearer = new QTimer( this );
184 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 153 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
185 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); 154 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
186} 155}
@@ -241,104 +210,106 @@ void TaskBar::styleChange( QStyle &s )
241void TaskBar::calcMaxWindowRect() 210void TaskBar::calcMaxWindowRect()
242{ 211{
243#ifdef Q_WS_QWS 212#ifdef Q_WS_QWS
244 QRect wr; 213 QRect wr;
245 int displayWidth = qApp->desktop()->width(); 214 int displayWidth = qApp->desktop()->width();
246 QRect ir = inputMethods->inputRect(); 215 QRect ir = inputMethods->inputRect();
247 if ( ir.isValid() ) { 216 if ( ir.isValid() ) {
248 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 217 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
249 } else { 218 } else {
250 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 219 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
251 } 220 }
252 221
253#if QT_VERSION < 300 222#if QT_VERSION < 300
254 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 223 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
255 QSize(qt_screen->width(),qt_screen->height())) 224 QSize(qt_screen->width(),qt_screen->height()))
256 ); 225 );
257#else 226#else
258 QWSServer::setMaxWindowRect( wr ); 227 QWSServer::setMaxWindowRect( wr );
259#endif 228#endif
260#endif 229#endif
261} 230}
262 231
263void TaskBar::receive( const QCString &msg, const QByteArray &data ) 232void TaskBar::receive( const QCString &msg, const QByteArray &data )
264{ 233{
265 QDataStream stream( data, IO_ReadOnly ); 234 QDataStream stream( data, IO_ReadOnly );
266 if ( msg == "message(QString)" ) { 235 if ( msg == "message(QString)" ) {
267 QString text; 236 QString text;
268 stream >> text; 237 stream >> text;
269 setStatusMessage( text ); 238 setStatusMessage( text );
270 } else if ( msg == "hideInputMethod()" ) { 239 } else if ( msg == "hideInputMethod()" ) {
271 inputMethods->hideInputMethod(); 240 inputMethods->hideInputMethod();
272 } else if ( msg == "showInputMethod()" ) { 241 } else if ( msg == "showInputMethod()" ) {
273 inputMethods->showInputMethod(); 242 inputMethods->showInputMethod();
274 } else if ( msg == "reloadInputMethods()" ) { 243 } else if ( msg == "reloadInputMethods()" ) {
275 inputMethods->loadInputMethods(); 244 inputMethods->loadInputMethods();
276 } else if ( msg == "reloadApps()" ) { 245 } else if ( msg == "toggleInputMethod()" ) {
277 sm->reloadApps(); 246 inputMethods->shown() ? inputMethods->hideInputMethod() : inputMethods->showInputMethod();
278 } else if ( msg == "reloadApplets()" ) { 247 } else if ( msg == "reloadApps()" ) {
279 sysTray->clearApplets(); 248 sm->reloadApps();
280 sysTray->addApplets(); 249 } else if ( msg == "reloadApplets()" ) {
281 sm->reloadApplets(); 250 sysTray->clearApplets();
282 } else if ( msg == "soundAlarm()" ) { 251 sysTray->addApplets();
283 DesktopApplication::soundAlarm ( ); 252 sm->reloadApplets();
284 } 253 } else if ( msg == "soundAlarm()" ) {
285 else if ( msg == "setLed(int,bool)" ) { 254 DesktopApplication::soundAlarm ( );
286 int led, status; 255 }
287 stream >> led >> status; 256 else if ( msg == "setLed(int,bool)" ) {
288 257 int led, status;
289 QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); 258 stream >> led >> status;
290 if ( ll. count ( )){ 259
291 OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; 260 QValueList <OLed> ll = ODevice::inst ( )-> ledList ( );
292 bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); 261 if ( ll. count ( )){
293 262 OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0];
294 ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); 263 bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow );
295 } 264
296 } 265 ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off );
297 else if ( msg == "toggleMenu()" ) { 266 }
298 if ( sm-> launchMenu-> isVisible ( )) 267 }
299 sm-> launch ( ); 268 else if ( msg == "toggleMenu()" ) {
300 else { 269 if ( sm-> launchMenu-> isVisible ( ))
301 QCopEnvelope e ( "QPE/System", "toggleApplicationMenu()" ); 270 sm-> launch ( );
302 } 271 else {
303 } 272 QCopEnvelope e ( "QPE/System", "toggleApplicationMenu()" );
304 else if ( msg == "toggleStartMenu()" ) { 273 }
305 sm-> launch ( ); 274 }
306 } 275 else if ( msg == "toggleStartMenu()" ) {
276 sm-> launch ( );
277 }
307} 278}
308 279
309QWidget *TaskBar::calibrate(bool) 280QWidget *TaskBar::calibrate(bool)
310{ 281{
311#ifdef Q_WS_QWS 282#ifdef Q_WS_QWS
312 Calibrate *c = new Calibrate; 283 Calibrate *c = new Calibrate;
313 c->show(); 284 c->show();
314 return c; 285 return c;
315#else 286#else
316 return 0; 287 return 0;
317#endif 288#endif
318} 289}
319 290
320void TaskBar::toggleNumLockState() 291void TaskBar::toggleNumLockState()
321{ 292{
322 if ( lockState ) lockState->toggleNumLockState(); 293 if ( lockState ) lockState->toggleNumLockState();
323} 294}
324 295
325void TaskBar::toggleCapsLockState() 296void TaskBar::toggleCapsLockState()
326{ 297{
327 if ( lockState ) lockState->toggleCapsLockState(); 298 if ( lockState ) lockState->toggleCapsLockState();
328} 299}
329 300
330void TaskBar::toggleSymbolInput() 301void TaskBar::toggleSymbolInput()
331{ 302{
332 if ( inputMethods->currentShown() == "Unicode" ) { 303 if ( inputMethods->currentShown() == "Unicode" ) {
333 inputMethods->hideInputMethod(); 304 inputMethods->hideInputMethod();
334 } else { 305 } else {
335 inputMethods->showInputMethod("Unicode"); 306 inputMethods->showInputMethod("Unicode");
336 } 307 }
337} 308}
338 309
339bool TaskBar::recoverMemory() 310bool TaskBar::recoverMemory()
340{ 311{
341 //eturn mru->quitOldApps(); 312 //mru->quitOldApps() is no longer supported
342 return true; 313 return true;
343} 314}
344 315
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h
index a0bf395..0cfc123 100644
--- a/core/launcher/taskbar.h
+++ b/core/launcher/taskbar.h
@@ -7,79 +7,77 @@
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#ifndef __TASKBAR_H__ 21#ifndef __TASKBAR_H__
22#define __TASKBAR_H__ 22#define __TASKBAR_H__
23 23
24#include <qhbox.h> 24#include <qhbox.h>
25 25
26class QLabel; 26class QLabel;
27class QTimer; 27class QTimer;
28class InputMethods; 28class InputMethods;
29class Wait; 29class Wait;
30class SysTray; 30class SysTray;
31//class MRUList;
32class RunningAppBar; 31class RunningAppBar;
33class QWidgetStack; 32class QWidgetStack;
34class QTimer; 33class QTimer;
35class QLabel; 34class QLabel;
36class StartMenu; 35class StartMenu;
37class LockKeyState; 36class LockKeyState;
38 37
39class TaskBar : public QHBox { 38class TaskBar : public QHBox {
40 Q_OBJECT 39 Q_OBJECT
41public: 40public:
42 TaskBar(); 41 TaskBar();
43 ~TaskBar(); 42 ~TaskBar();
44 43
45 static QWidget *calibrate( bool ); 44 static QWidget *calibrate( bool );
46 45
47 bool recoverMemory(); 46 bool recoverMemory();
48 47
49 StartMenu *startMenu() const { return sm; } 48 StartMenu *startMenu() const { return sm; }
50public slots: 49public slots:
51 void startWait(); 50 void startWait();
52 void stopWait(const QString&); 51 void stopWait(const QString&);
53 void stopWait(); 52 void stopWait();
54 void clearStatusBar(); 53 void clearStatusBar();
55 void toggleNumLockState(); 54 void toggleNumLockState();
56 void toggleCapsLockState(); 55 void toggleCapsLockState();
57 void toggleSymbolInput(); 56 void toggleSymbolInput();
58 57
59protected: 58protected:
60 void resizeEvent( QResizeEvent * ); 59 void resizeEvent( QResizeEvent * );
61 void styleChange( QStyle & ); 60 void styleChange( QStyle & );
62 void setStatusMessage( const QString &text ); 61 void setStatusMessage( const QString &text );
63 62
64public slots: 63public slots:
65 void calcMaxWindowRect(); 64 void calcMaxWindowRect();
66private slots: 65private slots:
67 void receive( const QCString &msg, const QByteArray &data ); 66 void receive( const QCString &msg, const QByteArray &data );
68 67
69private: 68private:
70 69
71 QTimer *waitTimer; 70 QTimer *waitTimer;
72 Wait *waitIcon; 71 Wait *waitIcon;
73 InputMethods *inputMethods; 72 InputMethods *inputMethods;
74 SysTray *sysTray; 73 SysTray *sysTray;
75 // MRUList *mru;
76 RunningAppBar* runningAppBar; 74 RunningAppBar* runningAppBar;
77 QWidgetStack *stack; 75 QWidgetStack *stack;
78 QTimer *clearer; 76 QTimer *clearer;
79 QLabel *label; 77 QLabel *label;
80 LockKeyState* lockState; 78 LockKeyState* lockState;
81 StartMenu *sm; 79 StartMenu *sm;
82}; 80};
83 81
84 82
85#endif // __TASKBAR_H__ 83#endif // __TASKBAR_H__