summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qt_override.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/qt_override.cpp b/library/qt_override.cpp
index 0d783bd..9c5ba24 100644
--- a/library/qt_override.cpp
+++ b/library/qt_override.cpp
@@ -1,166 +1,170 @@
1 1
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qwsdecoration_qws.h> 3#include <qwsdecoration_qws.h>
4#include <qcommonstyle.h> 4#include <qcommonstyle.h>
5#include <qfontdatabase.h> 5#include <qfontdatabase.h>
6 6
7#include <unistd.h> 7#include <unistd.h>
8#include <stdlib.h> 8#include <stdlib.h>
9#include <stdio.h> 9#include <stdio.h>
10#include <limits.h>
11#include <sys/param.h> // for toolchains with old libc headers
10 12
11#include "qt_override_p.h" 13#include "qt_override_p.h"
12 14
13 15
14 16
15struct color_fix_t { 17struct color_fix_t {
16 char *m_app; 18 char *m_app;
17 char *m_class; 19 char *m_class;
18 char *m_name; 20 char *m_name;
19 QColorGroup::ColorRole m_set; 21 QColorGroup::ColorRole m_set;
20 QColorGroup::ColorRole m_get; 22 QColorGroup::ColorRole m_get;
21}; 23};
22 24
23 25
24 26
25static const color_fix_t apps_that_need_special_colors [] = { 27static const color_fix_t apps_that_need_special_colors [] = {
26 { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base }, 28 { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base },
27 { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base }, 29 { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base },
28 30
29 { 0, 0, 0, QColorGroup::Base, QColorGroup::Base } 31 { 0, 0, 0, QColorGroup::Base, QColorGroup::Base }
30}; 32};
31 33
32static const char * const apps_that_need_pointsizes_times_10 [] = { 34static const char * const apps_that_need_pointsizes_times_10 [] = {
33 "HancomMobileWord", 35 "HancomMobileWord",
36 "hancomsheet",
37 "HancomPresenterViewer",
34 38
35 0 39 0
36}; 40};
37 41
38 42
39 43
40 44
41int Opie::force_appearance = 0; 45int Opie::force_appearance = 0;
42 46
43 47
44// Return the *real* name of the binary - not just a quick guess 48// Return the *real* name of the binary - not just a quick guess
45// by looking at argv [0] (which could be anything) 49// by looking at argv [0] (which could be anything)
46 50
47static void binaryNameFree ( ) 51static void binaryNameFree ( )
48{ 52{
49 ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here 53 ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here
50} 54}
51 55
52const char *Opie::binaryName ( ) 56const char *Opie::binaryName ( )
53{ 57{
54 static const char *appname = 0; 58 static const char *appname = 0;
55 59
56 if ( !appname ) { 60 if ( !appname ) {
57 char dst [PATH_MAX + 1]; 61 char dst [PATH_MAX + 1];
58 int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX ); 62 int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX );
59 63
60 if ( l <= 0 ) 64 if ( l <= 0 )
61 l = 0; 65 l = 0;
62 66
63 dst [l] = 0; 67 dst [l] = 0;
64 const char *b = ::strrchr ( dst, '/' ); 68 const char *b = ::strrchr ( dst, '/' );
65 appname = ::strdup ( b ? b + 1 : dst ); 69 appname = ::strdup ( b ? b + 1 : dst );
66 70
67 ::atexit ( binaryNameFree ); 71 ::atexit ( binaryNameFree );
68 } 72 }
69 return appname; 73 return appname;
70} 74}
71 75
72 76
73// Fix for a toolchain incompatibility (binaries compiled with 77// Fix for a toolchain incompatibility (binaries compiled with
74// old tcs using shared libs compiled with newer tcs) 78// old tcs using shared libs compiled with newer tcs)
75 79
76extern "C" { 80extern "C" {
77 81
78extern void __gmon_start__ ( ) __attribute__(( weak )); 82extern void __gmon_start__ ( ) __attribute__(( weak ));
79 83
80extern void __gmon_start__ ( ) 84extern void __gmon_start__ ( )
81{ 85{
82} 86}
83 87
84} 88}
85 89
86 90
87// Fix for apps, that use QPainter::eraseRect() which doesn't work with styles 91// 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 92// that set a background pixmap (it would be easier to fix eraseRect(), but
89// TT made it an inline ...) 93// TT made it an inline ...)
90 94
91void QPEApplication::polish ( QWidget *w ) 95void QPEApplication::polish ( QWidget *w )
92{ 96{
93 qDebug ( "QPEApplication::polish()" ); 97 qDebug ( "QPEApplication::polish()" );
94 98
95 for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { 99 for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) {
96 if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && 100 if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) &&
97 ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && 101 ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) &&
98 ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) { 102 ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) {
99 QPalette pal = w-> palette ( ); 103 QPalette pal = w-> palette ( );
100 pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get )); 104 pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get ));
101 w-> setPalette ( pal ); 105 w-> setPalette ( pal );
102 } 106 }
103 } 107 }
104 QApplication::polish ( w ); 108 QApplication::polish ( w );
105} 109}
106 110
107 111
108// Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes 112// Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes
109// were multiplied by 10 (which was incorrect) 113// were multiplied by 10 (which was incorrect)
110 114
111QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) 115QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset )
112{ 116{
113 qDebug ( "QFontDatabase::pointSizes()" ); 117 qDebug ( "QFontDatabase::pointSizes()" );
114 118
115 QValueList <int> sl = pointSizes_NonWeak ( family, style, charset ); 119 QValueList <int> sl = pointSizes_NonWeak ( family, style, charset );
116 120
117 for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { 121 for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) {
118 if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) { 122 if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) {
119 for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 123 for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
120 *it *= 10; 124 *it *= 10;
121 } 125 }
122 } 126 }
123 return sl; 127 return sl;
124} 128}
125 129
126 130
127// Various style/font/color related overrides for weak symbols in Qt/E, 131// 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. 132// which allows us to force the usage of the global Opie appearance.
129 133
130void QApplication::setStyle ( QStyle *style ) 134void QApplication::setStyle ( QStyle *style )
131{ 135{
132 qDebug ( "QApplication::setStyle()" ); 136 qDebug ( "QApplication::setStyle()" );
133 137
134 if ( Opie::force_appearance & Opie::Force_Style ) 138 if ( Opie::force_appearance & Opie::Force_Style )
135 delete style; 139 delete style;
136 else 140 else
137 QApplication::setStyle_NonWeak ( style ); 141 QApplication::setStyle_NonWeak ( style );
138} 142}
139 143
140void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) 144void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className )
141{ 145{
142 qDebug ( "QApplication::setPalette()" ); 146 qDebug ( "QApplication::setPalette()" );
143 147
144 if (!( Opie::force_appearance & Opie::Force_Style )) 148 if (!( Opie::force_appearance & Opie::Force_Style ))
145 QApplication::setPalette_NonWeak ( pal, informWidgets, className ); 149 QApplication::setPalette_NonWeak ( pal, informWidgets, className );
146} 150}
147 151
148void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) 152void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className )
149{ 153{
150 qDebug ( "QApplication::setFont()" ); 154 qDebug ( "QApplication::setFont()" );
151 155
152 if (!( Opie::force_appearance & Opie::Force_Font )) 156 if (!( Opie::force_appearance & Opie::Force_Font ))
153 QApplication::setFont_NonWeak ( fnt, informWidgets, className ); 157 QApplication::setFont_NonWeak ( fnt, informWidgets, className );
154} 158}
155 159
156 160
157void QApplication::qwsSetDecoration ( QWSDecoration *deco ) 161void QApplication::qwsSetDecoration ( QWSDecoration *deco )
158{ 162{
159 qDebug ( "QApplication::qwsSetDecoration()" ); 163 qDebug ( "QApplication::qwsSetDecoration()" );
160 164
161 if ( Opie::force_appearance & Opie::Force_Decoration ) 165 if ( Opie::force_appearance & Opie::Force_Decoration )
162 delete deco; 166 delete deco;
163 else 167 else
164 QApplication::qwsSetDecoration_NonWeak ( deco ); 168 QApplication::qwsSetDecoration_NonWeak ( deco );
165} 169}
166 170