-rw-r--r-- | core/launcher/taskbar.cpp | 2 |
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 | |||
@@ -77,193 +77,193 @@ static 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 | ||
95 | static bool initNumLock() | 95 | static 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 | ||
103 | class LockKeyState : public QWidget | 103 | class LockKeyState : public QWidget |
104 | { | 104 | { |
105 | public: | 105 | public: |
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 | } |
134 | private: | 134 | private: |
135 | QPixmap nl_pm, cl_pm; | 135 | QPixmap nl_pm, cl_pm; |
136 | bool nl, cl; | 136 | bool nl, cl; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | TaskBar::~TaskBar() | 139 | TaskBar::~TaskBar() |
140 | { | 140 | { |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) | 144 | TaskBar::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 ); |
173 | y#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 | ||
191 | void TaskBar::setStatusMessage( const QString &text ) | 191 | void 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 | ||
200 | void TaskBar::clearStatusBar() | 200 | void 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 | ||
207 | void TaskBar::startWait() | 207 | void 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 | ||
214 | void TaskBar::stopWait(const QString& app) | 214 | void 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 | ||
221 | void TaskBar::stopWait() | 221 | void TaskBar::stopWait() |
222 | { | 222 | { |
223 | waitTimer->stop(); | 223 | waitTimer->stop(); |
224 | 224 | ||
225 | waitIcon->setWaiting( false ); | 225 | waitIcon->setWaiting( false ); |
226 | } | 226 | } |
227 | 227 | ||
228 | void TaskBar::resizeEvent( QResizeEvent *e ) | 228 | void TaskBar::resizeEvent( QResizeEvent *e ) |
229 | { | 229 | { |
230 | QHBox::resizeEvent( e ); | 230 | QHBox::resizeEvent( e ); |
231 | calcMaxWindowRect(); | 231 | calcMaxWindowRect(); |
232 | } | 232 | } |
233 | 233 | ||
234 | void TaskBar::styleChange( QStyle &s ) | 234 | void TaskBar::styleChange( QStyle &s ) |
235 | { | 235 | { |
236 | QHBox::styleChange( s ); | 236 | QHBox::styleChange( s ); |
237 | calcMaxWindowRect(); | 237 | calcMaxWindowRect(); |
238 | } | 238 | } |
239 | 239 | ||
240 | void TaskBar::calcMaxWindowRect() | 240 | void 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 | ||
262 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) | 262 | void 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()" ) { |