-rw-r--r-- | library/global.cpp | 16 | ||||
-rw-r--r-- | library/library.pro | 7 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 40 | ||||
-rw-r--r-- | library/qpeapplication.h | 2 | ||||
-rw-r--r-- | library/qt_override.cpp | 166 | ||||
-rw-r--r-- | library/qt_override_p.h | 21 |
6 files changed, 209 insertions, 43 deletions
diff --git a/library/global.cpp b/library/global.cpp index 2162e02..d6ba84f 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -598,40 +598,26 @@ void Global::invoke(const QString &c) | |||
598 | #ifdef HAVE_QUICKEXEC | 598 | #ifdef HAVE_QUICKEXEC |
599 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; | 599 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; |
600 | qDebug("libfile = %s", libexe.latin1() ); | 600 | qDebug("libfile = %s", libexe.latin1() ); |
601 | if ( QFile::exists( libexe ) ) { | 601 | if ( QFile::exists( libexe ) ) { |
602 | qDebug("calling quickexec %s", libexe.latin1() ); | 602 | qDebug("calling quickexec %s", libexe.latin1() ); |
603 | quickexecv( libexe.utf8().data(), (const char **)args ); | 603 | quickexecv( libexe.utf8().data(), (const char **)args ); |
604 | } else | 604 | } else |
605 | #endif | 605 | #endif |
606 | { | 606 | { |
607 | char *oldpre = ::getenv ( "LD_PRELOAD" ); | ||
608 | |||
609 | QString newpre = QPEApplication::qpeDir ( ) + "/lib/libpreload.so"; | ||
610 | if ( QFile::exists ( newpre )) { | ||
611 | if ( oldpre && oldpre [0] ) | ||
612 | newpre = newpre + ":" + oldpre; | ||
613 | ::setenv ( "LD_PRELOAD", newpre. latin1( ), 1 ); | ||
614 | qDebug ( "\nPRELOADING\n" ); | ||
615 | } | ||
616 | |||
617 | if ( !::vfork() ) { | 607 | if ( !::vfork() ) { |
618 | for ( int fd = 3; fd < 100; fd++ ) | 608 | for ( int fd = 3; fd < 100; fd++ ) |
619 | ::close( fd ); | 609 | ::close( fd ); |
620 | ::setpgid( ::getpid(), ::getppid() ); | 610 | ::setpgid( ::getpid(), ::getppid() ); |
621 | // Try bindir first, so that foo/bar works too | 611 | // Try bindir first, so that foo/bar works too |
622 | ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); | 612 | ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); |
623 | ::execvp( args[0], (char * const *)args ); | 613 | ::execvp( args[0], (char * const *)args ); |
624 | _exit( -1 ); | 614 | _exit( -1 ); |
625 | } | 615 | } |
626 | if ( oldpre ) | ||
627 | ::setenv ( "LD_PRELOAD", oldpre, 1 ); | ||
628 | else | ||
629 | ::unsetenv ( "LD_PRELOAD" ); | ||
630 | } | 616 | } |
631 | StartingAppList::add( list[0] ); | 617 | StartingAppList::add( list[0] ); |
632 | #endif //QT_NO_QWS_MULTIPROCESS | 618 | #endif //QT_NO_QWS_MULTIPROCESS |
633 | } | 619 | } |
634 | 620 | ||
635 | 621 | ||
636 | /*! | 622 | /*! |
637 | Executes the application identfied by \a c, passing \a | 623 | Executes the application identfied by \a c, passing \a |
diff --git a/library/library.pro b/library/library.pro index 4a06550..d9538fb 100644 --- a/library/library.pro +++ b/library/library.pro | |||
@@ -52,17 +52,19 @@ HEADERS = calendar.h \ | |||
52 | categorywidget.h \ | 52 | categorywidget.h \ |
53 | ir.h \ | 53 | ir.h \ |
54 | backend/vobject_p.h \ | 54 | backend/vobject_p.h \ |
55 | findwidget_p.h \ | 55 | findwidget_p.h \ |
56 | finddialog.h \ | 56 | finddialog.h \ |
57 | lnkproperties.h \ | 57 | lnkproperties.h \ |
58 | windowdecorationinterface.h \ | 58 | windowdecorationinterface.h \ |
59 | textcodecinterface.h \ | 59 | textcodecinterface.h \ |
60 | imagecodecinterface.h | 60 | imagecodecinterface.h \ |
61 | qt_override_p.h | ||
62 | |||
61 | SOURCES= calendar.cpp \ | 63 | SOURCES= calendar.cpp \ |
62 | global.cpp \ | 64 | global.cpp \ |
63 | xmlreader.cpp \ | 65 | xmlreader.cpp \ |
64 | mimetype.cpp \ | 66 | mimetype.cpp \ |
65 | menubutton.cpp \ | 67 | menubutton.cpp \ |
66 | network.cpp \ | 68 | network.cpp \ |
67 | networkinterface.cpp \ | 69 | networkinterface.cpp \ |
68 | filemanager.cpp \ | 70 | filemanager.cpp \ |
@@ -107,17 +109,18 @@ SOURCES = calendar.cpp \ | |||
107 | categoryedit_p.cpp \ | 109 | categoryedit_p.cpp \ |
108 | categoryselect.cpp \ | 110 | categoryselect.cpp \ |
109 | categorywidget.cpp \ | 111 | categorywidget.cpp \ |
110 | ir.cpp \ | 112 | ir.cpp \ |
111 | backend/vcc_yacc.cpp \ | 113 | backend/vcc_yacc.cpp \ |
112 | backend/vobject.cpp \ | 114 | backend/vobject.cpp \ |
113 | findwidget_p.cpp \ | 115 | findwidget_p.cpp \ |
114 | finddialog.cpp \ | 116 | finddialog.cpp \ |
115 | lnkproperties.cpp | 117 | lnkproperties.cpp \ |
118 | qt_override.cpp | ||
116 | 119 | ||
117 | # Qt 3 compatibility | 120 | # Qt 3 compatibility |
118 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h | 121 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h |
119 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp | 122 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp |
120 | INCLUDEPATH += $(OPIEDIR)/include backend | 123 | INCLUDEPATH += $(OPIEDIR)/include backend |
121 | LIBS += -ldl -lcrypt -lm | 124 | LIBS += -ldl -lcrypt -lm |
122 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui | 125 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui |
123 | TARGET = qpe | 126 | TARGET = qpe |
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 7cbda92..4c93111 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -81,16 +81,18 @@ | |||
81 | #include "textcodecinterface.h" | 81 | #include "textcodecinterface.h" |
82 | #include "imagecodecinterface.h" | 82 | #include "imagecodecinterface.h" |
83 | 83 | ||
84 | #include <unistd.h> | 84 | #include <unistd.h> |
85 | #include <sys/file.h> | 85 | #include <sys/file.h> |
86 | #include <sys/ioctl.h> | 86 | #include <sys/ioctl.h> |
87 | #include <sys/soundcard.h> | 87 | #include <sys/soundcard.h> |
88 | 88 | ||
89 | #include "qt_override_p.h" | ||
90 | |||
89 | 91 | ||
90 | class QPEApplicationData | 92 | class QPEApplicationData |
91 | { | 93 | { |
92 | public: | 94 | public: |
93 | QPEApplicationData() : presstimer( 0 ), presswidget( 0 ), rightpressed( FALSE ), | 95 | QPEApplicationData() : presstimer( 0 ), presswidget( 0 ), rightpressed( FALSE ), |
94 | kbgrabber( 0 ), kbregrab( FALSE ), notbusysent( FALSE ), preloaded( FALSE ), | 96 | kbgrabber( 0 ), kbregrab( FALSE ), notbusysent( FALSE ), preloaded( FALSE ), |
95 | forceshow( FALSE ), nomaximize( FALSE ), qpe_main_widget( 0 ), | 97 | forceshow( FALSE ), nomaximize( FALSE ), qpe_main_widget( 0 ), |
96 | keep_running( TRUE ) | 98 | keep_running( TRUE ) |
@@ -894,62 +896,44 @@ void QPEApplication::setDefaultRotation( int r ) | |||
894 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 896 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
895 | e << r; | 897 | e << r; |
896 | } | 898 | } |
897 | #endif | 899 | #endif |
898 | 900 | ||
899 | } | 901 | } |
900 | } | 902 | } |
901 | 903 | ||
902 | // exported to libpreload.so | ||
903 | int opie_block_style = 0; | ||
904 | 904 | ||
905 | /*! | 905 | /*! |
906 | \internal | 906 | \internal |
907 | */ | 907 | */ |
908 | void QPEApplication::applyStyle() | 908 | void QPEApplication::applyStyle() |
909 | { | 909 | { |
910 | Config config( "qpe" ); | 910 | Config config( "qpe" ); |
911 | config.setGroup( "Appearance" ); | 911 | config.setGroup( "Appearance" ); |
912 | 912 | ||
913 | // don't block ourselves ... | 913 | // don't block ourselves ... |
914 | opie_block_style = 0; | 914 | Opie::force_appearance = 0; |
915 | 915 | ||
916 | 916 | static QString appname = Opie::binaryName ( ); | |
917 | static QString appname; | ||
918 | |||
919 | if ( appname. isNull ( )) { | ||
920 | char src [32]; | ||
921 | char dst [PATH_MAX + 1]; | ||
922 | ::sprintf ( src, "/proc/%d/exe", ::getpid ( )); | ||
923 | int l = ::readlink ( src, dst, PATH_MAX ); | ||
924 | if ( l > 0 ) { | ||
925 | dst [l] = 0; | ||
926 | const char *b = ::strrchr ( dst, '/' ); | ||
927 | appname = ( b ? b + 1 : dst ); | ||
928 | } | ||
929 | else | ||
930 | appname = ""; | ||
931 | } | ||
932 | |||
933 | 917 | ||
934 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 918 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
935 | int nostyle = 0; | 919 | int nostyle = 0; |
936 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 920 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
937 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 921 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
938 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 922 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
939 | break; | 923 | break; |
940 | } | 924 | } |
941 | } | 925 | } |
942 | 926 | ||
943 | // Widget style | 927 | // Widget style |
944 | QString style = config.readEntry( "Style", "Light" ); | 928 | QString style = config.readEntry( "Style", "Light" ); |
945 | 929 | ||
946 | // don't set a custom style | 930 | // don't set a custom style |
947 | if ( nostyle & 0x01 ) | 931 | if ( nostyle & Opie::Force_Style ) |
948 | style = "Light"; | 932 | style = "Light"; |
949 | 933 | ||
950 | internalSetStyle ( style ); | 934 | internalSetStyle ( style ); |
951 | 935 | ||
952 | // Colors | 936 | // Colors |
953 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); | 937 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); |
954 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); | 938 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); |
955 | QPalette pal( btncolor, bgcolor ); | 939 | QPalette pal( btncolor, bgcolor ); |
@@ -968,41 +952,41 @@ void QPEApplication::applyStyle() | |||
968 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 952 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
969 | 953 | ||
970 | setPalette( pal, TRUE ); | 954 | setPalette( pal, TRUE ); |
971 | 955 | ||
972 | // Window Decoration | 956 | // Window Decoration |
973 | QString dec = config.readEntry( "Decoration", "Qtopia" ); | 957 | QString dec = config.readEntry( "Decoration", "Qtopia" ); |
974 | 958 | ||
975 | // don't set a custom deco | 959 | // don't set a custom deco |
976 | if ( nostyle & 0x04 ) | 960 | if ( nostyle & Opie::Force_Decoration ) |
977 | dec = ""; | 961 | dec = ""; |
978 | 962 | ||
979 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 963 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
980 | 964 | ||
981 | if ( dec != d->decorationName ) { | 965 | if ( dec != d->decorationName ) { |
982 | qwsSetDecoration( new QPEDecoration( dec ) ); | 966 | qwsSetDecoration( new QPEDecoration( dec ) ); |
983 | d->decorationName = dec; | 967 | d->decorationName = dec; |
984 | } | 968 | } |
985 | 969 | ||
986 | // Font | 970 | // Font |
987 | QString ff = config.readEntry( "FontFamily", font().family() ); | 971 | QString ff = config.readEntry( "FontFamily", font().family() ); |
988 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 972 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
989 | 973 | ||
990 | // don't set a custom font | 974 | // don't set a custom font |
991 | if ( nostyle & 0x02 ) { | 975 | if ( nostyle & Opie::Force_Font ) { |
992 | ff = "Helvetica"; | 976 | ff = "Helvetica"; |
993 | fs = 10; | 977 | fs = 10; |
994 | } | 978 | } |
995 | 979 | ||
996 | setFont ( QFont ( ff, fs ), true ); | 980 | setFont ( QFont ( ff, fs ), true ); |
997 | 981 | ||
998 | // revert to global blocking policy ... | 982 | // revert to global blocking policy ... |
999 | opie_block_style = config. readBoolEntry ( "ForceStyle", false ) ? 0xff : 0x00; | 983 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1000 | opie_block_style -= nostyle; | 984 | Opie::force_appearance &= ~nostyle; |
1001 | } | 985 | } |
1002 | 986 | ||
1003 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 987 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1004 | { | 988 | { |
1005 | #ifdef Q_WS_QWS | 989 | #ifdef Q_WS_QWS |
1006 | QDataStream stream( data, IO_ReadOnly ); | 990 | QDataStream stream( data, IO_ReadOnly ); |
1007 | if ( msg == "applyStyle()" ) { | 991 | if ( msg == "applyStyle()" ) { |
1008 | applyStyle(); | 992 | applyStyle(); |
@@ -1688,16 +1672,20 @@ void QPEApplication::hideOrQuit() | |||
1688 | e << d->appName; | 1672 | e << d->appName; |
1689 | d->qpe_main_widget->hide(); | 1673 | d->qpe_main_widget->hide(); |
1690 | } | 1674 | } |
1691 | #endif | 1675 | #endif |
1692 | else | 1676 | else |
1693 | quit(); | 1677 | quit(); |
1694 | } | 1678 | } |
1695 | 1679 | ||
1680 | |||
1681 | // These 6 stubs below need 1.5K in the binary and besides that - | ||
1682 | // we are not using ancient toolchains anymore - sandman | ||
1683 | |||
1696 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SHARP) | 1684 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SHARP) |
1697 | 1685 | ||
1698 | // The libraries with the skiff package (and possibly others) have | 1686 | // The libraries with the skiff package (and possibly others) have |
1699 | // completely useless implementations of builtin new and delete that | 1687 | // completely useless implementations of builtin new and delete that |
1700 | // use about 50% of your CPU. Here we revert to the simple libc | 1688 | // use about 50% of your CPU. Here we revert to the simple libc |
1701 | // functions. | 1689 | // functions. |
1702 | 1690 | ||
1703 | void* operator new[]( size_t size ) | 1691 | void* operator new[]( size_t size ) |
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 2515f1b..86affa6 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -109,16 +109,18 @@ protected: | |||
109 | void prepareForTermination(bool willrestart); | 109 | void prepareForTermination(bool willrestart); |
110 | virtual void restart(); | 110 | virtual void restart(); |
111 | virtual void shutdown(); | 111 | virtual void shutdown(); |
112 | bool eventFilter( QObject *, QEvent * ); | 112 | bool eventFilter( QObject *, QEvent * ); |
113 | void timerEvent( QTimerEvent * ); | 113 | void timerEvent( QTimerEvent * ); |
114 | bool raiseAppropriateWindow(); | 114 | bool raiseAppropriateWindow(); |
115 | virtual void tryQuit(); | 115 | virtual void tryQuit(); |
116 | 116 | ||
117 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) | ||
118 | |||
117 | private: | 119 | private: |
118 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 120 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
119 | 121 | ||
120 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 122 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
121 | QCopChannel *sysChannel; | 123 | QCopChannel *sysChannel; |
122 | QCopChannel *pidChannel; | 124 | QCopChannel *pidChannel; |
123 | #endif | 125 | #endif |
124 | QPEApplicationData *d; | 126 | QPEApplicationData *d; |
diff --git a/library/qt_override.cpp b/library/qt_override.cpp new file mode 100644 index 0000000..0d783bd --- a/dev/null +++ b/library/qt_override.cpp | |||
@@ -0,0 +1,166 @@ | |||
1 | |||
2 | #include <qpe/qpeapplication.h> | ||
3 | #include <qwsdecoration_qws.h> | ||
4 | #include <qcommonstyle.h> | ||
5 | #include <qfontdatabase.h> | ||
6 | |||
7 | #include <unistd.h> | ||
8 | #include <stdlib.h> | ||
9 | #include <stdio.h> | ||
10 | |||
11 | #include "qt_override_p.h" | ||
12 | |||
13 | |||
14 | |||
15 | struct color_fix_t { | ||
16 | char *m_app; | ||
17 | char *m_class; | ||
18 | char *m_name; | ||
19 | QColorGroup::ColorRole m_set; | ||
20 | QColorGroup::ColorRole m_get; | ||
21 | }; | ||
22 | |||
23 | |||
24 | |||
25 | static const color_fix_t apps_that_need_special_colors [] = { | ||
26 | { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base }, | ||
27 | { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base }, | ||
28 | |||
29 | { 0, 0, 0, QColorGroup::Base, QColorGroup::Base } | ||
30 | }; | ||
31 | |||
32 | static const char * const apps_that_need_pointsizes_times_10 [] = { | ||
33 | "HancomMobileWord", | ||
34 | |||
35 | 0 | ||
36 | }; | ||
37 | |||
38 | |||
39 | |||
40 | |||
41 | int Opie::force_appearance = 0; | ||
42 | |||
43 | |||
44 | // Return the *real* name of the binary - not just a quick guess | ||
45 | // by looking at argv [0] (which could be anything) | ||
46 | |||
47 | static void binaryNameFree ( ) | ||
48 | { | ||
49 | ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here | ||
50 | } | ||
51 | |||
52 | const char *Opie::binaryName ( ) | ||
53 | { | ||
54 | static const char *appname = 0; | ||
55 | |||
56 | if ( !appname ) { | ||
57 | char dst [PATH_MAX + 1]; | ||
58 | int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX ); | ||
59 | |||
60 | if ( l <= 0 ) | ||
61 | l = 0; | ||
62 | |||
63 | dst [l] = 0; | ||
64 | const char *b = ::strrchr ( dst, '/' ); | ||
65 | appname = ::strdup ( b ? b + 1 : dst ); | ||
66 | |||
67 | ::atexit ( binaryNameFree ); | ||
68 | } | ||
69 | return appname; | ||
70 | } | ||
71 | |||
72 | |||
73 | // Fix for a toolchain incompatibility (binaries compiled with | ||
74 | // old tcs using shared libs compiled with newer tcs) | ||
75 | |||
76 | extern "C" { | ||
77 | |||
78 | extern void __gmon_start__ ( ) __attribute__(( weak )); | ||
79 | |||
80 | extern void __gmon_start__ ( ) | ||
81 | { | ||
82 | } | ||
83 | |||
84 | } | ||
85 | |||
86 | |||
87 | // Fix for apps, that use QPainter::eraseRect() which doesn't work with styles | ||
88 | // that set a background pixmap (it would be easier to fix eraseRect(), but | ||
89 | // TT made it an inline ...) | ||
90 | |||
91 | void QPEApplication::polish ( QWidget *w ) | ||
92 | { | ||
93 | qDebug ( "QPEApplication::polish()" ); | ||
94 | |||
95 | for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { | ||
96 | if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && | ||
97 | ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && | ||
98 | ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) { | ||
99 | QPalette pal = w-> palette ( ); | ||
100 | pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get )); | ||
101 | w-> setPalette ( pal ); | ||
102 | } | ||
103 | } | ||
104 | QApplication::polish ( w ); | ||
105 | } | ||
106 | |||
107 | |||
108 | // Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes | ||
109 | // were multiplied by 10 (which was incorrect) | ||
110 | |||
111 | QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) | ||
112 | { | ||
113 | qDebug ( "QFontDatabase::pointSizes()" ); | ||
114 | |||
115 | QValueList <int> sl = pointSizes_NonWeak ( family, style, charset ); | ||
116 | |||
117 | for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { | ||
118 | if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) { | ||
119 | for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | ||
120 | *it *= 10; | ||
121 | } | ||
122 | } | ||
123 | return sl; | ||
124 | } | ||
125 | |||
126 | |||
127 | // Various style/font/color related overrides for weak symbols in Qt/E, | ||
128 | // which allows us to force the usage of the global Opie appearance. | ||
129 | |||
130 | void QApplication::setStyle ( QStyle *style ) | ||
131 | { | ||
132 | qDebug ( "QApplication::setStyle()" ); | ||
133 | |||
134 | if ( Opie::force_appearance & Opie::Force_Style ) | ||
135 | delete style; | ||
136 | else | ||
137 | QApplication::setStyle_NonWeak ( style ); | ||
138 | } | ||
139 | |||
140 | void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) | ||
141 | { | ||
142 | qDebug ( "QApplication::setPalette()" ); | ||
143 | |||
144 | if (!( Opie::force_appearance & Opie::Force_Style )) | ||
145 | QApplication::setPalette_NonWeak ( pal, informWidgets, className ); | ||
146 | } | ||
147 | |||
148 | void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) | ||
149 | { | ||
150 | qDebug ( "QApplication::setFont()" ); | ||
151 | |||
152 | if (!( Opie::force_appearance & Opie::Force_Font )) | ||
153 | QApplication::setFont_NonWeak ( fnt, informWidgets, className ); | ||
154 | } | ||
155 | |||
156 | |||
157 | void QApplication::qwsSetDecoration ( QWSDecoration *deco ) | ||
158 | { | ||
159 | qDebug ( "QApplication::qwsSetDecoration()" ); | ||
160 | |||
161 | if ( Opie::force_appearance & Opie::Force_Decoration ) | ||
162 | delete deco; | ||
163 | else | ||
164 | QApplication::qwsSetDecoration_NonWeak ( deco ); | ||
165 | } | ||
166 | |||
diff --git a/library/qt_override_p.h b/library/qt_override_p.h new file mode 100644 index 0000000..d11917c --- a/dev/null +++ b/library/qt_override_p.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __QT_OVERRIDE_H__ | ||
2 | #define __QT_OVERRIDE_H__ | ||
3 | |||
4 | namespace Opie { | ||
5 | |||
6 | enum ForceAppearance { | ||
7 | Force_Style = 0x01, | ||
8 | Force_Font = 0x02, | ||
9 | Force_Decoration = 0x04, | ||
10 | |||
11 | Force_All = 0xff, | ||
12 | Force_None = 0x00, | ||
13 | }; | ||
14 | |||
15 | extern const char *binaryName ( ); | ||
16 | |||
17 | extern int force_appearance; | ||
18 | |||
19 | } | ||
20 | |||
21 | #endif | ||