-rw-r--r-- | library/qpeapplication.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index df313ce..3efba20 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1,282 +1,283 @@ | |||
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 >= 300 | 63 | #if QT_VERSION >= 300 |
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 | 92 | ||
92 | #include <unistd.h> | 93 | #include <unistd.h> |
93 | #include <sys/file.h> | 94 | #include <sys/file.h> |
94 | #include <sys/ioctl.h> | 95 | #include <sys/ioctl.h> |
95 | #ifndef QT_NO_SOUND | 96 | #ifndef QT_NO_SOUND |
96 | #include <sys/soundcard.h> | 97 | #include <sys/soundcard.h> |
97 | #endif | 98 | #endif |
98 | #include "qt_override_p.h" | 99 | #include "qt_override_p.h" |
99 | 100 | ||
100 | #include <backend/rohfeedback.h> | 101 | #include <backend/rohfeedback.h> |
101 | 102 | ||
102 | 103 | ||
103 | static bool useBigPixmaps = 0; | 104 | static bool useBigPixmaps = 0; |
104 | 105 | ||
105 | class HackWidget : public QWidget | 106 | class HackWidget : public QWidget |
106 | { | 107 | { |
107 | public: | 108 | public: |
108 | bool needsOk() | 109 | bool needsOk() |
109 | { return (getWState() & WState_Reserved1 ); } | 110 | { return (getWState() & WState_Reserved1 ); } |
110 | 111 | ||
111 | QRect normalGeometry() | 112 | QRect normalGeometry() |
112 | { return topData()->normalGeometry; }; | 113 | { return topData()->normalGeometry; }; |
113 | }; | 114 | }; |
114 | 115 | ||
115 | class QPEApplicationData | 116 | class QPEApplicationData |
116 | { | 117 | { |
117 | public: | 118 | public: |
118 | QPEApplicationData ( ) : | 119 | QPEApplicationData ( ) : |
119 | presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 120 | presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
120 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), | 121 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), |
121 | keep_running( true ), qcopQok( false ), | 122 | keep_running( true ), qcopQok( false ), |
122 | fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), | 123 | fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), |
123 | bigIconSize( 32 ), qpe_main_widget( 0 ) | 124 | bigIconSize( 32 ), qpe_main_widget( 0 ) |
124 | { | 125 | { |
125 | Config cfg( "qpe" ); | 126 | Config cfg( "qpe" ); |
126 | cfg.setGroup( "Appearance" ); | 127 | cfg.setGroup( "Appearance" ); |
127 | useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); | 128 | useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); |
128 | fontFamily = cfg.readEntry( "FontFamily", "Vera" ); | 129 | fontFamily = cfg.readEntry( "FontFamily", "Vera" ); |
129 | fontSize = cfg.readNumEntry( "FontSize", 10 ); | 130 | fontSize = cfg.readNumEntry( "FontSize", 10 ); |
130 | smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); | 131 | smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); |
131 | bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); | 132 | bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); |
132 | #ifdef OPIE_WITHROHFEEDBACK | 133 | #ifdef OPIE_WITHROHFEEDBACK |
133 | RoH = 0; | 134 | RoH = 0; |
134 | #endif | 135 | #endif |
135 | } | 136 | } |
136 | 137 | ||
137 | int presstimer; | 138 | int presstimer; |
138 | QWidget* presswidget; | 139 | QWidget* presswidget; |
139 | QPoint presspos; | 140 | QPoint presspos; |
140 | #ifdef OPIE_WITHROHFEEDBACK | 141 | #ifdef OPIE_WITHROHFEEDBACK |
141 | Opie::Internal::RoHFeedback *RoH; | 142 | Opie::Internal::RoHFeedback *RoH; |
142 | #endif | 143 | #endif |
143 | 144 | ||
144 | bool rightpressed : 1; | 145 | bool rightpressed : 1; |
145 | bool kbgrabbed : 1; | 146 | bool kbgrabbed : 1; |
146 | bool notbusysent : 1; | 147 | bool notbusysent : 1; |
147 | bool preloaded : 1; | 148 | bool preloaded : 1; |
148 | bool forceshow : 1; | 149 | bool forceshow : 1; |
149 | bool nomaximize : 1; | 150 | bool nomaximize : 1; |
150 | bool keep_running : 1; | 151 | bool keep_running : 1; |
151 | bool qcopQok : 1; | 152 | bool qcopQok : 1; |
152 | 153 | ||
153 | QCString fontFamily; | 154 | QCString fontFamily; |
154 | int fontSize; | 155 | int fontSize; |
155 | int smallIconSize; | 156 | int smallIconSize; |
156 | int bigIconSize; | 157 | int bigIconSize; |
157 | 158 | ||
158 | QStringList langs; | 159 | QStringList langs; |
159 | QString appName; | 160 | QString appName; |
160 | struct QCopRec | 161 | struct QCopRec |
161 | { | 162 | { |
162 | QCopRec( const QCString &ch, const QCString &msg, | 163 | QCopRec( const QCString &ch, const QCString &msg, |
163 | const QByteArray &d ) : | 164 | const QByteArray &d ) : |
164 | channel( ch ), message( msg ), data( d ) | 165 | channel( ch ), message( msg ), data( d ) |
165 | { } | 166 | { } |
166 | 167 | ||
167 | QCString channel; | 168 | QCString channel; |
168 | QCString message; | 169 | QCString message; |
169 | QByteArray data; | 170 | QByteArray data; |
170 | }; | 171 | }; |
171 | QWidget* qpe_main_widget; | 172 | QWidget* qpe_main_widget; |
172 | QGuardedPtr<QWidget> lastraised; | 173 | QGuardedPtr<QWidget> lastraised; |
173 | QQueue<QCopRec> qcopq; | 174 | QQueue<QCopRec> qcopq; |
174 | QString styleName; | 175 | QString styleName; |
175 | QString decorationName; | 176 | QString decorationName; |
176 | 177 | ||
177 | void enqueueQCop( const QCString &ch, const QCString &msg, | 178 | void enqueueQCop( const QCString &ch, const QCString &msg, |
178 | const QByteArray &data ) | 179 | const QByteArray &data ) |
179 | { | 180 | { |
180 | qcopq.enqueue( new QCopRec( ch, msg, data ) ); | 181 | qcopq.enqueue( new QCopRec( ch, msg, data ) ); |
181 | } | 182 | } |
182 | void sendQCopQ() | 183 | void sendQCopQ() |
183 | { | 184 | { |
184 | if (!qcopQok ) | 185 | if (!qcopQok ) |
185 | return; | 186 | return; |
186 | 187 | ||
187 | QCopRec * r; | 188 | QCopRec * r; |
188 | 189 | ||
189 | while((r=qcopq.dequeue())) { | 190 | while((r=qcopq.dequeue())) { |
190 | // remove from queue before sending... | 191 | // remove from queue before sending... |
191 | // event loop can come around again before getting | 192 | // event loop can come around again before getting |
192 | // back from sendLocally | 193 | // back from sendLocally |
193 | #ifndef QT_NO_COP | 194 | #ifndef QT_NO_COP |
194 | QCopChannel::sendLocally( r->channel, r->message, r->data ); | 195 | QCopChannel::sendLocally( r->channel, r->message, r->data ); |
195 | #endif | 196 | #endif |
196 | 197 | ||
197 | delete r; | 198 | delete r; |
198 | } | 199 | } |
199 | } | 200 | } |
200 | 201 | ||
201 | static void show_mx(QWidget* mw, bool nomaximize, QString &strName) | 202 | static void show_mx(QWidget* mw, bool nomaximize, QString &strName) |
202 | { | 203 | { |
203 | if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) | 204 | if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) |
204 | { | 205 | { |
205 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps ); | 206 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps ); |
206 | } | 207 | } |
207 | QPoint p; | 208 | QPoint p; |
208 | QSize s; | 209 | QSize s; |
209 | bool max; | 210 | bool max; |
210 | if ( mw->isVisible() ) { | 211 | if ( mw->isVisible() ) { |
211 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 212 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
212 | mw->resize(s); | 213 | mw->resize(s); |
213 | mw->move(p); | 214 | mw->move(p); |
214 | } | 215 | } |
215 | mw->raise(); | 216 | mw->raise(); |
216 | } else { | 217 | } else { |
217 | 218 | ||
218 | if ( mw->layout() && mw->inherits("QDialog") ) { | 219 | if ( mw->layout() && mw->inherits("QDialog") ) { |
219 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 220 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
220 | mw->resize(s); | 221 | mw->resize(s); |
221 | mw->move(p); | 222 | mw->move(p); |
222 | 223 | ||
223 | if ( max && !nomaximize ) { | 224 | if ( max && !nomaximize ) { |
224 | mw->showMaximized(); | 225 | mw->showMaximized(); |
225 | } else { | 226 | } else { |
226 | mw->show(); | 227 | mw->show(); |
227 | } | 228 | } |
228 | } else { | 229 | } else { |
229 | QPEApplication::showDialog((QDialog*)mw,nomaximize); | 230 | QPEApplication::showDialog((QDialog*)mw,nomaximize); |
230 | } | 231 | } |
231 | } else { | 232 | } else { |
232 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 233 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
233 | mw->resize(s); | 234 | mw->resize(s); |
234 | mw->move(p); | 235 | mw->move(p); |
235 | } else { //no stored rectangle, make an estimation | 236 | } else { //no stored rectangle, make an estimation |
236 | int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2; | 237 | int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2; |
237 | int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2; | 238 | int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2; |
238 | mw->move( QMAX(x,0), QMAX(y,0) ); | 239 | mw->move( QMAX(x,0), QMAX(y,0) ); |
239 | #ifdef Q_WS_QWS | 240 | #ifdef Q_WS_QWS |
240 | if ( !nomaximize ) | 241 | if ( !nomaximize ) |
241 | mw->showMaximized(); | 242 | mw->showMaximized(); |
242 | #endif | 243 | #endif |
243 | } | 244 | } |
244 | if ( max && !nomaximize ) | 245 | if ( max && !nomaximize ) |
245 | mw->showMaximized(); | 246 | mw->showMaximized(); |
246 | else | 247 | else |
247 | mw->show(); | 248 | mw->show(); |
248 | } | 249 | } |
249 | } | 250 | } |
250 | } | 251 | } |
251 | 252 | ||
252 | static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) | 253 | static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) |
253 | { | 254 | { |
254 | maximized = TRUE; | 255 | maximized = TRUE; |
255 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button | 256 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button |
256 | if ( qApp->desktop()->width() <= 350 ) | 257 | if ( qApp->desktop()->width() <= 350 ) |
257 | return FALSE; | 258 | return FALSE; |
258 | 259 | ||
259 | Config cfg( "qpe" ); | 260 | Config cfg( "qpe" ); |
260 | cfg.setGroup("ApplicationPositions"); | 261 | cfg.setGroup("ApplicationPositions"); |
261 | QString str = cfg.readEntry( app, QString::null ); | 262 | QString str = cfg.readEntry( app, QString::null ); |
262 | QStringList l = QStringList::split(",", str); | 263 | QStringList l = QStringList::split(",", str); |
263 | 264 | ||
264 | if ( l.count() == 5) { | 265 | if ( l.count() == 5) { |
265 | p.setX( l[0].toInt() ); | 266 | p.setX( l[0].toInt() ); |
266 | p.setY( l[1].toInt() ); | 267 | p.setY( l[1].toInt() ); |
267 | 268 | ||
268 | s.setWidth( l[2].toInt() ); | 269 | s.setWidth( l[2].toInt() ); |
269 | s.setHeight( l[3].toInt() ); | 270 | s.setHeight( l[3].toInt() ); |
270 | 271 | ||
271 | maximized = l[4].toInt(); | 272 | maximized = l[4].toInt(); |
272 | 273 | ||
273 | return TRUE; | 274 | return TRUE; |
274 | } | 275 | } |
275 | 276 | ||
276 | return FALSE; | 277 | return FALSE; |
277 | } | 278 | } |
278 | 279 | ||
279 | 280 | ||
280 | static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) | 281 | static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) |
281 | { | 282 | { |
282 | #ifndef Q_WS_QWS | 283 | #ifndef Q_WS_QWS |
@@ -1105,390 +1106,385 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) | |||
1105 | QWidget * active = activeWindow ( ); | 1106 | QWidget * active = activeWindow ( ); |
1106 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 1107 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
1107 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 1108 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
1108 | QChar ch ( ke-> simpleData.unicode ); | 1109 | QChar ch ( ke-> simpleData.unicode ); |
1109 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 1110 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
1110 | ke-> simpleData.keycode, | 1111 | ke-> simpleData.keycode, |
1111 | ch. latin1 ( ), | 1112 | ch. latin1 ( ), |
1112 | ke-> simpleData.modifiers, | 1113 | ke-> simpleData.modifiers, |
1113 | QString ( ch ), | 1114 | QString ( ch ), |
1114 | ke-> simpleData.is_auto_repeat, 1 ); | 1115 | ke-> simpleData.is_auto_repeat, 1 ); |
1115 | 1116 | ||
1116 | QObject *which = QWidget::keyboardGrabber ( ); | 1117 | QObject *which = QWidget::keyboardGrabber ( ); |
1117 | if ( !which ) | 1118 | if ( !which ) |
1118 | which = QApplication::focusWidget ( ); | 1119 | which = QApplication::focusWidget ( ); |
1119 | if ( !which ) | 1120 | if ( !which ) |
1120 | which = QApplication::activeWindow ( ); | 1121 | which = QApplication::activeWindow ( ); |
1121 | if ( !which ) | 1122 | if ( !which ) |
1122 | which = qApp; | 1123 | which = qApp; |
1123 | 1124 | ||
1124 | QApplication::sendEvent ( which, &qke ); | 1125 | QApplication::sendEvent ( which, &qke ); |
1125 | } | 1126 | } |
1126 | else { // we didn't grab the keyboard, so send the event to the launcher | 1127 | else { // we didn't grab the keyboard, so send the event to the launcher |
1127 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 1128 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); |
1128 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); | 1129 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); |
1129 | } | 1130 | } |
1130 | } | 1131 | } |
1131 | return true; | 1132 | return true; |
1132 | } | 1133 | } |
1133 | } | 1134 | } |
1134 | if ( e->type == QWSEvent::Focus ) { | 1135 | if ( e->type == QWSEvent::Focus ) { |
1135 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 1136 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
1136 | if ( !fe->simpleData.get_focus ) { | 1137 | if ( !fe->simpleData.get_focus ) { |
1137 | QWidget * active = activeWindow(); | 1138 | QWidget * active = activeWindow(); |
1138 | while ( active && active->isPopup() ) { | 1139 | while ( active && active->isPopup() ) { |
1139 | active->close(); | 1140 | active->close(); |
1140 | active = activeWindow(); | 1141 | active = activeWindow(); |
1141 | } | 1142 | } |
1142 | } | 1143 | } |
1143 | else { | 1144 | else { |
1144 | // make sure our modal widget is ALWAYS on top | 1145 | // make sure our modal widget is ALWAYS on top |
1145 | QWidget *topm = activeModalWidget(); | 1146 | QWidget *topm = activeModalWidget(); |
1146 | if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { | 1147 | if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { |
1147 | topm->raise(); | 1148 | topm->raise(); |
1148 | } | 1149 | } |
1149 | } | 1150 | } |
1150 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 1151 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
1151 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 1152 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
1152 | if ( m == AlwaysOff ) | 1153 | if ( m == AlwaysOff ) |
1153 | Global::hideInputMethod(); | 1154 | Global::hideInputMethod(); |
1154 | if ( m == AlwaysOn ) | 1155 | if ( m == AlwaysOn ) |
1155 | Global::showInputMethod(); | 1156 | Global::showInputMethod(); |
1156 | } | 1157 | } |
1157 | } | 1158 | } |
1158 | 1159 | ||
1159 | 1160 | ||
1160 | return QApplication::qwsEventFilter( e ); | 1161 | return QApplication::qwsEventFilter( e ); |
1161 | } | 1162 | } |
1162 | #endif | 1163 | #endif |
1163 | 1164 | ||
1164 | /*! | 1165 | /*! |
1165 | Destroys the QPEApplication. | 1166 | Destroys the QPEApplication. |
1166 | */ | 1167 | */ |
1167 | QPEApplication::~QPEApplication() | 1168 | QPEApplication::~QPEApplication() |
1168 | { | 1169 | { |
1169 | ungrabKeyboard(); | 1170 | ungrabKeyboard(); |
1170 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 1171 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
1171 | // Need to delete QCopChannels early, since the display will | 1172 | // Need to delete QCopChannels early, since the display will |
1172 | // be gone by the time we get to ~QObject(). | 1173 | // be gone by the time we get to ~QObject(). |
1173 | delete sysChannel; | 1174 | delete sysChannel; |
1174 | delete pidChannel; | 1175 | delete pidChannel; |
1175 | #endif | 1176 | #endif |
1176 | 1177 | ||
1177 | #ifdef OPIE_WITHROHFEEDBACK | 1178 | #ifdef OPIE_WITHROHFEEDBACK |
1178 | if( d->RoH ) | 1179 | if( d->RoH ) |
1179 | delete d->RoH; | 1180 | delete d->RoH; |
1180 | #endif | 1181 | #endif |
1181 | delete d; | 1182 | delete d; |
1182 | } | 1183 | } |
1183 | 1184 | ||
1184 | /*! | 1185 | /*! |
1185 | Returns <tt>$OPIEDIR/</tt>. | 1186 | Returns <tt>$OPIEDIR/</tt>. |
1186 | */ | 1187 | */ |
1187 | QString QPEApplication::qpeDir() | 1188 | QString QPEApplication::qpeDir() |
1188 | { | 1189 | { |
1189 | const char * base = getenv( "OPIEDIR" ); | 1190 | const char * base = getenv( "OPIEDIR" ); |
1190 | if ( base ) | 1191 | if ( base ) |
1191 | return QString( base ) + "/"; | 1192 | return QString( base ) + "/"; |
1192 | 1193 | ||
1193 | return QString( "../" ); | 1194 | return QString( "../" ); |
1194 | } | 1195 | } |
1195 | 1196 | ||
1196 | /*! | 1197 | /*! |
1197 | Returns the user's current Document directory. There is a trailing "/". | 1198 | Returns the user's current Document directory. There is a trailing "/". |
1198 | .. well, it does now,, and there's no trailing '/' | 1199 | .. well, it does now,, and there's no trailing '/' |
1199 | */ | 1200 | */ |
1200 | QString QPEApplication::documentDir() | 1201 | QString QPEApplication::documentDir() |
1201 | { | 1202 | { |
1202 | const char* base = getenv( "HOME"); | 1203 | const char* base = getenv( "HOME"); |
1203 | if ( base ) | 1204 | if ( base ) |
1204 | return QString( base ) + "/Documents"; | 1205 | return QString( base ) + "/Documents"; |
1205 | 1206 | ||
1206 | return QString( "../Documents" ); | 1207 | return QString( "../Documents" ); |
1207 | } | 1208 | } |
1208 | 1209 | ||
1209 | static int deforient = -1; | 1210 | static int deforient = -1; |
1210 | 1211 | ||
1211 | /*! | 1212 | /*! |
1212 | \internal | 1213 | \internal |
1213 | */ | 1214 | */ |
1214 | int QPEApplication::defaultRotation() | 1215 | int QPEApplication::defaultRotation() |
1215 | { | 1216 | { |
1216 | if ( deforient < 0 ) { | 1217 | if ( deforient < 0 ) { |
1217 | QString d = getenv( "QWS_DISPLAY" ); | 1218 | QString d = getenv( "QWS_DISPLAY" ); |
1218 | if ( d.contains( "Rot90" ) ) { | 1219 | if ( d.contains( "Rot90" ) ) { |
1219 | deforient = 90; | 1220 | deforient = 90; |
1220 | } | 1221 | } |
1221 | else if ( d.contains( "Rot180" ) ) { | 1222 | else if ( d.contains( "Rot180" ) ) { |
1222 | deforient = 180; | 1223 | deforient = 180; |
1223 | } | 1224 | } |
1224 | else if ( d.contains( "Rot270" ) ) { | 1225 | else if ( d.contains( "Rot270" ) ) { |
1225 | deforient = 270; | 1226 | deforient = 270; |
1226 | } | 1227 | } |
1227 | else { | 1228 | else { |
1228 | deforient = 0; | 1229 | deforient = 0; |
1229 | } | 1230 | } |
1230 | } | 1231 | } |
1231 | return deforient; | 1232 | return deforient; |
1232 | } | 1233 | } |
1233 | 1234 | ||
1234 | /*! | 1235 | /*! |
1235 | \internal | 1236 | \internal |
1236 | */ | 1237 | */ |
1237 | void QPEApplication::setDefaultRotation( int r ) | 1238 | void QPEApplication::setDefaultRotation( int r ) |
1238 | { | 1239 | { |
1239 | if ( qApp->type() == GuiServer ) { | 1240 | if ( qApp->type() == GuiServer ) { |
1240 | deforient = r; | 1241 | deforient = r; |
1241 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1242 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
1242 | Config config("qpe"); | 1243 | Config config("qpe"); |
1243 | config.setGroup( "Rotation" ); | 1244 | config.setGroup( "Rotation" ); |
1244 | config.writeEntry( "Rot", r ); | 1245 | config.writeEntry( "Rot", r ); |
1245 | } | 1246 | } |
1246 | else { | 1247 | else { |
1247 | #ifndef QT_NO_COP | 1248 | #ifndef QT_NO_COP |
1248 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1249 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1249 | e << r; | 1250 | e << r; |
1250 | } | 1251 | } |
1251 | #endif | 1252 | #endif |
1252 | 1253 | ||
1253 | } | 1254 | } |
1254 | } | 1255 | } |
1255 | 1256 | ||
1256 | #include <qgfx_qws.h> | 1257 | #include <qgfx_qws.h> |
1257 | #include <qwindowsystem_qws.h> | 1258 | #include <qwindowsystem_qws.h> |
1258 | 1259 | ||
1259 | #if QT_VERSION > 236 | 1260 | #if QT_VERSION > 236 |
1260 | extern void qws_clearLoadedFonts(); | 1261 | extern void qws_clearLoadedFonts(); |
1261 | #endif | 1262 | #endif |
1262 | 1263 | ||
1263 | void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1264 | void QPEApplication::setCurrentMode( int x, int y, int depth ) |
1264 | { | 1265 | { |
1265 | // Reset the caches | 1266 | // Reset the caches |
1266 | #if QT_VERSION > 236 | 1267 | #if QT_VERSION > 236 |
1267 | qws_clearLoadedFonts(); | 1268 | qws_clearLoadedFonts(); |
1268 | #endif | 1269 | #endif |
1269 | QPixmapCache::clear(); | 1270 | QPixmapCache::clear(); |
1270 | 1271 | ||
1271 | // Change the screen mode | 1272 | // Change the screen mode |
1272 | qt_screen->setMode(x, y, depth); | 1273 | qt_screen->setMode(x, y, depth); |
1273 | 1274 | ||
1274 | if ( qApp->type() == GuiServer ) { | 1275 | if ( qApp->type() == GuiServer ) { |
1275 | #if QT_VERSION > 236 | 1276 | #if QT_VERSION > 236 |
1276 | // Reconfigure the GuiServer | 1277 | // Reconfigure the GuiServer |
1277 | qwsServer->beginDisplayReconfigure(); | 1278 | qwsServer->beginDisplayReconfigure(); |
1278 | qwsServer->endDisplayReconfigure(); | 1279 | qwsServer->endDisplayReconfigure(); |
1279 | #endif | 1280 | #endif |
1280 | // Get all the running apps to reset | 1281 | // Get all the running apps to reset |
1281 | QCopEnvelope env( "QPE/System", "reset()" ); | 1282 | QCopEnvelope env( "QPE/System", "reset()" ); |
1282 | } | 1283 | } |
1283 | } | 1284 | } |
1284 | 1285 | ||
1285 | void QPEApplication::reset() { | 1286 | void QPEApplication::reset() { |
1286 | // Reconnect to the screen | 1287 | // Reconnect to the screen |
1287 | qt_screen->disconnect(); | 1288 | qt_screen->disconnect(); |
1288 | qt_screen->connect( QString::null ); | 1289 | qt_screen->connect( QString::null ); |
1289 | 1290 | ||
1290 | // Redraw everything | 1291 | // Redraw everything |
1291 | applyStyle(); | 1292 | applyStyle(); |
1292 | } | 1293 | } |
1293 | 1294 | ||
1294 | #if (QT_VERSION < 238) && defined Q_OS_MACX | 1295 | #if (QT_VERSION < 238) && defined Q_OS_MACX |
1295 | bool qt_left_hand_scrollbars = false; | 1296 | bool qt_left_hand_scrollbars = false; |
1296 | #else | 1297 | #else |
1297 | #ifdef Q_OS_MACX | 1298 | extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL; |
1298 | #define WEAK_SYMBOL __attribute__((weak_import)) | ||
1299 | #else | ||
1300 | #define WEAK_SYMBOL __attribute__((weak)) | ||
1301 | #endif | ||
1302 | extern bool qt_left_hand_scrollbars WEAK_SYMBOL; | ||
1303 | #endif | 1299 | #endif |
1304 | 1300 | ||
1305 | /*! | 1301 | /*! |
1306 | \internal | 1302 | \internal |
1307 | */ | 1303 | */ |
1308 | void QPEApplication::applyStyle() | 1304 | void QPEApplication::applyStyle() |
1309 | { | 1305 | { |
1310 | Config config( "qpe" ); | 1306 | Config config( "qpe" ); |
1311 | config.setGroup( "Appearance" ); | 1307 | config.setGroup( "Appearance" ); |
1312 | 1308 | ||
1313 | #if QT_VERSION > 233 | 1309 | #if QT_VERSION > 233 |
1314 | #if !defined(OPIE_NO_OVERRIDE_QT) | 1310 | #if !defined(OPIE_NO_OVERRIDE_QT) |
1315 | // don't block ourselves ... | 1311 | // don't block ourselves ... |
1316 | Opie::force_appearance = 0; | 1312 | Opie::force_appearance = 0; |
1317 | 1313 | ||
1318 | static QString appname = Opie::binaryName ( ); | 1314 | static QString appname = Opie::binaryName ( ); |
1319 | 1315 | ||
1320 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 1316 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
1321 | int nostyle = 0; | 1317 | int nostyle = 0; |
1322 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 1318 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
1323 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 1319 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
1324 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 1320 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
1325 | break; | 1321 | break; |
1326 | } | 1322 | } |
1327 | } | 1323 | } |
1328 | #else | 1324 | #else |
1329 | int nostyle = 0; | 1325 | int nostyle = 0; |
1330 | #endif | 1326 | #endif |
1331 | 1327 | ||
1332 | // Widget style | 1328 | // Widget style |
1333 | QString style = config.readEntry( "Style", "FlatStyle" ); | 1329 | QString style = config.readEntry( "Style", "FlatStyle" ); |
1334 | 1330 | ||
1335 | // don't set a custom style | 1331 | // don't set a custom style |
1336 | if ( nostyle & Opie::Force_Style ) | 1332 | if ( nostyle & Opie::Force_Style ) |
1337 | style = "FlatStyle"; | 1333 | style = "FlatStyle"; |
1338 | 1334 | ||
1339 | internalSetStyle ( style ); | 1335 | internalSetStyle ( style ); |
1340 | 1336 | ||
1341 | // Colors - from /etc/colors/Liquid.scheme | 1337 | // Colors - from /etc/colors/Liquid.scheme |
1342 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); | 1338 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); |
1343 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); | 1339 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); |
1344 | QPalette pal( btncolor, bgcolor ); | 1340 | QPalette pal( btncolor, bgcolor ); |
1345 | QString color = config.readEntry( "Highlight", "#73adef" ); | 1341 | QString color = config.readEntry( "Highlight", "#73adef" ); |
1346 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1342 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1347 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1343 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1348 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1344 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1349 | color = config.readEntry( "Text", "#000000" ); | 1345 | color = config.readEntry( "Text", "#000000" ); |
1350 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1346 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1351 | color = config.readEntry( "ButtonText", "#000000" ); | 1347 | color = config.readEntry( "ButtonText", "#000000" ); |
1352 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1348 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1353 | color = config.readEntry( "Base", "#FFFFFF" ); | 1349 | color = config.readEntry( "Base", "#FFFFFF" ); |
1354 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1350 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1355 | 1351 | ||
1356 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1352 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1357 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1353 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1358 | 1354 | ||
1359 | setPalette( pal, TRUE ); | 1355 | setPalette( pal, TRUE ); |
1360 | 1356 | ||
1361 | 1357 | ||
1362 | // Set the ScrollBar on the 'right' side but only if the weak symbol is present | 1358 | // Set the ScrollBar on the 'right' side but only if the weak symbol is present |
1363 | if (&qt_left_hand_scrollbars ) | 1359 | if (&qt_left_hand_scrollbars ) |
1364 | qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); | 1360 | qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); |
1365 | 1361 | ||
1366 | // Window Decoration | 1362 | // Window Decoration |
1367 | QString dec = config.readEntry( "Decoration", "Flat" ); | 1363 | QString dec = config.readEntry( "Decoration", "Flat" ); |
1368 | 1364 | ||
1369 | // don't set a custom deco | 1365 | // don't set a custom deco |
1370 | if ( nostyle & Opie::Force_Decoration ) | 1366 | if ( nostyle & Opie::Force_Decoration ) |
1371 | dec = ""; | 1367 | dec = ""; |
1372 | 1368 | ||
1373 | 1369 | ||
1374 | if ( dec != d->decorationName ) { | 1370 | if ( dec != d->decorationName ) { |
1375 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1371 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1376 | d->decorationName = dec; | 1372 | d->decorationName = dec; |
1377 | } | 1373 | } |
1378 | 1374 | ||
1379 | // Font | 1375 | // Font |
1380 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1376 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1381 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1377 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1382 | 1378 | ||
1383 | // don't set a custom font | 1379 | // don't set a custom font |
1384 | if ( nostyle & Opie::Force_Font ) { | 1380 | if ( nostyle & Opie::Force_Font ) { |
1385 | ff = "Vera"; | 1381 | ff = "Vera"; |
1386 | fs = 10; | 1382 | fs = 10; |
1387 | } | 1383 | } |
1388 | 1384 | ||
1389 | setFont ( QFont ( ff, fs ), true ); | 1385 | setFont ( QFont ( ff, fs ), true ); |
1390 | 1386 | ||
1391 | #if !defined(OPIE_NO_OVERRIDE_QT) | 1387 | #if !defined(OPIE_NO_OVERRIDE_QT) |
1392 | // revert to global blocking policy ... | 1388 | // revert to global blocking policy ... |
1393 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1389 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1394 | Opie::force_appearance &= ~nostyle; | 1390 | Opie::force_appearance &= ~nostyle; |
1395 | #endif | 1391 | #endif |
1396 | #endif | 1392 | #endif |
1397 | } | 1393 | } |
1398 | 1394 | ||
1399 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1395 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1400 | { | 1396 | { |
1401 | #ifdef Q_WS_QWS | 1397 | #ifdef Q_WS_QWS |
1402 | QDataStream stream( data, IO_ReadOnly ); | 1398 | QDataStream stream( data, IO_ReadOnly ); |
1403 | if ( msg == "applyStyle()" ) { | 1399 | if ( msg == "applyStyle()" ) { |
1404 | applyStyle(); | 1400 | applyStyle(); |
1405 | } | 1401 | } |
1406 | else if ( msg == "toggleApplicationMenu()" ) { | 1402 | else if ( msg == "toggleApplicationMenu()" ) { |
1407 | QWidget *active = activeWindow ( ); | 1403 | QWidget *active = activeWindow ( ); |
1408 | 1404 | ||
1409 | if ( active ) { | 1405 | if ( active ) { |
1410 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1406 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1411 | bool oldactive = man-> isActive ( ); | 1407 | bool oldactive = man-> isActive ( ); |
1412 | 1408 | ||
1413 | man-> setActive( !man-> isActive() ); | 1409 | man-> setActive( !man-> isActive() ); |
1414 | 1410 | ||
1415 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1411 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1416 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1412 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1417 | } | 1413 | } |
1418 | } | 1414 | } |
1419 | } | 1415 | } |
1420 | else if ( msg == "setDefaultRotation(int)" ) { | 1416 | else if ( msg == "setDefaultRotation(int)" ) { |
1421 | if ( type() == GuiServer ) { | 1417 | if ( type() == GuiServer ) { |
1422 | int r; | 1418 | int r; |
1423 | stream >> r; | 1419 | stream >> r; |
1424 | setDefaultRotation( r ); | 1420 | setDefaultRotation( r ); |
1425 | } | 1421 | } |
1426 | } | 1422 | } |
1427 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> | 1423 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> |
1428 | if ( type() == GuiServer ) { | 1424 | if ( type() == GuiServer ) { |
1429 | int x, y, depth; | 1425 | int x, y, depth; |
1430 | stream >> x; | 1426 | stream >> x; |
1431 | stream >> y; | 1427 | stream >> y; |
1432 | stream >> depth; | 1428 | stream >> depth; |
1433 | setCurrentMode( x, y, depth ); | 1429 | setCurrentMode( x, y, depth ); |
1434 | } | 1430 | } |
1435 | } | 1431 | } |
1436 | else if ( msg == "reset()" ) { | 1432 | else if ( msg == "reset()" ) { |
1437 | if ( type() != GuiServer ) | 1433 | if ( type() != GuiServer ) |
1438 | reset(); | 1434 | reset(); |
1439 | } | 1435 | } |
1440 | else if ( msg == "setCurrentRotation(int)" ) { | 1436 | else if ( msg == "setCurrentRotation(int)" ) { |
1441 | int r; | 1437 | int r; |
1442 | stream >> r; | 1438 | stream >> r; |
1443 | setCurrentRotation( r ); | 1439 | setCurrentRotation( r ); |
1444 | } | 1440 | } |
1445 | else if ( msg == "shutdown()" ) { | 1441 | else if ( msg == "shutdown()" ) { |
1446 | if ( type() == GuiServer ) | 1442 | if ( type() == GuiServer ) |
1447 | shutdown(); | 1443 | shutdown(); |
1448 | } | 1444 | } |
1449 | else if ( msg == "quit()" ) { | 1445 | else if ( msg == "quit()" ) { |
1450 | if ( type() != GuiServer ) | 1446 | if ( type() != GuiServer ) |
1451 | tryQuit(); | 1447 | tryQuit(); |
1452 | } | 1448 | } |
1453 | else if ( msg == "forceQuit()" ) { | 1449 | else if ( msg == "forceQuit()" ) { |
1454 | if ( type() != GuiServer ) | 1450 | if ( type() != GuiServer ) |
1455 | quit(); | 1451 | quit(); |
1456 | } | 1452 | } |
1457 | else if ( msg == "restart()" ) { | 1453 | else if ( msg == "restart()" ) { |
1458 | if ( type() == GuiServer ) | 1454 | if ( type() == GuiServer ) |
1459 | restart(); | 1455 | restart(); |
1460 | } | 1456 | } |
1461 | else if ( msg == "language(QString)" ) { | 1457 | else if ( msg == "language(QString)" ) { |
1462 | if ( type() == GuiServer ) { | 1458 | if ( type() == GuiServer ) { |
1463 | QString l; | 1459 | QString l; |
1464 | stream >> l; | 1460 | stream >> l; |
1465 | QString cl = getenv( "LANG" ); | 1461 | QString cl = getenv( "LANG" ); |
1466 | if ( cl != l ) { | 1462 | if ( cl != l ) { |
1467 | if ( l.isNull() ) | 1463 | if ( l.isNull() ) |
1468 | unsetenv( "LANG" ); | 1464 | unsetenv( "LANG" ); |
1469 | else | 1465 | else |
1470 | setenv( "LANG", l.latin1(), 1 ); | 1466 | setenv( "LANG", l.latin1(), 1 ); |
1471 | restart(); | 1467 | restart(); |
1472 | } | 1468 | } |
1473 | } | 1469 | } |
1474 | } | 1470 | } |
1475 | else if ( msg == "timeChange(QString)" ) { | 1471 | else if ( msg == "timeChange(QString)" ) { |
1476 | QString t; | 1472 | QString t; |
1477 | stream >> t; | 1473 | stream >> t; |
1478 | if ( t.isNull() ) | 1474 | if ( t.isNull() ) |
1479 | unsetenv( "TZ" ); | 1475 | unsetenv( "TZ" ); |
1480 | else | 1476 | else |
1481 | setenv( "TZ", t.latin1(), 1 ); | 1477 | setenv( "TZ", t.latin1(), 1 ); |
1482 | // emit the signal so everyone else knows... | 1478 | // emit the signal so everyone else knows... |
1483 | emit timeChanged(); | 1479 | emit timeChanged(); |
1484 | } | 1480 | } |
1485 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { | 1481 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { |
1486 | if ( type() == GuiServer ) { | 1482 | if ( type() == GuiServer ) { |
1487 | QDateTime when; | 1483 | QDateTime when; |
1488 | QCString channel, message; | 1484 | QCString channel, message; |
1489 | int data; | 1485 | int data; |
1490 | stream >> when >> channel >> message >> data; | 1486 | stream >> when >> channel >> message >> data; |
1491 | AlarmServer::addAlarm( when, channel, message, data ); | 1487 | AlarmServer::addAlarm( when, channel, message, data ); |
1492 | } | 1488 | } |
1493 | } | 1489 | } |
1494 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { | 1490 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { |