-rw-r--r-- | core/launcher/desktop.cpp | 3 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 92 |
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 | |||
@@ -38,12 +38,15 @@ | |||
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> |
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 | |||
@@ -32,12 +32,16 @@ | |||
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> |
@@ -47,22 +51,22 @@ | |||
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" |
@@ -75,20 +79,20 @@ static Global::Command builtins[] = { | |||
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 | ||
91 | static bool initNumLock() | 95 | static 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 |
@@ -97,38 +101,38 @@ static bool initNumLock() | |||
97 | } | 101 | } |
98 | 102 | ||
99 | class LockKeyState : public QWidget | 103 | 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; |
132 | bool nl, cl; | 136 | bool nl, cl; |
133 | }; | 137 | }; |
134 | 138 | ||
@@ -142,13 +146,13 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn | |||
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 | ||
@@ -168,13 +172,13 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn | |||
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())); |
@@ -183,13 +187,13 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn | |||
183 | 187 | ||
184 | void TaskBar::setStatusMessage( const QString &text ) | 188 | void 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 | ||
193 | void TaskBar::clearStatusBar() | 197 | void TaskBar::clearStatusBar() |
194 | { | 198 | { |
195 | label->clear(); | 199 | label->clear(); |
@@ -232,21 +236,21 @@ void 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 | ||
@@ -255,27 +259,27 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data ) | |||
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 | ||
280 | QWidget *TaskBar::calibrate(bool) | 284 | QWidget *TaskBar::calibrate(bool) |
281 | { | 285 | { |
@@ -298,15 +302,15 @@ void TaskBar::toggleCapsLockState() | |||
298 | if ( lockState ) lockState->toggleCapsLockState(); | 302 | if ( lockState ) lockState->toggleCapsLockState(); |
299 | } | 303 | } |
300 | 304 | ||
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 | ||
310 | bool TaskBar::recoverMemory() | 314 | bool TaskBar::recoverMemory() |
311 | { | 315 | { |
312 | return mru->quitOldApps(); | 316 | return mru->quitOldApps(); |