author | llornkcor <llornkcor> | 2004-04-25 12:15:06 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-25 12:15:06 (UTC) |
commit | 6182b509bdb16dd4d1e95b9a570219ef6c15ed21 (patch) (unidiff) | |
tree | 681bcfd272bd1d8d4873ee94acd56d42968997c3 | |
parent | 84466242f91283378aec1b1ecda0bb27eb4f6097 (diff) | |
download | opie-6182b509bdb16dd4d1e95b9a570219ef6c15ed21.zip opie-6182b509bdb16dd4d1e95b9a570219ef6c15ed21.tar.gz opie-6182b509bdb16dd4d1e95b9a570219ef6c15ed21.tar.bz2 |
fix bigfotos
-rw-r--r-- | library/qpeapplication.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 86dbe85..d0e9613 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1,689 +1,699 @@ | |||
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 | // ugly hack, remove that later after finding a sane solution | ||
179 | // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, | ||
180 | // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has | ||
181 | // a (physically) large enough display to use the small icons | ||
182 | #if defined(OPIE_HIGH_RES_SMALL_PHY) | ||
183 | if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { | ||
184 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); | ||
185 | } | ||
186 | #endif | ||
187 | |||
178 | QPoint p; | 188 | QPoint p; |
179 | QSize s; | 189 | QSize s; |
180 | bool max; | 190 | bool max; |
181 | if ( mw->isVisible() ) { | 191 | if ( mw->isVisible() ) { |
182 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 192 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
183 | mw->resize(s); | 193 | mw->resize(s); |
184 | mw->move(p); | 194 | mw->move(p); |
185 | } | 195 | } |
186 | mw->raise(); | 196 | mw->raise(); |
187 | } else { | 197 | } else { |
188 | 198 | ||
189 | if ( mw->layout() && mw->inherits("QDialog") ) { | 199 | if ( mw->layout() && mw->inherits("QDialog") ) { |
190 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 200 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
191 | mw->resize(s); | 201 | mw->resize(s); |
192 | mw->move(p); | 202 | mw->move(p); |
193 | 203 | ||
194 | if ( max && !nomaximize ) { | 204 | if ( max && !nomaximize ) { |
195 | mw->showMaximized(); | 205 | mw->showMaximized(); |
196 | } else { | 206 | } else { |
197 | mw->show(); | 207 | mw->show(); |
198 | } | 208 | } |
199 | } else { | 209 | } else { |
200 | qpe_show_dialog((QDialog*)mw,nomaximize); | 210 | qpe_show_dialog((QDialog*)mw,nomaximize); |
201 | } | 211 | } |
202 | } else { | 212 | } else { |
203 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 213 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
204 | mw->resize(s); | 214 | mw->resize(s); |
205 | mw->move(p); | 215 | mw->move(p); |
206 | } else { //no stored rectangle, make an estimation | 216 | } else { //no stored rectangle, make an estimation |
207 | int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2; | 217 | int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2; |
208 | int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2; | 218 | int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2; |
209 | mw->move( QMAX(x,0), QMAX(y,0) ); | 219 | mw->move( QMAX(x,0), QMAX(y,0) ); |
210 | #ifdef Q_WS_QWS | 220 | #ifdef Q_WS_QWS |
211 | if ( !nomaximize ) | 221 | if ( !nomaximize ) |
212 | mw->showMaximized(); | 222 | mw->showMaximized(); |
213 | #endif | 223 | #endif |
214 | } | 224 | } |
215 | if ( max && !nomaximize ) | 225 | if ( max && !nomaximize ) |
216 | mw->showMaximized(); | 226 | mw->showMaximized(); |
217 | else | 227 | else |
218 | mw->show(); | 228 | mw->show(); |
219 | } | 229 | } |
220 | } | 230 | } |
221 | } | 231 | } |
222 | 232 | ||
223 | static void qpe_show_dialog( QDialog* d, bool nomax ) | 233 | static void qpe_show_dialog( QDialog* d, bool nomax ) |
224 | { | 234 | { |
225 | QSize sh = d->sizeHint(); | 235 | QSize sh = d->sizeHint(); |
226 | int w = QMAX(sh.width(),d->width()); | 236 | int w = QMAX(sh.width(),d->width()); |
227 | int h = QMAX(sh.height(),d->height()); | 237 | int h = QMAX(sh.height(),d->height()); |
228 | 238 | ||
229 | if ( d->parentWidget() && !d->parentWidget()->topLevelWidget()->isMaximized() ) | 239 | if ( d->parentWidget() && !d->parentWidget()->topLevelWidget()->isMaximized() ) |
230 | nomax = TRUE; | 240 | nomax = TRUE; |
231 | 241 | ||
232 | #ifndef Q_WS_QWS | 242 | #ifndef Q_WS_QWS |
233 | QSize s(qApp->desktop()->width(), qApp->desktop()->height() ); | 243 | QSize s(qApp->desktop()->width(), qApp->desktop()->height() ); |
234 | #else | 244 | #else |
235 | QSize s(qt_maxWindowRect.width(), qt_maxWindowRect.height() ); | 245 | QSize s(qt_maxWindowRect.width(), qt_maxWindowRect.height() ); |
236 | #endif | 246 | #endif |
237 | 247 | ||
238 | int maxX = s.width() - (d->frameGeometry().width() - d->geometry().width()); | 248 | int maxX = s.width() - (d->frameGeometry().width() - d->geometry().width()); |
239 | int maxY = s.height() - (d->frameGeometry().height() - d->geometry().height()); | 249 | int maxY = s.height() - (d->frameGeometry().height() - d->geometry().height()); |
240 | 250 | ||
241 | if ( (w >= maxX && h >= maxY) || ( (!nomax) && ( w > s.width()*3/4 || h > s.height()*3/4 ) ) ) { | 251 | if ( (w >= maxX && h >= maxY) || ( (!nomax) && ( w > s.width()*3/4 || h > s.height()*3/4 ) ) ) { |
242 | d->showMaximized(); | 252 | d->showMaximized(); |
243 | } else { | 253 | } else { |
244 | // try centering the dialog around its parent | 254 | // try centering the dialog around its parent |
245 | QPoint p(0,0); | 255 | QPoint p(0,0); |
246 | if ( d->parentWidget() ) { | 256 | if ( d->parentWidget() ) { |
247 | QPoint pp = d->parentWidget()->mapToGlobal( QPoint(0,0) ); | 257 | QPoint pp = d->parentWidget()->mapToGlobal( QPoint(0,0) ); |
248 | p = QPoint( pp.x() + d->parentWidget()->width()/2, | 258 | p = QPoint( pp.x() + d->parentWidget()->width()/2, |
249 | pp.y() + d->parentWidget()->height()/ 2 ); | 259 | pp.y() + d->parentWidget()->height()/ 2 ); |
250 | } else { | 260 | } else { |
251 | p = QPoint( maxX/2, maxY/2 ); | 261 | p = QPoint( maxX/2, maxY/2 ); |
252 | } | 262 | } |
253 | 263 | ||
254 | p = QPoint( p.x() - w/2, p.y() - h/2 ); | 264 | p = QPoint( p.x() - w/2, p.y() - h/2 ); |
255 | //qDebug("p(x,y) is %d %d", p.x(), p.y() ); | 265 | //qDebug("p(x,y) is %d %d", p.x(), p.y() ); |
256 | 266 | ||
257 | if ( w >= maxX ) { | 267 | if ( w >= maxX ) { |
258 | if ( p.y() < 0 ) | 268 | if ( p.y() < 0 ) |
259 | p.setY(0); | 269 | p.setY(0); |
260 | if ( p.y() + h > maxY ) | 270 | if ( p.y() + h > maxY ) |
261 | p.setY( maxY - h); | 271 | p.setY( maxY - h); |
262 | 272 | ||
263 | d->resize(maxX, h); | 273 | d->resize(maxX, h); |
264 | d->move(0, p.y() ); | 274 | d->move(0, p.y() ); |
265 | } else if ( h >= maxY ) { | 275 | } else if ( h >= maxY ) { |
266 | if ( p.x() < 0 ) | 276 | if ( p.x() < 0 ) |
267 | p.setX(0); | 277 | p.setX(0); |
268 | if ( p.x() + w > maxX ) | 278 | if ( p.x() + w > maxX ) |
269 | p.setX( maxX - w); | 279 | p.setX( maxX - w); |
270 | 280 | ||
271 | d->resize(w, maxY); | 281 | d->resize(w, maxY); |
272 | d->move(p.x(),0); | 282 | d->move(p.x(),0); |
273 | } else { | 283 | } else { |
274 | d->resize(w, h); | 284 | d->resize(w, h); |
275 | } | 285 | } |
276 | 286 | ||
277 | d->show(); | 287 | d->show(); |
278 | } | 288 | } |
279 | } | 289 | } |
280 | 290 | ||
281 | static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) | 291 | static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) |
282 | { | 292 | { |
283 | maximized = TRUE; | 293 | maximized = TRUE; |
284 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button | 294 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button |
285 | if ( qApp->desktop()->width() <= 350 ) | 295 | if ( qApp->desktop()->width() <= 350 ) |
286 | return FALSE; | 296 | return FALSE; |
287 | 297 | ||
288 | Config cfg( "qpe" ); | 298 | Config cfg( "qpe" ); |
289 | cfg.setGroup("ApplicationPositions"); | 299 | cfg.setGroup("ApplicationPositions"); |
290 | QString str = cfg.readEntry( app, QString::null ); | 300 | QString str = cfg.readEntry( app, QString::null ); |
291 | QStringList l = QStringList::split(",", str); | 301 | QStringList l = QStringList::split(",", str); |
292 | 302 | ||
293 | if ( l.count() == 5) { | 303 | if ( l.count() == 5) { |
294 | p.setX( l[0].toInt() ); | 304 | p.setX( l[0].toInt() ); |
295 | p.setY( l[1].toInt() ); | 305 | p.setY( l[1].toInt() ); |
296 | 306 | ||
297 | s.setWidth( l[2].toInt() ); | 307 | s.setWidth( l[2].toInt() ); |
298 | s.setHeight( l[3].toInt() ); | 308 | s.setHeight( l[3].toInt() ); |
299 | 309 | ||
300 | maximized = l[4].toInt(); | 310 | maximized = l[4].toInt(); |
301 | 311 | ||
302 | return TRUE; | 312 | return TRUE; |
303 | } | 313 | } |
304 | 314 | ||
305 | return FALSE; | 315 | return FALSE; |
306 | } | 316 | } |
307 | 317 | ||
308 | 318 | ||
309 | static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) | 319 | static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) |
310 | { | 320 | { |
311 | #ifndef Q_WS_QWS | 321 | #ifndef Q_WS_QWS |
312 | QRect qt_maxWindowRect = qApp->desktop()->geometry(); | 322 | QRect qt_maxWindowRect = qApp->desktop()->geometry(); |
313 | #endif | 323 | #endif |
314 | int maxX = qt_maxWindowRect.width(); | 324 | int maxX = qt_maxWindowRect.width(); |
315 | int maxY = qt_maxWindowRect.height(); | 325 | int maxY = qt_maxWindowRect.height(); |
316 | int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() ); | 326 | int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() ); |
317 | int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() ); | 327 | int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() ); |
318 | 328 | ||
319 | // total window size is not allowed to be larger than desktop window size | 329 | // total window size is not allowed to be larger than desktop window size |
320 | if ( ( wWidth >= maxX ) && ( wHeight >= maxY ) ) | 330 | if ( ( wWidth >= maxX ) && ( wHeight >= maxY ) ) |
321 | return FALSE; | 331 | return FALSE; |
322 | 332 | ||
323 | if ( wWidth > maxX ) { | 333 | if ( wWidth > maxX ) { |
324 | s.setWidth( maxX - (w->frameGeometry().width() - w->geometry().width() ) ); | 334 | s.setWidth( maxX - (w->frameGeometry().width() - w->geometry().width() ) ); |
325 | wWidth = maxX; | 335 | wWidth = maxX; |
326 | } | 336 | } |
327 | 337 | ||
328 | if ( wHeight > maxY ) { | 338 | if ( wHeight > maxY ) { |
329 | s.setHeight( maxY - (w->frameGeometry().height() - w->geometry().height() ) ); | 339 | s.setHeight( maxY - (w->frameGeometry().height() - w->geometry().height() ) ); |
330 | wHeight = maxY; | 340 | wHeight = maxY; |
331 | } | 341 | } |
332 | 342 | ||
333 | // any smaller than this and the maximize/close/help buttons will be overlapping | 343 | // any smaller than this and the maximize/close/help buttons will be overlapping |
334 | if ( wWidth < 80 || wHeight < 60 ) | 344 | if ( wWidth < 80 || wHeight < 60 ) |
335 | return FALSE; | 345 | return FALSE; |
336 | 346 | ||
337 | if ( p.x() < 0 ) | 347 | if ( p.x() < 0 ) |
338 | p.setX(0); | 348 | p.setX(0); |
339 | if ( p.y() < 0 ) | 349 | if ( p.y() < 0 ) |
340 | p.setY(0); | 350 | p.setY(0); |
341 | 351 | ||
342 | if ( p.x() + wWidth > maxX ) | 352 | if ( p.x() + wWidth > maxX ) |
343 | p.setX( maxX - wWidth ); | 353 | p.setX( maxX - wWidth ); |
344 | if ( p.y() + wHeight > maxY ) | 354 | if ( p.y() + wHeight > maxY ) |
345 | p.setY( maxY - wHeight ); | 355 | p.setY( maxY - wHeight ); |
346 | 356 | ||
347 | return TRUE; | 357 | return TRUE; |
348 | } | 358 | } |
349 | 359 | ||
350 | static void store_widget_rect(QWidget *w, QString &app) | 360 | static void store_widget_rect(QWidget *w, QString &app) |
351 | { | 361 | { |
352 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button | 362 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button |
353 | if ( qApp->desktop()->width() <= 350 ) | 363 | if ( qApp->desktop()->width() <= 350 ) |
354 | return; | 364 | return; |
355 | // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to | 365 | // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to |
356 | // get the non-maximized version, so we have to do it the hard way ) | 366 | // get the non-maximized version, so we have to do it the hard way ) |
357 | int offsetX = w->x() - w->geometry().left(); | 367 | int offsetX = w->x() - w->geometry().left(); |
358 | int offsetY = w->y() - w->geometry().top(); | 368 | int offsetY = w->y() - w->geometry().top(); |
359 | 369 | ||
360 | QRect r; | 370 | QRect r; |
361 | if ( w->isMaximized() ) | 371 | if ( w->isMaximized() ) |
362 | r = ( (HackWidget *) w)->normalGeometry(); | 372 | r = ( (HackWidget *) w)->normalGeometry(); |
363 | else | 373 | else |
364 | r = w->geometry(); | 374 | r = w->geometry(); |
365 | 375 | ||
366 | // Stores the window placement as pos(), size() (due to the offset mapping) | 376 | // Stores the window placement as pos(), size() (due to the offset mapping) |
367 | Config cfg( "qpe" ); | 377 | Config cfg( "qpe" ); |
368 | cfg.setGroup("ApplicationPositions"); | 378 | cfg.setGroup("ApplicationPositions"); |
369 | QString s; | 379 | QString s; |
370 | s.sprintf("%d,%d,%d,%d,%d", r.left() + offsetX, r.top() + offsetY, r.width(), r.height(), w->isMaximized() ); | 380 | s.sprintf("%d,%d,%d,%d,%d", r.left() + offsetX, r.top() + offsetY, r.width(), r.height(), w->isMaximized() ); |
371 | cfg.writeEntry( app, s ); | 381 | cfg.writeEntry( app, s ); |
372 | } | 382 | } |
373 | 383 | ||
374 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) | 384 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) |
375 | { | 385 | { |
376 | /* | 386 | /* |
377 | // This works but disable it for now until it is safe to apply | 387 | // This works but disable it for now until it is safe to apply |
378 | // What is does is scan the .desktop files of all the apps for | 388 | // What is does is scan the .desktop files of all the apps for |
379 | // the applnk that has the corresponding argv[0] as this program | 389 | // the applnk that has the corresponding argv[0] as this program |
380 | // then it uses the name stored in the .desktop file as the caption | 390 | // then it uses the name stored in the .desktop file as the caption |
381 | // for the main widget. This saves duplicating translations for | 391 | // for the main widget. This saves duplicating translations for |
382 | // the app name in the program and in the .desktop files. | 392 | // the app name in the program and in the .desktop files. |
383 | 393 | ||
384 | AppLnkSet apps( appsPath ); | 394 | AppLnkSet apps( appsPath ); |
385 | 395 | ||
386 | QList<AppLnk> appsList = apps.children(); | 396 | QList<AppLnk> appsList = apps.children(); |
387 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { | 397 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { |
388 | if ( (*it)->exec() == appName ) { | 398 | if ( (*it)->exec() == appName ) { |
389 | mw->setCaption( (*it)->name() ); | 399 | mw->setCaption( (*it)->name() ); |
390 | return TRUE; | 400 | return TRUE; |
391 | } | 401 | } |
392 | } | 402 | } |
393 | */ | 403 | */ |
394 | return FALSE; | 404 | return FALSE; |
395 | } | 405 | } |
396 | 406 | ||
397 | 407 | ||
398 | void show(QWidget* mw, bool nomax) | 408 | void show(QWidget* mw, bool nomax) |
399 | { | 409 | { |
400 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); | 410 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); |
401 | nomaximize = nomax; | 411 | nomaximize = nomax; |
402 | qpe_main_widget = mw; | 412 | qpe_main_widget = mw; |
403 | qcopQok = TRUE; | 413 | qcopQok = TRUE; |
404 | #ifndef QT_NO_COP | 414 | #ifndef QT_NO_COP |
405 | 415 | ||
406 | sendQCopQ(); | 416 | sendQCopQ(); |
407 | #endif | 417 | #endif |
408 | 418 | ||
409 | if ( preloaded ) { | 419 | if ( preloaded ) { |
410 | if (forceshow) | 420 | if (forceshow) |
411 | show_mx(mw, nomax, appName); | 421 | show_mx(mw, nomax, appName); |
412 | } | 422 | } |
413 | else if ( keep_running ) { | 423 | else if ( keep_running ) { |
414 | show_mx(mw, nomax, appName); | 424 | show_mx(mw, nomax, appName); |
415 | } | 425 | } |
416 | } | 426 | } |
417 | 427 | ||
418 | void loadTextCodecs() | 428 | void loadTextCodecs() |
419 | { | 429 | { |
420 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; | 430 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; |
421 | #ifdef Q_OS_MACX | 431 | #ifdef Q_OS_MACX |
422 | QDir dir( path, "lib*.dylib" ); | 432 | QDir dir( path, "lib*.dylib" ); |
423 | #else | 433 | #else |
424 | QDir dir( path, "lib*.so" ); | 434 | QDir dir( path, "lib*.so" ); |
425 | #endif | 435 | #endif |
426 | QStringList list; | 436 | QStringList list; |
427 | if ( dir. exists ( )) | 437 | if ( dir. exists ( )) |
428 | list = dir.entryList(); | 438 | list = dir.entryList(); |
429 | QStringList::Iterator it; | 439 | QStringList::Iterator it; |
430 | for ( it = list.begin(); it != list.end(); ++it ) { | 440 | for ( it = list.begin(); it != list.end(); ++it ) { |
431 | TextCodecInterface *iface = 0; | 441 | TextCodecInterface *iface = 0; |
432 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 442 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
433 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 443 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
434 | QValueList<int> mibs = iface->mibEnums(); | 444 | QValueList<int> mibs = iface->mibEnums(); |
435 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { | 445 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { |
436 | (void)iface->createForMib(*i); | 446 | (void)iface->createForMib(*i); |
437 | // ### it exists now; need to remember if we can delete it | 447 | // ### it exists now; need to remember if we can delete it |
438 | } | 448 | } |
439 | } | 449 | } |
440 | else { | 450 | else { |
441 | lib->unload(); | 451 | lib->unload(); |
442 | delete lib; | 452 | delete lib; |
443 | } | 453 | } |
444 | } | 454 | } |
445 | } | 455 | } |
446 | 456 | ||
447 | void loadImageCodecs() | 457 | void loadImageCodecs() |
448 | { | 458 | { |
449 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; | 459 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; |
450 | #ifdef Q_OS_MACX | 460 | #ifdef Q_OS_MACX |
451 | QDir dir( path, "lib*.dylib" ); | 461 | QDir dir( path, "lib*.dylib" ); |
452 | #else | 462 | #else |
453 | QDir dir( path, "lib*.so" ); | 463 | QDir dir( path, "lib*.so" ); |
454 | #endif | 464 | #endif |
455 | QStringList list; | 465 | QStringList list; |
456 | if ( dir. exists ( )) | 466 | if ( dir. exists ( )) |
457 | list = dir.entryList(); | 467 | list = dir.entryList(); |
458 | QStringList::Iterator it; | 468 | QStringList::Iterator it; |
459 | for ( it = list.begin(); it != list.end(); ++it ) { | 469 | for ( it = list.begin(); it != list.end(); ++it ) { |
460 | ImageCodecInterface *iface = 0; | 470 | ImageCodecInterface *iface = 0; |
461 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 471 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
462 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 472 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
463 | QStringList formats = iface->keys(); | 473 | QStringList formats = iface->keys(); |
464 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { | 474 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { |
465 | (void)iface->installIOHandler(*i); | 475 | (void)iface->installIOHandler(*i); |
466 | // ### it exists now; need to remember if we can delete it | 476 | // ### it exists now; need to remember if we can delete it |
467 | } | 477 | } |
468 | } | 478 | } |
469 | else { | 479 | else { |
470 | lib->unload(); | 480 | lib->unload(); |
471 | delete lib; | 481 | delete lib; |
472 | } | 482 | } |
473 | } | 483 | } |
474 | } | 484 | } |
475 | }; | 485 | }; |
476 | 486 | ||
477 | class ResourceMimeFactory : public QMimeSourceFactory | 487 | class ResourceMimeFactory : public QMimeSourceFactory |
478 | { | 488 | { |
479 | public: | 489 | public: |
480 | ResourceMimeFactory() : resImage( 0 ) | 490 | ResourceMimeFactory() : resImage( 0 ) |
481 | { | 491 | { |
482 | setFilePath( Global::helpPath() ); | 492 | setFilePath( Global::helpPath() ); |
483 | setExtensionType( "html", "text/html;charset=UTF-8" ); | 493 | setExtensionType( "html", "text/html;charset=UTF-8" ); |
484 | } | 494 | } |
485 | ~ResourceMimeFactory() { | 495 | ~ResourceMimeFactory() { |
486 | delete resImage; | 496 | delete resImage; |
487 | } | 497 | } |
488 | 498 | ||
489 | const QMimeSource* data( const QString& abs_name ) const | 499 | const QMimeSource* data( const QString& abs_name ) const |
490 | { | 500 | { |
491 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); | 501 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); |
492 | if ( !r ) { | 502 | if ( !r ) { |
493 | int sl = abs_name.length(); | 503 | int sl = abs_name.length(); |
494 | do { | 504 | do { |
495 | sl = abs_name.findRev( '/', sl - 1 ); | 505 | sl = abs_name.findRev( '/', sl - 1 ); |
496 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; | 506 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; |
497 | int dot = name.findRev( '.' ); | 507 | int dot = name.findRev( '.' ); |
498 | if ( dot >= 0 ) | 508 | if ( dot >= 0 ) |
499 | name = name.left( dot ); | 509 | name = name.left( dot ); |
500 | QImage img = Resource::loadImage( name ); | 510 | QImage img = Resource::loadImage( name ); |
501 | if ( !img.isNull() ) { | 511 | if ( !img.isNull() ) { |
502 | delete resImage; | 512 | delete resImage; |
503 | resImage = new QImageDrag( img ); | 513 | resImage = new QImageDrag( img ); |
504 | r = resImage; | 514 | r = resImage; |
505 | } | 515 | } |
506 | } | 516 | } |
507 | while ( !r && sl > 0 ); | 517 | while ( !r && sl > 0 ); |
508 | } | 518 | } |
509 | return r; | 519 | return r; |
510 | } | 520 | } |
511 | private: | 521 | private: |
512 | mutable QImageDrag *resImage; | 522 | mutable QImageDrag *resImage; |
513 | }; | 523 | }; |
514 | 524 | ||
515 | static int& hack(int& i) | 525 | static int& hack(int& i) |
516 | { | 526 | { |
517 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 527 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
518 | // These should be created, but aren't in Qt 2.3.0 | 528 | // These should be created, but aren't in Qt 2.3.0 |
519 | (void)new QUtf8Codec; | 529 | (void)new QUtf8Codec; |
520 | (void)new QUtf16Codec; | 530 | (void)new QUtf16Codec; |
521 | #endif | 531 | #endif |
522 | return i; | 532 | return i; |
523 | } | 533 | } |
524 | 534 | ||
525 | static int muted = 0; | 535 | static int muted = 0; |
526 | static int micMuted = 0; | 536 | static int micMuted = 0; |
527 | 537 | ||
528 | static void setVolume( int t = 0, int percent = -1 ) | 538 | static void setVolume( int t = 0, int percent = -1 ) |
529 | { | 539 | { |
530 | switch ( t ) { | 540 | switch ( t ) { |
531 | case 0: { | 541 | case 0: { |
532 | Config cfg( "qpe" ); | 542 | Config cfg( "qpe" ); |
533 | cfg.setGroup( "Volume" ); | 543 | cfg.setGroup( "Volume" ); |
534 | if ( percent < 0 ) | 544 | if ( percent < 0 ) |
535 | percent = cfg.readNumEntry( "VolumePercent", 50 ); | 545 | percent = cfg.readNumEntry( "VolumePercent", 50 ); |
536 | #ifndef QT_NO_SOUND | 546 | #ifndef QT_NO_SOUND |
537 | int fd = 0; | 547 | int fd = 0; |
538 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 548 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
539 | int vol = muted ? 0 : percent; | 549 | int vol = muted ? 0 : percent; |
540 | // set both channels to same volume | 550 | // set both channels to same volume |
541 | vol |= vol << 8; | 551 | vol |= vol << 8; |
542 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_VOLUME ), &vol ); | 552 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_VOLUME ), &vol ); |
543 | ::close( fd ); | 553 | ::close( fd ); |
544 | } | 554 | } |
545 | #endif | 555 | #endif |
546 | } | 556 | } |
547 | break; | 557 | break; |
548 | } | 558 | } |
549 | } | 559 | } |
550 | 560 | ||
551 | static void setMic( int t = 0, int percent = -1 ) | 561 | static void setMic( int t = 0, int percent = -1 ) |
552 | { | 562 | { |
553 | switch ( t ) { | 563 | switch ( t ) { |
554 | case 0: { | 564 | case 0: { |
555 | Config cfg( "qpe" ); | 565 | Config cfg( "qpe" ); |
556 | cfg.setGroup( "Volume" ); | 566 | cfg.setGroup( "Volume" ); |
557 | if ( percent < 0 ) | 567 | if ( percent < 0 ) |
558 | percent = cfg.readNumEntry( "Mic", 50 ); | 568 | percent = cfg.readNumEntry( "Mic", 50 ); |
559 | 569 | ||
560 | #ifndef QT_NO_SOUND | 570 | #ifndef QT_NO_SOUND |
561 | int fd = 0; | 571 | int fd = 0; |
562 | int mic = micMuted ? 0 : percent; | 572 | int mic = micMuted ? 0 : percent; |
563 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 573 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
564 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); | 574 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); |
565 | ::close( fd ); | 575 | ::close( fd ); |
566 | } | 576 | } |
567 | #endif | 577 | #endif |
568 | } | 578 | } |
569 | break; | 579 | break; |
570 | } | 580 | } |
571 | } | 581 | } |
572 | 582 | ||
573 | 583 | ||
574 | static void setBass( int t = 0, int percent = -1 ) | 584 | static void setBass( int t = 0, int percent = -1 ) |
575 | { | 585 | { |
576 | switch ( t ) { | 586 | switch ( t ) { |
577 | case 0: { | 587 | case 0: { |
578 | Config cfg( "qpe" ); | 588 | Config cfg( "qpe" ); |
579 | cfg.setGroup( "Volume" ); | 589 | cfg.setGroup( "Volume" ); |
580 | if ( percent < 0 ) | 590 | if ( percent < 0 ) |
581 | percent = cfg.readNumEntry( "BassPercent", 50 ); | 591 | percent = cfg.readNumEntry( "BassPercent", 50 ); |
582 | 592 | ||
583 | #ifndef QT_NO_SOUND | 593 | #ifndef QT_NO_SOUND |
584 | int fd = 0; | 594 | int fd = 0; |
585 | int bass = percent; | 595 | int bass = percent; |
586 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 596 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
587 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | 597 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); |
588 | ::close( fd ); | 598 | ::close( fd ); |
589 | } | 599 | } |
590 | #endif | 600 | #endif |
591 | } | 601 | } |
592 | break; | 602 | break; |
593 | } | 603 | } |
594 | } | 604 | } |
595 | 605 | ||
596 | 606 | ||
597 | static void setTreble( int t = 0, int percent = -1 ) | 607 | static void setTreble( int t = 0, int percent = -1 ) |
598 | { | 608 | { |
599 | switch ( t ) { | 609 | switch ( t ) { |
600 | case 0: { | 610 | case 0: { |
601 | Config cfg( "qpe" ); | 611 | Config cfg( "qpe" ); |
602 | cfg.setGroup( "Volume" ); | 612 | cfg.setGroup( "Volume" ); |
603 | if ( percent < 0 ) | 613 | if ( percent < 0 ) |
604 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | 614 | percent = cfg.readNumEntry( "TreblePercent", 50 ); |
605 | 615 | ||
606 | #ifndef QT_NO_SOUND | 616 | #ifndef QT_NO_SOUND |
607 | int fd = 0; | 617 | int fd = 0; |
608 | int treble = percent; | 618 | int treble = percent; |
609 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 619 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
610 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | 620 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); |
611 | ::close( fd ); | 621 | ::close( fd ); |
612 | } | 622 | } |
613 | #endif | 623 | #endif |
614 | } | 624 | } |
615 | break; | 625 | break; |
616 | } | 626 | } |
617 | } | 627 | } |
618 | 628 | ||
619 | 629 | ||
620 | /** | 630 | /** |
621 | \class QPEApplication | 631 | \class QPEApplication |
622 | \brief The QPEApplication class implements various system services | 632 | \brief The QPEApplication class implements various system services |
623 | that are available to all Qtopia applications. | 633 | that are available to all Qtopia applications. |
624 | 634 | ||
625 | Simply by using QPEApplication instead of QApplication, a standard Qt | 635 | Simply by using QPEApplication instead of QApplication, a standard Qt |
626 | application becomes a Qtopia application. It automatically follows | 636 | application becomes a Qtopia application. It automatically follows |
627 | style changes, quits and raises, and in the | 637 | style changes, quits and raises, and in the |
628 | case of \link docwidget.html document-oriented\endlink applications, | 638 | case of \link docwidget.html document-oriented\endlink applications, |
629 | changes the currently displayed document in response to the environment. | 639 | changes the currently displayed document in response to the environment. |
630 | 640 | ||
631 | To create a \link docwidget.html document-oriented\endlink | 641 | To create a \link docwidget.html document-oriented\endlink |
632 | application use showMainDocumentWidget(); to create a | 642 | application use showMainDocumentWidget(); to create a |
633 | non-document-oriented application use showMainWidget(). The | 643 | non-document-oriented application use showMainWidget(). The |
634 | keepRunning() function indicates whether the application will | 644 | keepRunning() function indicates whether the application will |
635 | continue running after it's processed the last \link qcop.html | 645 | continue running after it's processed the last \link qcop.html |
636 | QCop\endlink message. This can be changed using setKeepRunning(). | 646 | QCop\endlink message. This can be changed using setKeepRunning(). |
637 | 647 | ||
638 | A variety of signals are emitted when certain events occur, for | 648 | A variety of signals are emitted when certain events occur, for |
639 | example, timeChanged(), clockChanged(), weekChanged(), | 649 | example, timeChanged(), clockChanged(), weekChanged(), |
640 | dateFormatChanged() and volumeChanged(). If the application receives | 650 | dateFormatChanged() and volumeChanged(). If the application receives |
641 | a \link qcop.html QCop\endlink message on the application's | 651 | a \link qcop.html QCop\endlink message on the application's |
642 | QPE/Application/\e{appname} channel, the appMessage() signal is | 652 | QPE/Application/\e{appname} channel, the appMessage() signal is |
643 | emitted. There are also flush() and reload() signals, which | 653 | emitted. There are also flush() and reload() signals, which |
644 | are emitted when synching begins and ends respectively - upon these | 654 | are emitted when synching begins and ends respectively - upon these |
645 | signals, the application should save and reload any data | 655 | signals, the application should save and reload any data |
646 | files that are involved in synching. Most of these signals will initially | 656 | files that are involved in synching. Most of these signals will initially |
647 | be received and unfiltered through the appMessage() signal. | 657 | be received and unfiltered through the appMessage() signal. |
648 | 658 | ||
649 | This class also provides a set of useful static functions. The | 659 | This class also provides a set of useful static functions. The |
650 | qpeDir() and documentDir() functions return the respective paths. | 660 | qpeDir() and documentDir() functions return the respective paths. |
651 | The grabKeyboard() and ungrabKeyboard() functions are used to | 661 | The grabKeyboard() and ungrabKeyboard() functions are used to |
652 | control whether the application takes control of the device's | 662 | control whether the application takes control of the device's |
653 | physical buttons (e.g. application launch keys). The stylus' mode of | 663 | physical buttons (e.g. application launch keys). The stylus' mode of |
654 | operation is set with setStylusOperation() and retrieved with | 664 | operation is set with setStylusOperation() and retrieved with |
655 | stylusOperation(). There are also setInputMethodHint() and | 665 | stylusOperation(). There are also setInputMethodHint() and |
656 | inputMethodHint() functions. | 666 | inputMethodHint() functions. |
657 | 667 | ||
658 | \ingroup qtopiaemb | 668 | \ingroup qtopiaemb |
659 | */ | 669 | */ |
660 | 670 | ||
661 | /*! | 671 | /*! |
662 | \fn void QPEApplication::clientMoused() | 672 | \fn void QPEApplication::clientMoused() |
663 | 673 | ||
664 | \internal | 674 | \internal |
665 | */ | 675 | */ |
666 | 676 | ||
667 | /*! | 677 | /*! |
668 | \fn void QPEApplication::timeChanged(); | 678 | \fn void QPEApplication::timeChanged(); |
669 | This signal is emitted when the time changes outside the normal | 679 | This signal is emitted when the time changes outside the normal |
670 | passage of time, i.e. if the time is set backwards or forwards. | 680 | passage of time, i.e. if the time is set backwards or forwards. |
671 | */ | 681 | */ |
672 | 682 | ||
673 | /*! | 683 | /*! |
674 | \fn void QPEApplication::clockChanged( bool ampm ); | 684 | \fn void QPEApplication::clockChanged( bool ampm ); |
675 | 685 | ||
676 | This signal is emitted when the user changes the clock's style. If | 686 | This signal is emitted when the user changes the clock's style. If |
677 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 687 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
678 | they want a 24-hour clock. | 688 | they want a 24-hour clock. |
679 | */ | 689 | */ |
680 | 690 | ||
681 | /*! | 691 | /*! |
682 | \fn void QPEApplication::volumeChanged( bool muted ) | 692 | \fn void QPEApplication::volumeChanged( bool muted ) |
683 | 693 | ||
684 | This signal is emitted whenever the mute state is changed. If \a | 694 | This signal is emitted whenever the mute state is changed. If \a |
685 | muted is TRUE, then sound output has been muted. | 695 | muted is TRUE, then sound output has been muted. |
686 | */ | 696 | */ |
687 | 697 | ||
688 | /*! | 698 | /*! |
689 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 699 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |