summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpedecoration_qws.cpp55
1 files changed, 15 insertions, 40 deletions
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp
index fb47c14..1afae88 100644
--- a/library/qpedecoration_qws.cpp
+++ b/library/qpedecoration_qws.cpp
@@ -116,424 +116,399 @@ static QImage scaleButton( const QImage &img, int height )
116 } else { 116 } else {
117 return img; 117 return img;
118 } 118 }
119} 119}
120 120
121class TLWidget : public QWidget 121class TLWidget : public QWidget
122{ 122{
123public: 123public:
124 QWSManager *manager() 124 QWSManager *manager()
125 { 125 {
126 return topData()->qwsManager; 126 return topData()->qwsManager;
127 } 127 }
128 128
129 QTLWExtra *topExtra() 129 QTLWExtra *topExtra()
130 { 130 {
131 return topData(); 131 return topData();
132 } 132 }
133 133
134 void setWState( uint s ) { QWidget::setWState( s ); } 134 void setWState( uint s ) { QWidget::setWState( s ); }
135 void clearWState( uint s ) { QWidget::clearWState( s ); } 135 void clearWState( uint s ) { QWidget::clearWState( s ); }
136}; 136};
137 137
138 138
139QPEManager::QPEManager( QPEDecoration *d, QObject *parent ) 139QPEManager::QPEManager( QPEDecoration *d, QObject *parent )
140 : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE) 140 : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE)
141{ 141{
142 wtTimer = new QTimer( this ); 142 wtTimer = new QTimer( this );
143 connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) ); 143 connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) );
144} 144}
145 145
146 146
147void QPEManager::updateActive() 147void QPEManager::updateActive()
148{ 148{
149 QWidget *newActive = qApp->activeWindow(); 149 QWidget *newActive = qApp->activeWindow();
150 if ( newActive && (QWidget*)active == newActive ) 150 if ( newActive && (QWidget*)active == newActive )
151 return; 151 return;
152 152
153 if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) { 153 if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) {
154 ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this ); 154 ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this );
155 } 155 }
156 156
157 if ( newActive && ((TLWidget *)newActive)->manager() ) { 157 if ( newActive && ((TLWidget *)newActive)->manager() ) {
158 active = newActive; 158 active = newActive;
159 ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this ); 159 ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this );
160 } else if ( !newActive ) { 160 } else if ( !newActive ) {
161 active = 0; 161 active = 0;
162 } 162 }
163} 163}
164 164
165int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p ) 165int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p )
166{ 166{
167 QRect rect(w->geometry()); 167 QRect rect(w->geometry());
168 168
169 if ( decoration->region( w, rect, 169 if ( decoration->region( w, rect,
170 (QWSDecoration::Region)QPEDecoration::Help ).contains(p) ) 170 (QWSDecoration::Region)QPEDecoration::Help ).contains(p) )
171 return QPEDecoration::Help; 171 return QPEDecoration::Help;
172 172
173 for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) { 173 for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) {
174 if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p)) 174 if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p))
175 return (QWSDecoration::Region)i; 175 return (QWSDecoration::Region)i;
176 } 176 }
177 177
178 return QWSDecoration::None; 178 return QWSDecoration::None;
179} 179}
180 180
181bool QPEManager::eventFilter( QObject *o, QEvent *e ) 181bool QPEManager::eventFilter( QObject *o, QEvent *e )
182{ 182{
183 QWSManager *mgr = (QWSManager *)o; 183 QWSManager *mgr = (QWSManager *)o;
184 QWidget *w = mgr->widget(); 184 QWidget *w = mgr->widget();
185 switch ( e->type() ) { 185 switch ( e->type() ) {
186 case QEvent::MouseButtonPress: 186 case QEvent::MouseButtonPress:
187 { 187 {
188 pressTime = QTime::currentTime(); 188 pressTime = QTime::currentTime();
189 QPoint p = ((QMouseEvent*)e)->globalPos(); 189 QPoint p = ((QMouseEvent*)e)->globalPos();
190 int inRegion = pointInQpeRegion( w, p ); 190 int inRegion = pointInQpeRegion( w, p );
191#ifdef WHATSTHIS_MODE 191#ifdef WHATSTHIS_MODE
192 if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) { 192 if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) {
193 QString text; 193 QString text;
194 switch ( inRegion ) { 194 switch ( inRegion ) {
195 case QWSDecoration::Close: 195 case QWSDecoration::Close:
196 if ( ((DecorHackWidget*)w)->needsOk() ) 196 if ( ((DecorHackWidget*)w)->needsOk() )
197 text = tr("Click to close this window, discarding changes."); 197 text = tr("Click to close this window, discarding changes.");
198 else 198 else
199 text = tr("Click to close this window."); 199 text = tr("Click to close this window.");
200 break; 200 break;
201 case QWSDecoration::Minimize: 201 case QWSDecoration::Minimize:
202 text = tr("Click to close this window and apply changes."); 202 text = tr("Click to close this window and apply changes.");
203 break; 203 break;
204 case QWSDecoration::Maximize: 204 case QWSDecoration::Maximize:
205 if ( w->isMaximized() ) 205 if ( w->isMaximized() )
206 text = tr("Click to make this window movable."); 206 text = tr("Click to make this window movable.");
207 else 207 else
208 text = tr("Click to make this window use all available screen area."); 208 text = tr("Click to make this window use all available screen area.");
209 break; 209 break;
210 default: 210 default:
211 break; 211 break;
212 } 212 }
213 QWhatsThis::leaveWhatsThisMode( text ); 213 QWhatsThis::leaveWhatsThisMode( text );
214 whatsThisTimeout(); 214 whatsThisTimeout();
215 helpState = 0; 215 helpState = 0;
216 return true; 216 return true;
217 } 217 }
218#endif 218#endif
219 if ( inRegion == QPEDecoration::Help ) { 219 if ( inRegion == QPEDecoration::Help ) {
220#ifdef WHATSTHIS_MODE 220#ifdef WHATSTHIS_MODE
221 wtTimer->start( 400, TRUE ); 221 wtTimer->start( 400, TRUE );
222#endif 222#endif
223 helpState = QWSButton::Clicked|QWSButton::MouseOver; 223 helpState = QWSButton::Clicked|QWSButton::MouseOver;
224 drawButton( w, QPEDecoration::Help, helpState ); 224 drawButton( w, QPEDecoration::Help, helpState );
225 return true; 225 return true;
226 } 226 }
227 } 227 }
228 break; 228 break;
229 case QEvent::MouseButtonRelease: 229 case QEvent::MouseButtonRelease:
230 if ( helpState & QWSButton::Clicked ) { 230 if ( helpState & QWSButton::Clicked ) {
231 wtTimer->stop(); 231 wtTimer->stop();
232 helpState = 0; 232 helpState = 0;
233 drawButton( w, QPEDecoration::Help, helpState ); 233 drawButton( w, QPEDecoration::Help, helpState );
234 QPoint p = ((QMouseEvent*)e)->globalPos(); 234 QPoint p = ((QMouseEvent*)e)->globalPos();
235 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { 235 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) {
236 decoration->help( w ); 236 decoration->help( w );
237 } 237 }
238 return true; 238 return true;
239 } 239 }
240 break; 240 break;
241 case QEvent::MouseMove: 241 case QEvent::MouseMove:
242 if ( helpState & QWSButton::Clicked ) { 242 if ( helpState & QWSButton::Clicked ) {
243 int oldState = helpState; 243 int oldState = helpState;
244 QPoint p = ((QMouseEvent*)e)->globalPos(); 244 QPoint p = ((QMouseEvent*)e)->globalPos();
245 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { 245 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) {
246 helpState = QWSButton::Clicked|QWSButton::MouseOver; 246 helpState = QWSButton::Clicked|QWSButton::MouseOver;
247 } else { 247 } else {
248 helpState = 0; 248 helpState = 0;
249 } 249 }
250 if ( helpState != oldState ) 250 if ( helpState != oldState )
251 drawButton( w, QPEDecoration::Help, helpState ); 251 drawButton( w, QPEDecoration::Help, helpState );
252 } 252 }
253 break; 253 break;
254 default: 254 default:
255 break; 255 break;
256 } 256 }
257 return QObject::eventFilter( o, e ); 257 return QObject::eventFilter( o, e );
258} 258}
259 259
260void QPEManager::drawButton( QWidget *w, QPEDecoration::QPERegion r, int state ) 260void QPEManager::drawButton( QWidget *w, QPEDecoration::QPERegion r, int state )
261{ 261{
262 QPainter painter(w); 262 QPainter painter(w);
263 QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; 263 QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region;
264 painter.internalGfx()->setWidgetDeviceRegion( rgn ); 264 painter.internalGfx()->setWidgetDeviceRegion( rgn );
265 painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); 265 painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All));
266 decoration->paintButton( &painter, w, (QWSDecoration::Region)r, state ); 266 decoration->paintButton( &painter, w, (QWSDecoration::Region)r, state );
267} 267}
268 268
269void QPEManager::drawTitle( QWidget *w ) 269void QPEManager::drawTitle( QWidget *w )
270{ 270{
271 QPainter painter(w); 271 QPainter painter(w);
272 QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; 272 QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region;
273 painter.internalGfx()->setWidgetDeviceRegion( rgn ); 273 painter.internalGfx()->setWidgetDeviceRegion( rgn );
274 painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); 274 painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All));
275 decoration->paint( &painter, w ); 275 decoration->paint( &painter, w );
276 decoration->paintButton(&painter, w, QWSDecoration::Menu, 0); 276 decoration->paintButton(&painter, w, QWSDecoration::Menu, 0);
277 decoration->paintButton(&painter, w, QWSDecoration::Close, 0); 277 decoration->paintButton(&painter, w, QWSDecoration::Close, 0);
278 decoration->paintButton(&painter, w, QWSDecoration::Minimize, 0); 278 decoration->paintButton(&painter, w, QWSDecoration::Minimize, 0);
279 decoration->paintButton(&painter, w, QWSDecoration::Maximize, 0); 279 decoration->paintButton(&painter, w, QWSDecoration::Maximize, 0);
280} 280}
281 281
282void QPEManager::whatsThisTimeout() 282void QPEManager::whatsThisTimeout()
283{ 283{
284 if ( !QWhatsThis::inWhatsThisMode() ) { 284 if ( !QWhatsThis::inWhatsThisMode() ) {
285 if ( inWhatsThis ) { 285 if ( inWhatsThis ) {
286 if ( whatsThis ) { 286 if ( whatsThis ) {
287 QWidget *w = whatsThis; 287 QWidget *w = whatsThis;
288 whatsThis = 0; 288 whatsThis = 0;
289 drawTitle( w ); 289 drawTitle( w );
290 } 290 }
291 wtTimer->stop(); 291 wtTimer->stop();
292 } else { 292 } else {
293 QWhatsThis::enterWhatsThisMode(); 293 QWhatsThis::enterWhatsThisMode();
294 helpState = 0; 294 helpState = 0;
295 updateActive(); 295 updateActive();
296 if ( active ) { 296 if ( active ) {
297 whatsThis = active; 297 whatsThis = active;
298 drawTitle( active ); 298 drawTitle( active );
299 // check periodically to see if we've left whats this mode 299 // check periodically to see if we've left whats this mode
300 wtTimer->start( 250 ); 300 wtTimer->start( 250 );
301 } 301 }
302 } 302 }
303 inWhatsThis = !inWhatsThis; 303 inWhatsThis = !inWhatsThis;
304 } 304 }
305} 305}
306 306
307//=========================================================================== 307//===========================================================================
308 308#define IMAGE_METHOD( methodName, imageName ) \
309static QImage *okImage( int th ) 309static QImage* methodName( int th ) { \
310{ 310 static QImage *i = 0; \
311 static QImage *i = 0; 311 if ( !i || ::abs( i->height()-th ) > 4 ) { \
312 if ( !i || ::abs( i->height()-th ) > 4 ) { 312 delete i; \
313 delete i; 313 i = new QImage(scaleButton(Resource::loadImage(#imageName),th)); \
314 i = new QImage(scaleButton(Resource::loadImage("OKButton"),th)); 314 } \
315 } 315 \
316 return i; 316 return i; \
317} 317}
318 318
319static QImage *closeImage( int th ) 319IMAGE_METHOD(okImage, OKButton );
320{ 320IMAGE_METHOD(closeImage, CloseButton );
321 static QImage *i = 0; 321IMAGE_METHOD(helpImage, HelpButton );
322 if ( !i || ::abs( i->height()-th ) > 4 ) { 322IMAGE_METHOD(maximizeImage,MaximizeButton );
323 delete i;
324 i = new QImage(scaleButton(Resource::loadImage("CloseButton"),th));
325 }
326 return i;
327}
328
329static QImage *helpImage( int th )
330{
331 static QImage *i = 0;
332 if ( !i || ::abs( i->height()-th ) > 4 ) {
333 delete i;
334 i = new QImage(scaleButton(Resource::loadImage("HelpButton"),th));
335 }
336 return i;
337}
338
339static QImage *maximizeImage( int th )
340{
341 static QImage *i = 0;
342 if ( !i || ::abs( i->height()-th ) > 4 ) {
343 delete i;
344 i = new QImage(scaleButton(Resource::loadImage("MaximizeButton"),th));
345 }
346 return i;
347}
348 323
349int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const 324int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const
350{ 325{
351 switch ( m ) { 326 switch ( m ) {
352 case TitleHeight: 327 case TitleHeight:
353 if ( QApplication::desktop()->height() > 320 ) 328 if ( QApplication::desktop()->height() > 320 )
354 return 19; 329 return 19;
355 else 330 else
356 return 15; 331 return 15;
357 case LeftBorder: 332 case LeftBorder:
358 case RightBorder: 333 case RightBorder:
359 case TopBorder: 334 case TopBorder:
360 case BottomBorder: 335 case BottomBorder:
361 return 4; 336 return 4;
362 case OKWidth: 337 case OKWidth:
363 return okImage(metric(TitleHeight,wd))->width(); 338 return okImage(metric(TitleHeight,wd))->width();
364 case CloseWidth: 339 case CloseWidth:
365 return closeImage(metric(TitleHeight,wd))->width(); 340 return closeImage(metric(TitleHeight,wd))->width();
366 case HelpWidth: 341 case HelpWidth:
367 return helpImage(metric(TitleHeight,wd))->width(); 342 return helpImage(metric(TitleHeight,wd))->width();
368 case MaximizeWidth: 343 case MaximizeWidth:
369 return maximizeImage(metric(TitleHeight,wd))->width(); 344 return maximizeImage(metric(TitleHeight,wd))->width();
370 case CornerGrabSize: 345 case CornerGrabSize:
371 return 16; 346 return 16;
372 } 347 }
373 348
374 return 0; 349 return 0;
375} 350}
376 351
377void WindowDecorationInterface::drawArea( Area a, QPainter *p, const WindowData *wd ) const 352void WindowDecorationInterface::drawArea( Area a, QPainter *p, const WindowData *wd ) const
378{ 353{
379 int th = metric( TitleHeight, wd ); 354 int th = metric( TitleHeight, wd );
380 QRect r = wd->rect; 355 QRect r = wd->rect;
381 356
382 switch ( a ) { 357 switch ( a ) {
383 case Border: 358 case Border:
384 { 359 {
385 const QColorGroup &cg = wd->palette.active(); 360 const QColorGroup &cg = wd->palette.active();
386 qDrawWinPanel(p, r.x()-metric(LeftBorder,wd), 361 qDrawWinPanel(p, r.x()-metric(LeftBorder,wd),
387 r.y()-th-metric(TopBorder,wd), 362 r.y()-th-metric(TopBorder,wd),
388 r.width()+metric(LeftBorder,wd)+metric(RightBorder,wd), 363 r.width()+metric(LeftBorder,wd)+metric(RightBorder,wd),
389 r.height()+th+metric(TopBorder,wd)+metric(BottomBorder,wd), 364 r.height()+th+metric(TopBorder,wd)+metric(BottomBorder,wd),
390 cg, FALSE, &cg.brush(QColorGroup::Background)); 365 cg, FALSE, &cg.brush(QColorGroup::Background));
391 } 366 }
392 break; 367 break;
393 case Title: 368 case Title:
394 { 369 {
395 const QColorGroup &cg = wd->palette.active(); 370 const QColorGroup &cg = wd->palette.active();
396 QBrush titleBrush; 371 QBrush titleBrush;
397 QPen titleLines; 372 QPen titleLines;
398 373
399 if ( wd->flags & WindowData::Active ) { 374 if ( wd->flags & WindowData::Active ) {
400 titleBrush = cg.brush(QColorGroup::Highlight); 375 titleBrush = cg.brush(QColorGroup::Highlight);
401 titleLines = titleBrush.color().dark(); 376 titleLines = titleBrush.color().dark();
402 } else { 377 } else {
403 titleBrush = cg.brush(QColorGroup::Background); 378 titleBrush = cg.brush(QColorGroup::Background);
404 titleLines = titleBrush.color(); 379 titleLines = titleBrush.color();
405 } 380 }
406 381
407 p->fillRect( r.x(), r.y()-th, r.width(), th, titleBrush); 382 p->fillRect( r.x(), r.y()-th, r.width(), th, titleBrush);
408 383
409 p->setPen( titleLines ); 384 p->setPen( titleLines );
410 for ( int i = r.y()-th; i < r.y(); i += 2 ) 385 for ( int i = r.y()-th; i < r.y(); i += 2 )
411 p->drawLine( r.left(), i, r.right(), i ); 386 p->drawLine( r.left(), i, r.right(), i );
412 } 387 }
413 break; 388 break;
414 case TitleText: 389 case TitleText:
415 p->drawText( r.x()+3+metric(HelpWidth,wd), r.top()-th, 390 p->drawText( r.x()+3+metric(HelpWidth,wd), r.top()-th,
416 r.width()-metric(OKWidth,wd)-metric(CloseWidth,wd), 391 r.width()-metric(OKWidth,wd)-metric(CloseWidth,wd),
417 th, QPainter::AlignVCenter, wd->caption); 392 th, QPainter::AlignVCenter, wd->caption);
418 break; 393 break;
419 } 394 }
420} 395}
421 396
422void WindowDecorationInterface::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int, int, QWSButton::State state ) const 397void WindowDecorationInterface::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int, int, QWSButton::State state ) const
423{ 398{
424 QImage *img = 0; 399 QImage *img = 0;
425 switch ( b ) { 400 switch ( b ) {
426 case OK: 401 case OK:
427 img = okImage(metric(TitleHeight,wd)); 402 img = okImage(metric(TitleHeight,wd));
428 break; 403 break;
429 case Close: 404 case Close:
430 img = closeImage(metric(TitleHeight,wd)); 405 img = closeImage(metric(TitleHeight,wd));
431 break; 406 break;
432 case Help: 407 case Help:
433 img = helpImage(metric(TitleHeight,wd)); 408 img = helpImage(metric(TitleHeight,wd));
434 break; 409 break;
435 case Maximize: 410 case Maximize:
436 img = maximizeImage(metric(TitleHeight,wd)); 411 img = maximizeImage(metric(TitleHeight,wd));
437 break; 412 break;
438 } 413 }
439 414
440 if ( img ) { 415 if ( img ) {
441 if ((state & QWSButton::MouseOver) && (state & QWSButton::Clicked)) 416 if ((state & QWSButton::MouseOver) && (state & QWSButton::Clicked))
442 p->drawImage(x+2, y+2, *img); 417 p->drawImage(x+2, y+2, *img);
443 else 418 else
444 p->drawImage(x+1, y+1, *img); 419 p->drawImage(x+1, y+1, *img);
445 } 420 }
446} 421}
447 422
448QRegion WindowDecorationInterface::mask( const WindowData *wd ) const 423QRegion WindowDecorationInterface::mask( const WindowData *wd ) const
449{ 424{
450 int th = metric(TitleHeight,wd); 425 int th = metric(TitleHeight,wd);
451 QRect rect( wd->rect ); 426 QRect rect( wd->rect );
452 QRect r(rect.left() - metric(LeftBorder,wd), 427 QRect r(rect.left() - metric(LeftBorder,wd),
453 rect.top() - th - metric(TopBorder,wd), 428 rect.top() - th - metric(TopBorder,wd),
454 rect.width() + metric(LeftBorder,wd) + metric(RightBorder,wd), 429 rect.width() + metric(LeftBorder,wd) + metric(RightBorder,wd),
455 rect.height() + th + metric(TopBorder,wd) + metric(BottomBorder,wd)); 430 rect.height() + th + metric(TopBorder,wd) + metric(BottomBorder,wd));
456 return QRegion(r) - rect; 431 return QRegion(r) - rect;
457} 432}
458 433
459class DefaultWindowDecoration : public WindowDecorationInterface 434class DefaultWindowDecoration : public WindowDecorationInterface
460{ 435{
461public: 436public:
462 DefaultWindowDecoration(){} 437 DefaultWindowDecoration(){}
463 QString name() const { 438 QString name() const {
464 return qApp->translate("WindowDecoration", "Default", 439 return qApp->translate("WindowDecoration", "Default",
465 "List box text for default window decoration"); 440 "List box text for default window decoration");
466 } 441 }
467 QPixmap icon() const { 442 QPixmap icon() const {
468 return QPixmap(); 443 return QPixmap();
469 } 444 }
470 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 445 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
471 *iface = 0; 446 *iface = 0;
472 if ( uuid == IID_QUnknown ) 447 if ( uuid == IID_QUnknown )
473 *iface = this; 448 *iface = this;
474 else if ( uuid == IID_WindowDecoration ) 449 else if ( uuid == IID_WindowDecoration )
475 *iface = this; 450 *iface = this;
476 else 451 else
477 return QS_FALSE; 452 return QS_FALSE;
478 453
479 if ( *iface ) 454 if ( *iface )
480 (*iface)->addRef(); 455 (*iface)->addRef();
481 return QS_OK; 456 return QS_OK;
482 } 457 }
483 Q_REFCOUNT 458 Q_REFCOUNT
484 459
485}; 460};
486 461
487static WindowDecorationInterface *wdiface = 0; 462static WindowDecorationInterface *wdiface = 0;
488static QLibrary* wdlib = 0; 463static QLibrary* wdlib = 0;
489static QString libname; 464static QString libname;
490 465
491//=========================================================================== 466//===========================================================================
492bool QPEDecoration::helpExists() const 467bool QPEDecoration::helpExists() const
493{ 468{
494 if ( helpFile.isNull() ) { 469 if ( helpFile.isNull() ) {
495 QStringList helpPath = Global::helpPath(); 470 QStringList helpPath = Global::helpPath();
496 QString hf = QString(qApp->argv()[0]) + ".html"; 471 QString hf = QString(qApp->argv()[0]) + ".html";
497 bool he = FALSE; 472 bool he = FALSE;
498 for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !he; ++it) 473 for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !he; ++it)
499 he = QFile::exists( *it + "/" + hf ); 474 he = QFile::exists( *it + "/" + hf );
500 ((QPEDecoration*)this)->helpFile = hf; 475 ((QPEDecoration*)this)->helpFile = hf;
501 ((QPEDecoration*)this)->helpexists = he; 476 ((QPEDecoration*)this)->helpexists = he;
502 return he; 477 return he;
503 } 478 }
504 return helpexists; 479 return helpexists;
505} 480}
506 481
507QPEDecoration::QPEDecoration() 482QPEDecoration::QPEDecoration()
508 : QWSDefaultDecoration() 483 : QWSDefaultDecoration()
509{ 484{
510 if ( wdlib ) { 485 if ( wdlib ) {
511 delete wdlib; 486 delete wdlib;
512 wdlib = 0; 487 wdlib = 0;
513 } else { 488 } else {
514 delete wdiface; 489 delete wdiface;
515 } 490 }
516 wdiface = new DefaultWindowDecoration; 491 wdiface = new DefaultWindowDecoration;
517 492
518 helpexists = FALSE; // We don't know (flagged by helpFile being null) 493 helpexists = FALSE; // We don't know (flagged by helpFile being null)
519 qpeManager = new QPEManager( this ); 494 qpeManager = new QPEManager( this );
520 imageOk = Resource::loadImage( "OKButton" ); 495 imageOk = Resource::loadImage( "OKButton" );
521 imageClose = Resource::loadImage( "CloseButton" ); 496 imageClose = Resource::loadImage( "CloseButton" );
522 imageHelp = Resource::loadImage( "HelpButton" ); 497 imageHelp = Resource::loadImage( "HelpButton" );
523} 498}
524 499
525QPEDecoration::QPEDecoration( const QString &plugin ) 500QPEDecoration::QPEDecoration( const QString &plugin )
526 : QWSDefaultDecoration() 501 : QWSDefaultDecoration()
527{ 502{
528 libname = plugin; 503 libname = plugin;
529 504
530 if ( wdlib ) { 505 if ( wdlib ) {
531 wdiface->release(); 506 wdiface->release();
532 wdlib->unload(); 507 wdlib->unload();
533 delete wdlib; 508 delete wdlib;
534 wdlib = 0; 509 wdlib = 0;
535 } else { 510 } else {
536 delete wdiface; 511 delete wdiface;
537 } 512 }
538 513
539 WindowDecorationInterface *iface = 0; 514 WindowDecorationInterface *iface = 0;