summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2005-02-08 22:59:18 (UTC)
committer zecke <zecke>2005-02-08 22:59:18 (UTC)
commitf24d8318de30b47ec8f877293fd175deaa0b914c (patch) (unidiff)
tree980c18e803b7b85573e1ab11a9ade2b281273d3e /library
parent7cff42233a2e0e2761f54fea89db785c7b519c94 (diff)
downloadopie-f24d8318de30b47ec8f877293fd175deaa0b914c.zip
opie-f24d8318de30b47ec8f877293fd175deaa0b914c.tar.gz
opie-f24d8318de30b47ec8f877293fd175deaa0b914c.tar.bz2
-Kill the need to compile Opie against a patched version of Qt/E
Remove the setStyle and setFont overrides as a result remove settings from the buildsystem and the Apperance GUI We do this as we won't run NeoCal or TKC Apps on a GCC3 (now default compiler) libqpe, to run these applications one can use oz-compat
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/library.pro6
-rw-r--r--library/qpeapplication.cpp40
-rw-r--r--library/qpeapplication.h5
-rw-r--r--library/qt_override.cpp170
-rw-r--r--library/qt_override_p.h25
5 files changed, 0 insertions, 246 deletions
diff --git a/library/library.pro b/library/library.pro
index 04e125f..95c18a2 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -1,145 +1,139 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 #CONFIG += qt warn_on release 2 #CONFIG += qt warn_on release
3 CONFIG += qt warn_on debug 3 CONFIG += qt warn_on debug
4 HEADERS= calendar.h \ 4 HEADERS= calendar.h \
5 global.h \ 5 global.h \
6 resource.h \ 6 resource.h \
7 xmlreader.h \ 7 xmlreader.h \
8 mimetype.h \ 8 mimetype.h \
9 menubutton.h \ 9 menubutton.h \
10 network.h \ 10 network.h \
11 networkinterface.h \ 11 networkinterface.h \
12 filemanager.h \ 12 filemanager.h \
13 fontmanager.h \ 13 fontmanager.h \
14 qdawg.h \ 14 qdawg.h \
15 datebookmonth.h \ 15 datebookmonth.h \
16 fileselector.h \ 16 fileselector.h \
17 fileselector_p.h \ 17 fileselector_p.h \
18 imageedit.h \ 18 imageedit.h \
19 qcopenvelope_qws.h \ 19 qcopenvelope_qws.h \
20 qpedecoration_qws.h \ 20 qpedecoration_qws.h \
21 qpeapplication.h \ 21 qpeapplication.h \
22 qpestyle.h \ 22 qpestyle.h \
23 qpedialog.h \ 23 qpedialog.h \
24 lightstyle.h \ 24 lightstyle.h \
25 config.h \ 25 config.h \
26 applnk.h \ 26 applnk.h \
27 sound.h \ 27 sound.h \
28 tzselect.h \ 28 tzselect.h \
29 qmath.h \ 29 qmath.h \
30 datebookdb.h \ 30 datebookdb.h \
31 alarmserver.h \ 31 alarmserver.h \
32 process.h \ 32 process.h \
33 password.h \ 33 password.h \
34 timestring.h \ 34 timestring.h \
35 fontfactoryinterface.h \ 35 fontfactoryinterface.h \
36 fontdatabase.h \ 36 fontdatabase.h \
37 power.h \ 37 power.h \
38 storage.h \ 38 storage.h \
39 qpemessagebox.h \ 39 qpemessagebox.h \
40 timeconversion.h \ 40 timeconversion.h \
41 qpedebug.h \ 41 qpedebug.h \
42 qpemenubar.h \ 42 qpemenubar.h \
43 qpetoolbar.h \ 43 qpetoolbar.h \
44 backend/categories.h \ 44 backend/categories.h \
45 stringutil.h \ 45 stringutil.h \
46 backend/palmtoprecord.h \ 46 backend/palmtoprecord.h \
47 backend/task.h \ 47 backend/task.h \
48 backend/event.h \ 48 backend/event.h \
49 backend/contact.h\ 49 backend/contact.h\
50 categorymenu.h \ 50 categorymenu.h \
51 categoryedit_p.h \ 51 categoryedit_p.h \
52 categoryselect.h \ 52 categoryselect.h \
53 categorywidget.h \ 53 categorywidget.h \
54 ir.h \ 54 ir.h \
55 backend/vobject_p.h \ 55 backend/vobject_p.h \
56 findwidget_p.h \ 56 findwidget_p.h \
57 finddialog.h \ 57 finddialog.h \
58 lnkproperties.h \ 58 lnkproperties.h \
59 windowdecorationinterface.h \ 59 windowdecorationinterface.h \
60 textcodecinterface.h \ 60 textcodecinterface.h \
61 imagecodecinterface.h \ 61 imagecodecinterface.h \
62 qt_override_p.h \
63 qpeglobal.h 62 qpeglobal.h
64 63
65 SOURCES= calendar.cpp \ 64 SOURCES= calendar.cpp \
66 global.cpp \ 65 global.cpp \
67 xmlreader.cpp \ 66 xmlreader.cpp \
68 mimetype.cpp \ 67 mimetype.cpp \
69 menubutton.cpp \ 68 menubutton.cpp \
70 network.cpp \ 69 network.cpp \
71 networkinterface.cpp \ 70 networkinterface.cpp \
72 filemanager.cpp \ 71 filemanager.cpp \
73 fontmanager.cpp \ 72 fontmanager.cpp \
74 qdawg.cpp \ 73 qdawg.cpp \
75 datebookmonth.cpp \ 74 datebookmonth.cpp \
76 fileselector.cpp \ 75 fileselector.cpp \
77 imageedit.cpp \ 76 imageedit.cpp \
78 resource.cpp \ 77 resource.cpp \
79 qpedecoration_qws.cpp \ 78 qpedecoration_qws.cpp \
80 qcopenvelope_qws.cpp \ 79 qcopenvelope_qws.cpp \
81 qpeapplication.cpp \ 80 qpeapplication.cpp \
82 qpestyle.cpp \ 81 qpestyle.cpp \
83 qpedialog.cpp \ 82 qpedialog.cpp \
84 lightstyle.cpp \ 83 lightstyle.cpp \
85 config.cpp \ 84 config.cpp \
86 applnk.cpp \ 85 applnk.cpp \
87 sound.cpp \ 86 sound.cpp \
88 tzselect.cpp \ 87 tzselect.cpp \
89 qmath.c \ 88 qmath.c \
90 datebookdb.cpp \ 89 datebookdb.cpp \
91 alarmserver.cpp \ 90 alarmserver.cpp \
92 password.cpp \ 91 password.cpp \
93 process.cpp \ 92 process.cpp \
94 process_unix.cpp \ 93 process_unix.cpp \
95 timestring.cpp \ 94 timestring.cpp \
96 fontdatabase.cpp \ 95 fontdatabase.cpp \
97 power.cpp \ 96 power.cpp \
98 storage.cpp \ 97 storage.cpp \
99 qpemessagebox.cpp \ 98 qpemessagebox.cpp \
100 backend/timeconversion.cpp \ 99 backend/timeconversion.cpp \
101 qpedebug.cpp \ 100 qpedebug.cpp \
102 qpemenubar.cpp \ 101 qpemenubar.cpp \
103 qpetoolbar.cpp \ 102 qpetoolbar.cpp \
104 backend/categories.cpp \ 103 backend/categories.cpp \
105 backend/stringutil.cpp \ 104 backend/stringutil.cpp \
106 backend/palmtoprecord.cpp \ 105 backend/palmtoprecord.cpp \
107 backend/task.cpp \ 106 backend/task.cpp \
108 backend/event.cpp \ 107 backend/event.cpp \
109 backend/contact.cpp \ 108 backend/contact.cpp \
110 categorymenu.cpp \ 109 categorymenu.cpp \
111 categoryedit_p.cpp \ 110 categoryedit_p.cpp \
112 categoryselect.cpp \ 111 categoryselect.cpp \
113 categorywidget.cpp \ 112 categorywidget.cpp \
114 ir.cpp \ 113 ir.cpp \
115 backend/vcc_yacc.cpp \ 114 backend/vcc_yacc.cpp \
116 backend/vobject.cpp \ 115 backend/vobject.cpp \
117 findwidget_p.cpp \ 116 findwidget_p.cpp \
118 finddialog.cpp \ 117 finddialog.cpp \
119 lnkproperties.cpp \ 118 lnkproperties.cpp \
120 qt_override.cpp \
121 widget_showing.cpp 119 widget_showing.cpp
122 120
123 121
124 122
125# Qt 3 compatibility 123# Qt 3 compatibility
126HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h 124HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h
127SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp 125SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp
128INCLUDEPATH += $(OPIEDIR)/include backend 126INCLUDEPATH += $(OPIEDIR)/include backend
129 LIBS += -ldl -lcrypt -lm 127 LIBS += -ldl -lcrypt -lm
130INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui 128INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui
131 TARGET = qpe 129 TARGET = qpe
132 DESTDIR = $(OPIEDIR)/lib$(PROJMAK) 130 DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
133 VERSION = 1.5.0.1 131 VERSION = 1.5.0.1
134 132
135include( $(OPIEDIR)/include.pro ) 133include( $(OPIEDIR)/include.pro )
136 134
137contains( CONFIG, no-override ){
138 DEFINES += OPIE_NO_OVERRIDE_QT
139}
140
141contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){ 135contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){
142 DEFINES += OPIE_WITHROHFEEDBACK 136 DEFINES += OPIE_WITHROHFEEDBACK
143 SOURCES += backend/rohfeedback.cpp 137 SOURCES += backend/rohfeedback.cpp
144 HEADERS += backend/rohfeedback.h 138 HEADERS += backend/rohfeedback.h
145} 139}
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 1c5ced3..2bd7cbe 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1,291 +1,290 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
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#define QTOPIA_INTERNAL_LANGLIST 20#define QTOPIA_INTERNAL_LANGLIST
21#include <stdlib.h> 21#include <stdlib.h>
22#include <unistd.h> 22#include <unistd.h>
23#ifndef Q_OS_MACX 23#ifndef Q_OS_MACX
24#include <linux/limits.h> // needed for some toolchains (PATH_MAX) 24#include <linux/limits.h> // needed for some toolchains (PATH_MAX)
25#endif 25#endif
26#include <qfile.h> 26#include <qfile.h>
27#include <qqueue.h> 27#include <qqueue.h>
28#ifdef Q_WS_QWS 28#ifdef Q_WS_QWS
29#ifndef QT_NO_COP 29#ifndef QT_NO_COP
30#if QT_VERSION <= 231 30#if QT_VERSION <= 231
31#define private public 31#define private public
32#define sendLocally processEvent 32#define sendLocally processEvent
33#include "qcopenvelope_qws.h" 33#include "qcopenvelope_qws.h"
34#undef private 34#undef private
35#else 35#else
36#include "qcopenvelope_qws.h" 36#include "qcopenvelope_qws.h"
37#endif 37#endif
38#endif 38#endif
39#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
40#endif 40#endif
41#include <qtextstream.h> 41#include <qtextstream.h>
42#include <qpalette.h> 42#include <qpalette.h>
43#include <qbuffer.h> 43#include <qbuffer.h>
44#include <qptrdict.h> 44#include <qptrdict.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qdir.h> 46#include <qdir.h>
47#include <qlabel.h> 47#include <qlabel.h>
48#include <qdialog.h> 48#include <qdialog.h>
49#include <qdragobject.h> 49#include <qdragobject.h>
50#include <qtextcodec.h> 50#include <qtextcodec.h>
51#include <qevent.h> 51#include <qevent.h>
52#include <qtooltip.h> 52#include <qtooltip.h>
53#include <qsignal.h> 53#include <qsignal.h>
54#include <qmainwindow.h> 54#include <qmainwindow.h>
55#include <qwidgetlist.h> 55#include <qwidgetlist.h>
56#include <qpixmapcache.h> 56#include <qpixmapcache.h>
57 57
58#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 58#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
59#define QTOPIA_INTERNAL_INITAPP 59#define QTOPIA_INTERNAL_INITAPP
60#include "qpeapplication.h" 60#include "qpeapplication.h"
61#include "qpestyle.h" 61#include "qpestyle.h"
62#include "styleinterface.h" 62#include "styleinterface.h"
63#if QT_VERSION >= 0x030000 63#if QT_VERSION >= 0x030000
64#include <qstylefactory.h> 64#include <qstylefactory.h>
65#else 65#else
66#include <qplatinumstyle.h> 66#include <qplatinumstyle.h>
67#include <qwindowsstyle.h> 67#include <qwindowsstyle.h>
68#include <qmotifstyle.h> 68#include <qmotifstyle.h>
69#include <qmotifplusstyle.h> 69#include <qmotifplusstyle.h>
70#include "lightstyle.h" 70#include "lightstyle.h"
71 71
72#include <qpe/qlibrary.h> 72#include <qpe/qlibrary.h>
73#endif 73#endif
74#include "global.h" 74#include "global.h"
75#include "resource.h" 75#include "resource.h"
76#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 76#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
77#include "qutfcodec.h" 77#include "qutfcodec.h"
78#endif 78#endif
79#include "config.h" 79#include "config.h"
80#include "network.h" 80#include "network.h"
81#ifdef QWS 81#ifdef QWS
82#include "fontmanager.h" 82#include "fontmanager.h"
83#include "fontdatabase.h" 83#include "fontdatabase.h"
84#endif 84#endif
85 85
86#include "alarmserver.h" 86#include "alarmserver.h"
87#include "applnk.h" 87#include "applnk.h"
88#include "qpemenubar.h" 88#include "qpemenubar.h"
89#include "textcodecinterface.h" 89#include "textcodecinterface.h"
90#include "imagecodecinterface.h" 90#include "imagecodecinterface.h"
91#include <qtopia/qpeglobal.h> 91#include <qtopia/qpeglobal.h>
92 92
93#include <unistd.h> 93#include <unistd.h>
94#include <sys/file.h> 94#include <sys/file.h>
95#include <sys/ioctl.h> 95#include <sys/ioctl.h>
96#ifndef QT_NO_SOUND 96#ifndef QT_NO_SOUND
97#include <sys/soundcard.h> 97#include <sys/soundcard.h>
98#endif 98#endif
99#include "qt_override_p.h"
100 99
101#include <backend/rohfeedback.h> 100#include <backend/rohfeedback.h>
102 101
103 102
104static bool useBigPixmaps = 0; 103static bool useBigPixmaps = 0;
105 104
106class HackWidget : public QWidget 105class HackWidget : public QWidget
107{ 106{
108public: 107public:
109 bool needsOk() 108 bool needsOk()
110 { return (getWState() & WState_Reserved1 ); } 109 { return (getWState() & WState_Reserved1 ); }
111 110
112 QRect normalGeometry() 111 QRect normalGeometry()
113 { return topData()->normalGeometry; }; 112 { return topData()->normalGeometry; };
114}; 113};
115 114
116class QPEApplicationData 115class QPEApplicationData
117{ 116{
118public: 117public:
119 QPEApplicationData ( ) : 118 QPEApplicationData ( ) :
120 presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), 119 presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ),
121 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), 120 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
122 keep_running( true ), qcopQok( false ), 121 keep_running( true ), qcopQok( false ),
123 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), 122 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ),
124 bigIconSize( 32 ), qpe_main_widget( 0 ) 123 bigIconSize( 32 ), qpe_main_widget( 0 )
125 { 124 {
126 Config cfg( "qpe" ); 125 Config cfg( "qpe" );
127 cfg.setGroup( "Appearance" ); 126 cfg.setGroup( "Appearance" );
128 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); 127 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false );
129 fontFamily = cfg.readEntry( "FontFamily", "Vera" ); 128 fontFamily = cfg.readEntry( "FontFamily", "Vera" );
130 fontSize = cfg.readNumEntry( "FontSize", 10 ); 129 fontSize = cfg.readNumEntry( "FontSize", 10 );
131 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); 130 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 );
132 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); 131 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 );
133#ifdef OPIE_WITHROHFEEDBACK 132#ifdef OPIE_WITHROHFEEDBACK
134 RoH = 0; 133 RoH = 0;
135#endif 134#endif
136 } 135 }
137 136
138 int presstimer; 137 int presstimer;
139 QWidget* presswidget; 138 QWidget* presswidget;
140 QPoint presspos; 139 QPoint presspos;
141#ifdef OPIE_WITHROHFEEDBACK 140#ifdef OPIE_WITHROHFEEDBACK
142 Opie::Internal::RoHFeedback *RoH; 141 Opie::Internal::RoHFeedback *RoH;
143#endif 142#endif
144 143
145 bool rightpressed : 1; 144 bool rightpressed : 1;
146 bool kbgrabbed : 1; 145 bool kbgrabbed : 1;
147 bool notbusysent : 1; 146 bool notbusysent : 1;
148 bool preloaded : 1; 147 bool preloaded : 1;
149 bool forceshow : 1; 148 bool forceshow : 1;
150 bool nomaximize : 1; 149 bool nomaximize : 1;
151 bool keep_running : 1; 150 bool keep_running : 1;
152 bool qcopQok : 1; 151 bool qcopQok : 1;
153 152
154 QCString fontFamily; 153 QCString fontFamily;
155 int fontSize; 154 int fontSize;
156 int smallIconSize; 155 int smallIconSize;
157 int bigIconSize; 156 int bigIconSize;
158 157
159 QString appName; 158 QString appName;
160 struct QCopRec 159 struct QCopRec
161 { 160 {
162 QCopRec( const QCString &ch, const QCString &msg, 161 QCopRec( const QCString &ch, const QCString &msg,
163 const QByteArray &d ) : 162 const QByteArray &d ) :
164 channel( ch ), message( msg ), data( d ) 163 channel( ch ), message( msg ), data( d )
165 { } 164 { }
166 165
167 QCString channel; 166 QCString channel;
168 QCString message; 167 QCString message;
169 QByteArray data; 168 QByteArray data;
170 }; 169 };
171 QWidget* qpe_main_widget; 170 QWidget* qpe_main_widget;
172 QGuardedPtr<QWidget> lastraised; 171 QGuardedPtr<QWidget> lastraised;
173 QQueue<QCopRec> qcopq; 172 QQueue<QCopRec> qcopq;
174 QString styleName; 173 QString styleName;
175 QString decorationName; 174 QString decorationName;
176 175
177 void enqueueQCop( const QCString &ch, const QCString &msg, 176 void enqueueQCop( const QCString &ch, const QCString &msg,
178 const QByteArray &data ) 177 const QByteArray &data )
179 { 178 {
180 qcopq.enqueue( new QCopRec( ch, msg, data ) ); 179 qcopq.enqueue( new QCopRec( ch, msg, data ) );
181 } 180 }
182 void sendQCopQ() 181 void sendQCopQ()
183 { 182 {
184 if (!qcopQok ) 183 if (!qcopQok )
185 return; 184 return;
186 185
187 QCopRec * r; 186 QCopRec * r;
188 187
189 while((r=qcopq.dequeue())) { 188 while((r=qcopq.dequeue())) {
190 // remove from queue before sending... 189 // remove from queue before sending...
191 // event loop can come around again before getting 190 // event loop can come around again before getting
192 // back from sendLocally 191 // back from sendLocally
193#ifndef QT_NO_COP 192#ifndef QT_NO_COP
194 QCopChannel::sendLocally( r->channel, r->message, r->data ); 193 QCopChannel::sendLocally( r->channel, r->message, r->data );
195#endif 194#endif
196 195
197 delete r; 196 delete r;
198 } 197 }
199 } 198 }
200 199
201 static void show_mx(QWidget* mw, bool nomaximize, QString &strName) { 200 static void show_mx(QWidget* mw, bool nomaximize, QString &strName) {
202 if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) 201 if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") )
203 { 202 {
204 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps ); 203 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps );
205 } 204 }
206 QPoint p; 205 QPoint p;
207 QSize s; 206 QSize s;
208 bool max; 207 bool max;
209 208
210 if ( mw->isVisible() ) { 209 if ( mw->isVisible() ) {
211 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { 210 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
212 mw->resize(s); 211 mw->resize(s);
213 mw->move(p); 212 mw->move(p);
214 } 213 }
215 mw->raise(); 214 mw->raise();
216 } else { 215 } else {
217 216
218 if ( mw->layout() && mw->inherits("QDialog") ) { 217 if ( mw->layout() && mw->inherits("QDialog") ) {
219 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { 218 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
220 mw->resize(s); 219 mw->resize(s);
221 mw->move(p); 220 mw->move(p);
222 221
223 if ( max && !nomaximize ) { 222 if ( max && !nomaximize ) {
224 mw->showMaximized(); 223 mw->showMaximized();
225 } else { 224 } else {
226 mw->show(); 225 mw->show();
227 } 226 }
228 } else { 227 } else {
229 QPEApplication::showDialog((QDialog*)mw,nomaximize); 228 QPEApplication::showDialog((QDialog*)mw,nomaximize);
230 } 229 }
231 } else { 230 } else {
232 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { 231 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
233 mw->resize(s); 232 mw->resize(s);
234 mw->move(p); 233 mw->move(p);
235 } else { //no stored rectangle, make an estimation 234 } else { //no stored rectangle, make an estimation
236 int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2; 235 int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2;
237 int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2; 236 int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2;
238 mw->move( QMAX(x,0), QMAX(y,0) ); 237 mw->move( QMAX(x,0), QMAX(y,0) );
239#ifdef Q_WS_QWS 238#ifdef Q_WS_QWS
240 if ( !nomaximize ) 239 if ( !nomaximize )
241 mw->showMaximized(); 240 mw->showMaximized();
242#endif 241#endif
243 } 242 }
244 if ( max && !nomaximize ) 243 if ( max && !nomaximize )
245 mw->showMaximized(); 244 mw->showMaximized();
246 else 245 else
247 mw->show(); 246 mw->show();
248 } 247 }
249 } 248 }
250 } 249 }
251 250
252 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) 251 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s)
253 { 252 {
254 maximized = TRUE; 253 maximized = TRUE;
255 // 350 is the trigger in qwsdefaultdecoration for providing a resize button 254 // 350 is the trigger in qwsdefaultdecoration for providing a resize button
256 if ( qApp->desktop()->width() <= 350 ) 255 if ( qApp->desktop()->width() <= 350 )
257 return FALSE; 256 return FALSE;
258 257
259 Config cfg( "qpe" ); 258 Config cfg( "qpe" );
260 cfg.setGroup("ApplicationPositions"); 259 cfg.setGroup("ApplicationPositions");
261 QString str = cfg.readEntry( app, QString::null ); 260 QString str = cfg.readEntry( app, QString::null );
262 QStringList l = QStringList::split(",", str); 261 QStringList l = QStringList::split(",", str);
263 262
264 if ( l.count() == 5) { 263 if ( l.count() == 5) {
265 p.setX( l[0].toInt() ); 264 p.setX( l[0].toInt() );
266 p.setY( l[1].toInt() ); 265 p.setY( l[1].toInt() );
267 266
268 s.setWidth( l[2].toInt() ); 267 s.setWidth( l[2].toInt() );
269 s.setHeight( l[3].toInt() ); 268 s.setHeight( l[3].toInt() );
270 269
271 maximized = l[4].toInt(); 270 maximized = l[4].toInt();
272 271
273 return TRUE; 272 return TRUE;
274 } 273 }
275 274
276 return FALSE; 275 return FALSE;
277 } 276 }
278 277
279 278
280 static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) 279 static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s)
281 { 280 {
282#ifndef Q_WS_QWS 281#ifndef Q_WS_QWS
283 QRect qt_maxWindowRect = qApp->desktop()->geometry(); 282 QRect qt_maxWindowRect = qApp->desktop()->geometry();
284#endif 283#endif
285 int maxX = qt_maxWindowRect.width(); 284 int maxX = qt_maxWindowRect.width();
286 int maxY = qt_maxWindowRect.height(); 285 int maxY = qt_maxWindowRect.height();
287 int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() ); 286 int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() );
288 int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() ); 287 int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() );
289 288
290 // total window size is not allowed to be larger than desktop window size 289 // total window size is not allowed to be larger than desktop window size
291 if ( ( wWidth >= maxX ) && ( wHeight >= maxY ) ) 290 if ( ( wWidth >= maxX ) && ( wHeight >= maxY ) )
@@ -1163,466 +1162,427 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
1163 } 1162 }
1164 return true; 1163 return true;
1165 } 1164 }
1166 } 1165 }
1167 if ( e->type == QWSEvent::Focus ) { 1166 if ( e->type == QWSEvent::Focus ) {
1168 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 1167 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
1169 if ( !fe->simpleData.get_focus ) { 1168 if ( !fe->simpleData.get_focus ) {
1170 QWidget * active = activeWindow(); 1169 QWidget * active = activeWindow();
1171 while ( active && active->isPopup() ) { 1170 while ( active && active->isPopup() ) {
1172 active->close(); 1171 active->close();
1173 active = activeWindow(); 1172 active = activeWindow();
1174 } 1173 }
1175 } 1174 }
1176 else { 1175 else {
1177 // make sure our modal widget is ALWAYS on top 1176 // make sure our modal widget is ALWAYS on top
1178 QWidget *topm = activeModalWidget(); 1177 QWidget *topm = activeModalWidget();
1179 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { 1178 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) {
1180 topm->raise(); 1179 topm->raise();
1181 } 1180 }
1182 } 1181 }
1183 if ( fe->simpleData.get_focus && inputMethodDict ) { 1182 if ( fe->simpleData.get_focus && inputMethodDict ) {
1184 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 1183 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
1185 if ( m == AlwaysOff ) 1184 if ( m == AlwaysOff )
1186 Global::hideInputMethod(); 1185 Global::hideInputMethod();
1187 if ( m == AlwaysOn ) 1186 if ( m == AlwaysOn )
1188 Global::showInputMethod(); 1187 Global::showInputMethod();
1189 } 1188 }
1190 } 1189 }
1191 1190
1192 1191
1193 return QApplication::qwsEventFilter( e ); 1192 return QApplication::qwsEventFilter( e );
1194} 1193}
1195#endif 1194#endif
1196 1195
1197/*! 1196/*!
1198 Destroys the QPEApplication. 1197 Destroys the QPEApplication.
1199*/ 1198*/
1200QPEApplication::~QPEApplication() 1199QPEApplication::~QPEApplication()
1201{ 1200{
1202 ungrabKeyboard(); 1201 ungrabKeyboard();
1203#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 1202#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
1204 // Need to delete QCopChannels early, since the display will 1203 // Need to delete QCopChannels early, since the display will
1205 // be gone by the time we get to ~QObject(). 1204 // be gone by the time we get to ~QObject().
1206 delete sysChannel; 1205 delete sysChannel;
1207 delete pidChannel; 1206 delete pidChannel;
1208#endif 1207#endif
1209 1208
1210#ifdef OPIE_WITHROHFEEDBACK 1209#ifdef OPIE_WITHROHFEEDBACK
1211 if( d->RoH ) 1210 if( d->RoH )
1212 delete d->RoH; 1211 delete d->RoH;
1213#endif 1212#endif
1214 delete d; 1213 delete d;
1215} 1214}
1216 1215
1217/*! 1216/*!
1218 Returns <tt>$OPIEDIR/</tt>. 1217 Returns <tt>$OPIEDIR/</tt>.
1219*/ 1218*/
1220QString QPEApplication::qpeDir() 1219QString QPEApplication::qpeDir()
1221{ 1220{
1222 QString base, dir; 1221 QString base, dir;
1223 1222
1224 if (getenv( "OPIEDIR" )) 1223 if (getenv( "OPIEDIR" ))
1225 base = QString(getenv("OPIEDIR")).stripWhiteSpace(); 1224 base = QString(getenv("OPIEDIR")).stripWhiteSpace();
1226 if ( !base.isNull() && (base.length() > 0 )){ 1225 if ( !base.isNull() && (base.length() > 0 )){
1227#ifdef Q_OS_WIN32 1226#ifdef Q_OS_WIN32
1228 QString temp(base); 1227 QString temp(base);
1229 if (temp[(int)temp.length()-1] != QDir::separator()) 1228 if (temp[(int)temp.length()-1] != QDir::separator())
1230 temp.append(QDir::separator()); 1229 temp.append(QDir::separator());
1231 dir = temp; 1230 dir = temp;
1232#else 1231#else
1233 dir = QString( base ) + "/"; 1232 dir = QString( base ) + "/";
1234#endif 1233#endif
1235 }else{ 1234 }else{
1236 dir = QString( ".." ) + QDir::separator(); 1235 dir = QString( ".." ) + QDir::separator();
1237 } 1236 }
1238 1237
1239 return dir; 1238 return dir;
1240} 1239}
1241 1240
1242/*! 1241/*!
1243 Returns the user's current Document directory. There is a trailing "/". 1242 Returns the user's current Document directory. There is a trailing "/".
1244 .. well, it does now,, and there's no trailing '/' 1243 .. well, it does now,, and there's no trailing '/'
1245*/ 1244*/
1246QString QPEApplication::documentDir() 1245QString QPEApplication::documentDir()
1247{ 1246{
1248 const char* base = getenv( "HOME"); 1247 const char* base = getenv( "HOME");
1249 if ( base ) 1248 if ( base )
1250 return QString( base ) + "/Documents"; 1249 return QString( base ) + "/Documents";
1251 1250
1252 return QString( "../Documents" ); 1251 return QString( "../Documents" );
1253} 1252}
1254 1253
1255static int deforient = -1; 1254static int deforient = -1;
1256 1255
1257/*! 1256/*!
1258 \internal 1257 \internal
1259*/ 1258*/
1260int QPEApplication::defaultRotation() 1259int QPEApplication::defaultRotation()
1261{ 1260{
1262 if ( deforient < 0 ) { 1261 if ( deforient < 0 ) {
1263 QString d = getenv( "QWS_DISPLAY" ); 1262 QString d = getenv( "QWS_DISPLAY" );
1264 if ( d.contains( "Rot90" ) ) { 1263 if ( d.contains( "Rot90" ) ) {
1265 deforient = 90; 1264 deforient = 90;
1266 } 1265 }
1267 else if ( d.contains( "Rot180" ) ) { 1266 else if ( d.contains( "Rot180" ) ) {
1268 deforient = 180; 1267 deforient = 180;
1269 } 1268 }
1270 else if ( d.contains( "Rot270" ) ) { 1269 else if ( d.contains( "Rot270" ) ) {
1271 deforient = 270; 1270 deforient = 270;
1272 } 1271 }
1273 else { 1272 else {
1274 deforient = 0; 1273 deforient = 0;
1275 } 1274 }
1276 } 1275 }
1277 return deforient; 1276 return deforient;
1278} 1277}
1279 1278
1280/*! 1279/*!
1281 \internal 1280 \internal
1282*/ 1281*/
1283void QPEApplication::setDefaultRotation( int r ) 1282void QPEApplication::setDefaultRotation( int r )
1284{ 1283{
1285 if ( qApp->type() == GuiServer ) { 1284 if ( qApp->type() == GuiServer ) {
1286 deforient = r; 1285 deforient = r;
1287 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 1286 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
1288 Config config("qpe"); 1287 Config config("qpe");
1289 config.setGroup( "Rotation" ); 1288 config.setGroup( "Rotation" );
1290 config.writeEntry( "Rot", r ); 1289 config.writeEntry( "Rot", r );
1291 } 1290 }
1292 else { 1291 else {
1293#ifndef QT_NO_COP 1292#ifndef QT_NO_COP
1294 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); 1293 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
1295 e << r; 1294 e << r;
1296 } 1295 }
1297#endif 1296#endif
1298 1297
1299 } 1298 }
1300} 1299}
1301 1300
1302#include <qgfx_qws.h> 1301#include <qgfx_qws.h>
1303#include <qwindowsystem_qws.h> 1302#include <qwindowsystem_qws.h>
1304 1303
1305#if QT_VERSION > 236 1304#if QT_VERSION > 236
1306extern void qws_clearLoadedFonts(); 1305extern void qws_clearLoadedFonts();
1307#endif 1306#endif
1308 1307
1309void QPEApplication::setCurrentMode( int x, int y, int depth ) 1308void QPEApplication::setCurrentMode( int x, int y, int depth )
1310{ 1309{
1311 // Reset the caches 1310 // Reset the caches
1312#if QT_VERSION > 236 1311#if QT_VERSION > 236
1313 qws_clearLoadedFonts(); 1312 qws_clearLoadedFonts();
1314#endif 1313#endif
1315 QPixmapCache::clear(); 1314 QPixmapCache::clear();
1316 1315
1317 // Change the screen mode 1316 // Change the screen mode
1318 qt_screen->setMode(x, y, depth); 1317 qt_screen->setMode(x, y, depth);
1319 1318
1320 if ( qApp->type() == GuiServer ) { 1319 if ( qApp->type() == GuiServer ) {
1321#if QT_VERSION > 236 1320#if QT_VERSION > 236
1322 // Reconfigure the GuiServer 1321 // Reconfigure the GuiServer
1323 qwsServer->beginDisplayReconfigure(); 1322 qwsServer->beginDisplayReconfigure();
1324 qwsServer->endDisplayReconfigure(); 1323 qwsServer->endDisplayReconfigure();
1325#endif 1324#endif
1326 // Get all the running apps to reset 1325 // Get all the running apps to reset
1327 QCopEnvelope env( "QPE/System", "reset()" ); 1326 QCopEnvelope env( "QPE/System", "reset()" );
1328 } 1327 }
1329} 1328}
1330 1329
1331void QPEApplication::reset() { 1330void QPEApplication::reset() {
1332 // Reconnect to the screen 1331 // Reconnect to the screen
1333 qt_screen->disconnect(); 1332 qt_screen->disconnect();
1334 qt_screen->connect( QString::null ); 1333 qt_screen->connect( QString::null );
1335 1334
1336 // Redraw everything 1335 // Redraw everything
1337 applyStyle(); 1336 applyStyle();
1338} 1337}
1339 1338
1340#if (QT_VERSION < 238) && defined Q_OS_MACX 1339#if (QT_VERSION < 238) && defined Q_OS_MACX
1341bool qt_left_hand_scrollbars = false; 1340bool qt_left_hand_scrollbars = false;
1342#else 1341#else
1343extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL; 1342extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL;
1344#endif 1343#endif
1345 1344
1346/*! 1345/*!
1347 \internal 1346 \internal
1348*/ 1347*/
1349void QPEApplication::applyStyle() 1348void QPEApplication::applyStyle()
1350{ 1349{
1351 Config config( "qpe" ); 1350 Config config( "qpe" );
1352 config.setGroup( "Appearance" ); 1351 config.setGroup( "Appearance" );
1353 1352
1354#if QT_VERSION > 233 1353#if QT_VERSION > 233
1355#if !defined(OPIE_NO_OVERRIDE_QT)
1356 // don't block ourselves ...
1357 Opie::force_appearance = 0;
1358
1359 static QString appname = Opie::binaryName ( );
1360
1361 QStringList ex = config. readListEntry ( "NoStyle", ';' );
1362 int nostyle = 0;
1363 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) {
1364 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) {
1365 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 );
1366 break;
1367 }
1368 }
1369#else
1370 int nostyle = 0;
1371#endif
1372
1373 // Widget style 1354 // Widget style
1374 QString style = config.readEntry( "Style", "FlatStyle" ); 1355 QString style = config.readEntry( "Style", "FlatStyle" );
1375 1356
1376 // don't set a custom style
1377 if ( nostyle & Opie::Force_Style )
1378 style = "FlatStyle";
1379
1380 internalSetStyle ( style ); 1357 internalSetStyle ( style );
1381 1358
1382 // Colors - from /etc/colors/Liquid.scheme 1359 // Colors - from /etc/colors/Liquid.scheme
1383 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); 1360 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) );
1384 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); 1361 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) );
1385 QPalette pal( btncolor, bgcolor ); 1362 QPalette pal( btncolor, bgcolor );
1386 QString color = config.readEntry( "Highlight", "#73adef" ); 1363 QString color = config.readEntry( "Highlight", "#73adef" );
1387 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 1364 pal.setColor( QColorGroup::Highlight, QColor( color ) );
1388 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 1365 color = config.readEntry( "HighlightedText", "#FFFFFF" );
1389 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 1366 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
1390 color = config.readEntry( "Text", "#000000" ); 1367 color = config.readEntry( "Text", "#000000" );
1391 pal.setColor( QColorGroup::Text, QColor( color ) ); 1368 pal.setColor( QColorGroup::Text, QColor( color ) );
1392 color = config.readEntry( "ButtonText", "#000000" ); 1369 color = config.readEntry( "ButtonText", "#000000" );
1393 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 1370 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
1394 color = config.readEntry( "Base", "#FFFFFF" ); 1371 color = config.readEntry( "Base", "#FFFFFF" );
1395 pal.setColor( QColorGroup::Base, QColor( color ) ); 1372 pal.setColor( QColorGroup::Base, QColor( color ) );
1396 1373
1397 pal.setColor( QPalette::Disabled, QColorGroup::Text, 1374 pal.setColor( QPalette::Disabled, QColorGroup::Text,
1398 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 1375 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
1399 1376
1400 setPalette( pal, TRUE ); 1377 setPalette( pal, TRUE );
1401 1378
1402 1379
1403 // Set the ScrollBar on the 'right' side but only if the weak symbol is present 1380 // Set the ScrollBar on the 'right' side but only if the weak symbol is present
1404 if (&qt_left_hand_scrollbars ) 1381 if (&qt_left_hand_scrollbars )
1405 qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); 1382 qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false );
1406 1383
1407 // Window Decoration 1384 // Window Decoration
1408 QString dec = config.readEntry( "Decoration", "Flat" ); 1385 QString dec = config.readEntry( "Decoration", "Flat" );
1409 1386
1410 // don't set a custom deco
1411 if ( nostyle & Opie::Force_Decoration )
1412 dec = "";
1413
1414
1415 if ( dec != d->decorationName ) { 1387 if ( dec != d->decorationName ) {
1416 qwsSetDecoration( new QPEDecoration( dec ) ); 1388 qwsSetDecoration( new QPEDecoration( dec ) );
1417 d->decorationName = dec; 1389 d->decorationName = dec;
1418 } 1390 }
1419 1391
1420 // Font 1392 // Font
1421 QString ff = config.readEntry( "FontFamily", font().family() ); 1393 QString ff = config.readEntry( "FontFamily", font().family() );
1422 int fs = config.readNumEntry( "FontSize", font().pointSize() ); 1394 int fs = config.readNumEntry( "FontSize", font().pointSize() );
1423 1395
1424 // don't set a custom font
1425 if ( nostyle & Opie::Force_Font ) {
1426 ff = "Vera";
1427 fs = 10;
1428 }
1429
1430 setFont ( QFont ( ff, fs ), true ); 1396 setFont ( QFont ( ff, fs ), true );
1431
1432#if !defined(OPIE_NO_OVERRIDE_QT)
1433 // revert to global blocking policy ...
1434 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None;
1435 Opie::force_appearance &= ~nostyle;
1436#endif
1437#endif 1397#endif
1438} 1398}
1439 1399
1440void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) 1400void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data )
1441{ 1401{
1442#ifdef Q_WS_QWS 1402#ifdef Q_WS_QWS
1443 QDataStream stream( data, IO_ReadOnly ); 1403 QDataStream stream( data, IO_ReadOnly );
1444 if ( msg == "applyStyle()" ) { 1404 if ( msg == "applyStyle()" ) {
1445 applyStyle(); 1405 applyStyle();
1446 } 1406 }
1447 else if ( msg == "toggleApplicationMenu()" ) { 1407 else if ( msg == "toggleApplicationMenu()" ) {
1448 QWidget *active = activeWindow ( ); 1408 QWidget *active = activeWindow ( );
1449 1409
1450 if ( active ) { 1410 if ( active ) {
1451 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); 1411 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( );
1452 bool oldactive = man-> isActive ( ); 1412 bool oldactive = man-> isActive ( );
1453 1413
1454 man-> setActive( !man-> isActive() ); 1414 man-> setActive( !man-> isActive() );
1455 1415
1456 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu 1416 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu
1457 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); 1417 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" );
1458 } 1418 }
1459 } 1419 }
1460 } 1420 }
1461 else if ( msg == "setDefaultRotation(int)" ) { 1421 else if ( msg == "setDefaultRotation(int)" ) {
1462 if ( type() == GuiServer ) { 1422 if ( type() == GuiServer ) {
1463 int r; 1423 int r;
1464 stream >> r; 1424 stream >> r;
1465 setDefaultRotation( r ); 1425 setDefaultRotation( r );
1466 } 1426 }
1467 } 1427 }
1468 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> 1428 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net>
1469 if ( type() == GuiServer ) { 1429 if ( type() == GuiServer ) {
1470 int x, y, depth; 1430 int x, y, depth;
1471 stream >> x; 1431 stream >> x;
1472 stream >> y; 1432 stream >> y;
1473 stream >> depth; 1433 stream >> depth;
1474 setCurrentMode( x, y, depth ); 1434 setCurrentMode( x, y, depth );
1475 } 1435 }
1476 } 1436 }
1477 else if ( msg == "reset()" ) { 1437 else if ( msg == "reset()" ) {
1478 if ( type() != GuiServer ) 1438 if ( type() != GuiServer )
1479 reset(); 1439 reset();
1480 } 1440 }
1481 else if ( msg == "setCurrentRotation(int)" ) { 1441 else if ( msg == "setCurrentRotation(int)" ) {
1482 int r; 1442 int r;
1483 stream >> r; 1443 stream >> r;
1484 setCurrentRotation( r ); 1444 setCurrentRotation( r );
1485 } 1445 }
1486 else if ( msg == "shutdown()" ) { 1446 else if ( msg == "shutdown()" ) {
1487 if ( type() == GuiServer ) 1447 if ( type() == GuiServer )
1488 shutdown(); 1448 shutdown();
1489 } 1449 }
1490 else if ( msg == "quit()" ) { 1450 else if ( msg == "quit()" ) {
1491 if ( type() != GuiServer ) 1451 if ( type() != GuiServer )
1492 tryQuit(); 1452 tryQuit();
1493 } 1453 }
1494 else if ( msg == "forceQuit()" ) { 1454 else if ( msg == "forceQuit()" ) {
1495 if ( type() != GuiServer ) 1455 if ( type() != GuiServer )
1496 quit(); 1456 quit();
1497 } 1457 }
1498 else if ( msg == "restart()" ) { 1458 else if ( msg == "restart()" ) {
1499 if ( type() == GuiServer ) 1459 if ( type() == GuiServer )
1500 restart(); 1460 restart();
1501 } 1461 }
1502 else if ( msg == "language(QString)" ) { 1462 else if ( msg == "language(QString)" ) {
1503 if ( type() == GuiServer ) { 1463 if ( type() == GuiServer ) {
1504 QString l; 1464 QString l;
1505 stream >> l; 1465 stream >> l;
1506 QString cl = getenv( "LANG" ); 1466 QString cl = getenv( "LANG" );
1507 if ( cl != l ) { 1467 if ( cl != l ) {
1508 if ( l.isNull() ) 1468 if ( l.isNull() )
1509 unsetenv( "LANG" ); 1469 unsetenv( "LANG" );
1510 else 1470 else
1511 setenv( "LANG", l.latin1(), 1 ); 1471 setenv( "LANG", l.latin1(), 1 );
1512 restart(); 1472 restart();
1513 } 1473 }
1514 } 1474 }
1515 } 1475 }
1516 else if ( msg == "timeChange(QString)" ) { 1476 else if ( msg == "timeChange(QString)" ) {
1517 QString t; 1477 QString t;
1518 stream >> t; 1478 stream >> t;
1519 if ( t.isNull() ) 1479 if ( t.isNull() )
1520 unsetenv( "TZ" ); 1480 unsetenv( "TZ" );
1521 else 1481 else
1522 setenv( "TZ", t.latin1(), 1 ); 1482 setenv( "TZ", t.latin1(), 1 );
1523 // emit the signal so everyone else knows... 1483 // emit the signal so everyone else knows...
1524 emit timeChanged(); 1484 emit timeChanged();
1525 } 1485 }
1526 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { 1486 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) {
1527 if ( type() == GuiServer ) { 1487 if ( type() == GuiServer ) {
1528 QDateTime when; 1488 QDateTime when;
1529 QCString channel, message; 1489 QCString channel, message;
1530 int data; 1490 int data;
1531 stream >> when >> channel >> message >> data; 1491 stream >> when >> channel >> message >> data;
1532 AlarmServer::addAlarm( when, channel, message, data ); 1492 AlarmServer::addAlarm( when, channel, message, data );
1533 } 1493 }
1534 } 1494 }
1535 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { 1495 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) {
1536 if ( type() == GuiServer ) { 1496 if ( type() == GuiServer ) {
1537 QDateTime when; 1497 QDateTime when;
1538 QCString channel, message; 1498 QCString channel, message;
1539 int data; 1499 int data;
1540 stream >> when >> channel >> message >> data; 1500 stream >> when >> channel >> message >> data;
1541 AlarmServer::deleteAlarm( when, channel, message, data ); 1501 AlarmServer::deleteAlarm( when, channel, message, data );
1542 } 1502 }
1543 } 1503 }
1544 else if ( msg == "clockChange(bool)" ) { 1504 else if ( msg == "clockChange(bool)" ) {
1545 int tmp; 1505 int tmp;
1546 stream >> tmp; 1506 stream >> tmp;
1547 emit clockChanged( tmp ); 1507 emit clockChanged( tmp );
1548 } 1508 }
1549 else if ( msg == "weekChange(bool)" ) { 1509 else if ( msg == "weekChange(bool)" ) {
1550 int tmp; 1510 int tmp;
1551 stream >> tmp; 1511 stream >> tmp;
1552 emit weekChanged( tmp ); 1512 emit weekChanged( tmp );
1553 } 1513 }
1554 else if ( msg == "setDateFormat(DateFormat)" ) { 1514 else if ( msg == "setDateFormat(DateFormat)" ) {
1555 DateFormat tmp; 1515 DateFormat tmp;
1556 stream >> tmp; 1516 stream >> tmp;
1557 emit dateFormatChanged( tmp ); 1517 emit dateFormatChanged( tmp );
1558 } 1518 }
1559 else if ( msg == "setVolume(int,int)" ) { 1519 else if ( msg == "setVolume(int,int)" ) {
1560 int t, v; 1520 int t, v;
1561 stream >> t >> v; 1521 stream >> t >> v;
1562 setVolume( t, v ); 1522 setVolume( t, v );
1563 emit volumeChanged( muted ); 1523 emit volumeChanged( muted );
1564 } 1524 }
1565 else if ( msg == "volumeChange(bool)" ) { 1525 else if ( msg == "volumeChange(bool)" ) {
1566 stream >> muted; 1526 stream >> muted;
1567 setVolume(); 1527 setVolume();
1568 emit volumeChanged( muted ); 1528 emit volumeChanged( muted );
1569 } 1529 }
1570 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1530 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1571 int t, v; 1531 int t, v;
1572 stream >> t >> v; 1532 stream >> t >> v;
1573 setMic( t, v ); 1533 setMic( t, v );
1574 emit micChanged( micMuted ); 1534 emit micChanged( micMuted );
1575 } 1535 }
1576 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1536 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1577 stream >> micMuted; 1537 stream >> micMuted;
1578 setMic(); 1538 setMic();
1579 emit micChanged( micMuted ); 1539 emit micChanged( micMuted );
1580 } 1540 }
1581 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1541 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1582 int t, v; 1542 int t, v;
1583 stream >> t >> v; 1543 stream >> t >> v;
1584 setBass( t, v ); 1544 setBass( t, v );
1585 } 1545 }
1586 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1546 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1587 setBass(); 1547 setBass();
1588 } 1548 }
1589 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1549 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1590 int t, v; 1550 int t, v;
1591 stream >> t >> v; 1551 stream >> t >> v;
1592 setTreble( t, v ); 1552 setTreble( t, v );
1593 } 1553 }
1594 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1554 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1595 setTreble(); 1555 setTreble();
1596 } else if ( msg == "getMarkedText()" ) { 1556 } else if ( msg == "getMarkedText()" ) {
1597 if ( type() == GuiServer ) { 1557 if ( type() == GuiServer ) {
1598 const ushort unicode = 'C'-'@'; 1558 const ushort unicode = 'C'-'@';
1599 const int scan = Key_C; 1559 const int scan = Key_C;
1600 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); 1560 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
1601 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); 1561 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
1602 } 1562 }
1603 } else if ( msg == "newChannel(QString)") { 1563 } else if ( msg == "newChannel(QString)") {
1604 QString myChannel = "QPE/Application/" + d->appName; 1564 QString myChannel = "QPE/Application/" + d->appName;
1605 QString channel; 1565 QString channel;
1606 stream >> channel; 1566 stream >> channel;
1607 if (channel == myChannel) { 1567 if (channel == myChannel) {
1608 processQCopFile(); 1568 processQCopFile();
1609 d->sendQCopQ(); 1569 d->sendQCopQ();
1610 } 1570 }
1611 } 1571 }
1612 1572
1613 1573
1614#endif 1574#endif
1615} 1575}
1616 1576
1617 1577
1618 1578
1619 1579
1620 1580
1621/*! 1581/*!
1622 \internal 1582 \internal
1623*/ 1583*/
1624bool QPEApplication::raiseAppropriateWindow() 1584bool QPEApplication::raiseAppropriateWindow()
1625{ 1585{
1626 bool r=FALSE; 1586 bool r=FALSE;
1627 1587
1628 // 1. Raise the main widget 1588 // 1. Raise the main widget
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 849d5b3..167fe69 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -1,244 +1,239 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
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#ifndef __QPE_APPLICATION_H__ 20#ifndef __QPE_APPLICATION_H__
21#define __QPE_APPLICATION_H__ 21#define __QPE_APPLICATION_H__
22 22
23#include <stdlib.h> // for setenv() 23#include <stdlib.h> // for setenv()
24 24
25#include <qglobal.h> 25#include <qglobal.h>
26#include <qapplication.h> 26#include <qapplication.h>
27#include <qdialog.h> 27#include <qdialog.h>
28#include <qwsdisplay_qws.h> 28#include <qwsdisplay_qws.h>
29#if defined(_WS_QWS_) && !defined(Q_WS_QWS) 29#if defined(_WS_QWS_) && !defined(Q_WS_QWS)
30#define Q_WS_QWS 30#define Q_WS_QWS
31#endif 31#endif
32#include "qpedecoration_qws.h" 32#include "qpedecoration_qws.h"
33#include "timestring.h" 33#include "timestring.h"
34#include "qpeglobal.h" 34#include "qpeglobal.h"
35 35
36class QCopChannel; 36class QCopChannel;
37class QPEApplicationData; 37class QPEApplicationData;
38class QWSEvent; 38class QWSEvent;
39class QWSKeyEvent; 39class QWSKeyEvent;
40 40
41/** 41/**
42 \brief The QPEApplication class implements various system services 42 \brief The QPEApplication class implements various system services
43 that are available to all Qtopia applications. 43 that are available to all Qtopia applications.
44 44
45 Simply by using QPEApplication instead of QApplication, a standard Qt 45 Simply by using QPEApplication instead of QApplication, a standard Qt
46 application becomes a Qtopia application. It automatically follows 46 application becomes a Qtopia application. It automatically follows
47 style changes, quits and raises, and in the 47 style changes, quits and raises, and in the
48 case of \link docwidget.html document-oriented\endlink applications, 48 case of \link docwidget.html document-oriented\endlink applications,
49 changes the currently displayed document in response to the environment. 49 changes the currently displayed document in response to the environment.
50 50
51 To create a \link docwidget.html document-oriented\endlink 51 To create a \link docwidget.html document-oriented\endlink
52 application use showMainDocumentWidget(); to create a 52 application use showMainDocumentWidget(); to create a
53 non-document-oriented application use showMainWidget(). The 53 non-document-oriented application use showMainWidget(). The
54 keepRunning() function indicates whether the application will 54 keepRunning() function indicates whether the application will
55 continue running after it's processed the last \link qcop.html 55 continue running after it's processed the last \link qcop.html
56 QCop\endlink message. This can be changed using setKeepRunning(). 56 QCop\endlink message. This can be changed using setKeepRunning().
57 57
58 A variety of signals are emitted when certain events occur, for 58 A variety of signals are emitted when certain events occur, for
59 example, timeChanged(), clockChanged(), weekChanged(), 59 example, timeChanged(), clockChanged(), weekChanged(),
60 dateFormatChanged() and volumeChanged(). If the application receives 60 dateFormatChanged() and volumeChanged(). If the application receives
61 a \link qcop.html QCop\endlink message on the application's 61 a \link qcop.html QCop\endlink message on the application's
62 QPE/Application/\e{appname} channel, the appMessage() signal is 62 QPE/Application/\e{appname} channel, the appMessage() signal is
63 emitted. There are also flush() and reload() signals, which 63 emitted. There are also flush() and reload() signals, which
64 are emitted when synching begins and ends respectively - upon these 64 are emitted when synching begins and ends respectively - upon these
65 signals, the application should save and reload any data 65 signals, the application should save and reload any data
66 files that are involved in synching. Most of these signals will initially 66 files that are involved in synching. Most of these signals will initially
67 be received and unfiltered through the appMessage() signal. 67 be received and unfiltered through the appMessage() signal.
68 68
69 This class also provides a set of useful static functions. The 69 This class also provides a set of useful static functions. The
70 qpeDir() and documentDir() functions return the respective paths. 70 qpeDir() and documentDir() functions return the respective paths.
71 The grabKeyboard() and ungrabKeyboard() functions are used to 71 The grabKeyboard() and ungrabKeyboard() functions are used to
72 control whether the application takes control of the device's 72 control whether the application takes control of the device's
73 physical buttons (e.g. application launch keys). The stylus' mode of 73 physical buttons (e.g. application launch keys). The stylus' mode of
74 operation is set with setStylusOperation() and retrieved with 74 operation is set with setStylusOperation() and retrieved with
75 stylusOperation(). There are also setInputMethodHint() and 75 stylusOperation(). There are also setInputMethodHint() and
76 inputMethodHint() functions. 76 inputMethodHint() functions.
77 77
78 \ingroup qtopiaemb 78 \ingroup qtopiaemb
79*/ 79*/
80class QPEApplication : public QApplication 80class QPEApplication : public QApplication
81{ 81{
82 Q_OBJECT 82 Q_OBJECT
83public: 83public:
84 QPEApplication( int& argc, char **argv, Type=GuiClient ); 84 QPEApplication( int& argc, char **argv, Type=GuiClient );
85 ~QPEApplication(); 85 ~QPEApplication();
86 86
87 static QString qpeDir(); 87 static QString qpeDir();
88 static QString documentDir(); 88 static QString documentDir();
89 void applyStyle(); 89 void applyStyle();
90 void reset(); 90 void reset();
91 static int defaultRotation(); 91 static int defaultRotation();
92 static void setDefaultRotation(int r); 92 static void setDefaultRotation(int r);
93 static void setCurrentRotation(int r); 93 static void setCurrentRotation(int r);
94 static void setCurrentMode(int x, int y, int depth ); 94 static void setCurrentMode(int x, int y, int depth );
95 static void grabKeyboard(); 95 static void grabKeyboard();
96 static void ungrabKeyboard(); 96 static void ungrabKeyboard();
97 97
98 enum StylusMode { 98 enum StylusMode {
99 LeftOnly, 99 LeftOnly,
100 RightOnHold 100 RightOnHold
101 // RightOnHoldLeftDelayed, etc. 101 // RightOnHoldLeftDelayed, etc.
102 }; 102 };
103 static void setStylusOperation( QWidget*, StylusMode ); 103 static void setStylusOperation( QWidget*, StylusMode );
104 static StylusMode stylusOperation( QWidget* ); 104 static StylusMode stylusOperation( QWidget* );
105 105
106 enum InputMethodHint { 106 enum InputMethodHint {
107 Normal, 107 Normal,
108 AlwaysOff, 108 AlwaysOff,
109 AlwaysOn 109 AlwaysOn
110 }; 110 };
111 111
112 enum screenSaverHint { 112 enum screenSaverHint {
113 Disable = 0, 113 Disable = 0,
114 DisableLightOff = 1, 114 DisableLightOff = 1,
115 DisableSuspend = 2, 115 DisableSuspend = 2,
116 Enable = 100 116 Enable = 100
117 }; 117 };
118 118
119 static void setInputMethodHint( QWidget *, InputMethodHint ); 119 static void setInputMethodHint( QWidget *, InputMethodHint );
120 static InputMethodHint inputMethodHint( QWidget * ); 120 static InputMethodHint inputMethodHint( QWidget * );
121 121
122 void showMainWidget( QWidget*, bool nomax=FALSE ); 122 void showMainWidget( QWidget*, bool nomax=FALSE );
123 void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); 123 void showMainDocumentWidget( QWidget*, bool nomax=FALSE );
124 124
125 static void showDialog( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; 125 static void showDialog( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
126 static int execDialog ( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; 126 static int execDialog ( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
127 static void showWidget( QWidget*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; 127 static void showWidget( QWidget*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
128 /* Merge setTempScreenSaverMode */ 128 /* Merge setTempScreenSaverMode */
129#ifdef QTOPIA_INTERNAL_INITAPP 129#ifdef QTOPIA_INTERNAL_INITAPP
130 void initApp( int argv, char **argv ); 130 void initApp( int argv, char **argv );
131#endif 131#endif
132 132
133 static void setKeepRunning(); 133 static void setKeepRunning();
134 bool keepRunning() const; 134 bool keepRunning() const;
135 135
136 bool keyboardGrabbed() const; 136 bool keyboardGrabbed() const;
137 137
138 int exec(); 138 int exec();
139 139
140signals: 140signals:
141 void clientMoused(); 141 void clientMoused();
142 void timeChanged(); 142 void timeChanged();
143 void clockChanged( bool pm ); 143 void clockChanged( bool pm );
144 void micChanged( bool muted ); 144 void micChanged( bool muted );
145 void volumeChanged( bool muted ); 145 void volumeChanged( bool muted );
146 void appMessage( const QCString& msg, const QByteArray& data); 146 void appMessage( const QCString& msg, const QByteArray& data);
147 void weekChanged( bool startOnMonday ); 147 void weekChanged( bool startOnMonday );
148 void dateFormatChanged( DateFormat ); 148 void dateFormatChanged( DateFormat );
149 void flush(); 149 void flush();
150 void reload(); 150 void reload();
151 /* linkChanged signal */ 151 /* linkChanged signal */
152 152
153private slots: 153private slots:
154 void systemMessage( const QCString &msg, const QByteArray &data ); 154 void systemMessage( const QCString &msg, const QByteArray &data );
155 void pidMessage( const QCString &msg, const QByteArray &data ); 155 void pidMessage( const QCString &msg, const QByteArray &data );
156 void removeSenderFromStylusDict(); 156 void removeSenderFromStylusDict();
157 void hideOrQuit(); 157 void hideOrQuit();
158 158
159protected: 159protected:
160 bool qwsEventFilter( QWSEvent * ); 160 bool qwsEventFilter( QWSEvent * );
161 void internalSetStyle( const QString &style ); 161 void internalSetStyle( const QString &style );
162 void prepareForTermination(bool willrestart); 162 void prepareForTermination(bool willrestart);
163 virtual void restart(); 163 virtual void restart();
164 virtual void shutdown(); 164 virtual void shutdown();
165 bool eventFilter( QObject *, QEvent * ); 165 bool eventFilter( QObject *, QEvent * );
166 void timerEvent( QTimerEvent * ); 166 void timerEvent( QTimerEvent * );
167 bool raiseAppropriateWindow(); 167 bool raiseAppropriateWindow();
168 virtual void tryQuit(); 168 virtual void tryQuit();
169#ifndef OPIE_NO_ERASE_RECT_HACKFIX
170 #if QT_VERSION > 233
171 virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!)
172 #endif
173#endif
174private: 169private:
175 void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); 170 void mapToDefaultAction( QWSKeyEvent *ke, int defKey );
176 void processQCopFile(); 171 void processQCopFile();
177 172
178#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 173#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
179 QCopChannel *sysChannel; 174 QCopChannel *sysChannel;
180 QCopChannel *pidChannel; 175 QCopChannel *pidChannel;
181#endif 176#endif
182 QPEApplicationData *d; 177 QPEApplicationData *d;
183 178
184 bool reserved_sh; 179 bool reserved_sh;
185 180
186}; 181};
187 182
188 183
189 184
190enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ 185enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */
191 186
192inline int TransToDeg ( Transformation t ) 187inline int TransToDeg ( Transformation t )
193{ 188{
194 int d = static_cast<int>( t ); 189 int d = static_cast<int>( t );
195 return d * 90; 190 return d * 90;
196} 191}
197 192
198inline Transformation DegToTrans ( int d ) 193inline Transformation DegToTrans ( int d )
199{ 194{
200 Transformation t = static_cast<Transformation>( d / 90 ); 195 Transformation t = static_cast<Transformation>( d / 90 );
201 return t; 196 return t;
202} 197}
203 198
204/* 199/*
205 * Set current rotation of Opie, and rotation for newly started apps. 200 * Set current rotation of Opie, and rotation for newly started apps.
206 * Differs from setDefaultRotation in that 1) it rotates currently running apps, 201 * Differs from setDefaultRotation in that 1) it rotates currently running apps,
207 * and 2) does not set deforient or save orientation to qpe.conf. 202 * and 2) does not set deforient or save orientation to qpe.conf.
208 */ 203 */
209 204
210inline void QPEApplication::setCurrentRotation( int r ) 205inline void QPEApplication::setCurrentRotation( int r )
211{ 206{
212 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots 207 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots
213 // for compatibility with the SharpROM use fallback to setDefaultTransformation() 208 // for compatibility with the SharpROM use fallback to setDefaultTransformation()
214#if QT_VERSION > 233 209#if QT_VERSION > 233
215 Transformation e = DegToTrans( r ); 210 Transformation e = DegToTrans( r );
216 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 211 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
217 qApp->desktop()->qwsDisplay()->setTransformation( e ); 212 qApp->desktop()->qwsDisplay()->setTransformation( e );
218#else 213#else
219 setDefaultRotation( r ); 214 setDefaultRotation( r );
220#endif 215#endif
221} 216}
222 217
223/* 218/*
224 * Qtopia 1.7 SDK compatibility macros 219 * Qtopia 1.7 SDK compatibility macros
225 * FIXME: Support Opie Quicklaunch Interface 220 * FIXME: Support Opie Quicklaunch Interface
226 */ 221 */
227 #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \ 222 #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \
228 int main( int argc, char** argv ) \ 223 int main( int argc, char** argv ) \
229 { \ 224 { \
230 QPEApplication app = QPEApplication( argc, argv );\ 225 QPEApplication app = QPEApplication( argc, argv );\
231 IMPLEMENTATION* mw = new IMPLEMENTATION(); \ 226 IMPLEMENTATION* mw = new IMPLEMENTATION(); \
232 app.showMainWidget( mw ); \ 227 app.showMainWidget( mw ); \
233 app.exec(); \ 228 app.exec(); \
234 } 229 }
235#define QTOPIA_MAIN // Bee-Bop-Alula 230#define QTOPIA_MAIN // Bee-Bop-Alula
236 231
237/* 232/*
238 * -remove me 233 * -remove me
239 */ 234 */
240#ifdef Q_WS_QWS 235#ifdef Q_WS_QWS
241extern Q_EXPORT QRect qt_maxWindowRect; 236extern Q_EXPORT QRect qt_maxWindowRect;
242#endif 237#endif
243 238
244#endif 239#endif
diff --git a/library/qt_override.cpp b/library/qt_override.cpp
deleted file mode 100644
index a0d753b..0000000
--- a/library/qt_override.cpp
+++ b/dev/null
@@ -1,170 +0,0 @@
1
2#include <qpe/qpeapplication.h>
3#include <qfontdatabase.h>
4
5#include <unistd.h>
6#include <stdlib.h>
7#include <stdio.h>
8#include <limits.h>
9#include <sys/param.h> // for toolchains with old libc headers
10
11#include <qtopia/qpeglobal.h>
12#include "qt_override_p.h"
13
14#if QT_VERSION > 233
15
16#ifndef OPIE_NO_ERASE_RECT_HACKFIX
17struct color_fix_t {
18 char *m_app;
19 char *m_class;
20 char *m_name;
21 QColorGroup::ColorRole m_set;
22 QColorGroup::ColorRole m_get;
23};
24
25
26
27static const color_fix_t apps_that_need_special_colors [] = {
28 { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base },
29 { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base },
30
31 { 0, 0, 0, QColorGroup::Base, QColorGroup::Base }
32};
33
34#endif
35
36#ifndef OPIE_NO_OVERRIDE_QT
37
38static const char * const apps_that_need_pointsizes_times_10 [] = {
39 "HancomMobileWord",
40 "hancomsheet",
41 "HancomPresenterViewer",
42
43 0
44};
45
46
47
48
49int Opie::force_appearance = 0;
50
51
52// Return the *real* name of the binary - not just a quick guess
53// by looking at argv [0] (which could be anything)
54
55static void binaryNameFree ( )
56{
57 ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here
58}
59
60const char *Opie::binaryName ( )
61{
62 static const char *appname = 0;
63
64 if ( !appname ) {
65 char dst [PATH_MAX + 1];
66 int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX );
67
68 if ( l <= 0 )
69 l = 0;
70
71 dst [l] = 0;
72 const char *b = ::strrchr ( dst, '/' );
73 appname = ::strdup ( b ? b + 1 : dst );
74
75 ::atexit ( binaryNameFree );
76 }
77 return appname;
78}
79
80#else
81int Opie::force_appearance = 0;
82#endif
83
84// Fix for a toolchain incompatibility (binaries compiled with
85// old tcs using shared libs compiled with newer tcs)
86
87extern "C" {
88
89extern void __gmon_start__ ( ) QPE_WEAK_SYMBOL;
90extern void __gmon_start__ ( )
91{
92}
93
94}
95
96
97#ifndef OPIE_NO_ERASE_RECT_HACKFIX
98// Fix for apps, that use QPainter::eraseRect() which doesn't work with styles
99// that set a background pixmap (it would be easier to fix eraseRect(), but
100// TT made it an inline ...)
101
102void QPEApplication::polish ( QWidget *w )
103{
104#ifndef OPIE_NO_OVERRIDE_QT
105 for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) {
106 if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) &&
107 ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) &&
108 ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) {
109 QPalette pal = w-> palette ( );
110 pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get ));
111 w-> setPalette ( pal );
112 }
113 }
114#endif
115 QApplication::polish ( w );
116}
117#endif
118
119
120#ifndef OPIE_NO_OVERRIDE_QT
121// Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes
122// were multiplied by 10 (which was incorrect)
123
124QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset )
125{
126 QValueList <int> sl = pointSizes_NonWeak ( family, style, charset );
127
128 for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) {
129 if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) {
130 for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
131 *it *= 10;
132 }
133 }
134 return sl;
135}
136
137
138// Various style/font/color related overrides for weak symbols in Qt/E,
139// which allows us to force the usage of the global Opie appearance.
140
141void QApplication::setStyle ( QStyle *style )
142{
143 if ( Opie::force_appearance & Opie::Force_Style )
144 delete style;
145 else
146 QApplication::setStyle_NonWeak ( style );
147}
148
149void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className )
150{
151 if (!( Opie::force_appearance & Opie::Force_Style ))
152 QApplication::setPalette_NonWeak ( pal, informWidgets, className );
153}
154
155void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className )
156{
157 if (!( Opie::force_appearance & Opie::Force_Font ))
158 QApplication::setFont_NonWeak ( fnt, informWidgets, className );
159}
160
161
162void QApplication::qwsSetDecoration ( QWSDecoration *deco )
163{
164 if ( Opie::force_appearance & Opie::Force_Decoration )
165 delete deco;
166 else
167 QApplication::qwsSetDecoration_NonWeak ( deco );
168}
169#endif
170#endif
diff --git a/library/qt_override_p.h b/library/qt_override_p.h
deleted file mode 100644
index cb05d15..0000000
--- a/library/qt_override_p.h
+++ b/dev/null
@@ -1,25 +0,0 @@
1#ifndef __QT_OVERRIDE_H__
2#define __QT_OVERRIDE_H__
3
4#if QT_VERSION > 233
5
6namespace Opie {
7
8enum ForceAppearance {
9 Force_Style = 0x01,
10 Force_Font = 0x02,
11 Force_Decoration = 0x04,
12
13 Force_All = 0xff,
14 Force_None = 0x00,
15};
16
17extern const char *binaryName ( );
18
19extern int force_appearance;
20
21}
22
23#endif // (QT_VERSION >233)
24
25#endif