-rw-r--r-- | core/launcher/taskbar.cpp | 92 |
1 files changed, 48 insertions, 44 deletions
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 | |||
@@ -35,6 +35,10 @@ | |||
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> |
@@ -50,16 +54,16 @@ | |||
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 | ||
@@ -78,14 +82,14 @@ static Global::Command builtins[] = { | |||
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 | ||
91 | static bool initNumLock() | 95 | static bool initNumLock() |
@@ -100,32 +104,32 @@ class LockKeyState : public QWidget | |||
100 | { | 104 | { |
101 | public: | 105 | public: |
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 | } |
130 | private: | 134 | private: |
131 | QPixmap nl_pm, cl_pm; | 135 | QPixmap nl_pm, cl_pm; |
@@ -145,7 +149,7 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn | |||
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 ); |
@@ -171,7 +175,7 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn | |||
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 ); |
@@ -186,7 +190,7 @@ void TaskBar::setStatusMessage( const QString &text ) | |||
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 | ||
@@ -235,15 +239,15 @@ void TaskBar::calcMaxWindowRect() | |||
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 |
@@ -258,21 +262,21 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data ) | |||
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 | } |
@@ -301,9 +305,9 @@ void TaskBar::toggleCapsLockState() | |||
301 | void TaskBar::toggleSymbolInput() | 305 | void 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 | ||