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