author | zecke <zecke> | 2004-02-08 14:24:56 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-08 14:24:56 (UTC) |
commit | a763515241faab10c9d86c5cb785c714578e9bb0 (patch) (unidiff) | |
tree | 35ecc8bd63fdc7a40e26d8fe369b389f21901d5c /library | |
parent | 258a55008dc84c8860f0c851b1da1e6cc921a1cb (diff) | |
download | opie-a763515241faab10c9d86c5cb785c714578e9bb0.zip opie-a763515241faab10c9d86c5cb785c714578e9bb0.tar.gz opie-a763515241faab10c9d86c5cb785c714578e9bb0.tar.bz2 |
ReMerge QPEDeco
-rw-r--r-- | library/qpedecoration_qws.cpp | 147 | ||||
-rw-r--r-- | library/qpedecoration_qws.h | 9 |
2 files changed, 100 insertions, 56 deletions
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index bac1a75..7842ebd 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp | |||
@@ -16,15 +16,17 @@ | |||
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 | #ifdef QWS | ||
20 | #define QTOPIA_INTERNAL_LANGLIST | 21 | #define QTOPIA_INTERNAL_LANGLIST |
21 | #include <qapplication.h> | 22 | #include <qapplication.h> |
22 | #include <qstyle.h> | 23 | #include <qstyle.h> |
23 | #include <qwidget.h> | 24 | #include <qwidget.h> |
24 | #include <qpainter.h> | 25 | #include <qpainter.h> |
25 | #include <qtimer.h> | 26 | #include <qtimer.h> |
26 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qpopupmenu.h> | ||
27 | #include "qcopenvelope_qws.h" | 29 | #include "qcopenvelope_qws.h" |
28 | #include "qpedecoration_qws.h" | 30 | #include "qpedecoration_qws.h" |
29 | #include <qdialog.h> | 31 | #include <qdialog.h> |
30 | #include <qdrawutil.h> | 32 | #include <qdrawutil.h> |
@@ -33,14 +35,15 @@ | |||
33 | #include "resource.h" | 35 | #include "resource.h" |
34 | #include "global.h" | 36 | #include "global.h" |
35 | #include "qlibrary.h" | 37 | #include "qlibrary.h" |
36 | #include "windowdecorationinterface.h" | 38 | #include "windowdecorationinterface.h" |
39 | #include <qpe/qlibrary.h> | ||
37 | #include <qfile.h> | 40 | #include <qfile.h> |
38 | #include <qsignal.h> | 41 | #include <qsignal.h> |
39 | 42 | ||
40 | #include <stdlib.h> | 43 | #include <stdlib.h> |
41 | 44 | ||
42 | extern QRect qt_maxWindowRect; | 45 | extern Q_EXPORT QRect qt_maxWindowRect; |
43 | 46 | ||
44 | #define WHATSTHIS_MODE | 47 | #define WHATSTHIS_MODE |
45 | 48 | ||
46 | #ifndef QT_NO_QWS_QPE_WM_STYLE | 49 | #ifndef QT_NO_QWS_QPE_WM_STYLE |
@@ -94,14 +97,15 @@ static const char * const qpe_accept_xpm[] = { | |||
94 | " "}; | 97 | " "}; |
95 | 98 | ||
96 | #endif // QT_NO_IMAGEIO_XPM | 99 | #endif // QT_NO_IMAGEIO_XPM |
97 | 100 | ||
98 | class HackWidget : public QWidget | 101 | class DecorHackWidget : public QWidget |
99 | { | 102 | { |
100 | public: | 103 | public: |
101 | bool needsOk() { | 104 | bool needsOk() { |
102 | return (getWState() & WState_Reserved1 ) || | 105 | return (getWState() & WState_Reserved1 ) || |
103 | (inherits( "QDialog" ) && !inherits( "QMessageBox" ) ); | 106 | (inherits("QDialog") && !inherits("QMessageBox") |
107 | && !inherits("QWizard") ); | ||
104 | } | 108 | } |
105 | }; | 109 | }; |
106 | 110 | ||
107 | static QImage scaleButton( const QImage &img, int height ) | 111 | static QImage scaleButton( const QImage &img, int height ) |
@@ -187,21 +191,21 @@ bool QPEManager::eventFilter( QObject *o, QEvent *e ) | |||
187 | if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) { | 191 | if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) { |
188 | QString text; | 192 | QString text; |
189 | switch ( inRegion ) { | 193 | switch ( inRegion ) { |
190 | case QWSDecoration::Close: | 194 | case QWSDecoration::Close: |
191 | if ( ((HackWidget*)w)->needsOk() ) | 195 | if ( ((DecorHackWidget*)w)->needsOk() ) |
192 | text = QObject::tr("Click to close this window, discarding changes."); | 196 | text = tr("Click to close this window, discarding changes."); |
193 | else | 197 | else |
194 | text = QObject::tr("Click to close this window."); | 198 | text = tr("Click to close this window."); |
195 | break; | 199 | break; |
196 | case QWSDecoration::Minimize: | 200 | case QWSDecoration::Minimize: |
197 | text = QObject::tr("Click to close this window and apply changes."); | 201 | text = tr("Click to close this window and apply changes."); |
198 | break; | 202 | break; |
199 | case QWSDecoration::Maximize: | 203 | case QWSDecoration::Maximize: |
200 | if ( w->isMaximized() ) | 204 | if ( w->isMaximized() ) |
201 | text = QObject::tr("Click to make this window moveable."); | 205 | text = tr("Click to make this window movable."); |
202 | else | 206 | else |
203 | text = QObject::tr("Click to make this window use all available screen area."); | 207 | text = tr("Click to make this window use all available screen area."); |
204 | break; | 208 | break; |
205 | default: | 209 | default: |
206 | break; | 210 | break; |
207 | } | 211 | } |
@@ -453,11 +457,12 @@ QRegion WindowDecorationInterface::mask( const WindowData *wd ) const | |||
453 | 457 | ||
454 | class DefaultWindowDecoration : public WindowDecorationInterface | 458 | class DefaultWindowDecoration : public WindowDecorationInterface |
455 | { | 459 | { |
456 | public: | 460 | public: |
457 | DefaultWindowDecoration() : ref(0) {} | 461 | DefaultWindowDecoration(){} |
458 | QString name() const { | 462 | QString name() const { |
459 | return "Default"; | 463 | return qApp->translate("WindowDecoration", "Default", |
464 | "List box text for default window decoration"); | ||
460 | } | 465 | } |
461 | QPixmap icon() const { | 466 | QPixmap icon() const { |
462 | return QPixmap(); | 467 | return QPixmap(); |
463 | } | 468 | } |
@@ -466,48 +471,69 @@ public: | |||
466 | if ( uuid == IID_QUnknown ) | 471 | if ( uuid == IID_QUnknown ) |
467 | *iface = this; | 472 | *iface = this; |
468 | else if ( uuid == IID_WindowDecoration ) | 473 | else if ( uuid == IID_WindowDecoration ) |
469 | *iface = this; | 474 | *iface = this; |
475 | else | ||
476 | return QS_FALSE; | ||
470 | 477 | ||
471 | if ( *iface ) | 478 | if ( *iface ) |
472 | (*iface)->addRef(); | 479 | (*iface)->addRef(); |
473 | return QS_OK; | 480 | return QS_OK; |
474 | } | 481 | } |
475 | Q_REFCOUNT | 482 | Q_REFCOUNT |
476 | 483 | ||
477 | private: | ||
478 | ulong ref; | ||
479 | }; | 484 | }; |
480 | 485 | ||
481 | static WindowDecorationInterface *wdiface = 0; | 486 | static WindowDecorationInterface *wdiface = 0; |
482 | static QLibrary *wdlib = 0; | 487 | static QLibrary* wdlib = 0; |
483 | static QString libname; | 488 | static QString libname; |
484 | 489 | ||
485 | //=========================================================================== | 490 | //=========================================================================== |
491 | bool QPEDecoration::helpExists() const | ||
492 | { | ||
493 | if ( helpFile.isNull() ) { | ||
494 | QStringList helpPath = Global::helpPath(); | ||
495 | QString hf = QString(qApp->argv()[0]) + ".html"; | ||
496 | bool he = FALSE; | ||
497 | for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !he; ++it) | ||
498 | he = QFile::exists( *it + "/" + hf ); | ||
499 | ((QPEDecoration*)this)->helpFile = hf; | ||
500 | ((QPEDecoration*)this)->helpexists = he; | ||
501 | return he; | ||
502 | } | ||
503 | return helpexists; | ||
504 | } | ||
486 | 505 | ||
487 | QPEDecoration::QPEDecoration() | 506 | QPEDecoration::QPEDecoration() |
488 | : QWSDefaultDecoration() | 507 | : QWSDefaultDecoration() |
489 | { | 508 | { |
490 | init ( libname ); | 509 | if ( wdlib ) { |
510 | delete wdlib; | ||
511 | wdlib = 0; | ||
512 | } else { | ||
513 | delete wdiface; | ||
514 | } | ||
515 | wdiface = new DefaultWindowDecoration; | ||
516 | |||
517 | helpexists = FALSE; // We don't know (flagged by helpFile being null) | ||
518 | qpeManager = new QPEManager( this ); | ||
519 | imageOk = Resource::loadImage( "OKButton" ); | ||
520 | imageClose = Resource::loadImage( "CloseButton" ); | ||
521 | imageHelp = Resource::loadImage( "HelpButton" ); | ||
491 | } | 522 | } |
492 | 523 | ||
493 | QPEDecoration::QPEDecoration( const QString &plugin ) | 524 | QPEDecoration::QPEDecoration( const QString &plugin ) |
494 | : QWSDefaultDecoration() | 525 | : QWSDefaultDecoration() |
495 | { | 526 | { |
496 | init ( plugin ); | ||
497 | } | ||
498 | |||
499 | void QPEDecoration::init ( const QString &plugin ) | ||
500 | { | ||
501 | libname = plugin; | 527 | libname = plugin; |
502 | 528 | ||
503 | if ( wdlib ) { | 529 | if ( wdlib ) { |
504 | wdiface->release(); | 530 | wdiface->release(); |
505 | wdlib->unload(); | 531 | wdlib->unload(); |
506 | delete wdlib; | 532 | delete wdlib; |
507 | wdlib = 0; | 533 | wdlib = 0; |
508 | } else { | 534 | } else { |
509 | delete wdiface; | 535 | delete wdiface; |
510 | } | 536 | } |
511 | 537 | ||
512 | WindowDecorationInterface *iface = 0; | 538 | WindowDecorationInterface *iface = 0; |
513 | QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; | 539 | QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; |
@@ -535,21 +561,12 @@ void QPEDecoration::init ( const QString &plugin ) | |||
535 | delete lib; | 561 | delete lib; |
536 | wdiface = new DefaultWindowDecoration; | 562 | wdiface = new DefaultWindowDecoration; |
537 | } | 563 | } |
538 | 564 | ||
539 | helpFile = QString(qApp->argv()[0]) + ".html"; | ||
540 | QStringList helpPath = Global::helpPath(); | ||
541 | helpExists = FALSE; | ||
542 | for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) { | ||
543 | helpExists = QFile::exists( *it + "/" + helpFile ); | ||
544 | //qDebug ( "Checking %s/%s for help: %d", (*it).latin1(), helpFile.latin1(),helpExists); | ||
545 | } | ||
546 | qpeManager = new QPEManager( this ); | ||
547 | 565 | ||
548 | // Qtopia 1.5 compatibility | 566 | |
549 | imageOk = *okImage ( 15 ); | 567 | helpexists = FALSE; // We don't know (flagged by helpFile being null) |
550 | imageClose = *closeImage ( 15 ); | 568 | qpeManager = new QPEManager( this ); |
551 | imageHelp = *helpImage ( 15 ); | ||
552 | } | 569 | } |
553 | 570 | ||
554 | QPEDecoration::~QPEDecoration() | 571 | QPEDecoration::~QPEDecoration() |
555 | { | 572 | { |
@@ -613,16 +630,16 @@ QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecor | |||
613 | case Maximize: | 630 | case Maximize: |
614 | if ( !widget->inherits( "QDialog" ) && qApp->desktop()->width() > 350 ) { | 631 | if ( !widget->inherits( "QDialog" ) && qApp->desktop()->width() > 350 ) { |
615 | int maximizeWidth = wdiface->metric(WindowDecorationInterface::MaximizeWidth,&wd); | 632 | int maximizeWidth = wdiface->metric(WindowDecorationInterface::MaximizeWidth,&wd); |
616 | int left = rect.right() - maximizeWidth - closeWidth; | 633 | int left = rect.right() - maximizeWidth - closeWidth; |
617 | if ( ((HackWidget *)widget)->needsOk() ) | 634 | if ( ((DecorHackWidget *)widget)->needsOk() ) |
618 | left -= okWidth; | 635 | left -= okWidth; |
619 | QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight); | 636 | QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight); |
620 | region = r; | 637 | region = r; |
621 | } | 638 | } |
622 | break; | 639 | break; |
623 | case Minimize: | 640 | case Minimize: |
624 | if ( ((HackWidget *)widget)->needsOk() ) { | 641 | if ( ((DecorHackWidget *)widget)->needsOk() ) { |
625 | QRect r(rect.right() - okWidth, | 642 | QRect r(rect.right() - okWidth, |
626 | rect.top() - titleHeight, okWidth, titleHeight); | 643 | rect.top() - titleHeight, okWidth, titleHeight); |
627 | if (r.left() > rect.left() + titleHeight) | 644 | if (r.left() > rect.left() + titleHeight) |
628 | region = r; | 645 | region = r; |
@@ -630,27 +647,27 @@ QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecor | |||
630 | break; | 647 | break; |
631 | case Close: | 648 | case Close: |
632 | { | 649 | { |
633 | int left = rect.right() - closeWidth; | 650 | int left = rect.right() - closeWidth; |
634 | if ( ((HackWidget *)widget)->needsOk() ) | 651 | if ( ((DecorHackWidget *)widget)->needsOk() ) |
635 | left -= okWidth; | 652 | left -= okWidth; |
636 | QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight); | 653 | QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight); |
637 | region = r; | 654 | region = r; |
638 | } | 655 | } |
639 | break; | 656 | break; |
640 | case Title: | 657 | case Title: |
641 | if ( !widget->isMaximized() ) { | 658 | if ( !widget->isMaximized() ) { |
642 | int width = rect.width() - helpWidth - closeWidth; | 659 | int width = rect.width() - helpWidth - closeWidth; |
643 | if ( ((HackWidget *)widget)->needsOk() ) | 660 | if ( ((DecorHackWidget *)widget)->needsOk() ) |
644 | width -= okWidth; | 661 | width -= okWidth; |
645 | QRect r(rect.left()+helpWidth, rect.top() - titleHeight, | 662 | QRect r(rect.left()+helpWidth, rect.top() - titleHeight, |
646 | width, titleHeight); | 663 | width, titleHeight); |
647 | if (r.width() > 0) | 664 | if (r.width() > 0) |
648 | region = r; | 665 | region = r; |
649 | } | 666 | } |
650 | break; | 667 | break; |
651 | case Help: | 668 | case Help: |
652 | if ( helpExists || widget->testWFlags(Qt::WStyle_ContextHelp) ) { | 669 | if ( helpExists() || widget->testWFlags(Qt::WStyle_ContextHelp) ) { |
653 | QRect r(rect.left(), rect.top() - titleHeight, | 670 | QRect r(rect.left(), rect.top() - titleHeight, |
654 | helpWidth, titleHeight); | 671 | helpWidth, titleHeight); |
655 | region = r; | 672 | region = r; |
656 | } | 673 | } |
@@ -751,13 +768,13 @@ void QPEDecoration::paint(QPainter *painter, const QWidget *widget) | |||
751 | 768 | ||
752 | QRect rect(widget->rect()); | 769 | QRect rect(widget->rect()); |
753 | 770 | ||
754 | // title bar rect | 771 | // title bar rect |
755 | QRect tr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); | 772 | QRect tbr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); |
756 | 773 | ||
757 | #ifndef QT_NO_PALETTE | 774 | #ifndef QT_NO_PALETTE |
758 | QRegion oldClip = painter->clipRegion(); | 775 | QRegion oldClip = painter->clipRegion(); |
759 | painter->setClipRegion( oldClip - QRegion( tr ) );// reduce flicker | 776 | painter->setClipRegion( oldClip - QRegion( tbr ) );// reduce flicker |
760 | wdiface->drawArea( WindowDecorationInterface::Border, painter, &wd ); | 777 | wdiface->drawArea( WindowDecorationInterface::Border, painter, &wd ); |
761 | painter->setClipRegion( oldClip ); | 778 | painter->setClipRegion( oldClip ); |
762 | 779 | ||
763 | if (titleWidth > 0) { | 780 | if (titleWidth > 0) { |
@@ -795,11 +812,11 @@ void QPEDecoration::paintButton(QPainter *painter, const QWidget *w, | |||
795 | case Close: | 812 | case Close: |
796 | b = WindowDecorationInterface::Close; | 813 | b = WindowDecorationInterface::Close; |
797 | break; | 814 | break; |
798 | case Minimize: | 815 | case Minimize: |
799 | if ( ((HackWidget *)w)->needsOk() ) | 816 | if ( ((DecorHackWidget *)w)->needsOk() ) |
800 | b = WindowDecorationInterface::OK; | 817 | b = WindowDecorationInterface::OK; |
801 | else if ( helpExists ) | 818 | else if ( helpExists() ) |
802 | b = WindowDecorationInterface::Help; | 819 | b = WindowDecorationInterface::Help; |
803 | else | 820 | else |
804 | return; | 821 | return; |
805 | break; | 822 | break; |
@@ -817,9 +834,9 @@ void QPEDecoration::paintButton(QPainter *painter, const QWidget *w, | |||
817 | windowData( w, wd ); | 834 | windowData( w, wd ); |
818 | 835 | ||
819 | int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); | 836 | int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); |
820 | QRect rect(w->rect()); | 837 | QRect rect(w->rect()); |
821 | QRect tr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); | 838 | QRect tbr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); |
822 | QRect brect(region(w, w->rect(), type).boundingRect()); | 839 | QRect brect(region(w, w->rect(), type).boundingRect()); |
823 | 840 | ||
824 | const QColorGroup &cg = w->palette().active(); | 841 | const QColorGroup &cg = w->palette().active(); |
825 | if ( wd.flags & WindowDecorationInterface::WindowData::Active ) | 842 | if ( wd.flags & WindowDecorationInterface::WindowData::Active ) |
@@ -827,9 +844,9 @@ void QPEDecoration::paintButton(QPainter *painter, const QWidget *w, | |||
827 | else | 844 | else |
828 | painter->setPen( cg.color(QColorGroup::Text) ); | 845 | painter->setPen( cg.color(QColorGroup::Text) ); |
829 | 846 | ||
830 | QRegion oldClip = painter->clipRegion(); | 847 | QRegion oldClip = painter->clipRegion(); |
831 | painter->setClipRegion( QRect(brect.x(), tr.y(), brect.width(), tr.height()) ); // reduce flicker | 848 | painter->setClipRegion( QRect(brect.x(), tbr.y(), brect.width(), tbr.height()) ); // reduce flicker |
832 | wdiface->drawArea( WindowDecorationInterface::Title, painter, &wd ); | 849 | wdiface->drawArea( WindowDecorationInterface::Title, painter, &wd ); |
833 | wdiface->drawButton( b, painter, &wd, brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)state ); | 850 | wdiface->drawButton( b, painter, &wd, brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)state ); |
834 | painter->setClipRegion( oldClip ); | 851 | painter->setClipRegion( oldClip ); |
835 | } | 852 | } |
@@ -847,8 +864,22 @@ void QPEDecoration::maximize( QWidget *widget ) | |||
847 | QWSDecoration::maximize( widget ); | 864 | QWSDecoration::maximize( widget ); |
848 | } | 865 | } |
849 | } | 866 | } |
850 | 867 | ||
868 | QPopupMenu *QPEDecoration::menu( const QWidget *, const QPoint & ) | ||
869 | { | ||
870 | QPopupMenu *m = new QPopupMenu(); | ||
871 | |||
872 | m->insertItem(QPEManager::tr("Restore"), (int)Normalize); | ||
873 | m->insertItem(QPEManager::tr("Move"), (int)Title); | ||
874 | m->insertItem(QPEManager::tr("Size"), (int)BottomRight); | ||
875 | m->insertItem(QPEManager::tr("Maximize"), (int)Maximize); | ||
876 | m->insertSeparator(); | ||
877 | m->insertItem(QPEManager::tr("Close"), (int)Close); | ||
878 | |||
879 | return m; | ||
880 | } | ||
881 | |||
851 | #ifndef QT_NO_DIALOG | 882 | #ifndef QT_NO_DIALOG |
852 | class HackDialog : public QDialog | 883 | class HackDialog : public QDialog |
853 | { | 884 | { |
854 | public: | 885 | public: |
@@ -870,9 +901,9 @@ void QPEDecoration::minimize( QWidget *widget ) | |||
870 | HackDialog *d = (HackDialog *)widget; | 901 | HackDialog *d = (HackDialog *)widget; |
871 | d->acceptIt(); | 902 | d->acceptIt(); |
872 | } | 903 | } |
873 | #endif | 904 | #endif |
874 | else if ( ((HackWidget *)widget)->needsOk() ) { | 905 | else if ( ((DecorHackWidget *)widget)->needsOk() ) { |
875 | QSignal s; | 906 | QSignal s; |
876 | s.connect( widget, SLOT( accept() ) ); | 907 | s.connect( widget, SLOT( accept() ) ); |
877 | s.activate(); | 908 | s.activate(); |
878 | } else { | 909 | } else { |
@@ -881,13 +912,22 @@ void QPEDecoration::minimize( QWidget *widget ) | |||
881 | } | 912 | } |
882 | 913 | ||
883 | void QPEDecoration::help( QWidget *w ) | 914 | void QPEDecoration::help( QWidget *w ) |
884 | { | 915 | { |
885 | if ( helpExists ) { | 916 | if ( helpExists() ) { |
886 | Global::execute( "helpbrowser", helpFile ); | 917 | QString hf = helpFile; |
918 | QString localHelpFile = QString(qApp->argv()[0]) + "-" + w->name() + ".html"; | ||
919 | QStringList helpPath = Global::helpPath(); | ||
920 | for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end(); ++it) { | ||
921 | if ( QFile::exists( *it + "/" + localHelpFile ) ) { | ||
922 | hf = localHelpFile; | ||
923 | break; | ||
924 | } | ||
925 | } | ||
926 | Global::execute( "helpbrowser", hf ); | ||
887 | } else if ( w && w->testWFlags(Qt::WStyle_ContextHelp) ) { | 927 | } else if ( w && w->testWFlags(Qt::WStyle_ContextHelp) ) { |
888 | QWhatsThis::enterWhatsThisMode(); | 928 | QWhatsThis::enterWhatsThisMode(); |
889 | QWhatsThis::leaveWhatsThisMode( QObject::tr( | 929 | QWhatsThis::leaveWhatsThisMode( QObject::tr( |
890 | "<Qt>Comprehensive help is not available for this application, " | 930 | "<Qt>Comprehensive help is not available for this application, " |
891 | "however there is context-sensitive help.<p>To use context-sensitive help:<p>" | 931 | "however there is context-sensitive help.<p>To use context-sensitive help:<p>" |
892 | "<ol><li>click and hold the help button." | 932 | "<ol><li>click and hold the help button." |
893 | "<li>when the title bar shows <b>What's this...</b>, " | 933 | "<li>when the title bar shows <b>What's this...</b>, " |
@@ -898,9 +938,9 @@ void QPEDecoration::help( QWidget *w ) | |||
898 | void QPEDecoration::windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const | 938 | void QPEDecoration::windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const |
899 | { | 939 | { |
900 | wd.rect = w->rect(); | 940 | wd.rect = w->rect(); |
901 | if ( qpeManager->whatsThisWidget() == w ) | 941 | if ( qpeManager->whatsThisWidget() == w ) |
902 | wd.caption = QObject::tr("What's this..." ); | 942 | wd.caption = QObject::tr( "What's this..." ); |
903 | else | 943 | else |
904 | wd.caption = w->caption(); | 944 | wd.caption = w->caption(); |
905 | wd.palette = qApp->palette(); | 945 | wd.palette = qApp->palette(); |
906 | wd.flags = 0; | 946 | wd.flags = 0; |
@@ -923,4 +963,5 @@ QPopupMenu *QPEDecoration::menu(QWSManager*, const QWidget*, const QPoint&) | |||
923 | 963 | ||
924 | 964 | ||
925 | 965 | ||
926 | #endif // QT_NO_QWS_QPE_WM_STYLE | 966 | #endif // QT_NO_QWS_QPE_WM_STYLE |
967 | #endif | ||
diff --git a/library/qpedecoration_qws.h b/library/qpedecoration_qws.h index d0a2005..ca670cd 100644 --- a/library/qpedecoration_qws.h +++ b/library/qpedecoration_qws.h | |||
@@ -21,8 +21,9 @@ | |||
21 | #define QPE_DECORATION_QWS_H__ | 21 | #define QPE_DECORATION_QWS_H__ |
22 | 22 | ||
23 | 23 | ||
24 | #ifdef QWS | 24 | #ifdef QWS |
25 | #include <qpe/global.h> | ||
25 | #include <qwsdefaultdecoration_qws.h> | 26 | #include <qwsdefaultdecoration_qws.h> |
26 | #include <qimage.h> | 27 | #include <qimage.h> |
27 | #include <qdatetime.h> | 28 | #include <qdatetime.h> |
28 | #include <qguardedptr.h> | 29 | #include <qguardedptr.h> |
@@ -32,8 +33,9 @@ | |||
32 | #ifndef QT_NO_QWS_QPE_WM_STYLE | 33 | #ifndef QT_NO_QWS_QPE_WM_STYLE |
33 | 34 | ||
34 | class QPEManager; | 35 | class QPEManager; |
35 | class QTimer; | 36 | class QTimer; |
37 | #include <qwidget.h> | ||
36 | 38 | ||
37 | class QPEDecoration : public QWSDefaultDecoration | 39 | class QPEDecoration : public QWSDefaultDecoration |
38 | { | 40 | { |
39 | public: | 41 | public: |
@@ -46,8 +48,9 @@ public: | |||
46 | virtual void paintButton(QPainter *, const QWidget *, Region, int state); | 48 | virtual void paintButton(QPainter *, const QWidget *, Region, int state); |
47 | 49 | ||
48 | void maximize( QWidget * ); | 50 | void maximize( QWidget * ); |
49 | void minimize( QWidget * ); | 51 | void minimize( QWidget * ); |
52 | virtual QPopupMenu *menu( const QWidget *, const QPoint & ); | ||
50 | virtual void help( QWidget * ); | 53 | virtual void help( QWidget * ); |
51 | 54 | ||
52 | enum QPERegion { Help=LastRegion+1 }; | 55 | enum QPERegion { Help=LastRegion+1 }; |
53 | void buttonClicked( QPERegion r ); | 56 | void buttonClicked( QPERegion r ); |
@@ -62,16 +65,16 @@ protected: | |||
62 | 65 | ||
63 | private: | 66 | private: |
64 | void windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const; | 67 | void windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const; |
65 | 68 | ||
66 | void init ( const QString & ); | 69 | bool helpExists() const; |
67 | 70 | ||
68 | protected: | 71 | protected: |
69 | QImage imageOk; | 72 | QImage imageOk; |
70 | QImage imageClose; | 73 | QImage imageClose; |
71 | QImage imageHelp; | 74 | QImage imageHelp; |
72 | QString helpFile; | 75 | QString helpFile; |
73 | bool helpExists; | 76 | bool helpexists : 1; |
74 | QPEManager *qpeManager; | 77 | QPEManager *qpeManager; |
75 | }; | 78 | }; |
76 | 79 | ||
77 | 80 | ||
@@ -100,9 +103,9 @@ protected: | |||
100 | QGuardedPtr<QWidget> active; | 103 | QGuardedPtr<QWidget> active; |
101 | int helpState; | 104 | int helpState; |
102 | QTime pressTime; | 105 | QTime pressTime; |
103 | QTimer *wtTimer; | 106 | QTimer *wtTimer; |
104 | bool inWhatsThis; | 107 | bool inWhatsThis : 1; |
105 | QGuardedPtr<QWidget> whatsThis; | 108 | QGuardedPtr<QWidget> whatsThis; |
106 | }; | 109 | }; |
107 | 110 | ||
108 | 111 | ||