author | kergoth <kergoth> | 2003-04-26 15:26:36 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-26 15:26:36 (UTC) |
commit | e434f5a8dacef2d86b37d44b9ba7ffa713abaae7 (patch) (unidiff) | |
tree | 7053cd94210f6410b247cac42bb1c0c895a3a09d | |
parent | dd4f6b36681a28f785cf0923b0f9fc58ebe9a3bf (diff) | |
download | opie-e434f5a8dacef2d86b37d44b9ba7ffa713abaae7.zip opie-e434f5a8dacef2d86b37d44b9ba7ffa713abaae7.tar.gz opie-e434f5a8dacef2d86b37d44b9ba7ffa713abaae7.tar.bz2 |
Change default font for large screen sizes to vera/16 rather than vera/18.
-rw-r--r-- | library/qpeapplication.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index f4bfda9..e5da48c 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1,1294 +1,1294 @@ | |||
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 | ** $Id$ | 19 | ** $Id$ |
20 | ** | 20 | ** |
21 | **********************************************************************/ | 21 | **********************************************************************/ |
22 | #define QTOPIA_INTERNAL_LANGLIST | 22 | #define QTOPIA_INTERNAL_LANGLIST |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) | 25 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) |
26 | #include <qfile.h> | 26 | #include <qfile.h> |
27 | #ifdef Q_WS_QWS | 27 | #ifdef Q_WS_QWS |
28 | #ifndef QT_NO_COP | 28 | #ifndef QT_NO_COP |
29 | #if QT_VERSION <= 231 | 29 | #if QT_VERSION <= 231 |
30 | #define private public | 30 | #define private public |
31 | #define sendLocally processEvent | 31 | #define sendLocally processEvent |
32 | #include "qcopenvelope_qws.h" | 32 | #include "qcopenvelope_qws.h" |
33 | #undef private | 33 | #undef private |
34 | #else | 34 | #else |
35 | #include "qcopenvelope_qws.h" | 35 | #include "qcopenvelope_qws.h" |
36 | #endif | 36 | #endif |
37 | #endif | 37 | #endif |
38 | #include <qwindowsystem_qws.h> | 38 | #include <qwindowsystem_qws.h> |
39 | #endif | 39 | #endif |
40 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
41 | #include <qpalette.h> | 41 | #include <qpalette.h> |
42 | #include <qbuffer.h> | 42 | #include <qbuffer.h> |
43 | #include <qptrdict.h> | 43 | #include <qptrdict.h> |
44 | #include <qregexp.h> | 44 | #include <qregexp.h> |
45 | #include <qdir.h> | 45 | #include <qdir.h> |
46 | #include <qlabel.h> | 46 | #include <qlabel.h> |
47 | #include <qdialog.h> | 47 | #include <qdialog.h> |
48 | #include <qdragobject.h> | 48 | #include <qdragobject.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #include <qevent.h> | 50 | #include <qevent.h> |
51 | #include <qtooltip.h> | 51 | #include <qtooltip.h> |
52 | #include <qsignal.h> | 52 | #include <qsignal.h> |
53 | #include <qmainwindow.h> | 53 | #include <qmainwindow.h> |
54 | #include "qpeapplication.h" | 54 | #include "qpeapplication.h" |
55 | #include "qpestyle.h" | 55 | #include "qpestyle.h" |
56 | #include "styleinterface.h" | 56 | #include "styleinterface.h" |
57 | #if QT_VERSION >= 300 | 57 | #if QT_VERSION >= 300 |
58 | #include <qstylefactory.h> | 58 | #include <qstylefactory.h> |
59 | #else | 59 | #else |
60 | #include <qplatinumstyle.h> | 60 | #include <qplatinumstyle.h> |
61 | #include <qwindowsstyle.h> | 61 | #include <qwindowsstyle.h> |
62 | #include <qmotifstyle.h> | 62 | #include <qmotifstyle.h> |
63 | #include <qmotifplusstyle.h> | 63 | #include <qmotifplusstyle.h> |
64 | #include "lightstyle.h" | 64 | #include "lightstyle.h" |
65 | 65 | ||
66 | #include <qpe/qlibrary.h> | 66 | #include <qpe/qlibrary.h> |
67 | #endif | 67 | #endif |
68 | #include "global.h" | 68 | #include "global.h" |
69 | #include "resource.h" | 69 | #include "resource.h" |
70 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 70 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
71 | #include "qutfcodec.h" | 71 | #include "qutfcodec.h" |
72 | #endif | 72 | #endif |
73 | #include "config.h" | 73 | #include "config.h" |
74 | #include "network.h" | 74 | #include "network.h" |
75 | #ifdef QWS | 75 | #ifdef QWS |
76 | #include "fontmanager.h" | 76 | #include "fontmanager.h" |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #include "alarmserver.h" | 79 | #include "alarmserver.h" |
80 | #include "applnk.h" | 80 | #include "applnk.h" |
81 | #include "qpemenubar.h" | 81 | #include "qpemenubar.h" |
82 | #include "textcodecinterface.h" | 82 | #include "textcodecinterface.h" |
83 | #include "imagecodecinterface.h" | 83 | #include "imagecodecinterface.h" |
84 | 84 | ||
85 | #include <unistd.h> | 85 | #include <unistd.h> |
86 | #include <sys/file.h> | 86 | #include <sys/file.h> |
87 | #include <sys/ioctl.h> | 87 | #include <sys/ioctl.h> |
88 | #include <sys/soundcard.h> | 88 | #include <sys/soundcard.h> |
89 | 89 | ||
90 | #include "qt_override_p.h" | 90 | #include "qt_override_p.h" |
91 | 91 | ||
92 | 92 | ||
93 | class QPEApplicationData | 93 | class QPEApplicationData |
94 | { | 94 | { |
95 | public: | 95 | public: |
96 | QPEApplicationData ( ) | 96 | QPEApplicationData ( ) |
97 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 97 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
98 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), | 98 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), |
99 | keep_running( true ), qpe_main_widget( 0 ) | 99 | keep_running( true ), qpe_main_widget( 0 ) |
100 | 100 | ||
101 | { | 101 | { |
102 | qcopq.setAutoDelete( TRUE ); | 102 | qcopq.setAutoDelete( TRUE ); |
103 | } | 103 | } |
104 | 104 | ||
105 | int presstimer; | 105 | int presstimer; |
106 | QWidget* presswidget; | 106 | QWidget* presswidget; |
107 | QPoint presspos; | 107 | QPoint presspos; |
108 | 108 | ||
109 | bool rightpressed : 1; | 109 | bool rightpressed : 1; |
110 | bool kbgrabbed : 1; | 110 | bool kbgrabbed : 1; |
111 | bool notbusysent : 1; | 111 | bool notbusysent : 1; |
112 | bool preloaded : 1; | 112 | bool preloaded : 1; |
113 | bool forceshow : 1; | 113 | bool forceshow : 1; |
114 | bool nomaximize : 1; | 114 | bool nomaximize : 1; |
115 | bool keep_running : 1; | 115 | bool keep_running : 1; |
116 | 116 | ||
117 | QString appName; | 117 | QString appName; |
118 | struct QCopRec | 118 | struct QCopRec |
119 | { | 119 | { |
120 | QCopRec( const QCString &ch, const QCString &msg, | 120 | QCopRec( const QCString &ch, const QCString &msg, |
121 | const QByteArray &d ) : | 121 | const QByteArray &d ) : |
122 | channel( ch ), message( msg ), data( d ) | 122 | channel( ch ), message( msg ), data( d ) |
123 | { } | 123 | { } |
124 | 124 | ||
125 | QCString channel; | 125 | QCString channel; |
126 | QCString message; | 126 | QCString message; |
127 | QByteArray data; | 127 | QByteArray data; |
128 | }; | 128 | }; |
129 | QWidget* qpe_main_widget; | 129 | QWidget* qpe_main_widget; |
130 | QList<QCopRec> qcopq; | 130 | QList<QCopRec> qcopq; |
131 | 131 | ||
132 | void enqueueQCop( const QCString &ch, const QCString &msg, | 132 | void enqueueQCop( const QCString &ch, const QCString &msg, |
133 | const QByteArray &data ) | 133 | const QByteArray &data ) |
134 | { | 134 | { |
135 | qcopq.append( new QCopRec( ch, msg, data ) ); | 135 | qcopq.append( new QCopRec( ch, msg, data ) ); |
136 | } | 136 | } |
137 | void sendQCopQ() | 137 | void sendQCopQ() |
138 | { | 138 | { |
139 | QCopRec * r; | 139 | QCopRec * r; |
140 | #ifndef QT_NO_COP | 140 | #ifndef QT_NO_COP |
141 | 141 | ||
142 | for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it ) | 142 | for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it ) |
143 | QCopChannel::sendLocally( r->channel, r->message, r->data ); | 143 | QCopChannel::sendLocally( r->channel, r->message, r->data ); |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | qcopq.clear(); | 146 | qcopq.clear(); |
147 | } | 147 | } |
148 | static void show_mx(QWidget* mw, bool nomaximize) | 148 | static void show_mx(QWidget* mw, bool nomaximize) |
149 | { | 149 | { |
150 | 150 | ||
151 | // ugly hack, remove that later after finding a sane solution | 151 | // ugly hack, remove that later after finding a sane solution |
152 | if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { | 152 | if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { |
153 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); | 153 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); |
154 | } | 154 | } |
155 | 155 | ||
156 | if ( mw->layout() && mw->inherits("QDialog") ) { | 156 | if ( mw->layout() && mw->inherits("QDialog") ) { |
157 | QPEApplication::showDialog((QDialog*)mw, nomaximize); | 157 | QPEApplication::showDialog((QDialog*)mw, nomaximize); |
158 | } | 158 | } |
159 | else { | 159 | else { |
160 | #ifdef Q_WS_QWS | 160 | #ifdef Q_WS_QWS |
161 | if ( !nomaximize ) | 161 | if ( !nomaximize ) |
162 | mw->showMaximized(); | 162 | mw->showMaximized(); |
163 | else | 163 | else |
164 | #endif | 164 | #endif |
165 | 165 | ||
166 | mw->show(); | 166 | mw->show(); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) | 169 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) |
170 | { | 170 | { |
171 | /* | 171 | /* |
172 | // This works but disable it for now until it is safe to apply | 172 | // This works but disable it for now until it is safe to apply |
173 | // What is does is scan the .desktop files of all the apps for | 173 | // What is does is scan the .desktop files of all the apps for |
174 | // the applnk that has the corresponding argv[0] as this program | 174 | // the applnk that has the corresponding argv[0] as this program |
175 | // then it uses the name stored in the .desktop file as the caption | 175 | // then it uses the name stored in the .desktop file as the caption |
176 | // for the main widget. This saves duplicating translations for | 176 | // for the main widget. This saves duplicating translations for |
177 | // the app name in the program and in the .desktop files. | 177 | // the app name in the program and in the .desktop files. |
178 | 178 | ||
179 | AppLnkSet apps( appsPath ); | 179 | AppLnkSet apps( appsPath ); |
180 | 180 | ||
181 | QList<AppLnk> appsList = apps.children(); | 181 | QList<AppLnk> appsList = apps.children(); |
182 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { | 182 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { |
183 | if ( (*it)->exec() == appName ) { | 183 | if ( (*it)->exec() == appName ) { |
184 | mw->setCaption( (*it)->name() ); | 184 | mw->setCaption( (*it)->name() ); |
185 | return TRUE; | 185 | return TRUE; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | */ | 188 | */ |
189 | return FALSE; | 189 | return FALSE; |
190 | } | 190 | } |
191 | 191 | ||
192 | 192 | ||
193 | void show(QWidget* mw, bool nomax) | 193 | void show(QWidget* mw, bool nomax) |
194 | { | 194 | { |
195 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); | 195 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); |
196 | nomaximize = nomax; | 196 | nomaximize = nomax; |
197 | qpe_main_widget = mw; | 197 | qpe_main_widget = mw; |
198 | #ifndef QT_NO_COP | 198 | #ifndef QT_NO_COP |
199 | 199 | ||
200 | sendQCopQ(); | 200 | sendQCopQ(); |
201 | #endif | 201 | #endif |
202 | 202 | ||
203 | if ( preloaded ) { | 203 | if ( preloaded ) { |
204 | if (forceshow) | 204 | if (forceshow) |
205 | show_mx(mw, nomax); | 205 | show_mx(mw, nomax); |
206 | } | 206 | } |
207 | else if ( keep_running ) { | 207 | else if ( keep_running ) { |
208 | show_mx(mw, nomax); | 208 | show_mx(mw, nomax); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | void loadTextCodecs() | 212 | void loadTextCodecs() |
213 | { | 213 | { |
214 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; | 214 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; |
215 | QDir dir( path, "lib*.so" ); | 215 | QDir dir( path, "lib*.so" ); |
216 | QStringList list; | 216 | QStringList list; |
217 | if ( dir. exists ( )) | 217 | if ( dir. exists ( )) |
218 | list = dir.entryList(); | 218 | list = dir.entryList(); |
219 | QStringList::Iterator it; | 219 | QStringList::Iterator it; |
220 | for ( it = list.begin(); it != list.end(); ++it ) { | 220 | for ( it = list.begin(); it != list.end(); ++it ) { |
221 | TextCodecInterface *iface = 0; | 221 | TextCodecInterface *iface = 0; |
222 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 222 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
223 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 223 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
224 | QValueList<int> mibs = iface->mibEnums(); | 224 | QValueList<int> mibs = iface->mibEnums(); |
225 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { | 225 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { |
226 | (void)iface->createForMib(*i); | 226 | (void)iface->createForMib(*i); |
227 | // ### it exists now; need to remember if we can delete it | 227 | // ### it exists now; need to remember if we can delete it |
228 | } | 228 | } |
229 | } | 229 | } |
230 | else { | 230 | else { |
231 | lib->unload(); | 231 | lib->unload(); |
232 | delete lib; | 232 | delete lib; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | void loadImageCodecs() | 237 | void loadImageCodecs() |
238 | { | 238 | { |
239 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; | 239 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; |
240 | QDir dir( path, "lib*.so" ); | 240 | QDir dir( path, "lib*.so" ); |
241 | QStringList list; | 241 | QStringList list; |
242 | if ( dir. exists ( )) | 242 | if ( dir. exists ( )) |
243 | list = dir.entryList(); | 243 | list = dir.entryList(); |
244 | QStringList::Iterator it; | 244 | QStringList::Iterator it; |
245 | for ( it = list.begin(); it != list.end(); ++it ) { | 245 | for ( it = list.begin(); it != list.end(); ++it ) { |
246 | ImageCodecInterface *iface = 0; | 246 | ImageCodecInterface *iface = 0; |
247 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 247 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
248 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 248 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
249 | QStringList formats = iface->keys(); | 249 | QStringList formats = iface->keys(); |
250 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { | 250 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { |
251 | (void)iface->installIOHandler(*i); | 251 | (void)iface->installIOHandler(*i); |
252 | // ### it exists now; need to remember if we can delete it | 252 | // ### it exists now; need to remember if we can delete it |
253 | } | 253 | } |
254 | } | 254 | } |
255 | else { | 255 | else { |
256 | lib->unload(); | 256 | lib->unload(); |
257 | delete lib; | 257 | delete lib; |
258 | } | 258 | } |
259 | } | 259 | } |
260 | } | 260 | } |
261 | QString styleName; | 261 | QString styleName; |
262 | QString decorationName; | 262 | QString decorationName; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | class ResourceMimeFactory : public QMimeSourceFactory | 265 | class ResourceMimeFactory : public QMimeSourceFactory |
266 | { | 266 | { |
267 | public: | 267 | public: |
268 | ResourceMimeFactory() | 268 | ResourceMimeFactory() |
269 | { | 269 | { |
270 | setFilePath( Global::helpPath() ); | 270 | setFilePath( Global::helpPath() ); |
271 | setExtensionType( "html", "text/html;charset=UTF-8" ); | 271 | setExtensionType( "html", "text/html;charset=UTF-8" ); |
272 | } | 272 | } |
273 | 273 | ||
274 | const QMimeSource* data( const QString& abs_name ) const | 274 | const QMimeSource* data( const QString& abs_name ) const |
275 | { | 275 | { |
276 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); | 276 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); |
277 | if ( !r ) { | 277 | if ( !r ) { |
278 | int sl = abs_name.length(); | 278 | int sl = abs_name.length(); |
279 | do { | 279 | do { |
280 | sl = abs_name.findRev( '/', sl - 1 ); | 280 | sl = abs_name.findRev( '/', sl - 1 ); |
281 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; | 281 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; |
282 | int dot = name.findRev( '.' ); | 282 | int dot = name.findRev( '.' ); |
283 | if ( dot >= 0 ) | 283 | if ( dot >= 0 ) |
284 | name = name.left( dot ); | 284 | name = name.left( dot ); |
285 | QImage img = Resource::loadImage( name ); | 285 | QImage img = Resource::loadImage( name ); |
286 | if ( !img.isNull() ) | 286 | if ( !img.isNull() ) |
287 | r = new QImageDrag( img ); | 287 | r = new QImageDrag( img ); |
288 | } | 288 | } |
289 | while ( !r && sl > 0 ); | 289 | while ( !r && sl > 0 ); |
290 | } | 290 | } |
291 | return r; | 291 | return r; |
292 | } | 292 | } |
293 | }; | 293 | }; |
294 | 294 | ||
295 | static int muted = 0; | 295 | static int muted = 0; |
296 | static int micMuted = 0; | 296 | static int micMuted = 0; |
297 | 297 | ||
298 | static void setVolume( int t = 0, int percent = -1 ) | 298 | static void setVolume( int t = 0, int percent = -1 ) |
299 | { | 299 | { |
300 | switch ( t ) { | 300 | switch ( t ) { |
301 | case 0: { | 301 | case 0: { |
302 | Config cfg( "qpe" ); | 302 | Config cfg( "qpe" ); |
303 | cfg.setGroup( "Volume" ); | 303 | cfg.setGroup( "Volume" ); |
304 | if ( percent < 0 ) | 304 | if ( percent < 0 ) |
305 | percent = cfg.readNumEntry( "VolumePercent", 50 ); | 305 | percent = cfg.readNumEntry( "VolumePercent", 50 ); |
306 | int fd = 0; | 306 | int fd = 0; |
307 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 307 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
308 | int vol = muted ? 0 : percent; | 308 | int vol = muted ? 0 : percent; |
309 | // set both channels to same volume | 309 | // set both channels to same volume |
310 | vol |= vol << 8; | 310 | vol |= vol << 8; |
311 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); | 311 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); |
312 | ::close( fd ); | 312 | ::close( fd ); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | break; | 315 | break; |
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
319 | static void setMic( int t = 0, int percent = -1 ) | 319 | static void setMic( int t = 0, int percent = -1 ) |
320 | { | 320 | { |
321 | switch ( t ) { | 321 | switch ( t ) { |
322 | case 0: { | 322 | case 0: { |
323 | Config cfg( "qpe" ); | 323 | Config cfg( "qpe" ); |
324 | cfg.setGroup( "Volume" ); | 324 | cfg.setGroup( "Volume" ); |
325 | if ( percent < 0 ) | 325 | if ( percent < 0 ) |
326 | percent = cfg.readNumEntry( "Mic", 50 ); | 326 | percent = cfg.readNumEntry( "Mic", 50 ); |
327 | 327 | ||
328 | int fd = 0; | 328 | int fd = 0; |
329 | int mic = micMuted ? 0 : percent; | 329 | int mic = micMuted ? 0 : percent; |
330 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 330 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
331 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); | 331 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); |
332 | ::close( fd ); | 332 | ::close( fd ); |
333 | } | 333 | } |
334 | } | 334 | } |
335 | break; | 335 | break; |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | 339 | ||
340 | static void setBass( int t = 0, int percent = -1 ) | 340 | static void setBass( int t = 0, int percent = -1 ) |
341 | { | 341 | { |
342 | switch ( t ) { | 342 | switch ( t ) { |
343 | case 0: { | 343 | case 0: { |
344 | Config cfg( "qpe" ); | 344 | Config cfg( "qpe" ); |
345 | cfg.setGroup( "Volume" ); | 345 | cfg.setGroup( "Volume" ); |
346 | if ( percent < 0 ) | 346 | if ( percent < 0 ) |
347 | percent = cfg.readNumEntry( "BassPercent", 50 ); | 347 | percent = cfg.readNumEntry( "BassPercent", 50 ); |
348 | 348 | ||
349 | int fd = 0; | 349 | int fd = 0; |
350 | int bass = percent; | 350 | int bass = percent; |
351 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 351 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
352 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | 352 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); |
353 | ::close( fd ); | 353 | ::close( fd ); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | break; | 356 | break; |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | 360 | ||
361 | static void setTreble( int t = 0, int percent = -1 ) | 361 | static void setTreble( int t = 0, int percent = -1 ) |
362 | { | 362 | { |
363 | switch ( t ) { | 363 | switch ( t ) { |
364 | case 0: { | 364 | case 0: { |
365 | Config cfg( "qpe" ); | 365 | Config cfg( "qpe" ); |
366 | cfg.setGroup( "Volume" ); | 366 | cfg.setGroup( "Volume" ); |
367 | if ( percent < 0 ) | 367 | if ( percent < 0 ) |
368 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | 368 | percent = cfg.readNumEntry( "TreblePercent", 50 ); |
369 | 369 | ||
370 | int fd = 0; | 370 | int fd = 0; |
371 | int treble = percent; | 371 | int treble = percent; |
372 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 372 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
373 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | 373 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); |
374 | ::close( fd ); | 374 | ::close( fd ); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | break; | 377 | break; |
378 | } | 378 | } |
379 | } | 379 | } |
380 | 380 | ||
381 | 381 | ||
382 | /*! | 382 | /*! |
383 | \class QPEApplication qpeapplication.h | 383 | \class QPEApplication qpeapplication.h |
384 | \brief The QPEApplication class implements various system services | 384 | \brief The QPEApplication class implements various system services |
385 | that are available to all Qtopia applications. | 385 | that are available to all Qtopia applications. |
386 | 386 | ||
387 | Simply by using QPEApplication instead of QApplication, a standard Qt | 387 | Simply by using QPEApplication instead of QApplication, a standard Qt |
388 | application becomes a Qtopia application. It automatically follows | 388 | application becomes a Qtopia application. It automatically follows |
389 | style changes, quits and raises, and in the | 389 | style changes, quits and raises, and in the |
390 | case of \link docwidget.html document-oriented\endlink applications, | 390 | case of \link docwidget.html document-oriented\endlink applications, |
391 | changes the currently displayed document in response to the environment. | 391 | changes the currently displayed document in response to the environment. |
392 | 392 | ||
393 | To create a \link docwidget.html document-oriented\endlink | 393 | To create a \link docwidget.html document-oriented\endlink |
394 | application use showMainDocumentWidget(); to create a | 394 | application use showMainDocumentWidget(); to create a |
395 | non-document-oriented application use showMainWidget(). The | 395 | non-document-oriented application use showMainWidget(). The |
396 | keepRunning() function indicates whether the application will | 396 | keepRunning() function indicates whether the application will |
397 | continue running after it's processed the last \link qcop.html | 397 | continue running after it's processed the last \link qcop.html |
398 | QCop\endlink message. This can be changed using setKeepRunning(). | 398 | QCop\endlink message. This can be changed using setKeepRunning(). |
399 | 399 | ||
400 | A variety of signals are emitted when certain events occur, for | 400 | A variety of signals are emitted when certain events occur, for |
401 | example, timeChanged(), clockChanged(), weekChanged(), | 401 | example, timeChanged(), clockChanged(), weekChanged(), |
402 | dateFormatChanged() and volumeChanged(). If the application receives | 402 | dateFormatChanged() and volumeChanged(). If the application receives |
403 | a \link qcop.html QCop\endlink message on the application's | 403 | a \link qcop.html QCop\endlink message on the application's |
404 | QPE/Application/\e{appname} channel, the appMessage() signal is | 404 | QPE/Application/\e{appname} channel, the appMessage() signal is |
405 | emitted. There are also flush() and reload() signals, which | 405 | emitted. There are also flush() and reload() signals, which |
406 | are emitted when synching begins and ends respectively - upon these | 406 | are emitted when synching begins and ends respectively - upon these |
407 | signals, the application should save and reload any data | 407 | signals, the application should save and reload any data |
408 | files that are involved in synching. Most of these signals will initially | 408 | files that are involved in synching. Most of these signals will initially |
409 | be received and unfiltered through the appMessage() signal. | 409 | be received and unfiltered through the appMessage() signal. |
410 | 410 | ||
411 | This class also provides a set of useful static functions. The | 411 | This class also provides a set of useful static functions. The |
412 | qpeDir() and documentDir() functions return the respective paths. | 412 | qpeDir() and documentDir() functions return the respective paths. |
413 | The grabKeyboard() and ungrabKeyboard() functions are used to | 413 | The grabKeyboard() and ungrabKeyboard() functions are used to |
414 | control whether the application takes control of the device's | 414 | control whether the application takes control of the device's |
415 | physical buttons (e.g. application launch keys). The stylus' mode of | 415 | physical buttons (e.g. application launch keys). The stylus' mode of |
416 | operation is set with setStylusOperation() and retrieved with | 416 | operation is set with setStylusOperation() and retrieved with |
417 | stylusOperation(). There are also setInputMethodHint() and | 417 | stylusOperation(). There are also setInputMethodHint() and |
418 | inputMethodHint() functions. | 418 | inputMethodHint() functions. |
419 | 419 | ||
420 | \ingroup qtopiaemb | 420 | \ingroup qtopiaemb |
421 | */ | 421 | */ |
422 | 422 | ||
423 | /*! | 423 | /*! |
424 | \fn void QPEApplication::clientMoused() | 424 | \fn void QPEApplication::clientMoused() |
425 | 425 | ||
426 | \internal | 426 | \internal |
427 | */ | 427 | */ |
428 | 428 | ||
429 | /*! | 429 | /*! |
430 | \fn void QPEApplication::timeChanged(); | 430 | \fn void QPEApplication::timeChanged(); |
431 | This signal is emitted when the time changes outside the normal | 431 | This signal is emitted when the time changes outside the normal |
432 | passage of time, i.e. if the time is set backwards or forwards. | 432 | passage of time, i.e. if the time is set backwards or forwards. |
433 | */ | 433 | */ |
434 | 434 | ||
435 | /*! | 435 | /*! |
436 | \fn void QPEApplication::clockChanged( bool ampm ); | 436 | \fn void QPEApplication::clockChanged( bool ampm ); |
437 | 437 | ||
438 | This signal is emitted when the user changes the clock's style. If | 438 | This signal is emitted when the user changes the clock's style. If |
439 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 439 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
440 | they want a 24-hour clock. | 440 | they want a 24-hour clock. |
441 | */ | 441 | */ |
442 | 442 | ||
443 | /*! | 443 | /*! |
444 | \fn void QPEApplication::volumeChanged( bool muted ) | 444 | \fn void QPEApplication::volumeChanged( bool muted ) |
445 | 445 | ||
446 | This signal is emitted whenever the mute state is changed. If \a | 446 | This signal is emitted whenever the mute state is changed. If \a |
447 | muted is TRUE, then sound output has been muted. | 447 | muted is TRUE, then sound output has been muted. |
448 | */ | 448 | */ |
449 | 449 | ||
450 | /*! | 450 | /*! |
451 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 451 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
452 | 452 | ||
453 | This signal is emitted if the week start day is changed. If \a | 453 | This signal is emitted if the week start day is changed. If \a |
454 | startOnMonday is TRUE then the first day of the week is Monday; if | 454 | startOnMonday is TRUE then the first day of the week is Monday; if |
455 | \a startOnMonday is FALSE then the first day of the week is | 455 | \a startOnMonday is FALSE then the first day of the week is |
456 | Sunday. | 456 | Sunday. |
457 | */ | 457 | */ |
458 | 458 | ||
459 | /*! | 459 | /*! |
460 | \fn void QPEApplication::dateFormatChanged(DateFormat) | 460 | \fn void QPEApplication::dateFormatChanged(DateFormat) |
461 | 461 | ||
462 | This signal is emitted whenever the date format is changed. | 462 | This signal is emitted whenever the date format is changed. |
463 | */ | 463 | */ |
464 | 464 | ||
465 | /*! | 465 | /*! |
466 | \fn void QPEApplication::flush() | 466 | \fn void QPEApplication::flush() |
467 | 467 | ||
468 | ### | 468 | ### |
469 | */ | 469 | */ |
470 | 470 | ||
471 | /*! | 471 | /*! |
472 | \fn void QPEApplication::reload() | 472 | \fn void QPEApplication::reload() |
473 | 473 | ||
474 | */ | 474 | */ |
475 | 475 | ||
476 | /*! | 476 | /*! |
477 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 477 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
478 | 478 | ||
479 | This signal is emitted when a message is received on this | 479 | This signal is emitted when a message is received on this |
480 | application's QPE/Application/<i>appname</i> \link qcop.html | 480 | application's QPE/Application/<i>appname</i> \link qcop.html |
481 | QCop\endlink channel. | 481 | QCop\endlink channel. |
482 | 482 | ||
483 | The slot to which you connect this signal uses \a msg and \a data | 483 | The slot to which you connect this signal uses \a msg and \a data |
484 | in the following way: | 484 | in the following way: |
485 | 485 | ||
486 | \code | 486 | \code |
487 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 487 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
488 | { | 488 | { |
489 | QDataStream stream( data, IO_ReadOnly ); | 489 | QDataStream stream( data, IO_ReadOnly ); |
490 | if ( msg == "someMessage(int,int,int)" ) { | 490 | if ( msg == "someMessage(int,int,int)" ) { |
491 | int a,b,c; | 491 | int a,b,c; |
492 | stream >> a >> b >> c; | 492 | stream >> a >> b >> c; |
493 | ... | 493 | ... |
494 | } else if ( msg == "otherMessage(QString)" ) { | 494 | } else if ( msg == "otherMessage(QString)" ) { |
495 | ... | 495 | ... |
496 | } | 496 | } |
497 | } | 497 | } |
498 | \endcode | 498 | \endcode |
499 | 499 | ||
500 | \sa qcop.html | 500 | \sa qcop.html |
501 | Note that messages received here may be processed by qpe application | 501 | Note that messages received here may be processed by qpe application |
502 | and emitted as signals, such as flush() and reload(). | 502 | and emitted as signals, such as flush() and reload(). |
503 | */ | 503 | */ |
504 | 504 | ||
505 | /*! | 505 | /*! |
506 | Constructs a QPEApplication just as you would construct | 506 | Constructs a QPEApplication just as you would construct |
507 | a QApplication, passing \a argc, \a argv, and \a t. | 507 | a QApplication, passing \a argc, \a argv, and \a t. |
508 | 508 | ||
509 | For applications, \a t should be the default, GuiClient. Only | 509 | For applications, \a t should be the default, GuiClient. Only |
510 | the Qtopia server passes GuiServer. | 510 | the Qtopia server passes GuiServer. |
511 | */ | 511 | */ |
512 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 512 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
513 | : QApplication( argc, argv, t ) | 513 | : QApplication( argc, argv, t ) |
514 | { | 514 | { |
515 | d = new QPEApplicationData; | 515 | d = new QPEApplicationData; |
516 | d->loadTextCodecs(); | 516 | d->loadTextCodecs(); |
517 | d->loadImageCodecs(); | 517 | d->loadImageCodecs(); |
518 | int dw = desktop() ->width(); | 518 | int dw = desktop() ->width(); |
519 | 519 | ||
520 | if ( dw < 200 ) { | 520 | if ( dw < 200 ) { |
521 | setFont( QFont( "vera", 8 ) ); | 521 | setFont( QFont( "vera", 8 ) ); |
522 | AppLnk::setSmallIconSize( 10 ); | 522 | AppLnk::setSmallIconSize( 10 ); |
523 | AppLnk::setBigIconSize( 28 ); | 523 | AppLnk::setBigIconSize( 28 ); |
524 | } | 524 | } |
525 | else if ( dw > 600 ) { | 525 | else if ( dw > 600 ) { |
526 | setFont( QFont( "vera", 18 ) ); | 526 | setFont( QFont( "vera", 16 ) ); |
527 | AppLnk::setSmallIconSize( 24 ); | 527 | AppLnk::setSmallIconSize( 24 ); |
528 | AppLnk::setBigIconSize( 48 ); | 528 | AppLnk::setBigIconSize( 48 ); |
529 | } | 529 | } |
530 | else if ( dw > 200 ) { | 530 | else if ( dw > 200 ) { |
531 | setFont( QFont( "vera", 10 ) ); | 531 | setFont( QFont( "vera", 10 ) ); |
532 | AppLnk::setSmallIconSize( 14 ); | 532 | AppLnk::setSmallIconSize( 14 ); |
533 | AppLnk::setBigIconSize( 32 ); | 533 | AppLnk::setBigIconSize( 32 ); |
534 | } | 534 | } |
535 | 535 | ||
536 | 536 | ||
537 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 537 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
538 | 538 | ||
539 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 539 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
540 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 540 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
541 | 541 | ||
542 | QString qcopfn( "/tmp/qcop-msg-" ); | 542 | QString qcopfn( "/tmp/qcop-msg-" ); |
543 | qcopfn += QString( argv[ 0 ] ); // append command name | 543 | qcopfn += QString( argv[ 0 ] ); // append command name |
544 | 544 | ||
545 | QFile f( qcopfn ); | 545 | QFile f( qcopfn ); |
546 | if ( f.open( IO_ReadOnly ) ) { | 546 | if ( f.open( IO_ReadOnly ) ) { |
547 | flock( f.handle(), LOCK_EX ); | 547 | flock( f.handle(), LOCK_EX ); |
548 | } | 548 | } |
549 | 549 | ||
550 | sysChannel = new QCopChannel( "QPE/System", this ); | 550 | sysChannel = new QCopChannel( "QPE/System", this ); |
551 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 551 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
552 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 552 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); |
553 | 553 | ||
554 | QCString channel = QCString( argv[ 0 ] ); | 554 | QCString channel = QCString( argv[ 0 ] ); |
555 | channel.replace( QRegExp( ".*/" ), "" ); | 555 | channel.replace( QRegExp( ".*/" ), "" ); |
556 | d->appName = channel; | 556 | d->appName = channel; |
557 | channel = "QPE/Application/" + channel; | 557 | channel = "QPE/Application/" + channel; |
558 | pidChannel = new QCopChannel( channel, this ); | 558 | pidChannel = new QCopChannel( channel, this ); |
559 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 559 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
560 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 560 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); |
561 | 561 | ||
562 | if ( f.isOpen() ) { | 562 | if ( f.isOpen() ) { |
563 | d->keep_running = FALSE; | 563 | d->keep_running = FALSE; |
564 | QDataStream ds( &f ); | 564 | QDataStream ds( &f ); |
565 | QCString channel, message; | 565 | QCString channel, message; |
566 | QByteArray data; | 566 | QByteArray data; |
567 | while ( !ds.atEnd() ) { | 567 | while ( !ds.atEnd() ) { |
568 | ds >> channel >> message >> data; | 568 | ds >> channel >> message >> data; |
569 | d->enqueueQCop( channel, message, data ); | 569 | d->enqueueQCop( channel, message, data ); |
570 | } | 570 | } |
571 | 571 | ||
572 | flock( f.handle(), LOCK_UN ); | 572 | flock( f.handle(), LOCK_UN ); |
573 | f.close(); | 573 | f.close(); |
574 | f.remove(); | 574 | f.remove(); |
575 | } | 575 | } |
576 | 576 | ||
577 | for ( int a = 0; a < argc; a++ ) { | 577 | for ( int a = 0; a < argc; a++ ) { |
578 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 578 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
579 | argv[ a ] = argv[ a + 1 ]; | 579 | argv[ a ] = argv[ a + 1 ]; |
580 | a++; | 580 | a++; |
581 | d->preloaded = TRUE; | 581 | d->preloaded = TRUE; |
582 | argc -= 1; | 582 | argc -= 1; |
583 | } | 583 | } |
584 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { | 584 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { |
585 | argv[ a ] = argv[ a + 1 ]; | 585 | argv[ a ] = argv[ a + 1 ]; |
586 | a++; | 586 | a++; |
587 | d->preloaded = TRUE; | 587 | d->preloaded = TRUE; |
588 | d->forceshow = TRUE; | 588 | d->forceshow = TRUE; |
589 | argc -= 1; | 589 | argc -= 1; |
590 | } | 590 | } |
591 | } | 591 | } |
592 | 592 | ||
593 | /* overide stored arguments */ | 593 | /* overide stored arguments */ |
594 | setArgs( argc, argv ); | 594 | setArgs( argc, argv ); |
595 | 595 | ||
596 | #endif | 596 | #endif |
597 | 597 | ||
598 | // qwsSetDecoration( new QPEDecoration() ); | 598 | // qwsSetDecoration( new QPEDecoration() ); |
599 | 599 | ||
600 | #ifndef QT_NO_TRANSLATION | 600 | #ifndef QT_NO_TRANSLATION |
601 | 601 | ||
602 | QStringList langs = Global::languageList(); | 602 | QStringList langs = Global::languageList(); |
603 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { | 603 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { |
604 | QString lang = *it; | 604 | QString lang = *it; |
605 | 605 | ||
606 | QTranslator * trans; | 606 | QTranslator * trans; |
607 | QString tfn; | 607 | QString tfn; |
608 | 608 | ||
609 | trans = new QTranslator( this ); | 609 | trans = new QTranslator( this ); |
610 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; | 610 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; |
611 | if ( trans->load( tfn ) ) | 611 | if ( trans->load( tfn ) ) |
612 | installTranslator( trans ); | 612 | installTranslator( trans ); |
613 | else | 613 | else |
614 | delete trans; | 614 | delete trans; |
615 | 615 | ||
616 | trans = new QTranslator( this ); | 616 | trans = new QTranslator( this ); |
617 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; | 617 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; |
618 | if ( trans->load( tfn ) ) | 618 | if ( trans->load( tfn ) ) |
619 | installTranslator( trans ); | 619 | installTranslator( trans ); |
620 | else | 620 | else |
621 | delete trans; | 621 | delete trans; |
622 | 622 | ||
623 | //###language/font hack; should look it up somewhere | 623 | //###language/font hack; should look it up somewhere |
624 | #ifdef QWS | 624 | #ifdef QWS |
625 | 625 | ||
626 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 626 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
627 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 627 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
628 | setFont( fn ); | 628 | setFont( fn ); |
629 | } | 629 | } |
630 | #endif | 630 | #endif |
631 | 631 | ||
632 | } | 632 | } |
633 | #endif | 633 | #endif |
634 | 634 | ||
635 | applyStyle(); | 635 | applyStyle(); |
636 | 636 | ||
637 | if ( type() == GuiServer ) { | 637 | if ( type() == GuiServer ) { |
638 | setVolume(); | 638 | setVolume(); |
639 | } | 639 | } |
640 | 640 | ||
641 | installEventFilter( this ); | 641 | installEventFilter( this ); |
642 | 642 | ||
643 | QPEMenuToolFocusManager::initialize(); | 643 | QPEMenuToolFocusManager::initialize(); |
644 | 644 | ||
645 | #ifdef QT_NO_QWS_CURSOR | 645 | #ifdef QT_NO_QWS_CURSOR |
646 | // if we have no cursor, probably don't want tooltips | 646 | // if we have no cursor, probably don't want tooltips |
647 | QToolTip::setEnabled( FALSE ); | 647 | QToolTip::setEnabled( FALSE ); |
648 | #endif | 648 | #endif |
649 | } | 649 | } |
650 | 650 | ||
651 | static QPtrDict<void>* inputMethodDict = 0; | 651 | static QPtrDict<void>* inputMethodDict = 0; |
652 | static void createInputMethodDict() | 652 | static void createInputMethodDict() |
653 | { | 653 | { |
654 | if ( !inputMethodDict ) | 654 | if ( !inputMethodDict ) |
655 | inputMethodDict = new QPtrDict<void>; | 655 | inputMethodDict = new QPtrDict<void>; |
656 | } | 656 | } |
657 | 657 | ||
658 | /*! | 658 | /*! |
659 | Returns the currently set hint to the system as to whether | 659 | Returns the currently set hint to the system as to whether |
660 | widget \a w has any use for text input methods. | 660 | widget \a w has any use for text input methods. |
661 | 661 | ||
662 | 662 | ||
663 | \sa setInputMethodHint() InputMethodHint | 663 | \sa setInputMethodHint() InputMethodHint |
664 | */ | 664 | */ |
665 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | 665 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) |
666 | { | 666 | { |
667 | if ( inputMethodDict && w ) | 667 | if ( inputMethodDict && w ) |
668 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); | 668 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); |
669 | return Normal; | 669 | return Normal; |
670 | } | 670 | } |
671 | 671 | ||
672 | /*! | 672 | /*! |
673 | \enum QPEApplication::InputMethodHint | 673 | \enum QPEApplication::InputMethodHint |
674 | 674 | ||
675 | \value Normal the application sometimes needs text input (the default). | 675 | \value Normal the application sometimes needs text input (the default). |
676 | \value AlwaysOff the application never needs text input. | 676 | \value AlwaysOff the application never needs text input. |
677 | \value AlwaysOn the application always needs text input. | 677 | \value AlwaysOn the application always needs text input. |
678 | */ | 678 | */ |
679 | 679 | ||
680 | /*! | 680 | /*! |
681 | Hints to the system that widget \a w has use for text input methods | 681 | Hints to the system that widget \a w has use for text input methods |
682 | as specified by \a mode. | 682 | as specified by \a mode. |
683 | 683 | ||
684 | \sa inputMethodHint() InputMethodHint | 684 | \sa inputMethodHint() InputMethodHint |
685 | */ | 685 | */ |
686 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) | 686 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) |
687 | { | 687 | { |
688 | createInputMethodDict(); | 688 | createInputMethodDict(); |
689 | if ( mode == Normal ) { | 689 | if ( mode == Normal ) { |
690 | inputMethodDict->remove | 690 | inputMethodDict->remove |
691 | ( w ); | 691 | ( w ); |
692 | } | 692 | } |
693 | else { | 693 | else { |
694 | inputMethodDict->insert( w, ( void* ) mode ); | 694 | inputMethodDict->insert( w, ( void* ) mode ); |
695 | } | 695 | } |
696 | } | 696 | } |
697 | 697 | ||
698 | class HackDialog : public QDialog | 698 | class HackDialog : public QDialog |
699 | { | 699 | { |
700 | public: | 700 | public: |
701 | void acceptIt() | 701 | void acceptIt() |
702 | { | 702 | { |
703 | accept(); | 703 | accept(); |
704 | } | 704 | } |
705 | void rejectIt() | 705 | void rejectIt() |
706 | { | 706 | { |
707 | reject(); | 707 | reject(); |
708 | } | 708 | } |
709 | }; | 709 | }; |
710 | 710 | ||
711 | 711 | ||
712 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) | 712 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) |
713 | { | 713 | { |
714 | // specialised actions for certain widgets. May want to | 714 | // specialised actions for certain widgets. May want to |
715 | // add more stuff here. | 715 | // add more stuff here. |
716 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) | 716 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) |
717 | && activePopupWidget() ->parentWidget() | 717 | && activePopupWidget() ->parentWidget() |
718 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) | 718 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) |
719 | key = Qt::Key_Return; | 719 | key = Qt::Key_Return; |
720 | 720 | ||
721 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) | 721 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) |
722 | key = Qt::Key_Return; | 722 | key = Qt::Key_Return; |
723 | 723 | ||
724 | #ifdef QWS | 724 | #ifdef QWS |
725 | 725 | ||
726 | ke->simpleData.keycode = key; | 726 | ke->simpleData.keycode = key; |
727 | #endif | 727 | #endif |
728 | } | 728 | } |
729 | 729 | ||
730 | class HackWidget : public QWidget | 730 | class HackWidget : public QWidget |
731 | { | 731 | { |
732 | public: | 732 | public: |
733 | bool needsOk() | 733 | bool needsOk() |
734 | { | 734 | { |
735 | return ( getWState() & WState_Reserved1 ); | 735 | return ( getWState() & WState_Reserved1 ); |
736 | } | 736 | } |
737 | }; | 737 | }; |
738 | 738 | ||
739 | /*! | 739 | /*! |
740 | \internal | 740 | \internal |
741 | */ | 741 | */ |
742 | 742 | ||
743 | #ifdef QWS | 743 | #ifdef QWS |
744 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) | 744 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) |
745 | { | 745 | { |
746 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { | 746 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { |
747 | if ( qApp->type() != QApplication::GuiServer ) { | 747 | if ( qApp->type() != QApplication::GuiServer ) { |
748 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); | 748 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); |
749 | e << d->appName; | 749 | e << d->appName; |
750 | } | 750 | } |
751 | d->notbusysent = TRUE; | 751 | d->notbusysent = TRUE; |
752 | } | 752 | } |
753 | if ( type() == GuiServer ) { | 753 | if ( type() == GuiServer ) { |
754 | switch ( e->type ) { | 754 | switch ( e->type ) { |
755 | case QWSEvent::Mouse: | 755 | case QWSEvent::Mouse: |
756 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) | 756 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) |
757 | emit clientMoused(); | 757 | emit clientMoused(); |
758 | break; | 758 | break; |
759 | default: | 759 | default: |
760 | break; | 760 | break; |
761 | } | 761 | } |
762 | } | 762 | } |
763 | if ( e->type == QWSEvent::Key ) { | 763 | if ( e->type == QWSEvent::Key ) { |
764 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; | 764 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; |
765 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { | 765 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { |
766 | // Use special "OK" key to press "OK" on top level widgets | 766 | // Use special "OK" key to press "OK" on top level widgets |
767 | QWidget * active = activeWindow(); | 767 | QWidget * active = activeWindow(); |
768 | QWidget *popup = 0; | 768 | QWidget *popup = 0; |
769 | if ( active && active->isPopup() ) { | 769 | if ( active && active->isPopup() ) { |
770 | popup = active; | 770 | popup = active; |
771 | active = active->parentWidget(); | 771 | active = active->parentWidget(); |
772 | } | 772 | } |
773 | if ( active && ( int ) active->winId() == ke->simpleData.window && | 773 | if ( active && ( int ) active->winId() == ke->simpleData.window && |
774 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 774 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
775 | if ( ke->simpleData.is_press ) { | 775 | if ( ke->simpleData.is_press ) { |
776 | if ( popup ) | 776 | if ( popup ) |
777 | popup->close(); | 777 | popup->close(); |
778 | if ( active->inherits( "QDialog" ) ) { | 778 | if ( active->inherits( "QDialog" ) ) { |
779 | HackDialog * d = ( HackDialog * ) active; | 779 | HackDialog * d = ( HackDialog * ) active; |
780 | d->acceptIt(); | 780 | d->acceptIt(); |
781 | return TRUE; | 781 | return TRUE; |
782 | } | 782 | } |
783 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { | 783 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { |
784 | QSignal s; | 784 | QSignal s; |
785 | s.connect( active, SLOT( accept() ) ); | 785 | s.connect( active, SLOT( accept() ) ); |
786 | s.activate(); | 786 | s.activate(); |
787 | } | 787 | } |
788 | else { | 788 | else { |
789 | // do the same as with the select key: Map to the default action of the widget: | 789 | // do the same as with the select key: Map to the default action of the widget: |
790 | mapToDefaultAction( ke, Qt::Key_Return ); | 790 | mapToDefaultAction( ke, Qt::Key_Return ); |
791 | } | 791 | } |
792 | } | 792 | } |
793 | } | 793 | } |
794 | } | 794 | } |
795 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 795 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
796 | // Use special "select" key to do whatever default action a widget has | 796 | // Use special "select" key to do whatever default action a widget has |
797 | mapToDefaultAction( ke, Qt::Key_Space ); | 797 | mapToDefaultAction( ke, Qt::Key_Space ); |
798 | } | 798 | } |
799 | else if ( ke->simpleData.keycode == Qt::Key_Escape && | 799 | else if ( ke->simpleData.keycode == Qt::Key_Escape && |
800 | ke->simpleData.is_press ) { | 800 | ke->simpleData.is_press ) { |
801 | // Escape key closes app if focus on toplevel | 801 | // Escape key closes app if focus on toplevel |
802 | QWidget * active = activeWindow(); | 802 | QWidget * active = activeWindow(); |
803 | if ( active && active->testWFlags( WType_TopLevel ) && | 803 | if ( active && active->testWFlags( WType_TopLevel ) && |
804 | ( int ) active->winId() == ke->simpleData.window && | 804 | ( int ) active->winId() == ke->simpleData.window && |
805 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 805 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
806 | if ( active->inherits( "QDialog" ) ) { | 806 | if ( active->inherits( "QDialog" ) ) { |
807 | HackDialog * d = ( HackDialog * ) active; | 807 | HackDialog * d = ( HackDialog * ) active; |
808 | d->rejectIt(); | 808 | d->rejectIt(); |
809 | return TRUE; | 809 | return TRUE; |
810 | } | 810 | } |
811 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { | 811 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { |
812 | active->close(); | 812 | active->close(); |
813 | } | 813 | } |
814 | } | 814 | } |
815 | } | 815 | } |
816 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { | 816 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { |
817 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) | 817 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) |
818 | // but we cannot access libopie function within libqpe :( | 818 | // but we cannot access libopie function within libqpe :( |
819 | 819 | ||
820 | QWidget * active = activeWindow ( ); | 820 | QWidget * active = activeWindow ( ); |
821 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 821 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
822 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 822 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
823 | QChar ch ( ke-> simpleData.unicode ); | 823 | QChar ch ( ke-> simpleData.unicode ); |
824 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 824 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
825 | ke-> simpleData.keycode, | 825 | ke-> simpleData.keycode, |
826 | ch. latin1 ( ), | 826 | ch. latin1 ( ), |
827 | ke-> simpleData.modifiers, | 827 | ke-> simpleData.modifiers, |
828 | QString ( ch ), | 828 | QString ( ch ), |
829 | ke-> simpleData.is_auto_repeat, 1 ); | 829 | ke-> simpleData.is_auto_repeat, 1 ); |
830 | 830 | ||
831 | QObject *which = QWidget::keyboardGrabber ( ); | 831 | QObject *which = QWidget::keyboardGrabber ( ); |
832 | if ( !which ) | 832 | if ( !which ) |
833 | which = QApplication::focusWidget ( ); | 833 | which = QApplication::focusWidget ( ); |
834 | if ( !which ) | 834 | if ( !which ) |
835 | which = QApplication::activeWindow ( ); | 835 | which = QApplication::activeWindow ( ); |
836 | if ( !which ) | 836 | if ( !which ) |
837 | which = qApp; | 837 | which = qApp; |
838 | 838 | ||
839 | QApplication::sendEvent ( which, &qke ); | 839 | QApplication::sendEvent ( which, &qke ); |
840 | } | 840 | } |
841 | else { // we didn't grab the keyboard, so send the event to the launcher | 841 | else { // we didn't grab the keyboard, so send the event to the launcher |
842 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 842 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); |
843 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); | 843 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); |
844 | } | 844 | } |
845 | } | 845 | } |
846 | return true; | 846 | return true; |
847 | } | 847 | } |
848 | } | 848 | } |
849 | if ( e->type == QWSEvent::Focus ) { | 849 | if ( e->type == QWSEvent::Focus ) { |
850 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 850 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
851 | if ( !fe->simpleData.get_focus ) { | 851 | if ( !fe->simpleData.get_focus ) { |
852 | QWidget * active = activeWindow(); | 852 | QWidget * active = activeWindow(); |
853 | while ( active && active->isPopup() ) { | 853 | while ( active && active->isPopup() ) { |
854 | active->close(); | 854 | active->close(); |
855 | active = activeWindow(); | 855 | active = activeWindow(); |
856 | } | 856 | } |
857 | } | 857 | } |
858 | else { | 858 | else { |
859 | // make sure our modal widget is ALWAYS on top | 859 | // make sure our modal widget is ALWAYS on top |
860 | QWidget *topm = activeModalWidget(); | 860 | QWidget *topm = activeModalWidget(); |
861 | if ( topm ) { | 861 | if ( topm ) { |
862 | topm->raise(); | 862 | topm->raise(); |
863 | } | 863 | } |
864 | } | 864 | } |
865 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 865 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
866 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 866 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
867 | if ( m == AlwaysOff ) | 867 | if ( m == AlwaysOff ) |
868 | Global::hideInputMethod(); | 868 | Global::hideInputMethod(); |
869 | if ( m == AlwaysOn ) | 869 | if ( m == AlwaysOn ) |
870 | Global::showInputMethod(); | 870 | Global::showInputMethod(); |
871 | } | 871 | } |
872 | } | 872 | } |
873 | 873 | ||
874 | 874 | ||
875 | return QApplication::qwsEventFilter( e ); | 875 | return QApplication::qwsEventFilter( e ); |
876 | } | 876 | } |
877 | #endif | 877 | #endif |
878 | 878 | ||
879 | /*! | 879 | /*! |
880 | Destroys the QPEApplication. | 880 | Destroys the QPEApplication. |
881 | */ | 881 | */ |
882 | QPEApplication::~QPEApplication() | 882 | QPEApplication::~QPEApplication() |
883 | { | 883 | { |
884 | ungrabKeyboard(); | 884 | ungrabKeyboard(); |
885 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 885 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
886 | // Need to delete QCopChannels early, since the display will | 886 | // Need to delete QCopChannels early, since the display will |
887 | // be gone by the time we get to ~QObject(). | 887 | // be gone by the time we get to ~QObject(). |
888 | delete sysChannel; | 888 | delete sysChannel; |
889 | delete pidChannel; | 889 | delete pidChannel; |
890 | #endif | 890 | #endif |
891 | 891 | ||
892 | delete d; | 892 | delete d; |
893 | } | 893 | } |
894 | 894 | ||
895 | /*! | 895 | /*! |
896 | Returns <tt>$OPIEDIR/</tt>. | 896 | Returns <tt>$OPIEDIR/</tt>. |
897 | */ | 897 | */ |
898 | QString QPEApplication::qpeDir() | 898 | QString QPEApplication::qpeDir() |
899 | { | 899 | { |
900 | const char * base = getenv( "OPIEDIR" ); | 900 | const char * base = getenv( "OPIEDIR" ); |
901 | if ( base ) | 901 | if ( base ) |
902 | return QString( base ) + "/"; | 902 | return QString( base ) + "/"; |
903 | 903 | ||
904 | return QString( "../" ); | 904 | return QString( "../" ); |
905 | } | 905 | } |
906 | 906 | ||
907 | /*! | 907 | /*! |
908 | Returns the user's current Document directory. There is a trailing "/". | 908 | Returns the user's current Document directory. There is a trailing "/". |
909 | .. well, it does now,, and there's no trailing '/' | 909 | .. well, it does now,, and there's no trailing '/' |
910 | */ | 910 | */ |
911 | QString QPEApplication::documentDir() | 911 | QString QPEApplication::documentDir() |
912 | { | 912 | { |
913 | const char* base = getenv( "HOME"); | 913 | const char* base = getenv( "HOME"); |
914 | if ( base ) | 914 | if ( base ) |
915 | return QString( base ) + "/Documents"; | 915 | return QString( base ) + "/Documents"; |
916 | 916 | ||
917 | return QString( "../Documents" ); | 917 | return QString( "../Documents" ); |
918 | } | 918 | } |
919 | 919 | ||
920 | static int deforient = -1; | 920 | static int deforient = -1; |
921 | 921 | ||
922 | /*! | 922 | /*! |
923 | \internal | 923 | \internal |
924 | */ | 924 | */ |
925 | int QPEApplication::defaultRotation() | 925 | int QPEApplication::defaultRotation() |
926 | { | 926 | { |
927 | if ( deforient < 0 ) { | 927 | if ( deforient < 0 ) { |
928 | QString d = getenv( "QWS_DISPLAY" ); | 928 | QString d = getenv( "QWS_DISPLAY" ); |
929 | if ( d.contains( "Rot90" ) ) { | 929 | if ( d.contains( "Rot90" ) ) { |
930 | deforient = 90; | 930 | deforient = 90; |
931 | } | 931 | } |
932 | else if ( d.contains( "Rot180" ) ) { | 932 | else if ( d.contains( "Rot180" ) ) { |
933 | deforient = 180; | 933 | deforient = 180; |
934 | } | 934 | } |
935 | else if ( d.contains( "Rot270" ) ) { | 935 | else if ( d.contains( "Rot270" ) ) { |
936 | deforient = 270; | 936 | deforient = 270; |
937 | } | 937 | } |
938 | else { | 938 | else { |
939 | deforient = 0; | 939 | deforient = 0; |
940 | } | 940 | } |
941 | } | 941 | } |
942 | return deforient; | 942 | return deforient; |
943 | } | 943 | } |
944 | 944 | ||
945 | /*! | 945 | /*! |
946 | \internal | 946 | \internal |
947 | */ | 947 | */ |
948 | void QPEApplication::setDefaultRotation( int r ) | 948 | void QPEApplication::setDefaultRotation( int r ) |
949 | { | 949 | { |
950 | if ( qApp->type() == GuiServer ) { | 950 | if ( qApp->type() == GuiServer ) { |
951 | deforient = r; | 951 | deforient = r; |
952 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 952 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
953 | Config config("qpe"); | 953 | Config config("qpe"); |
954 | config.setGroup( "Rotation" ); | 954 | config.setGroup( "Rotation" ); |
955 | config.writeEntry( "Rot", r ); | 955 | config.writeEntry( "Rot", r ); |
956 | } | 956 | } |
957 | else { | 957 | else { |
958 | #ifndef QT_NO_COP | 958 | #ifndef QT_NO_COP |
959 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 959 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
960 | e << r; | 960 | e << r; |
961 | } | 961 | } |
962 | #endif | 962 | #endif |
963 | 963 | ||
964 | } | 964 | } |
965 | } | 965 | } |
966 | 966 | ||
967 | 967 | ||
968 | /*! | 968 | /*! |
969 | \internal | 969 | \internal |
970 | */ | 970 | */ |
971 | void QPEApplication::applyStyle() | 971 | void QPEApplication::applyStyle() |
972 | { | 972 | { |
973 | Config config( "qpe" ); | 973 | Config config( "qpe" ); |
974 | config.setGroup( "Appearance" ); | 974 | config.setGroup( "Appearance" ); |
975 | 975 | ||
976 | // don't block ourselves ... | 976 | // don't block ourselves ... |
977 | Opie::force_appearance = 0; | 977 | Opie::force_appearance = 0; |
978 | 978 | ||
979 | static QString appname = Opie::binaryName ( ); | 979 | static QString appname = Opie::binaryName ( ); |
980 | 980 | ||
981 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 981 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
982 | int nostyle = 0; | 982 | int nostyle = 0; |
983 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 983 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
984 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 984 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
985 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 985 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
986 | break; | 986 | break; |
987 | } | 987 | } |
988 | } | 988 | } |
989 | 989 | ||
990 | // Widget style | 990 | // Widget style |
991 | QString style = config.readEntry( "Style", "Light" ); | 991 | QString style = config.readEntry( "Style", "Light" ); |
992 | 992 | ||
993 | // don't set a custom style | 993 | // don't set a custom style |
994 | if ( nostyle & Opie::Force_Style ) | 994 | if ( nostyle & Opie::Force_Style ) |
995 | style = "Light"; | 995 | style = "Light"; |
996 | 996 | ||
997 | internalSetStyle ( style ); | 997 | internalSetStyle ( style ); |
998 | 998 | ||
999 | // Colors | 999 | // Colors |
1000 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); | 1000 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); |
1001 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); | 1001 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); |
1002 | QPalette pal( btncolor, bgcolor ); | 1002 | QPalette pal( btncolor, bgcolor ); |
1003 | QString color = config.readEntry( "Highlight", "#800000" ); | 1003 | QString color = config.readEntry( "Highlight", "#800000" ); |
1004 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1004 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1005 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1005 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1006 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1006 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1007 | color = config.readEntry( "Text", "#000000" ); | 1007 | color = config.readEntry( "Text", "#000000" ); |
1008 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1008 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1009 | color = config.readEntry( "ButtonText", "#000000" ); | 1009 | color = config.readEntry( "ButtonText", "#000000" ); |
1010 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1010 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1011 | color = config.readEntry( "Base", "#FFFFFF" ); | 1011 | color = config.readEntry( "Base", "#FFFFFF" ); |
1012 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1012 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1013 | 1013 | ||
1014 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1014 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1015 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1015 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1016 | 1016 | ||
1017 | setPalette( pal, TRUE ); | 1017 | setPalette( pal, TRUE ); |
1018 | 1018 | ||
1019 | // Window Decoration | 1019 | // Window Decoration |
1020 | QString dec = config.readEntry( "Decoration", "Qtopia" ); | 1020 | QString dec = config.readEntry( "Decoration", "Qtopia" ); |
1021 | 1021 | ||
1022 | // don't set a custom deco | 1022 | // don't set a custom deco |
1023 | if ( nostyle & Opie::Force_Decoration ) | 1023 | if ( nostyle & Opie::Force_Decoration ) |
1024 | dec = ""; | 1024 | dec = ""; |
1025 | 1025 | ||
1026 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1026 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1027 | 1027 | ||
1028 | if ( dec != d->decorationName ) { | 1028 | if ( dec != d->decorationName ) { |
1029 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1029 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1030 | d->decorationName = dec; | 1030 | d->decorationName = dec; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | // Font | 1033 | // Font |
1034 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1034 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1035 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1035 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1036 | 1036 | ||
1037 | // don't set a custom font | 1037 | // don't set a custom font |
1038 | if ( nostyle & Opie::Force_Font ) { | 1038 | if ( nostyle & Opie::Force_Font ) { |
1039 | ff = "Vera"; | 1039 | ff = "Vera"; |
1040 | fs = 10; | 1040 | fs = 10; |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | setFont ( QFont ( ff, fs ), true ); | 1043 | setFont ( QFont ( ff, fs ), true ); |
1044 | 1044 | ||
1045 | // revert to global blocking policy ... | 1045 | // revert to global blocking policy ... |
1046 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1046 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1047 | Opie::force_appearance &= ~nostyle; | 1047 | Opie::force_appearance &= ~nostyle; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1050 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1051 | { | 1051 | { |
1052 | #ifdef Q_WS_QWS | 1052 | #ifdef Q_WS_QWS |
1053 | QDataStream stream( data, IO_ReadOnly ); | 1053 | QDataStream stream( data, IO_ReadOnly ); |
1054 | if ( msg == "applyStyle()" ) { | 1054 | if ( msg == "applyStyle()" ) { |
1055 | applyStyle(); | 1055 | applyStyle(); |
1056 | } | 1056 | } |
1057 | else if ( msg == "toggleApplicationMenu()" ) { | 1057 | else if ( msg == "toggleApplicationMenu()" ) { |
1058 | QWidget *active = activeWindow ( ); | 1058 | QWidget *active = activeWindow ( ); |
1059 | 1059 | ||
1060 | if ( active ) { | 1060 | if ( active ) { |
1061 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1061 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1062 | bool oldactive = man-> isActive ( ); | 1062 | bool oldactive = man-> isActive ( ); |
1063 | 1063 | ||
1064 | man-> setActive( !man-> isActive() ); | 1064 | man-> setActive( !man-> isActive() ); |
1065 | 1065 | ||
1066 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1066 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1067 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1067 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1068 | } | 1068 | } |
1069 | } | 1069 | } |
1070 | } | 1070 | } |
1071 | else if ( msg == "setDefaultRotation(int)" ) { | 1071 | else if ( msg == "setDefaultRotation(int)" ) { |
1072 | if ( type() == GuiServer ) { | 1072 | if ( type() == GuiServer ) { |
1073 | int r; | 1073 | int r; |
1074 | stream >> r; | 1074 | stream >> r; |
1075 | setDefaultRotation( r ); | 1075 | setDefaultRotation( r ); |
1076 | } | 1076 | } |
1077 | } | 1077 | } |
1078 | else if ( msg == "setCurrentRotation(int)" ) { | 1078 | else if ( msg == "setCurrentRotation(int)" ) { |
1079 | int r; | 1079 | int r; |
1080 | stream >> r; | 1080 | stream >> r; |
1081 | setCurrentRotation( r ); | 1081 | setCurrentRotation( r ); |
1082 | } | 1082 | } |
1083 | else if ( msg == "shutdown()" ) { | 1083 | else if ( msg == "shutdown()" ) { |
1084 | if ( type() == GuiServer ) | 1084 | if ( type() == GuiServer ) |
1085 | shutdown(); | 1085 | shutdown(); |
1086 | } | 1086 | } |
1087 | else if ( msg == "quit()" ) { | 1087 | else if ( msg == "quit()" ) { |
1088 | if ( type() != GuiServer ) | 1088 | if ( type() != GuiServer ) |
1089 | tryQuit(); | 1089 | tryQuit(); |
1090 | } | 1090 | } |
1091 | else if ( msg == "forceQuit()" ) { | 1091 | else if ( msg == "forceQuit()" ) { |
1092 | if ( type() != GuiServer ) | 1092 | if ( type() != GuiServer ) |
1093 | quit(); | 1093 | quit(); |
1094 | } | 1094 | } |
1095 | else if ( msg == "restart()" ) { | 1095 | else if ( msg == "restart()" ) { |
1096 | if ( type() == GuiServer ) | 1096 | if ( type() == GuiServer ) |
1097 | restart(); | 1097 | restart(); |
1098 | } | 1098 | } |
1099 | else if ( msg == "language(QString)" ) { | 1099 | else if ( msg == "language(QString)" ) { |
1100 | if ( type() == GuiServer ) { | 1100 | if ( type() == GuiServer ) { |
1101 | QString l; | 1101 | QString l; |
1102 | stream >> l; | 1102 | stream >> l; |
1103 | QString cl = getenv( "LANG" ); | 1103 | QString cl = getenv( "LANG" ); |
1104 | if ( cl != l ) { | 1104 | if ( cl != l ) { |
1105 | if ( l.isNull() ) | 1105 | if ( l.isNull() ) |
1106 | unsetenv( "LANG" ); | 1106 | unsetenv( "LANG" ); |
1107 | else | 1107 | else |
1108 | setenv( "LANG", l.latin1(), 1 ); | 1108 | setenv( "LANG", l.latin1(), 1 ); |
1109 | restart(); | 1109 | restart(); |
1110 | } | 1110 | } |
1111 | } | 1111 | } |
1112 | } | 1112 | } |
1113 | else if ( msg == "timeChange(QString)" ) { | 1113 | else if ( msg == "timeChange(QString)" ) { |
1114 | QString t; | 1114 | QString t; |
1115 | stream >> t; | 1115 | stream >> t; |
1116 | if ( t.isNull() ) | 1116 | if ( t.isNull() ) |
1117 | unsetenv( "TZ" ); | 1117 | unsetenv( "TZ" ); |
1118 | else | 1118 | else |
1119 | setenv( "TZ", t.latin1(), 1 ); | 1119 | setenv( "TZ", t.latin1(), 1 ); |
1120 | // emit the signal so everyone else knows... | 1120 | // emit the signal so everyone else knows... |
1121 | emit timeChanged(); | 1121 | emit timeChanged(); |
1122 | } | 1122 | } |
1123 | else if ( msg == "execute(QString)" ) { | 1123 | else if ( msg == "execute(QString)" ) { |
1124 | if ( type() == GuiServer ) { | 1124 | if ( type() == GuiServer ) { |
1125 | QString t; | 1125 | QString t; |
1126 | stream >> t; | 1126 | stream >> t; |
1127 | Global::execute( t ); | 1127 | Global::execute( t ); |
1128 | } | 1128 | } |
1129 | } | 1129 | } |
1130 | else if ( msg == "execute(QString,QString)" ) { | 1130 | else if ( msg == "execute(QString,QString)" ) { |
1131 | if ( type() == GuiServer ) { | 1131 | if ( type() == GuiServer ) { |
1132 | QString t, d; | 1132 | QString t, d; |
1133 | stream >> t >> d; | 1133 | stream >> t >> d; |
1134 | Global::execute( t, d ); | 1134 | Global::execute( t, d ); |
1135 | } | 1135 | } |
1136 | } | 1136 | } |
1137 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { | 1137 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { |
1138 | if ( type() == GuiServer ) { | 1138 | if ( type() == GuiServer ) { |
1139 | QDateTime when; | 1139 | QDateTime when; |
1140 | QCString channel, message; | 1140 | QCString channel, message; |
1141 | int data; | 1141 | int data; |
1142 | stream >> when >> channel >> message >> data; | 1142 | stream >> when >> channel >> message >> data; |
1143 | AlarmServer::addAlarm( when, channel, message, data ); | 1143 | AlarmServer::addAlarm( when, channel, message, data ); |
1144 | } | 1144 | } |
1145 | } | 1145 | } |
1146 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { | 1146 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { |
1147 | if ( type() == GuiServer ) { | 1147 | if ( type() == GuiServer ) { |
1148 | QDateTime when; | 1148 | QDateTime when; |
1149 | QCString channel, message; | 1149 | QCString channel, message; |
1150 | int data; | 1150 | int data; |
1151 | stream >> when >> channel >> message >> data; | 1151 | stream >> when >> channel >> message >> data; |
1152 | AlarmServer::deleteAlarm( when, channel, message, data ); | 1152 | AlarmServer::deleteAlarm( when, channel, message, data ); |
1153 | } | 1153 | } |
1154 | } | 1154 | } |
1155 | else if ( msg == "clockChange(bool)" ) { | 1155 | else if ( msg == "clockChange(bool)" ) { |
1156 | int tmp; | 1156 | int tmp; |
1157 | stream >> tmp; | 1157 | stream >> tmp; |
1158 | emit clockChanged( tmp ); | 1158 | emit clockChanged( tmp ); |
1159 | } | 1159 | } |
1160 | else if ( msg == "weekChange(bool)" ) { | 1160 | else if ( msg == "weekChange(bool)" ) { |
1161 | int tmp; | 1161 | int tmp; |
1162 | stream >> tmp; | 1162 | stream >> tmp; |
1163 | emit weekChanged( tmp ); | 1163 | emit weekChanged( tmp ); |
1164 | } | 1164 | } |
1165 | else if ( msg == "setDateFormat(DateFormat)" ) { | 1165 | else if ( msg == "setDateFormat(DateFormat)" ) { |
1166 | DateFormat tmp; | 1166 | DateFormat tmp; |
1167 | stream >> tmp; | 1167 | stream >> tmp; |
1168 | emit dateFormatChanged( tmp ); | 1168 | emit dateFormatChanged( tmp ); |
1169 | } | 1169 | } |
1170 | else if ( msg == "setVolume(int,int)" ) { | 1170 | else if ( msg == "setVolume(int,int)" ) { |
1171 | int t, v; | 1171 | int t, v; |
1172 | stream >> t >> v; | 1172 | stream >> t >> v; |
1173 | setVolume( t, v ); | 1173 | setVolume( t, v ); |
1174 | emit volumeChanged( muted ); | 1174 | emit volumeChanged( muted ); |
1175 | } | 1175 | } |
1176 | else if ( msg == "volumeChange(bool)" ) { | 1176 | else if ( msg == "volumeChange(bool)" ) { |
1177 | stream >> muted; | 1177 | stream >> muted; |
1178 | setVolume(); | 1178 | setVolume(); |
1179 | emit volumeChanged( muted ); | 1179 | emit volumeChanged( muted ); |
1180 | } | 1180 | } |
1181 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1181 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1182 | int t, v; | 1182 | int t, v; |
1183 | stream >> t >> v; | 1183 | stream >> t >> v; |
1184 | setMic( t, v ); | 1184 | setMic( t, v ); |
1185 | emit micChanged( micMuted ); | 1185 | emit micChanged( micMuted ); |
1186 | } | 1186 | } |
1187 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1187 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1188 | stream >> micMuted; | 1188 | stream >> micMuted; |
1189 | setMic(); | 1189 | setMic(); |
1190 | emit micChanged( micMuted ); | 1190 | emit micChanged( micMuted ); |
1191 | } | 1191 | } |
1192 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1192 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1193 | int t, v; | 1193 | int t, v; |
1194 | stream >> t >> v; | 1194 | stream >> t >> v; |
1195 | setBass( t, v ); | 1195 | setBass( t, v ); |
1196 | } | 1196 | } |
1197 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1197 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1198 | setBass(); | 1198 | setBass(); |
1199 | } | 1199 | } |
1200 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1200 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1201 | int t, v; | 1201 | int t, v; |
1202 | stream >> t >> v; | 1202 | stream >> t >> v; |
1203 | setTreble( t, v ); | 1203 | setTreble( t, v ); |
1204 | } | 1204 | } |
1205 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1205 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1206 | setTreble(); | 1206 | setTreble(); |
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | 1209 | ||
1210 | 1210 | ||
1211 | #endif | 1211 | #endif |
1212 | } | 1212 | } |
1213 | 1213 | ||
1214 | /*! | 1214 | /*! |
1215 | \internal | 1215 | \internal |
1216 | */ | 1216 | */ |
1217 | bool QPEApplication::raiseAppropriateWindow() | 1217 | bool QPEApplication::raiseAppropriateWindow() |
1218 | { | 1218 | { |
1219 | bool r = FALSE; | 1219 | bool r = FALSE; |
1220 | // ########## raise()ing main window should raise and set active | 1220 | // ########## raise()ing main window should raise and set active |
1221 | // ########## it and then all childen. This belongs in Qt/Embedded | 1221 | // ########## it and then all childen. This belongs in Qt/Embedded |
1222 | QWidget *top = d->qpe_main_widget; | 1222 | QWidget *top = d->qpe_main_widget; |
1223 | if ( !top ) | 1223 | if ( !top ) |
1224 | top = mainWidget(); | 1224 | top = mainWidget(); |
1225 | if ( top && d->keep_running ) { | 1225 | if ( top && d->keep_running ) { |
1226 | if ( top->isVisible() ) | 1226 | if ( top->isVisible() ) |
1227 | r = TRUE; | 1227 | r = TRUE; |
1228 | else if (d->preloaded) { | 1228 | else if (d->preloaded) { |
1229 | // We are preloaded and not visible.. pretend we just started.. | 1229 | // We are preloaded and not visible.. pretend we just started.. |
1230 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1230 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1231 | e << d->appName; | 1231 | e << d->appName; |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | d->show_mx(top, d->nomaximize); | 1234 | d->show_mx(top, d->nomaximize); |
1235 | top->raise(); | 1235 | top->raise(); |
1236 | top->setActiveWindow(); | 1236 | top->setActiveWindow(); |
1237 | } | 1237 | } |
1238 | QWidget *topm = activeModalWidget(); | 1238 | QWidget *topm = activeModalWidget(); |
1239 | if ( topm && topm != top ) { | 1239 | if ( topm && topm != top ) { |
1240 | topm->show(); | 1240 | topm->show(); |
1241 | topm->raise(); | 1241 | topm->raise(); |
1242 | topm->setActiveWindow(); | 1242 | topm->setActiveWindow(); |
1243 | // If we haven't already handled the fastAppShowing message | 1243 | // If we haven't already handled the fastAppShowing message |
1244 | if (!top && d->preloaded) { | 1244 | if (!top && d->preloaded) { |
1245 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1245 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1246 | e << d->appName; | 1246 | e << d->appName; |
1247 | } | 1247 | } |
1248 | r = FALSE; | 1248 | r = FALSE; |
1249 | } | 1249 | } |
1250 | return r; | 1250 | return r; |
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | 1253 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) |
1254 | { | 1254 | { |
1255 | #ifdef Q_WS_QWS | 1255 | #ifdef Q_WS_QWS |
1256 | 1256 | ||
1257 | if ( msg == "quit()" ) { | 1257 | if ( msg == "quit()" ) { |
1258 | tryQuit(); | 1258 | tryQuit(); |
1259 | } | 1259 | } |
1260 | else if ( msg == "quitIfInvisible()" ) { | 1260 | else if ( msg == "quitIfInvisible()" ) { |
1261 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) | 1261 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) |
1262 | quit(); | 1262 | quit(); |
1263 | } | 1263 | } |
1264 | else if ( msg == "close()" ) { | 1264 | else if ( msg == "close()" ) { |
1265 | hideOrQuit(); | 1265 | hideOrQuit(); |
1266 | } | 1266 | } |
1267 | else if ( msg == "disablePreload()" ) { | 1267 | else if ( msg == "disablePreload()" ) { |
1268 | d->preloaded = FALSE; | 1268 | d->preloaded = FALSE; |
1269 | d->keep_running = TRUE; | 1269 | d->keep_running = TRUE; |
1270 | /* so that quit will quit */ | 1270 | /* so that quit will quit */ |
1271 | } | 1271 | } |
1272 | else if ( msg == "enablePreload()" ) { | 1272 | else if ( msg == "enablePreload()" ) { |
1273 | if (d->qpe_main_widget) | 1273 | if (d->qpe_main_widget) |
1274 | d->preloaded = TRUE; | 1274 | d->preloaded = TRUE; |
1275 | d->keep_running = TRUE; | 1275 | d->keep_running = TRUE; |
1276 | /* so next quit won't quit */ | 1276 | /* so next quit won't quit */ |
1277 | } | 1277 | } |
1278 | else if ( msg == "raise()" ) { | 1278 | else if ( msg == "raise()" ) { |
1279 | d->keep_running = TRUE; | 1279 | d->keep_running = TRUE; |
1280 | d->notbusysent = FALSE; | 1280 | d->notbusysent = FALSE; |
1281 | raiseAppropriateWindow(); | 1281 | raiseAppropriateWindow(); |
1282 | // Tell the system we're still chugging along... | 1282 | // Tell the system we're still chugging along... |
1283 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1283 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1284 | e << d->appName; | 1284 | e << d->appName; |
1285 | } | 1285 | } |
1286 | else if ( msg == "flush()" ) { | 1286 | else if ( msg == "flush()" ) { |
1287 | emit flush(); | 1287 | emit flush(); |
1288 | // we need to tell the desktop | 1288 | // we need to tell the desktop |
1289 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); | 1289 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); |
1290 | e << d->appName; | 1290 | e << d->appName; |
1291 | } | 1291 | } |
1292 | else if ( msg == "reload()" ) { | 1292 | else if ( msg == "reload()" ) { |
1293 | emit reload(); | 1293 | emit reload(); |
1294 | } | 1294 | } |