author | kergoth <kergoth> | 2002-02-04 22:14:18 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-02-04 22:14:18 (UTC) |
commit | d46cb220a09b41312d86bb33573940d3dcba2588 (patch) (unidiff) | |
tree | 6aacb1589d5de2ca908d067f99ba64dc608a6fa5 | |
parent | 500e2f0cdbe82035516b7a1c576e08e0b2ad72b3 (diff) | |
download | opie-d46cb220a09b41312d86bb33573940d3dcba2588.zip opie-d46cb220a09b41312d86bb33573940d3dcba2588.tar.gz opie-d46cb220a09b41312d86bb33573940d3dcba2588.tar.bz2 |
latest qtopia merge as of 20020204.
-rw-r--r-- | library/global.cpp | 55 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 40 | ||||
-rwxr-xr-x | mkipks | 2 | ||||
-rw-r--r-- | noncore/games/minesweep/Makefile.in | 18 |
4 files changed, 71 insertions, 44 deletions
diff --git a/library/global.cpp b/library/global.cpp index fd7579a..dd15eb7 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -1,370 +1,377 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | #include <qpe/qpedebug.h> | 21 | #include <qpe/qpedebug.h> |
21 | #include <qpe/global.h> | 22 | #include <qpe/global.h> |
22 | #include <qpe/qdawg.h> | 23 | #include <qpe/qdawg.h> |
23 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
25 | #include <qpe/storage.h> | 26 | #include <qpe/storage.h> |
26 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
27 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 28 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
28 | #include "qpe/qcopenvelope_qws.h" | 29 | #include "qpe/qcopenvelope_qws.h" |
29 | #endif | 30 | #endif |
30 | 31 | ||
31 | #include <qfile.h> | 32 | #include <qfile.h> |
32 | #include <qlabel.h> | 33 | #include <qlabel.h> |
33 | #include <qtimer.h> | 34 | #include <qtimer.h> |
34 | #include <qmap.h> | 35 | #include <qmap.h> |
35 | #include <qdict.h> | 36 | #include <qdict.h> |
36 | #include <qdir.h> | 37 | #include <qdir.h> |
37 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
38 | #include <qregexp.h> | 39 | #include <qregexp.h> |
39 | 40 | ||
40 | #include <stdlib.h> | 41 | #include <stdlib.h> |
41 | #include <sys/stat.h> | 42 | #include <sys/stat.h> |
42 | #include <sys/wait.h> | 43 | #include <sys/wait.h> |
43 | #include <sys/types.h> | 44 | #include <sys/types.h> |
44 | #include <fcntl.h> | 45 | #include <fcntl.h> |
45 | #include <unistd.h> | 46 | #include <unistd.h> |
46 | 47 | ||
47 | #include <qwindowsystem_qws.h> // for qwsServer | 48 | #include <qwindowsystem_qws.h> // for qwsServer |
48 | #include <qdatetime.h> | 49 | #include <qdatetime.h> |
49 | 50 | ||
50 | //#include "quickexec_p.h" | 51 | //#include "quickexec_p.h" |
51 | 52 | ||
52 | class Emitter : public QObject { | 53 | class Emitter : public QObject { |
53 | Q_OBJECT | 54 | Q_OBJECT |
54 | public: | 55 | public: |
55 | Emitter( QWidget* receiver, const QString& document ) | 56 | Emitter( QWidget* receiver, const QString& document ) |
56 | { | 57 | { |
57 | connect(this, SIGNAL(setDocument(const QString&)), | 58 | connect(this, SIGNAL(setDocument(const QString&)), |
58 | receiver, SLOT(setDocument(const QString&))); | 59 | receiver, SLOT(setDocument(const QString&))); |
59 | emit setDocument(document); | 60 | emit setDocument(document); |
60 | disconnect(this, SIGNAL(setDocument(const QString&)), | 61 | disconnect(this, SIGNAL(setDocument(const QString&)), |
61 | receiver, SLOT(setDocument(const QString&))); | 62 | receiver, SLOT(setDocument(const QString&))); |
62 | } | 63 | } |
63 | 64 | ||
64 | signals: | 65 | signals: |
65 | void setDocument(const QString&); | 66 | void setDocument(const QString&); |
66 | }; | 67 | }; |
67 | 68 | ||
68 | 69 | ||
69 | class StartingAppList : public QObject { | 70 | class StartingAppList : public QObject { |
70 | Q_OBJECT | 71 | Q_OBJECT |
71 | public: | 72 | public: |
72 | static void add( const QString& name ); | 73 | static void add( const QString& name ); |
73 | static bool isStarting( const QString name ); | 74 | static bool isStarting( const QString name ); |
74 | private slots: | 75 | private slots: |
75 | void handleNewChannel( const QString &); | 76 | void handleNewChannel( const QString &); |
76 | private: | 77 | private: |
77 | StartingAppList( QObject *parent=0, const char* name=0 ) ; | 78 | StartingAppList( QObject *parent=0, const char* name=0 ) ; |
78 | 79 | ||
79 | QDict<QTime> dict; | 80 | QDict<QTime> dict; |
80 | static StartingAppList *appl; | 81 | static StartingAppList *appl; |
81 | }; | 82 | }; |
82 | 83 | ||
83 | StartingAppList* StartingAppList::appl = 0; | 84 | StartingAppList* StartingAppList::appl = 0; |
84 | 85 | ||
85 | StartingAppList::StartingAppList( QObject *parent, const char* name ) | 86 | StartingAppList::StartingAppList( QObject *parent, const char* name ) |
86 | :QObject( parent, name ) | 87 | :QObject( parent, name ) |
87 | { | 88 | { |
88 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 89 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) |
89 | connect( qwsServer, SIGNAL( newChannel(const QString&)), | 90 | connect( qwsServer, SIGNAL( newChannel(const QString&)), |
90 | this, SLOT( handleNewChannel(const QString&)) ); | 91 | this, SLOT( handleNewChannel(const QString&)) ); |
91 | dict.setAutoDelete( TRUE ); | 92 | dict.setAutoDelete( TRUE ); |
92 | #endif | 93 | #endif |
93 | } | 94 | } |
94 | 95 | ||
95 | void StartingAppList::add( const QString& name ) | 96 | void StartingAppList::add( const QString& name ) |
96 | { | 97 | { |
97 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 98 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) |
98 | if ( !appl ) | 99 | if ( !appl ) |
99 | appl = new StartingAppList; | 100 | appl = new StartingAppList; |
100 | QTime *t = new QTime; | 101 | QTime *t = new QTime; |
101 | t->start(); | 102 | t->start(); |
102 | appl->dict.insert( "QPE/Application/" + name, t ); | 103 | appl->dict.insert( "QPE/Application/" + name, t ); |
103 | #endif | 104 | #endif |
104 | } | 105 | } |
105 | 106 | ||
106 | bool StartingAppList::isStarting( const QString name ) | 107 | bool StartingAppList::isStarting( const QString name ) |
107 | { | 108 | { |
108 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 109 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) |
109 | if ( appl ) { | 110 | if ( appl ) { |
110 | QTime *t = appl->dict.find( "QPE/Application/" + name ); | 111 | QTime *t = appl->dict.find( "QPE/Application/" + name ); |
111 | if ( !t ) | 112 | if ( !t ) |
112 | return FALSE; | 113 | return FALSE; |
113 | if ( t->elapsed() > 10000 ) { | 114 | if ( t->elapsed() > 10000 ) { |
114 | // timeout in case of crash or something | 115 | // timeout in case of crash or something |
115 | appl->dict.remove( "QPE/Application/" + name ); | 116 | appl->dict.remove( "QPE/Application/" + name ); |
116 | return FALSE; | 117 | return FALSE; |
117 | } | 118 | } |
118 | return TRUE; | 119 | return TRUE; |
119 | } | 120 | } |
120 | #endif | 121 | #endif |
121 | return FALSE; | 122 | return FALSE; |
122 | } | 123 | } |
123 | 124 | ||
124 | void StartingAppList::handleNewChannel( const QString & name ) | 125 | void StartingAppList::handleNewChannel( const QString & name ) |
125 | { | 126 | { |
126 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 127 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) |
127 | dict.remove( name ); | 128 | dict.remove( name ); |
128 | #endif | 129 | #endif |
129 | } | 130 | } |
130 | 131 | ||
131 | static bool docDirCreated = FALSE; | 132 | static bool docDirCreated = FALSE; |
132 | static QDawg* fixed_dawg = 0; | 133 | static QDawg* fixed_dawg = 0; |
133 | static QDict<QDawg> *named_dawg = 0; | 134 | static QDict<QDawg> *named_dawg = 0; |
134 | 135 | ||
135 | static QString qpeDir() | 136 | static QString qpeDir() |
136 | { | 137 | { |
137 | QString dir = getenv("OPIEDIR"); | 138 | QString dir = getenv("OPIEDIR"); |
138 | if ( dir.isEmpty() ) dir = ".."; | 139 | if ( dir.isEmpty() ) dir = ".."; |
139 | return dir; | 140 | return dir; |
140 | } | 141 | } |
141 | 142 | ||
142 | static QString dictDir() | 143 | static QString dictDir() |
143 | { | 144 | { |
144 | return qpeDir() + "/etc/dict"; | 145 | return qpeDir() + "/etc/dict"; |
145 | } | 146 | } |
146 | 147 | ||
147 | /*! | 148 | /*! |
148 | \class Global global.h | 149 | \class Global global.h |
149 | \brief The Global class collects application-wide global functions. | 150 | \brief The Global class collects application-wide global functions. |
150 | */ | 151 | */ |
151 | 152 | ||
152 | /*! | 153 | /*! |
153 | \internal | 154 | \internal |
154 | */ | 155 | */ |
155 | Global::Global() | 156 | Global::Global() |
156 | { | 157 | { |
157 | } | 158 | } |
158 | 159 | ||
159 | /*! | 160 | /*! |
160 | Returns the unchangeable QDawg that contains general | 161 | Returns the unchangeable QDawg that contains general |
161 | words for the current locale. | 162 | words for the current locale. |
162 | 163 | ||
163 | \sa addedDawg() | 164 | \sa addedDawg() |
164 | */ | 165 | */ |
165 | const QDawg& Global::fixedDawg() | 166 | const QDawg& Global::fixedDawg() |
166 | { | 167 | { |
167 | if ( !fixed_dawg ) { | 168 | if ( !fixed_dawg ) { |
168 | if ( !docDirCreated ) | 169 | if ( !docDirCreated ) |
169 | createDocDir(); | 170 | createDocDir(); |
170 | 171 | ||
171 | fixed_dawg = new QDawg; | 172 | fixed_dawg = new QDawg; |
172 | QString dawgfilename = dictDir() + "/dawg"; | 173 | QString dawgfilename = dictDir() + "/dawg"; |
173 | QString lang = getenv( "LANG" ); | 174 | QString words_lang; |
174 | QString dawgfilename_lang = dawgfilename + "." + lang; | 175 | QStringList langs = Global::languageList(); |
175 | QString words_lang = dictDir() + "/words." + lang; | 176 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { |
176 | if ( QFile::exists(dawgfilename_lang) || | 177 | QString lang = *it; |
177 | QFile::exists(words_lang) ) | 178 | words_lang = dictDir() + "/words." + lang; |
178 | dawgfilename = dawgfilename_lang; | 179 | QString dawgfilename_lang = dawgfilename + "." + lang; |
180 | if ( QFile::exists(dawgfilename_lang) || | ||
181 | QFile::exists(words_lang) ) { | ||
182 | dawgfilename = dawgfilename_lang; | ||
183 | break; | ||
184 | } | ||
185 | } | ||
179 | QFile dawgfile(dawgfilename); | 186 | QFile dawgfile(dawgfilename); |
180 | 187 | ||
181 | if ( !dawgfile.exists() ) { | 188 | if ( !dawgfile.exists() ) { |
182 | QString fn = dictDir() + "/words"; | 189 | QString fn = dictDir() + "/words"; |
183 | if ( QFile::exists(words_lang) ) | 190 | if ( QFile::exists(words_lang) ) |
184 | fn = words_lang; | 191 | fn = words_lang; |
185 | QFile in(fn); | 192 | QFile in(fn); |
186 | if ( in.open(IO_ReadOnly) ) { | 193 | if ( in.open(IO_ReadOnly) ) { |
187 | fixed_dawg->createFromWords(&in); | 194 | fixed_dawg->createFromWords(&in); |
188 | dawgfile.open(IO_WriteOnly); | 195 | dawgfile.open(IO_WriteOnly); |
189 | fixed_dawg->write(&dawgfile); | 196 | fixed_dawg->write(&dawgfile); |
190 | dawgfile.close(); | 197 | dawgfile.close(); |
191 | } | 198 | } |
192 | } else { | 199 | } else { |
193 | fixed_dawg->readFile(dawgfilename); | 200 | fixed_dawg->readFile(dawgfilename); |
194 | } | 201 | } |
195 | } | 202 | } |
196 | 203 | ||
197 | return *fixed_dawg; | 204 | return *fixed_dawg; |
198 | } | 205 | } |
199 | 206 | ||
200 | /*! | 207 | /*! |
201 | Returns the changeable QDawg that contains general | 208 | Returns the changeable QDawg that contains general |
202 | words for the current locale. | 209 | words for the current locale. |
203 | 210 | ||
204 | \sa fixedDawg() | 211 | \sa fixedDawg() |
205 | */ | 212 | */ |
206 | const QDawg& Global::addedDawg() | 213 | const QDawg& Global::addedDawg() |
207 | { | 214 | { |
208 | return dawg("local"); | 215 | return dawg("local"); |
209 | } | 216 | } |
210 | 217 | ||
211 | /*! | 218 | /*! |
212 | Returns the QDawg with the given \a name. | 219 | Returns the QDawg with the given \a name. |
213 | This is an application-specific word list. | 220 | This is an application-specific word list. |
214 | 221 | ||
215 | \a name should not contain "/". | 222 | \a name should not contain "/". |
216 | */ | 223 | */ |
217 | const QDawg& Global::dawg(const QString& name) | 224 | const QDawg& Global::dawg(const QString& name) |
218 | { | 225 | { |
219 | createDocDir(); | 226 | createDocDir(); |
220 | if ( !named_dawg ) | 227 | if ( !named_dawg ) |
221 | named_dawg = new QDict<QDawg>; | 228 | named_dawg = new QDict<QDawg>; |
222 | QDawg* r = named_dawg->find(name); | 229 | QDawg* r = named_dawg->find(name); |
223 | if ( !r ) { | 230 | if ( !r ) { |
224 | r = new QDawg; | 231 | r = new QDawg; |
225 | named_dawg->insert(name,r); | 232 | named_dawg->insert(name,r); |
226 | QString dawgfilename = dictDir() + "/" + name + ".dawg"; | 233 | QString dawgfilename = dictDir() + "/" + name + ".dawg"; |
227 | QFile dawgfile(dawgfilename); | 234 | QFile dawgfile(dawgfilename); |
228 | if ( dawgfile.open(IO_ReadOnly) ) | 235 | if ( dawgfile.open(IO_ReadOnly) ) |
229 | r->readFile(dawgfilename); | 236 | r->readFile(dawgfilename); |
230 | } | 237 | } |
231 | return *r; | 238 | return *r; |
232 | } | 239 | } |
233 | 240 | ||
234 | /*! | 241 | /*! |
235 | Adds \a wordlist to the addedDawg(). | 242 | Adds \a wordlist to the addedDawg(). |
236 | */ | 243 | */ |
237 | void Global::addWords(const QStringList& wordlist) | 244 | void Global::addWords(const QStringList& wordlist) |
238 | { | 245 | { |
239 | addWords("local",wordlist); | 246 | addWords("local",wordlist); |
240 | } | 247 | } |
241 | 248 | ||
242 | /*! | 249 | /*! |
243 | Adds \a wordlist to the dawg() named \a dictname. | 250 | Adds \a wordlist to the dawg() named \a dictname. |
244 | */ | 251 | */ |
245 | void Global::addWords(const QString& dictname, const QStringList& wordlist) | 252 | void Global::addWords(const QString& dictname, const QStringList& wordlist) |
246 | { | 253 | { |
247 | QDawg& d = (QDawg&)dawg(dictname); | 254 | QDawg& d = (QDawg&)dawg(dictname); |
248 | QStringList all = d.allWords() + wordlist; | 255 | QStringList all = d.allWords() + wordlist; |
249 | d.createFromWords(all); | 256 | d.createFromWords(all); |
250 | 257 | ||
251 | QString dawgfilename = dictDir() + "/" + dictname + ".dawg"; | 258 | QString dawgfilename = dictDir() + "/" + dictname + ".dawg"; |
252 | QFile dawgfile(dawgfilename); | 259 | QFile dawgfile(dawgfilename); |
253 | if ( dawgfile.open(IO_WriteOnly) ) { | 260 | if ( dawgfile.open(IO_WriteOnly) ) { |
254 | d.write(&dawgfile); | 261 | d.write(&dawgfile); |
255 | dawgfile.close(); | 262 | dawgfile.close(); |
256 | } | 263 | } |
257 | 264 | ||
258 | // #### Re-read the dawg here if we use mmap(). | 265 | // #### Re-read the dawg here if we use mmap(). |
259 | 266 | ||
260 | // #### Signal other processes to re-read. | 267 | // #### Signal other processes to re-read. |
261 | } | 268 | } |
262 | 269 | ||
263 | 270 | ||
264 | /*! | 271 | /*! |
265 | Returns a full path for the application named \a appname, with the | 272 | Returns a full path for the application named \a appname, with the |
266 | given \a filename or QString::null if there was a problem creating | 273 | given \a filename or QString::null if there was a problem creating |
267 | the directory tree for \a appname. | 274 | the directory tree for \a appname. |
268 | If \a filename contains "/", it is the caller's responsibility to | 275 | If \a filename contains "/", it is the caller's responsibility to |
269 | ensure those directories exist. | 276 | ensure those directories exist. |
270 | */ | 277 | */ |
271 | QString Global::applicationFileName(const QString& appname, const QString& filename) | 278 | QString Global::applicationFileName(const QString& appname, const QString& filename) |
272 | { | 279 | { |
273 | QDir d; | 280 | QDir d; |
274 | QString r = getenv("HOME"); | 281 | QString r = getenv("HOME"); |
275 | r += "/Applications/"; | 282 | r += "/Applications/"; |
276 | if ( !QFile::exists( r ) ) | 283 | if ( !QFile::exists( r ) ) |
277 | if ( d.mkdir(r) == false ) | 284 | if ( d.mkdir(r) == false ) |
278 | return QString::null; | 285 | return QString::null; |
279 | r += appname; | 286 | r += appname; |
280 | if ( !QFile::exists( r ) ) | 287 | if ( !QFile::exists( r ) ) |
281 | if ( d.mkdir(r) == false ) | 288 | if ( d.mkdir(r) == false ) |
282 | return QString::null; | 289 | return QString::null; |
283 | r += "/"; r += filename; | 290 | r += "/"; r += filename; |
284 | return r; | 291 | return r; |
285 | } | 292 | } |
286 | 293 | ||
287 | /*! | 294 | /*! |
288 | \internal | 295 | \internal |
289 | */ | 296 | */ |
290 | void Global::createDocDir() | 297 | void Global::createDocDir() |
291 | { | 298 | { |
292 | if ( !docDirCreated ) { | 299 | if ( !docDirCreated ) { |
293 | docDirCreated = TRUE; | 300 | docDirCreated = TRUE; |
294 | mkdir( QPEApplication::documentDir().latin1(), 0755 ); | 301 | mkdir( QPEApplication::documentDir().latin1(), 0755 ); |
295 | } | 302 | } |
296 | } | 303 | } |
297 | 304 | ||
298 | 305 | ||
299 | /*! | 306 | /*! |
300 | Displays a status \a message to the user. This generally appears | 307 | Displays a status \a message to the user. This generally appears |
301 | in the taskbar for some amount of time, then disappears. | 308 | in the taskbar for some amount of time, then disappears. |
302 | */ | 309 | */ |
303 | void Global::statusMessage(const QString& message) | 310 | void Global::statusMessage(const QString& message) |
304 | { | 311 | { |
305 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 312 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
306 | QCopEnvelope e( "QPE/TaskBar", "message(QString)" ); | 313 | QCopEnvelope e( "QPE/TaskBar", "message(QString)" ); |
307 | e << message; | 314 | e << message; |
308 | #endif | 315 | #endif |
309 | } | 316 | } |
310 | 317 | ||
311 | /*! | 318 | /*! |
312 | \internal | 319 | \internal |
313 | */ | 320 | */ |
314 | void Global::applyStyle() | 321 | void Global::applyStyle() |
315 | { | 322 | { |
316 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 323 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
317 | QCopChannel::send( "QPE/System", "applyStyle()" ); | 324 | QCopChannel::send( "QPE/System", "applyStyle()" ); |
318 | #else | 325 | #else |
319 | ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version | 326 | ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version |
320 | #endif | 327 | #endif |
321 | } | 328 | } |
322 | 329 | ||
323 | /*! | 330 | /*! |
324 | \internal | 331 | \internal |
325 | */ | 332 | */ |
326 | QWidget *Global::shutdown( bool ) | 333 | QWidget *Global::shutdown( bool ) |
327 | { | 334 | { |
328 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 335 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
329 | QCopChannel::send( "QPE/System", "shutdown()" ); | 336 | QCopChannel::send( "QPE/System", "shutdown()" ); |
330 | #endif | 337 | #endif |
331 | return 0; | 338 | return 0; |
332 | } | 339 | } |
333 | 340 | ||
334 | /*! | 341 | /*! |
335 | \internal | 342 | \internal |
336 | */ | 343 | */ |
337 | QWidget *Global::restart( bool ) | 344 | QWidget *Global::restart( bool ) |
338 | { | 345 | { |
339 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 346 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
340 | QCopChannel::send( "QPE/System", "restart()" ); | 347 | QCopChannel::send( "QPE/System", "restart()" ); |
341 | #endif | 348 | #endif |
342 | return 0; | 349 | return 0; |
343 | } | 350 | } |
344 | 351 | ||
345 | /*! | 352 | /*! |
346 | Explicitly show the current input method. | 353 | Explicitly show the current input method. |
347 | */ | 354 | */ |
348 | void Global::showInputMethod() | 355 | void Global::showInputMethod() |
349 | { | 356 | { |
350 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 357 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
351 | QCopChannel::send( "QPE/TaskBar", "showInputMethod()" ); | 358 | QCopChannel::send( "QPE/TaskBar", "showInputMethod()" ); |
352 | #endif | 359 | #endif |
353 | } | 360 | } |
354 | 361 | ||
355 | /*! | 362 | /*! |
356 | Explicitly hide the current input method. | 363 | Explicitly hide the current input method. |
357 | */ | 364 | */ |
358 | void Global::hideInputMethod() | 365 | void Global::hideInputMethod() |
359 | { | 366 | { |
360 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 367 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
361 | QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" ); | 368 | QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" ); |
362 | #endif | 369 | #endif |
363 | } | 370 | } |
364 | 371 | ||
365 | 372 | ||
366 | /*! | 373 | /*! |
367 | \internal | 374 | \internal |
368 | */ | 375 | */ |
369 | bool Global::isBuiltinCommand( const QString &name ) | 376 | bool Global::isBuiltinCommand( const QString &name ) |
370 | { | 377 | { |
@@ -450,195 +457,231 @@ void Global::invoke(const QString &c) | |||
450 | // Convert the command line in to a list of arguments | 457 | // Convert the command line in to a list of arguments |
451 | QStringList list = QStringList::split(QRegExp(" *"),c); | 458 | QStringList list = QStringList::split(QRegExp(" *"),c); |
452 | 459 | ||
453 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 460 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
454 | QString ap=list[0]; | 461 | QString ap=list[0]; |
455 | // see if the application is already running | 462 | // see if the application is already running |
456 | // XXX should lock file /tmp/qcop-msg-ap | 463 | // XXX should lock file /tmp/qcop-msg-ap |
457 | if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { | 464 | if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { |
458 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 465 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
459 | e << ap; | 466 | e << ap; |
460 | return; | 467 | return; |
461 | } | 468 | } |
462 | // XXX should unlock file /tmp/qcop-msg-ap | 469 | // XXX should unlock file /tmp/qcop-msg-ap |
463 | //see if it is being started | 470 | //see if it is being started |
464 | if ( StartingAppList::isStarting( ap ) ) { | 471 | if ( StartingAppList::isStarting( ap ) ) { |
465 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 472 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
466 | e << ap; | 473 | e << ap; |
467 | return; | 474 | return; |
468 | } | 475 | } |
469 | 476 | ||
470 | #endif | 477 | #endif |
471 | 478 | ||
472 | #ifdef QT_NO_QWS_MULTIPROCESS | 479 | #ifdef QT_NO_QWS_MULTIPROCESS |
473 | QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); | 480 | QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); |
474 | #else | 481 | #else |
475 | 482 | ||
476 | QStrList slist; | 483 | QStrList slist; |
477 | unsigned int j; | 484 | unsigned int j; |
478 | for ( j = 0; j < list.count(); j++ ) | 485 | for ( j = 0; j < list.count(); j++ ) |
479 | slist.append( list[j].utf8() ); | 486 | slist.append( list[j].utf8() ); |
480 | 487 | ||
481 | const char **args = new (const char *)[slist.count() + 1]; | 488 | const char **args = new (const char *)[slist.count() + 1]; |
482 | for ( j = 0; j < slist.count(); j++ ) | 489 | for ( j = 0; j < slist.count(); j++ ) |
483 | args[j] = slist.at(j); | 490 | args[j] = slist.at(j); |
484 | args[j] = NULL; | 491 | args[j] = NULL; |
485 | 492 | ||
486 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 493 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
487 | // an attempt to show a wait... | 494 | // an attempt to show a wait... |
488 | // more logic should be used, but this will be fine for the moment... | 495 | // more logic should be used, but this will be fine for the moment... |
489 | QCopEnvelope ( "QPE/System", "busy()" ); | 496 | QCopEnvelope ( "QPE/System", "busy()" ); |
490 | #endif | 497 | #endif |
491 | 498 | ||
492 | #ifdef HAVE_QUICKEXEC | 499 | #ifdef HAVE_QUICKEXEC |
493 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; | 500 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; |
494 | qDebug("libfile = %s", libexe.latin1() ); | 501 | qDebug("libfile = %s", libexe.latin1() ); |
495 | if ( QFile::exists( libexe ) ) { | 502 | if ( QFile::exists( libexe ) ) { |
496 | qDebug("calling quickexec %s", libexe.latin1() ); | 503 | qDebug("calling quickexec %s", libexe.latin1() ); |
497 | quickexecv( libexe.utf8().data(), (const char **)args ); | 504 | quickexecv( libexe.utf8().data(), (const char **)args ); |
498 | } else | 505 | } else |
499 | #endif | 506 | #endif |
500 | { | 507 | { |
501 | if ( !::vfork() ) { | 508 | if ( !::vfork() ) { |
502 | for ( int fd = 3; fd < 100; fd++ ) | 509 | for ( int fd = 3; fd < 100; fd++ ) |
503 | ::close( fd ); | 510 | ::close( fd ); |
504 | ::setpgid( ::getpid(), ::getppid() ); | 511 | ::setpgid( ::getpid(), ::getppid() ); |
505 | // Try bindir first, so that foo/bar works too | 512 | // Try bindir first, so that foo/bar works too |
506 | ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); | 513 | ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); |
507 | ::execvp( args[0], (char * const *)args ); | 514 | ::execvp( args[0], (char * const *)args ); |
508 | _exit( -1 ); | 515 | _exit( -1 ); |
509 | } | 516 | } |
510 | } | 517 | } |
511 | StartingAppList::add( list[0] ); | 518 | StartingAppList::add( list[0] ); |
512 | #endif //QT_NO_QWS_MULTIPROCESS | 519 | #endif //QT_NO_QWS_MULTIPROCESS |
513 | } | 520 | } |
514 | 521 | ||
515 | /*! | 522 | /*! |
516 | Executes application identfied by \a c, passing \a document. | 523 | Executes application identfied by \a c, passing \a document. |
517 | 524 | ||
518 | Note that you might be better off sending a QCop message to | 525 | Note that you might be better off sending a QCop message to |
519 | the application's QPE/Application/<i>appname</i> channel. | 526 | the application's QPE/Application/<i>appname</i> channel. |
520 | */ | 527 | */ |
521 | void Global::execute( const QString &c, const QString& document ) | 528 | void Global::execute( const QString &c, const QString& document ) |
522 | { | 529 | { |
523 | if ( qApp->type() != QApplication::GuiServer ) { | 530 | if ( qApp->type() != QApplication::GuiServer ) { |
524 | // ask the server to do the work | 531 | // ask the server to do the work |
525 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 532 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
526 | if ( document.isNull() ) { | 533 | if ( document.isNull() ) { |
527 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 534 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
528 | e << c; | 535 | e << c; |
529 | } else { | 536 | } else { |
530 | QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); | 537 | QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); |
531 | e << c << document; | 538 | e << c << document; |
532 | } | 539 | } |
533 | #endif | 540 | #endif |
534 | return; | 541 | return; |
535 | } | 542 | } |
536 | 543 | ||
537 | // Attempt to execute the app using a builtin class for the app first | 544 | // Attempt to execute the app using a builtin class for the app first |
538 | // else try and find it in the bin directory | 545 | // else try and find it in the bin directory |
539 | if (builtin) { | 546 | if (builtin) { |
540 | for (int i = 0; builtin[i].file; i++) { | 547 | for (int i = 0; builtin[i].file; i++) { |
541 | if ( builtin[i].file == c ) { | 548 | if ( builtin[i].file == c ) { |
542 | if ( running[i] ) { | 549 | if ( running[i] ) { |
543 | if ( !document.isNull() && builtin[i].documentary ) | 550 | if ( !document.isNull() && builtin[i].documentary ) |
544 | setDocument(running[i], document); | 551 | setDocument(running[i], document); |
545 | running[i]->raise(); | 552 | running[i]->raise(); |
546 | running[i]->show(); | 553 | running[i]->show(); |
547 | running[i]->setActiveWindow(); | 554 | running[i]->setActiveWindow(); |
548 | } else { | 555 | } else { |
549 | running[i] = builtin[i].func( builtin[i].maximized ); | 556 | running[i] = builtin[i].func( builtin[i].maximized ); |
550 | } | 557 | } |
551 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 558 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
552 | e << c; // that was quick ;-) | 559 | e << c; // that was quick ;-) |
553 | return; | 560 | return; |
554 | } | 561 | } |
555 | } | 562 | } |
556 | } | 563 | } |
557 | 564 | ||
558 | //Global::invoke(c, document); | 565 | //Global::invoke(c, document); |
559 | 566 | ||
560 | // Convert the command line in to a list of arguments | 567 | // Convert the command line in to a list of arguments |
561 | QStringList list = QStringList::split(QRegExp(" *"),c); | 568 | QStringList list = QStringList::split(QRegExp(" *"),c); |
562 | 569 | ||
563 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 570 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
564 | QString ap=list[0]; | 571 | QString ap=list[0]; |
565 | 572 | ||
566 | qDebug("executing %s", ap.latin1() ); | 573 | qDebug("executing %s", ap.latin1() ); |
567 | if ( ap == "suspend" ) { | 574 | if ( ap == "suspend" ) { |
568 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 575 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
569 | return; | 576 | return; |
570 | } | 577 | } |
571 | 578 | ||
572 | /* if need be, sending a qcop message will result in an invoke, see | 579 | /* if need be, sending a qcop message will result in an invoke, see |
573 | preceeding function */ | 580 | preceeding function */ |
574 | { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } | 581 | { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } |
575 | if ( !document.isEmpty() ) { | 582 | if ( !document.isEmpty() ) { |
576 | QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" ); | 583 | QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" ); |
577 | env << document; | 584 | env << document; |
578 | } | 585 | } |
579 | #endif | 586 | #endif |
580 | } | 587 | } |
581 | 588 | ||
582 | /*! | 589 | /*! |
583 | Returns the string \a s with the characters backslash, ", and $ | 590 | Returns the string \a s with the characters backslash, ", and $ |
584 | quoted by a preceeding backslash. | 591 | quoted by a preceeding backslash. |
585 | */ | 592 | */ |
586 | QString Global::shellQuote(const QString& s) | 593 | QString Global::shellQuote(const QString& s) |
587 | { | 594 | { |
588 | QString r="\""; | 595 | QString r="\""; |
589 | for (int i=0; i<(int)s.length(); i++) { | 596 | for (int i=0; i<(int)s.length(); i++) { |
590 | char c = s[i].latin1(); | 597 | char c = s[i].latin1(); |
591 | switch (c) { | 598 | switch (c) { |
592 | case '\\': case '"': case '$': | 599 | case '\\': case '"': case '$': |
593 | r+="\\"; | 600 | r+="\\"; |
594 | } | 601 | } |
595 | r += s[i]; | 602 | r += s[i]; |
596 | } | 603 | } |
597 | r += "\""; | 604 | r += "\""; |
598 | return r; | 605 | return r; |
599 | } | 606 | } |
600 | 607 | ||
601 | /*! | 608 | /*! |
602 | Returns the string \a s with the characters backslash and " | 609 | Returns the string \a s with the characters backslash and " |
603 | quoted by a preceeding backslash. | 610 | quoted by a preceeding backslash. |
604 | */ | 611 | */ |
605 | QString Global::stringQuote(const QString& s) | 612 | QString Global::stringQuote(const QString& s) |
606 | { | 613 | { |
607 | QString r="\""; | 614 | QString r="\""; |
608 | for (int i=0; i<(int)s.length(); i++) { | 615 | for (int i=0; i<(int)s.length(); i++) { |
609 | char c = s[i].latin1(); | 616 | char c = s[i].latin1(); |
610 | switch (c) { | 617 | switch (c) { |
611 | case '\\': case '"': | 618 | case '\\': case '"': |
612 | r+="\\"; | 619 | r+="\\"; |
613 | } | 620 | } |
614 | r += s[i]; | 621 | r += s[i]; |
615 | } | 622 | } |
616 | r += "\""; | 623 | r += "\""; |
617 | return r; | 624 | return r; |
618 | } | 625 | } |
619 | 626 | ||
620 | /*! | 627 | /*! |
621 | Finds all documents on the system's document directories which | 628 | Finds all documents on the system's document directories which |
622 | match the filter \a mimefilter, and appends the resulting DocLnk | 629 | match the filter \a mimefilter, and appends the resulting DocLnk |
623 | objects to \a folder. | 630 | objects to \a folder. |
624 | */ | 631 | */ |
625 | void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) | 632 | void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) |
626 | { | 633 | { |
627 | QString homedocs = QString(getenv("HOME")) + "/Documents"; | 634 | QString homedocs = QString(getenv("HOME")) + "/Documents"; |
628 | DocLnkSet d(homedocs,mimefilter); | 635 | DocLnkSet d(homedocs,mimefilter); |
629 | folder->appendFrom(d); | 636 | folder->appendFrom(d); |
630 | StorageInfo storage; | 637 | StorageInfo storage; |
631 | const QList<FileSystem> &fs = storage.fileSystems(); | 638 | const QList<FileSystem> &fs = storage.fileSystems(); |
632 | QListIterator<FileSystem> it ( fs ); | 639 | QListIterator<FileSystem> it ( fs ); |
633 | for ( ; it.current(); ++it ) { | 640 | for ( ; it.current(); ++it ) { |
634 | if ( (*it)->isRemovable() ) { | 641 | if ( (*it)->isRemovable() ) { |
635 | QString path = (*it)->path(); | 642 | QString path = (*it)->path(); |
636 | DocLnkSet ide( path, mimefilter ); | 643 | DocLnkSet ide( path, mimefilter ); |
637 | folder->appendFrom(ide); | 644 | folder->appendFrom(ide); |
638 | } | 645 | } |
639 | } | 646 | } |
640 | } | 647 | } |
641 | 648 | ||
649 | QStringList Global::languageList() | ||
650 | { | ||
651 | QString lang = getenv("LANG"); | ||
652 | QStringList langs; | ||
653 | langs.append(lang); | ||
654 | int i = lang.find("."); | ||
655 | if ( i > 0 ) | ||
656 | lang = lang.left( i ); | ||
657 | i = lang.find( "_" ); | ||
658 | if ( i > 0 ) | ||
659 | langs.append(lang.left(i)); | ||
660 | return langs; | ||
661 | } | ||
662 | |||
663 | QStringList Global::helpPath() | ||
664 | { | ||
665 | QStringList path; | ||
666 | QStringList langs = Global::languageList(); | ||
667 | for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) { | ||
668 | QString lang = *it; | ||
669 | if ( !lang.isEmpty() ) | ||
670 | path += QPEApplication::qpeDir() + "/help/" + lang + "/html"; | ||
671 | } | ||
672 | path += QPEApplication::qpeDir() + "/pics"; | ||
673 | path += QPEApplication::qpeDir() + "/help/en/html"; | ||
674 | path += QPEApplication::qpeDir() + "/docs"; | ||
675 | QString dir = QDir::current().canonicalPath(); | ||
676 | if ( dir == "/" ) | ||
677 | dir += "/docs"; | ||
678 | else { | ||
679 | path += dir + "/../pics"; | ||
680 | dir += "/../docs"; | ||
681 | path += dir; | ||
682 | } | ||
683 | return path; | ||
684 | } | ||
642 | 685 | ||
643 | 686 | ||
644 | #include "global.moc" | 687 | #include "global.moc" |
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 70ffec1..4dbfbd8 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1,757 +1,739 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | ** $Id$ | 19 | ** $Id$ |
20 | ** | 20 | ** |
21 | **********************************************************************/ | 21 | **********************************************************************/ |
22 | #define QTOPIA_INTERNAL_LANGLIST | ||
22 | #include <stdlib.h> | 23 | #include <stdlib.h> |
23 | #include <unistd.h> | 24 | #include <unistd.h> |
24 | #include <qfile.h> | 25 | #include <qfile.h> |
25 | #ifdef Q_WS_QWS | 26 | #ifdef Q_WS_QWS |
26 | #ifndef QT_NO_COP | 27 | #ifndef QT_NO_COP |
27 | #if QT_VERSION <= 231 | 28 | #if QT_VERSION <= 231 |
28 | #define private public | 29 | #define private public |
29 | #define sendLocally processEvent | 30 | #define sendLocally processEvent |
30 | #include "qcopenvelope_qws.h" | 31 | #include "qcopenvelope_qws.h" |
31 | #undef private | 32 | #undef private |
32 | #else | 33 | #else |
33 | #include "qcopenvelope_qws.h" | 34 | #include "qcopenvelope_qws.h" |
34 | #endif | 35 | #endif |
35 | #endif | 36 | #endif |
36 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
37 | #endif | 38 | #endif |
38 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
39 | #include <qpalette.h> | 40 | #include <qpalette.h> |
40 | #include <qbuffer.h> | 41 | #include <qbuffer.h> |
41 | #include <qptrdict.h> | 42 | #include <qptrdict.h> |
42 | #include <qregexp.h> | 43 | #include <qregexp.h> |
43 | #include <qdir.h> | 44 | #include <qdir.h> |
44 | #include <qlabel.h> | 45 | #include <qlabel.h> |
45 | #include <qdialog.h> | 46 | #include <qdialog.h> |
46 | #include <qdragobject.h> | 47 | #include <qdragobject.h> |
47 | #include <qevent.h> | 48 | #include <qevent.h> |
48 | #include <qtooltip.h> | 49 | #include <qtooltip.h> |
49 | #include <qsignal.h> | 50 | #include <qsignal.h> |
50 | #include "qpeapplication.h" | 51 | #include "qpeapplication.h" |
51 | #include "qpestyle.h" | 52 | #include "qpestyle.h" |
52 | #if QT_VERSION >= 300 | 53 | #if QT_VERSION >= 300 |
53 | #include <qstylefactory.h> | 54 | #include <qstylefactory.h> |
54 | #else | 55 | #else |
55 | #include <qplatinumstyle.h> | 56 | #include <qplatinumstyle.h> |
56 | #include <qwindowsstyle.h> | 57 | #include <qwindowsstyle.h> |
57 | #include <qmotifstyle.h> | 58 | #include <qmotifstyle.h> |
58 | #include <qmotifplusstyle.h> | 59 | #include <qmotifplusstyle.h> |
59 | #include "lightstyle.h" | 60 | #include "lightstyle.h" |
60 | #endif | 61 | #endif |
61 | #include "global.h" | 62 | #include "global.h" |
62 | #include "resource.h" | 63 | #include "resource.h" |
63 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 64 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
64 | #include "qutfcodec.h" | 65 | #include "qutfcodec.h" |
65 | #endif | 66 | #endif |
66 | #include "config.h" | 67 | #include "config.h" |
67 | #include "network.h" | 68 | #include "network.h" |
68 | #include "fontmanager.h" | 69 | #include "fontmanager.h" |
69 | #include "power.h" | 70 | #include "power.h" |
70 | #include "alarmserver.h" | 71 | #include "alarmserver.h" |
71 | #include "applnk.h" | 72 | #include "applnk.h" |
72 | #include "qpemenubar.h" | 73 | #include "qpemenubar.h" |
73 | 74 | ||
74 | #include <unistd.h> | 75 | #include <unistd.h> |
75 | #include <sys/file.h> | 76 | #include <sys/file.h> |
76 | #include <sys/ioctl.h> | 77 | #include <sys/ioctl.h> |
77 | #include <sys/soundcard.h> | 78 | #include <sys/soundcard.h> |
78 | 79 | ||
79 | // for setBacklight() | 80 | // for setBacklight() |
80 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 81 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
81 | #include <linux/fb.h> | 82 | #include <linux/fb.h> |
82 | #include <sys/types.h> | 83 | #include <sys/types.h> |
83 | #include <sys/stat.h> | 84 | #include <sys/stat.h> |
84 | #endif | 85 | #endif |
85 | #include <stdlib.h> | 86 | #include <stdlib.h> |
86 | 87 | ||
87 | 88 | ||
88 | class QPEApplicationData { | 89 | class QPEApplicationData { |
89 | public: | 90 | public: |
90 | QPEApplicationData() : presstimer(0), presswidget(0), rightpressed(FALSE), | 91 | QPEApplicationData() : presstimer(0), presswidget(0), rightpressed(FALSE), |
91 | kbgrabber(0), kbregrab(FALSE), notbusysent(FALSE), preloaded(FALSE), | 92 | kbgrabber(0), kbregrab(FALSE), notbusysent(FALSE), preloaded(FALSE), |
92 | forceshow(FALSE), nomaximize(FALSE), qpe_main_widget(0), | 93 | forceshow(FALSE), nomaximize(FALSE), qpe_main_widget(0), |
93 | keep_running(TRUE) | 94 | keep_running(TRUE) |
94 | { | 95 | { |
95 | qcopq.setAutoDelete(TRUE); | 96 | qcopq.setAutoDelete(TRUE); |
96 | } | 97 | } |
97 | 98 | ||
98 | int presstimer; | 99 | int presstimer; |
99 | QWidget* presswidget; | 100 | QWidget* presswidget; |
100 | QPoint presspos; | 101 | QPoint presspos; |
101 | bool rightpressed; | 102 | bool rightpressed; |
102 | int kbgrabber; | 103 | int kbgrabber; |
103 | bool kbregrab; | 104 | bool kbregrab; |
104 | bool notbusysent; | 105 | bool notbusysent; |
105 | QString appName; | 106 | QString appName; |
106 | struct QCopRec { | 107 | struct QCopRec { |
107 | QCopRec(const QCString &ch, const QCString &msg, | 108 | QCopRec(const QCString &ch, const QCString &msg, |
108 | const QByteArray &d) : | 109 | const QByteArray &d) : |
109 | channel(ch), message(msg), data(d) { } | 110 | channel(ch), message(msg), data(d) { } |
110 | 111 | ||
111 | QCString channel; | 112 | QCString channel; |
112 | QCString message; | 113 | QCString message; |
113 | QByteArray data; | 114 | QByteArray data; |
114 | }; | 115 | }; |
115 | bool preloaded; | 116 | bool preloaded; |
116 | bool forceshow; | 117 | bool forceshow; |
117 | bool nomaximize; | 118 | bool nomaximize; |
118 | QWidget* qpe_main_widget; | 119 | QWidget* qpe_main_widget; |
119 | bool keep_running; | 120 | bool keep_running; |
120 | QList<QCopRec> qcopq; | 121 | QList<QCopRec> qcopq; |
121 | 122 | ||
122 | void enqueueQCop(const QCString &ch, const QCString &msg, | 123 | void enqueueQCop(const QCString &ch, const QCString &msg, |
123 | const QByteArray &data) | 124 | const QByteArray &data) |
124 | { | 125 | { |
125 | qcopq.append(new QCopRec(ch,msg,data)); | 126 | qcopq.append(new QCopRec(ch,msg,data)); |
126 | } | 127 | } |
127 | void sendQCopQ() | 128 | void sendQCopQ() |
128 | { | 129 | { |
129 | QCopRec* r; | 130 | QCopRec* r; |
130 | for (QListIterator<QCopRec> it(qcopq); (r=it.current()); ++it) | 131 | for (QListIterator<QCopRec> it(qcopq); (r=it.current()); ++it) |
131 | QCopChannel::sendLocally(r->channel,r->message,r->data); | 132 | QCopChannel::sendLocally(r->channel,r->message,r->data); |
132 | qcopq.clear(); | 133 | qcopq.clear(); |
133 | } | 134 | } |
134 | }; | 135 | }; |
135 | 136 | ||
136 | class ResourceMimeFactory : public QMimeSourceFactory { | 137 | class ResourceMimeFactory : public QMimeSourceFactory { |
137 | public: | 138 | public: |
138 | ResourceMimeFactory() | 139 | ResourceMimeFactory() |
139 | { | 140 | { |
140 | QStringList path; | 141 | setFilePath( Global::helpPath() ); |
141 | QString lang = getenv("LANG"); | ||
142 | if ( !lang.isEmpty() ) | ||
143 | path += QPEApplication::qpeDir() + "/help/" + lang + "/html"; | ||
144 | path += QPEApplication::qpeDir() + "/pics"; | ||
145 | path += QPEApplication::qpeDir() + "/help/en/html"; | ||
146 | path += QPEApplication::qpeDir() + "/docs"; | ||
147 | QString dir = QDir::current().canonicalPath(); | ||
148 | if ( dir == "/" ) | ||
149 | dir += "/docs"; | ||
150 | else { | ||
151 | path += dir + "/../pics"; | ||
152 | dir += "/../docs"; | ||
153 | path += dir; | ||
154 | } | ||
155 | setFilePath( path ); | ||
156 | setExtensionType("html","text/html;charset=UTF-8"); | 142 | setExtensionType("html","text/html;charset=UTF-8"); |
157 | } | 143 | } |
158 | 144 | ||
159 | const QMimeSource* data(const QString& abs_name) const | 145 | const QMimeSource* data(const QString& abs_name) const |
160 | { | 146 | { |
161 | const QMimeSource* r = QMimeSourceFactory::data(abs_name); | 147 | const QMimeSource* r = QMimeSourceFactory::data(abs_name); |
162 | if ( !r ) { | 148 | if ( !r ) { |
163 | int sl = abs_name.length(); | 149 | int sl = abs_name.length(); |
164 | do { | 150 | do { |
165 | sl = abs_name.findRev('/',sl-1); | 151 | sl = abs_name.findRev('/',sl-1); |
166 | QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name; | 152 | QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name; |
167 | int dot = name.findRev('.'); | 153 | int dot = name.findRev('.'); |
168 | if ( dot >= 0 ) | 154 | if ( dot >= 0 ) |
169 | name = name.left(dot); | 155 | name = name.left(dot); |
170 | QImage img = Resource::loadImage(name); | 156 | QImage img = Resource::loadImage(name); |
171 | if ( !img.isNull() ) | 157 | if ( !img.isNull() ) |
172 | r = new QImageDrag(img); | 158 | r = new QImageDrag(img); |
173 | } while (!r && sl>0); | 159 | } while (!r && sl>0); |
174 | } | 160 | } |
175 | return r; | 161 | return r; |
176 | } | 162 | } |
177 | }; | 163 | }; |
178 | 164 | ||
179 | static int muted=0; | 165 | static int muted=0; |
180 | 166 | ||
181 | static void setVolume(int t=0, int percent=-1) | 167 | static void setVolume(int t=0, int percent=-1) |
182 | { | 168 | { |
183 | switch (t) { | 169 | switch (t) { |
184 | case 0: { | 170 | case 0: { |
185 | Config cfg("Sound"); | 171 | Config cfg("Sound"); |
186 | cfg.setGroup("System"); | 172 | cfg.setGroup("System"); |
187 | if ( percent < 0 ) | 173 | if ( percent < 0 ) |
188 | percent = cfg.readNumEntry("Volume",50); | 174 | percent = cfg.readNumEntry("Volume",50); |
189 | int fd = 0; | 175 | int fd = 0; |
190 | if ((fd = open("/dev/mixer", O_RDWR))>=0) { | 176 | if ((fd = open("/dev/mixer", O_RDWR))>=0) { |
191 | int vol = muted ? 0 : percent; | 177 | int vol = muted ? 0 : percent; |
192 | // set both channels to same volume | 178 | // set both channels to same volume |
193 | vol |= vol << 8; | 179 | vol |= vol << 8; |
194 | ioctl(fd, MIXER_WRITE(0), &vol); | 180 | ioctl(fd, MIXER_WRITE(0), &vol); |
195 | ::close(fd); | 181 | ::close(fd); |
196 | } | 182 | } |
197 | } break; | 183 | } break; |
198 | } | 184 | } |
199 | } | 185 | } |
200 | 186 | ||
201 | int qpe_sysBrightnessSteps() | 187 | int qpe_sysBrightnessSteps() |
202 | { | 188 | { |
203 | #if defined(QT_QWS_IPAQ) | 189 | #if defined(QT_QWS_IPAQ) |
204 | return 255; | 190 | return 255; |
205 | #elif defined(QT_QWS_EBX) | 191 | #elif defined(QT_QWS_EBX) |
206 | return 4; | 192 | return 4; |
207 | #else | 193 | #else |
208 | return 255; // ? | 194 | return 255; // ? |
209 | #endif | 195 | #endif |
210 | } | 196 | } |
211 | 197 | ||
212 | 198 | ||
213 | static int& hack(int& i) | 199 | static int& hack(int& i) |
214 | { | 200 | { |
215 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 201 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
216 | // These should be created, but aren't in Qt 2.3.0 | 202 | // These should be created, but aren't in Qt 2.3.0 |
217 | (void)new QUtf8Codec; | 203 | (void)new QUtf8Codec; |
218 | (void)new QUtf16Codec; | 204 | (void)new QUtf16Codec; |
219 | #endif | 205 | #endif |
220 | return i; | 206 | return i; |
221 | } | 207 | } |
222 | 208 | ||
223 | static bool forced_off = FALSE; | 209 | static bool forced_off = FALSE; |
224 | static int curbl=-1; | 210 | static int curbl=-1; |
225 | 211 | ||
226 | static int backlight() | 212 | static int backlight() |
227 | { | 213 | { |
228 | if ( curbl == -1 ) { | 214 | if ( curbl == -1 ) { |
229 | // Read from config | 215 | // Read from config |
230 | Config config( "qpe" ); | 216 | Config config( "qpe" ); |
231 | config.setGroup( "Screensaver" ); | 217 | config.setGroup( "Screensaver" ); |
232 | curbl = config.readNumEntry("Brightness",255); | 218 | curbl = config.readNumEntry("Brightness",255); |
233 | } | 219 | } |
234 | return curbl; | 220 | return curbl; |
235 | } | 221 | } |
236 | 222 | ||
237 | static void setBacklight(int bright) | 223 | static void setBacklight(int bright) |
238 | { | 224 | { |
239 | if ( bright == -3 ) { | 225 | if ( bright == -3 ) { |
240 | // Forced on | 226 | // Forced on |
241 | forced_off = FALSE; | 227 | forced_off = FALSE; |
242 | bright = -1; | 228 | bright = -1; |
243 | } | 229 | } |
244 | if ( forced_off && bright != -2 ) | 230 | if ( forced_off && bright != -2 ) |
245 | return; | 231 | return; |
246 | if ( bright == -2 ) { | 232 | if ( bright == -2 ) { |
247 | // Toggle between off and on | 233 | // Toggle between off and on |
248 | bright = curbl ? 0 : -1; | 234 | bright = curbl ? 0 : -1; |
249 | forced_off = !bright; | 235 | forced_off = !bright; |
250 | } | 236 | } |
251 | if ( bright == -1 ) { | 237 | if ( bright == -1 ) { |
252 | // Read from config | 238 | // Read from config |
253 | Config config( "qpe" ); | 239 | Config config( "qpe" ); |
254 | config.setGroup( "Screensaver" ); | 240 | config.setGroup( "Screensaver" ); |
255 | bright = config.readNumEntry("Brightness",255); | 241 | bright = config.readNumEntry("Brightness",255); |
256 | } | 242 | } |
257 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 243 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
258 | if ( QFile::exists("/usr/bin/bl") ) { | 244 | if ( QFile::exists("/usr/bin/bl") ) { |
259 | QString cmd = "/usr/bin/bl 1 "; | 245 | QString cmd = "/usr/bin/bl 1 "; |
260 | cmd += bright<=0 ? "0 " : "1 "; | 246 | cmd += bright<=0 ? "0 " : "1 "; |
261 | cmd += QString::number(bright); | 247 | cmd += QString::number(bright); |
262 | system(cmd.latin1()); | 248 | system(cmd.latin1()); |
263 | #if defined(QT_QWS_EBX) | 249 | #if defined(QT_QWS_EBX) |
264 | } else if ( QFile::exists("/dev/fl") ) { | 250 | } else if ( QFile::exists("/dev/fl") ) { |
265 | #define FL_IOCTL_STEP_CONTRAST 100 | 251 | #define FL_IOCTL_STEP_CONTRAST 100 |
266 | int fd = open("/dev/fl", O_WRONLY); | 252 | int fd = open("/dev/fl", O_WRONLY); |
267 | if (fd >= 0 ) { | 253 | if (fd >= 0 ) { |
268 | int steps = qpe_sysBrightnessSteps(); | 254 | int steps = qpe_sysBrightnessSteps(); |
269 | int bl = ( bright * steps + 127 ) / 255; | 255 | int bl = ( bright * steps + 127 ) / 255; |
270 | if ( bright && !bl ) bl = 1; | 256 | if ( bright && !bl ) bl = 1; |
271 | bl = ioctl(fd, FL_IOCTL_STEP_CONTRAST, bl); | 257 | bl = ioctl(fd, FL_IOCTL_STEP_CONTRAST, bl); |
272 | close(fd); | 258 | close(fd); |
273 | } | 259 | } |
274 | } | 260 | } |
275 | #elif defined(QT_QWS_IPAQ) | 261 | #elif defined(QT_QWS_IPAQ) |
276 | } else if ( QFile::exists("/dev/ts") || QFile::exists("/dev/h3600_ts") ) { | 262 | } else if ( QFile::exists("/dev/ts") || QFile::exists("/dev/h3600_ts") ) { |
277 | typedef struct { | 263 | typedef struct { |
278 | unsigned char mode; | 264 | unsigned char mode; |
279 | unsigned char pwr; | 265 | unsigned char pwr; |
280 | unsigned char brightness; | 266 | unsigned char brightness; |
281 | } FLITE_IN; | 267 | } FLITE_IN; |
282 | # ifndef FLITE_ON | 268 | # ifndef FLITE_ON |
283 | # ifndef _LINUX_IOCTL_H | 269 | # ifndef _LINUX_IOCTL_H |
284 | # include <linux/ioctl.h> | 270 | # include <linux/ioctl.h> |
285 | # endif | 271 | # endif |
286 | # define FLITE_ON _IOW('f', 7, FLITE_IN) | 272 | # define FLITE_ON _IOW('f', 7, FLITE_IN) |
287 | # endif | 273 | # endif |
288 | int fd; | 274 | int fd; |
289 | if ( QFile::exists("/dev/ts") ) | 275 | if ( QFile::exists("/dev/ts") ) |
290 | fd = open("/dev/ts", O_WRONLY); | 276 | fd = open("/dev/ts", O_WRONLY); |
291 | else | 277 | else |
292 | fd = open("/dev/h3600_ts", O_WRONLY); | 278 | fd = open("/dev/h3600_ts", O_WRONLY); |
293 | if (fd >= 0 ) { | 279 | if (fd >= 0 ) { |
294 | FLITE_IN bl; | 280 | FLITE_IN bl; |
295 | bl.mode = 1; | 281 | bl.mode = 1; |
296 | bl.pwr = bright ? 1 : 0; | 282 | bl.pwr = bright ? 1 : 0; |
297 | bl.brightness = bright; | 283 | bl.brightness = bright; |
298 | ioctl(fd, FLITE_ON, &bl); | 284 | ioctl(fd, FLITE_ON, &bl); |
299 | close(fd); | 285 | close(fd); |
300 | } | 286 | } |
301 | } | 287 | } |
302 | #endif | 288 | #endif |
303 | #endif | 289 | #endif |
304 | curbl = bright; | 290 | curbl = bright; |
305 | } | 291 | } |
306 | 292 | ||
307 | void qpe_setBacklight(int bright) { setBacklight(bright); } | 293 | void qpe_setBacklight(int bright) { setBacklight(bright); } |
308 | 294 | ||
309 | static bool dim_on = FALSE; | 295 | static bool dim_on = FALSE; |
310 | static bool lightoff_on = FALSE; | 296 | static bool lightoff_on = FALSE; |
311 | static int disable_suspend = 100; | 297 | static int disable_suspend = 100; |
312 | 298 | ||
313 | static bool powerOnline() | 299 | static bool powerOnline() |
314 | { | 300 | { |
315 | return PowerStatusManager::readStatus().acStatus() == PowerStatus::Online; | 301 | return PowerStatusManager::readStatus().acStatus() == PowerStatus::Online; |
316 | } | 302 | } |
317 | 303 | ||
318 | static bool networkOnline() | 304 | static bool networkOnline() |
319 | { | 305 | { |
320 | return Network::networkOnline(); | 306 | return Network::networkOnline(); |
321 | } | 307 | } |
322 | 308 | ||
323 | class QPEScreenSaver : public QWSScreenSaver | 309 | class QPEScreenSaver : public QWSScreenSaver |
324 | { | 310 | { |
325 | 311 | ||
326 | public: | 312 | public: |
327 | QPEScreenSaver() | 313 | QPEScreenSaver() |
328 | { | 314 | { |
329 | } | 315 | } |
330 | void restore() | 316 | void restore() |
331 | { | 317 | { |
332 | setBacklight(-1); | 318 | setBacklight(-1); |
333 | } | 319 | } |
334 | bool save(int level) | 320 | bool save(int level) |
335 | { | 321 | { |
336 | switch ( level ) { | 322 | switch ( level ) { |
337 | case 0: | 323 | case 0: |
338 | if ( disable_suspend > 0 && dim_on ) { | 324 | if ( disable_suspend > 0 && dim_on ) { |
339 | if (backlight() > 1) | 325 | if (backlight() > 1) |
340 | setBacklight(1); // lowest non-off | 326 | setBacklight(1); // lowest non-off |
341 | } | 327 | } |
342 | return TRUE; | 328 | return TRUE; |
343 | break; | 329 | break; |
344 | case 1: | 330 | case 1: |
345 | if ( disable_suspend > 1 && lightoff_on ) { | 331 | if ( disable_suspend > 1 && lightoff_on ) { |
346 | setBacklight(0); // off | 332 | setBacklight(0); // off |
347 | } | 333 | } |
348 | return TRUE; | 334 | return TRUE; |
349 | break; | 335 | break; |
350 | case 2: | 336 | case 2: |
351 | if ( disable_suspend > 2 && !powerOnline() && !networkOnline() ) { | 337 | if ( disable_suspend > 2 && !powerOnline() && !networkOnline() ) { |
352 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 338 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
353 | return TRUE; | 339 | return TRUE; |
354 | } | 340 | } |
355 | break; | 341 | break; |
356 | } | 342 | } |
357 | return FALSE; | 343 | return FALSE; |
358 | } | 344 | } |
359 | }; | 345 | }; |
360 | 346 | ||
361 | static int ssi(int interval, Config &config, const QString &enable, const QString& value, int def) | 347 | static int ssi(int interval, Config &config, const QString &enable, const QString& value, int def) |
362 | { | 348 | { |
363 | if ( !enable.isEmpty() && config.readNumEntry(enable,0) == 0 ) | 349 | if ( !enable.isEmpty() && config.readNumEntry(enable,0) == 0 ) |
364 | return 0; | 350 | return 0; |
365 | 351 | ||
366 | if ( interval < 0 ) { | 352 | if ( interval < 0 ) { |
367 | // Restore screen blanking and power saving state | 353 | // Restore screen blanking and power saving state |
368 | interval = config.readNumEntry( value, def ); | 354 | interval = config.readNumEntry( value, def ); |
369 | } | 355 | } |
370 | return interval; | 356 | return interval; |
371 | } | 357 | } |
372 | 358 | ||
373 | static void setScreenSaverIntervals(int i1, int i2, int i3) | 359 | static void setScreenSaverIntervals(int i1, int i2, int i3) |
374 | { | 360 | { |
375 | Config config( "qpe" ); | 361 | Config config( "qpe" ); |
376 | config.setGroup( "Screensaver" ); | 362 | config.setGroup( "Screensaver" ); |
377 | 363 | ||
378 | int v[4]; | 364 | int v[4]; |
379 | i1 = ssi(i1, config, "Dim","Interval_Dim", 30); | 365 | i1 = ssi(i1, config, "Dim","Interval_Dim", 30); |
380 | i2 = ssi(i2, config, "LightOff","Interval_LightOff", 20); | 366 | i2 = ssi(i2, config, "LightOff","Interval_LightOff", 20); |
381 | i3 = ssi(i3, config, "","Interval", 60); | 367 | i3 = ssi(i3, config, "","Interval", 60); |
382 | 368 | ||
383 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); | 369 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); |
384 | 370 | ||
385 | v[0] = QMAX( 1000*i1, 100); | 371 | v[0] = QMAX( 1000*i1, 100); |
386 | v[1] = QMAX( 1000*i2, 100); | 372 | v[1] = QMAX( 1000*i2, 100); |
387 | v[2] = QMAX( 1000*i3, 100); | 373 | v[2] = QMAX( 1000*i3, 100); |
388 | v[3] = 0; | 374 | v[3] = 0; |
389 | dim_on = ( (i1 != 0) ? config.readNumEntry("Dim",1) : FALSE ); | 375 | dim_on = ( (i1 != 0) ? config.readNumEntry("Dim",1) : FALSE ); |
390 | lightoff_on = ( (i2 != 0 ) ? config.readNumEntry("LightOff",1) : FALSE ); | 376 | lightoff_on = ( (i2 != 0 ) ? config.readNumEntry("LightOff",1) : FALSE ); |
391 | if ( !i1 && !i2 && !i3 ) | 377 | if ( !i1 && !i2 && !i3 ) |
392 | QWSServer::setScreenSaverInterval(0); | 378 | QWSServer::setScreenSaverInterval(0); |
393 | else | 379 | else |
394 | QWSServer::setScreenSaverIntervals(v); | 380 | QWSServer::setScreenSaverIntervals(v); |
395 | } | 381 | } |
396 | 382 | ||
397 | static void setScreenSaverInterval(int interval) | 383 | static void setScreenSaverInterval(int interval) |
398 | { | 384 | { |
399 | setScreenSaverIntervals(-1,-1,interval); | 385 | setScreenSaverIntervals(-1,-1,interval); |
400 | } | 386 | } |
401 | 387 | ||
402 | 388 | ||
403 | /*! | 389 | /*! |
404 | \class QPEApplication qpeapplication.h | 390 | \class QPEApplication qpeapplication.h |
405 | \brief The QPEApplication class implements various system services | 391 | \brief The QPEApplication class implements various system services |
406 | that are available to all Qtopia applications. | 392 | that are available to all Qtopia applications. |
407 | 393 | ||
408 | Simply by using QPEApplication instead of QApplication, a plain Qt | 394 | Simply by using QPEApplication instead of QApplication, a plain Qt |
409 | application becomes a Qtopia application. It automatically follows | 395 | application becomes a Qtopia application. It automatically follows |
410 | style changes, quits and raises, and in the | 396 | style changes, quits and raises, and in the |
411 | case of \link docwidget.html document-oriented\endlink applications, | 397 | case of \link docwidget.html document-oriented\endlink applications, |
412 | changes the current displayed document in response to the environment. | 398 | changes the current displayed document in response to the environment. |
413 | */ | 399 | */ |
414 | 400 | ||
415 | /*! | 401 | /*! |
416 | \fn void QPEApplication::clientMoused() | 402 | \fn void QPEApplication::clientMoused() |
417 | 403 | ||
418 | \internal | 404 | \internal |
419 | */ | 405 | */ |
420 | 406 | ||
421 | /*! | 407 | /*! |
422 | \fn void QPEApplication::timeChanged(); | 408 | \fn void QPEApplication::timeChanged(); |
423 | 409 | ||
424 | This signal is emitted when the time jumps forward or backwards | 410 | This signal is emitted when the time jumps forward or backwards |
425 | by more than the normal passage of time. | 411 | by more than the normal passage of time. |
426 | */ | 412 | */ |
427 | 413 | ||
428 | /*! | 414 | /*! |
429 | \fn void QPEApplication::clockChanged( bool ampm ); | 415 | \fn void QPEApplication::clockChanged( bool ampm ); |
430 | 416 | ||
431 | This signal is emitted when the user changes the style | 417 | This signal is emitted when the user changes the style |
432 | of clock. If \a ampm is TRUE, the user wants a 12-hour | 418 | of clock. If \a ampm is TRUE, the user wants a 12-hour |
433 | AM/PM close, otherwise, they want a 24-hour clock. | 419 | AM/PM close, otherwise, they want a 24-hour clock. |
434 | */ | 420 | */ |
435 | 421 | ||
436 | /*! | 422 | /*! |
437 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 423 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
438 | 424 | ||
439 | This signal is emitted when a message is received on the | 425 | This signal is emitted when a message is received on the |
440 | QPE/Application/<i>appname</i> QCop channel for this application. | 426 | QPE/Application/<i>appname</i> QCop channel for this application. |
441 | 427 | ||
442 | The slot to which you connect this signal uses \a msg and \a data | 428 | The slot to which you connect this signal uses \a msg and \a data |
443 | in the following way: | 429 | in the following way: |
444 | 430 | ||
445 | \code | 431 | \code |
446 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 432 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
447 | { | 433 | { |
448 | QDataStream stream( data, IO_ReadOnly ); | 434 | QDataStream stream( data, IO_ReadOnly ); |
449 | if ( msg == "someMessage(int,int,int)" ) { | 435 | if ( msg == "someMessage(int,int,int)" ) { |
450 | int a,b,c; | 436 | int a,b,c; |
451 | stream >> a >> b >> c; | 437 | stream >> a >> b >> c; |
452 | ... | 438 | ... |
453 | } else if ( msg == "otherMessage(QString)" ) { | 439 | } else if ( msg == "otherMessage(QString)" ) { |
454 | ... | 440 | ... |
455 | } | 441 | } |
456 | } | 442 | } |
457 | \endcode | 443 | \endcode |
458 | 444 | ||
459 | \sa qcop.html | 445 | \sa qcop.html |
460 | */ | 446 | */ |
461 | 447 | ||
462 | /*! | 448 | /*! |
463 | Constructs a QPEApplication just as you would construct | 449 | Constructs a QPEApplication just as you would construct |
464 | a QApplication, passing \a argc, \a argv, and \a t. | 450 | a QApplication, passing \a argc, \a argv, and \a t. |
465 | */ | 451 | */ |
466 | QPEApplication::QPEApplication( int& argc, char **argv, Type t ) | 452 | QPEApplication::QPEApplication( int& argc, char **argv, Type t ) |
467 | : QApplication( hack(argc), argv, t ) | 453 | : QApplication( hack(argc), argv, t ) |
468 | { | 454 | { |
469 | int dw = desktop()->width(); | 455 | int dw = desktop()->width(); |
470 | if ( dw < 200 ) { | 456 | if ( dw < 200 ) { |
471 | setFont( QFont( "helvetica", 8 ) ); | 457 | setFont( QFont( "helvetica", 8 ) ); |
472 | AppLnk::setSmallIconSize(10); | 458 | AppLnk::setSmallIconSize(10); |
473 | AppLnk::setBigIconSize(28); | 459 | AppLnk::setBigIconSize(28); |
474 | } | 460 | } |
475 | 461 | ||
476 | d = new QPEApplicationData; | 462 | d = new QPEApplicationData; |
477 | QMimeSourceFactory::setDefaultFactory(new ResourceMimeFactory); | 463 | QMimeSourceFactory::setDefaultFactory(new ResourceMimeFactory); |
478 | 464 | ||
479 | connect(this, SIGNAL(lastWindowClosed()), this, SLOT(hideOrQuit())); | 465 | connect(this, SIGNAL(lastWindowClosed()), this, SLOT(hideOrQuit())); |
480 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 466 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
481 | 467 | ||
482 | QString qcopfn("/tmp/qcop-msg-"); | 468 | QString qcopfn("/tmp/qcop-msg-"); |
483 | qcopfn += QString(argv[0]); // append command name | 469 | qcopfn += QString(argv[0]); // append command name |
484 | 470 | ||
485 | QFile f(qcopfn); | 471 | QFile f(qcopfn); |
486 | if ( f.open(IO_ReadOnly) ) { | 472 | if ( f.open(IO_ReadOnly) ) { |
487 | flock(f.handle(), LOCK_EX); | 473 | flock(f.handle(), LOCK_EX); |
488 | } | 474 | } |
489 | 475 | ||
490 | sysChannel = new QCopChannel( "QPE/System", this ); | 476 | sysChannel = new QCopChannel( "QPE/System", this ); |
491 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 477 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
492 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 478 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
493 | 479 | ||
494 | QCString channel = QCString(argv[0]); | 480 | QCString channel = QCString(argv[0]); |
495 | channel.replace(QRegExp(".*/"),""); | 481 | channel.replace(QRegExp(".*/"),""); |
496 | d->appName = channel; | 482 | d->appName = channel; |
497 | channel = "QPE/Application/" + channel; | 483 | channel = "QPE/Application/" + channel; |
498 | pidChannel = new QCopChannel( channel, this); | 484 | pidChannel = new QCopChannel( channel, this); |
499 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 485 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
500 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); | 486 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); |
501 | 487 | ||
502 | if ( f.isOpen() ) { | 488 | if ( f.isOpen() ) { |
503 | d->keep_running = FALSE; | 489 | d->keep_running = FALSE; |
504 | QDataStream ds(&f); | 490 | QDataStream ds(&f); |
505 | QCString channel, message; | 491 | QCString channel, message; |
506 | QByteArray data; | 492 | QByteArray data; |
507 | while(!ds.atEnd()) { | 493 | while(!ds.atEnd()) { |
508 | ds >> channel >> message >> data; | 494 | ds >> channel >> message >> data; |
509 | d->enqueueQCop(channel,message,data); | 495 | d->enqueueQCop(channel,message,data); |
510 | } | 496 | } |
511 | 497 | ||
512 | flock(f.handle(), LOCK_UN); | 498 | flock(f.handle(), LOCK_UN); |
513 | f.close(); | 499 | f.close(); |
514 | f.remove(); | 500 | f.remove(); |
515 | } | 501 | } |
516 | 502 | ||
517 | for (int a=0; a<argc; a++) { | 503 | for (int a=0; a<argc; a++) { |
518 | if ( qstrcmp(argv[a],"-preload")==0 ) { | 504 | if ( qstrcmp(argv[a],"-preload")==0 ) { |
519 | argv[a] = argv[a+1]; | 505 | argv[a] = argv[a+1]; |
520 | a++; | 506 | a++; |
521 | d->preloaded = TRUE; | 507 | d->preloaded = TRUE; |
522 | argc-=1; | 508 | argc-=1; |
523 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { | 509 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { |
524 | argv[a] = argv[a+1]; | 510 | argv[a] = argv[a+1]; |
525 | a++; | 511 | a++; |
526 | d->preloaded = TRUE; | 512 | d->preloaded = TRUE; |
527 | d->forceshow = TRUE; | 513 | d->forceshow = TRUE; |
528 | argc-=1; | 514 | argc-=1; |
529 | } | 515 | } |
530 | } | 516 | } |
531 | 517 | ||
532 | /* overide stored arguments */ | 518 | /* overide stored arguments */ |
533 | setArgs(argc, argv); | 519 | setArgs(argc, argv); |
534 | 520 | ||
535 | #endif | 521 | #endif |
536 | 522 | ||
537 | qwsSetDecoration( new QPEDecoration() ); | 523 | qwsSetDecoration( new QPEDecoration() ); |
538 | 524 | ||
539 | #ifndef QT_NO_TRANSLATION | 525 | #ifndef QT_NO_TRANSLATION |
540 | char *l = getenv( "LANG" ); | 526 | QStringList langs = Global::languageList(); |
541 | QString lang; | 527 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { |
542 | if ( l ) { | 528 | QString lang = *it; |
543 | lang = l; | ||
544 | 529 | ||
545 | /* | 530 | QTranslator * trans; |
546 | Config config("qpe"); | 531 | QString tfn; |
547 | config.setGroup( "Appearance" ); | ||
548 | lang = config.readEntry( "Language", lang ); | ||
549 | */ | ||
550 | 532 | ||
551 | QTranslator * trans = new QTranslator(this); | 533 | trans = new QTranslator(this); |
552 | QString tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; | 534 | tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm"; |
553 | if ( trans->load( tfn )) | 535 | if ( trans->load( tfn )) |
554 | installTranslator( trans ); | 536 | installTranslator( trans ); |
555 | else | 537 | else |
556 | delete trans; | 538 | delete trans; |
557 | 539 | ||
558 | trans = new QTranslator(this); | 540 | trans = new QTranslator(this); |
559 | tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm"; | 541 | tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; |
560 | if ( trans->load( tfn )) | 542 | if ( trans->load( tfn )) |
561 | installTranslator( trans ); | 543 | installTranslator( trans ); |
562 | else | 544 | else |
563 | delete trans; | 545 | delete trans; |
564 | 546 | ||
565 | //###language/font hack; should look it up somewhere | 547 | //###language/font hack; should look it up somewhere |
566 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 548 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
567 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 549 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
568 | setFont( fn ); | 550 | setFont( fn ); |
569 | } | 551 | } |
570 | } | 552 | } |
571 | #endif | 553 | #endif |
572 | 554 | ||
573 | applyStyle(); | 555 | applyStyle(); |
574 | 556 | ||
575 | if ( type() == GuiServer ) { | 557 | if ( type() == GuiServer ) { |
576 | setScreenSaverInterval(-1); | 558 | setScreenSaverInterval(-1); |
577 | setVolume(); | 559 | setVolume(); |
578 | QWSServer::setScreenSaver(new QPEScreenSaver); | 560 | QWSServer::setScreenSaver(new QPEScreenSaver); |
579 | } | 561 | } |
580 | 562 | ||
581 | installEventFilter( this ); | 563 | installEventFilter( this ); |
582 | 564 | ||
583 | QPEMenuToolFocusManager::initialize(); | 565 | QPEMenuToolFocusManager::initialize(); |
584 | 566 | ||
585 | #ifdef QT_NO_QWS_CURSOR | 567 | #ifdef QT_NO_QWS_CURSOR |
586 | // if we have no cursor, probably don't want tooltips | 568 | // if we have no cursor, probably don't want tooltips |
587 | QToolTip::setEnabled( FALSE ); | 569 | QToolTip::setEnabled( FALSE ); |
588 | #endif | 570 | #endif |
589 | } | 571 | } |
590 | 572 | ||
591 | static QPtrDict<void>* inputMethodDict=0; | 573 | static QPtrDict<void>* inputMethodDict=0; |
592 | static void createInputMethodDict() | 574 | static void createInputMethodDict() |
593 | { | 575 | { |
594 | if ( !inputMethodDict ) | 576 | if ( !inputMethodDict ) |
595 | inputMethodDict = new QPtrDict<void>; | 577 | inputMethodDict = new QPtrDict<void>; |
596 | } | 578 | } |
597 | 579 | ||
598 | /*! | 580 | /*! |
599 | Returns the currently set hint to the system as to whether | 581 | Returns the currently set hint to the system as to whether |
600 | \a w has any use for text input methods. | 582 | \a w has any use for text input methods. |
601 | 583 | ||
602 | \sa setInputMethodHint() | 584 | \sa setInputMethodHint() |
603 | */ | 585 | */ |
604 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w ) | 586 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w ) |
605 | { | 587 | { |
606 | if ( inputMethodDict && w ) | 588 | if ( inputMethodDict && w ) |
607 | return (InputMethodHint)(int)inputMethodDict->find(w); | 589 | return (InputMethodHint)(int)inputMethodDict->find(w); |
608 | return Normal; | 590 | return Normal; |
609 | } | 591 | } |
610 | 592 | ||
611 | /*! | 593 | /*! |
612 | \enum QPEApplication::InputMethodHint | 594 | \enum QPEApplication::InputMethodHint |
613 | 595 | ||
614 | \value Normal the application sometimes needs text input (the default). | 596 | \value Normal the application sometimes needs text input (the default). |
615 | \value AlwaysOff the application never needs text input. | 597 | \value AlwaysOff the application never needs text input. |
616 | \value AlwaysOn the application always needs text input. | 598 | \value AlwaysOn the application always needs text input. |
617 | */ | 599 | */ |
618 | 600 | ||
619 | /*! | 601 | /*! |
620 | Hints to the system that \a w has use for text input methods | 602 | Hints to the system that \a w has use for text input methods |
621 | as specified by \a mode. | 603 | as specified by \a mode. |
622 | 604 | ||
623 | \sa inputMethodHint() | 605 | \sa inputMethodHint() |
624 | */ | 606 | */ |
625 | void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) | 607 | void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) |
626 | { | 608 | { |
627 | createInputMethodDict(); | 609 | createInputMethodDict(); |
628 | if ( mode == Normal ) { | 610 | if ( mode == Normal ) { |
629 | inputMethodDict->remove(w); | 611 | inputMethodDict->remove(w); |
630 | } else { | 612 | } else { |
631 | inputMethodDict->insert(w,(void*)mode); | 613 | inputMethodDict->insert(w,(void*)mode); |
632 | } | 614 | } |
633 | } | 615 | } |
634 | 616 | ||
635 | class HackDialog : public QDialog | 617 | class HackDialog : public QDialog |
636 | { | 618 | { |
637 | public: | 619 | public: |
638 | void acceptIt() { accept(); } | 620 | void acceptIt() { accept(); } |
639 | void rejectIt() { reject(); } | 621 | void rejectIt() { reject(); } |
640 | }; | 622 | }; |
641 | 623 | ||
642 | 624 | ||
643 | void QPEApplication::mapToDefaultAction( QWSKeyEvent *ke, int key ) | 625 | void QPEApplication::mapToDefaultAction( QWSKeyEvent *ke, int key ) |
644 | { | 626 | { |
645 | // specialised actions for certain widgets. May want to | 627 | // specialised actions for certain widgets. May want to |
646 | // add more stuff here. | 628 | // add more stuff here. |
647 | if ( activePopupWidget() && activePopupWidget()->inherits( "QListBox" ) | 629 | if ( activePopupWidget() && activePopupWidget()->inherits( "QListBox" ) |
648 | && activePopupWidget()->parentWidget() | 630 | && activePopupWidget()->parentWidget() |
649 | && activePopupWidget()->parentWidget()->inherits( "QComboBox" ) ) | 631 | && activePopupWidget()->parentWidget()->inherits( "QComboBox" ) ) |
650 | key = Qt::Key_Return; | 632 | key = Qt::Key_Return; |
651 | 633 | ||
652 | if ( activePopupWidget() && activePopupWidget()->inherits( "QPopupMenu" ) ) | 634 | if ( activePopupWidget() && activePopupWidget()->inherits( "QPopupMenu" ) ) |
653 | key = Qt::Key_Return; | 635 | key = Qt::Key_Return; |
654 | 636 | ||
655 | ke->simpleData.keycode = key; | 637 | ke->simpleData.keycode = key; |
656 | } | 638 | } |
657 | 639 | ||
658 | class HackWidget : public QWidget | 640 | class HackWidget : public QWidget |
659 | { | 641 | { |
660 | public: | 642 | public: |
661 | bool needsOk() | 643 | bool needsOk() |
662 | { return (getWState() & WState_Reserved1 ); } | 644 | { return (getWState() & WState_Reserved1 ); } |
663 | }; | 645 | }; |
664 | 646 | ||
665 | /*! | 647 | /*! |
666 | \internal | 648 | \internal |
667 | */ | 649 | */ |
668 | bool QPEApplication::qwsEventFilter( QWSEvent *e ) | 650 | bool QPEApplication::qwsEventFilter( QWSEvent *e ) |
669 | { | 651 | { |
670 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { | 652 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { |
671 | if ( qApp->type() != QApplication::GuiServer ) { | 653 | if ( qApp->type() != QApplication::GuiServer ) { |
672 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 654 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
673 | e << d->appName; | 655 | e << d->appName; |
674 | } | 656 | } |
675 | d->notbusysent=TRUE; | 657 | d->notbusysent=TRUE; |
676 | } | 658 | } |
677 | if ( type() == GuiServer ) { | 659 | if ( type() == GuiServer ) { |
678 | switch ( e->type ) { | 660 | switch ( e->type ) { |
679 | case QWSEvent::Mouse: | 661 | case QWSEvent::Mouse: |
680 | if ( e->asMouse()->simpleData.state && !QWidget::find(e->window()) ) | 662 | if ( e->asMouse()->simpleData.state && !QWidget::find(e->window()) ) |
681 | emit clientMoused(); | 663 | emit clientMoused(); |
682 | } | 664 | } |
683 | } | 665 | } |
684 | if ( e->type == QWSEvent::Key ) { | 666 | if ( e->type == QWSEvent::Key ) { |
685 | if ( d->kbgrabber == 1 ) | 667 | if ( d->kbgrabber == 1 ) |
686 | return TRUE; | 668 | return TRUE; |
687 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 669 | QWSKeyEvent *ke = (QWSKeyEvent *)e; |
688 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { | 670 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { |
689 | // Use special "OK" key to press "OK" on top level widgets | 671 | // Use special "OK" key to press "OK" on top level widgets |
690 | QWidget *active = activeWindow(); | 672 | QWidget *active = activeWindow(); |
691 | QWidget *popup = 0; | 673 | QWidget *popup = 0; |
692 | if ( active && active->isPopup() ) { | 674 | if ( active && active->isPopup() ) { |
693 | popup = active; | 675 | popup = active; |
694 | active = active->parentWidget(); | 676 | active = active->parentWidget(); |
695 | } | 677 | } |
696 | if ( active && (int)active->winId() == ke->simpleData.window && | 678 | if ( active && (int)active->winId() == ke->simpleData.window && |
697 | !active->testWFlags( WStyle_Customize|WType_Popup|WType_Desktop )) { | 679 | !active->testWFlags( WStyle_Customize|WType_Popup|WType_Desktop )) { |
698 | if ( ke->simpleData.is_press ) { | 680 | if ( ke->simpleData.is_press ) { |
699 | if ( popup ) | 681 | if ( popup ) |
700 | popup->close(); | 682 | popup->close(); |
701 | if ( active->inherits( "QDialog" ) ) { | 683 | if ( active->inherits( "QDialog" ) ) { |
702 | HackDialog *d = (HackDialog *)active; | 684 | HackDialog *d = (HackDialog *)active; |
703 | d->acceptIt(); | 685 | d->acceptIt(); |
704 | return TRUE; | 686 | return TRUE; |
705 | } else if ( ((HackWidget *)active)->needsOk() ) { | 687 | } else if ( ((HackWidget *)active)->needsOk() ) { |
706 | QSignal s; | 688 | QSignal s; |
707 | s.connect( active, SLOT( accept() ) ); | 689 | s.connect( active, SLOT( accept() ) ); |
708 | s.activate(); | 690 | s.activate(); |
709 | } else { | 691 | } else { |
710 | // do the same as with the select key: Map to the default action of the widget: | 692 | // do the same as with the select key: Map to the default action of the widget: |
711 | mapToDefaultAction( ke, Qt::Key_Return ); | 693 | mapToDefaultAction( ke, Qt::Key_Return ); |
712 | } | 694 | } |
713 | } | 695 | } |
714 | } | 696 | } |
715 | } else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 697 | } else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
716 | // Use special "select" key to do whatever default action a widget has | 698 | // Use special "select" key to do whatever default action a widget has |
717 | mapToDefaultAction( ke, Qt::Key_Space ); | 699 | mapToDefaultAction( ke, Qt::Key_Space ); |
718 | } else if ( ke->simpleData.keycode == Qt::Key_Escape && | 700 | } else if ( ke->simpleData.keycode == Qt::Key_Escape && |
719 | ke->simpleData.is_press ) { | 701 | ke->simpleData.is_press ) { |
720 | // Escape key closes app if focus on toplevel | 702 | // Escape key closes app if focus on toplevel |
721 | QWidget *active = activeWindow(); | 703 | QWidget *active = activeWindow(); |
722 | if ( active && active->testWFlags( WType_TopLevel ) && | 704 | if ( active && active->testWFlags( WType_TopLevel ) && |
723 | (int)active->winId() == ke->simpleData.window && | 705 | (int)active->winId() == ke->simpleData.window && |
724 | !active->testWFlags( WStyle_Dialog|WStyle_Customize|WType_Popup|WType_Desktop )) { | 706 | !active->testWFlags( WStyle_Dialog|WStyle_Customize|WType_Popup|WType_Desktop )) { |
725 | if ( active->inherits( "QDialog" ) ) { | 707 | if ( active->inherits( "QDialog" ) ) { |
726 | HackDialog *d = (HackDialog *)active; | 708 | HackDialog *d = (HackDialog *)active; |
727 | d->rejectIt(); | 709 | d->rejectIt(); |
728 | return TRUE; | 710 | return TRUE; |
729 | } else if ( strcmp( argv()[0], "embeddedkonsole") != 0 ) { | 711 | } else if ( strcmp( argv()[0], "embeddedkonsole") != 0 ) { |
730 | active->close(); | 712 | active->close(); |
731 | } | 713 | } |
732 | } | 714 | } |
733 | } | 715 | } |
734 | 716 | ||
735 | #if QT_VERSION < 231 | 717 | #if QT_VERSION < 231 |
736 | // Filter out the F4/Launcher key from apps | 718 | // Filter out the F4/Launcher key from apps |
737 | // ### The launcher key may not always be F4 on all devices | 719 | // ### The launcher key may not always be F4 on all devices |
738 | if ( ((QWSKeyEvent *)e)->simpleData.keycode == Qt::Key_F4 ) | 720 | if ( ((QWSKeyEvent *)e)->simpleData.keycode == Qt::Key_F4 ) |
739 | return TRUE; | 721 | return TRUE; |
740 | #endif | 722 | #endif |
741 | } | 723 | } |
742 | if ( e->type == QWSEvent::Focus ) { | 724 | if ( e->type == QWSEvent::Focus ) { |
743 | QWSFocusEvent *fe = (QWSFocusEvent*)e; | 725 | QWSFocusEvent *fe = (QWSFocusEvent*)e; |
744 | QWidget* nfw = QWidget::find(e->window()); | 726 | QWidget* nfw = QWidget::find(e->window()); |
745 | if ( !fe->simpleData.get_focus ) { | 727 | if ( !fe->simpleData.get_focus ) { |
746 | QWidget *active = activeWindow(); | 728 | QWidget *active = activeWindow(); |
747 | while ( active && active->isPopup() ) { | 729 | while ( active && active->isPopup() ) { |
748 | active->close(); | 730 | active->close(); |
749 | active = activeWindow(); | 731 | active = activeWindow(); |
750 | } | 732 | } |
751 | if ( !nfw && d->kbgrabber == 2 ) { | 733 | if ( !nfw && d->kbgrabber == 2 ) { |
752 | ungrabKeyboard(); | 734 | ungrabKeyboard(); |
753 | d->kbregrab = TRUE; // want kb back when we're active | 735 | d->kbregrab = TRUE; // want kb back when we're active |
754 | } | 736 | } |
755 | } else { | 737 | } else { |
756 | // make sure our modal widget is ALWAYS on top | 738 | // make sure our modal widget is ALWAYS on top |
757 | QWidget *topm = activeModalWidget(); | 739 | QWidget *topm = activeModalWidget(); |
@@ -1,221 +1,221 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | QTE_VERSION=2.3.2 | 3 | QTE_VERSION=2.3.2 |
4 | DEB_VERSION=2.0 | 4 | DEB_VERSION=2.0 |
5 | 5 | ||
6 | # Have to do this here, since CVS can't store symlinks | 6 | # Have to do this here, since CVS can't store symlinks |
7 | mkdir -p etc/rc2.d | 7 | mkdir -p etc/rc2.d |
8 | rm -f etc/rc2.d/S98qpe | 8 | rm -f etc/rc2.d/S98qpe |
9 | ln -s ../init.d/qpe etc/rc2.d/S98qpe | 9 | ln -s ../init.d/qpe etc/rc2.d/S98qpe |
10 | 10 | ||
11 | VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) | 11 | VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) |
12 | VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) | 12 | VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) |
13 | VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$OPIEDIR/include/qpe/version.h) | 13 | VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$OPIEDIR/include/qpe/version.h) |
14 | SUB_VERSION=$(sed -n -e 's,.*SUB_VERSION \"\(.*\)\".*,\1,p' <$OPIEDIR/include/qpe/version.h) | 14 | SUB_VERSION=$(sed -n -e 's,.*SUB_VERSION \"\(.*\)\".*,\1,p' <$OPIEDIR/include/qpe/version.h) |
15 | if grep -q 'QPE_VERSION .*snapshot' $OPIEDIR/include/qpe/version.h | 15 | if grep -q 'QPE_VERSION .*snapshot' $OPIEDIR/include/qpe/version.h |
16 | then | 16 | then |
17 | VERSION_CVS="_$(date +%Y%m%d)" | 17 | VERSION_CVS="_$(date +%Y%m%d)" |
18 | else | 18 | else |
19 | VERSION_CVS="" | 19 | VERSION_CVS="" |
20 | fi | 20 | fi |
21 | 21 | ||
22 | QPE_VERSION=$VERSION_MAJ.$VERSION_MIN.$VERSION_PAT | 22 | QPE_VERSION=$VERSION_MAJ.$VERSION_MIN.$VERSION_PAT |
23 | 23 | ||
24 | ARCH=arm | 24 | ARCH=arm |
25 | STRIP=arm-linux-strip | 25 | STRIP=arm-linux-strip |
26 | STRIP_FILES="*Advanced RISC Machines ARM*not stripped" | 26 | STRIP_FILES="*Advanced RISC Machines ARM*not stripped" |
27 | 27 | ||
28 | TDIR=/tmp/ipk$$ | 28 | TDIR=/tmp/ipk$$ |
29 | DATADIR=$TDIR/data | 29 | DATADIR=$TDIR/data |
30 | CTRLDIR=$TDIR/control | 30 | CTRLDIR=$TDIR/control |
31 | 31 | ||
32 | IMAGEDIR= | 32 | IMAGEDIR= |
33 | VERB= | 33 | VERB= |
34 | LIST= | 34 | LIST= |
35 | RPM= | 35 | RPM= |
36 | 36 | ||
37 | while [ $# -ne 0 ] | 37 | while [ $# -ne 0 ] |
38 | do | 38 | do |
39 | case "$1" in | 39 | case "$1" in |
40 | -v) | 40 | -v) |
41 | VERB=1 | 41 | VERB=1 |
42 | echo >&2 "Packaging for version $VERSION_MAJ.$VERSION_MIN.$VERSION_PAT$VERSION_CVS" | 42 | echo >&2 "Packaging for version $VERSION_MAJ.$VERSION_MIN.$VERSION_PAT$VERSION_CVS" |
43 | ;; -l) | 43 | ;; -l) |
44 | LIST=1 | 44 | LIST=1 |
45 | ;; -i) | 45 | ;; -i) |
46 | shift | 46 | shift |
47 | IMAGEDIR=$1 | 47 | IMAGEDIR=$1 |
48 | DATADIR=$IMAGEDIR | 48 | DATADIR=$IMAGEDIR |
49 | mkdir -p $IMAGEDIR | 49 | mkdir -p $IMAGEDIR |
50 | ;; -rpm) | 50 | ;; -rpm) |
51 | if [ "$OPIEDIR" != "/opt/Qtopia" ] | 51 | if [ "$OPIEDIR" != "/opt/Qtopia" ] |
52 | then | 52 | then |
53 | echo >&2 '$OPIEDIR is not the standard /usr/Qtopia directory.' | 53 | echo >&2 '$OPIEDIR is not the standard /usr/Qtopia directory.' |
54 | sleep 1 | 54 | sleep 1 |
55 | #exit 1 | 55 | #exit 1 |
56 | fi | 56 | fi |
57 | RPM=1 | 57 | RPM=1 |
58 | ;; -arch) | 58 | ;; -arch) |
59 | shift | 59 | shift |
60 | ARCH=$1 | 60 | ARCH=$1 |
61 | STRIP= | 61 | STRIP= |
62 | STRIP_FILES= | 62 | STRIP_FILES= |
63 | ;; /*) | 63 | ;; /*) |
64 | FILES="$FILES $1" | 64 | FILES="$FILES $1" |
65 | ;; *) | 65 | ;; *) |
66 | FILES="$FILES $PWD/$1" | 66 | FILES="$FILES $PWD/$1" |
67 | esac | 67 | esac |
68 | shift | 68 | shift |
69 | done | 69 | done |
70 | 70 | ||
71 | 71 | ||
72 | if [ -z "$FILES" ] | 72 | if [ -z "$FILES" ] |
73 | then | 73 | then |
74 | FILES=`find $OPIEDIR -name "*.control" -print` | 74 | FILES=`find $OPIEDIR -name "*.control" -print` |
75 | fi | 75 | fi |
76 | 76 | ||
77 | RDIR=$PWD | 77 | RDIR=$PWD |
78 | cd $OPIEDIR | 78 | cd $OPIEDIR |
79 | 79 | ||
80 | for i in $FILES | 80 | for i in $FILES |
81 | do | 81 | do |
82 | rm -rf $TDIR | 82 | rm -rf $TDIR |
83 | 83 | ||
84 | mkdir -p $DATADIR | 84 | mkdir -p $DATADIR |
85 | mkdir -p $CTRLDIR | 85 | mkdir -p $CTRLDIR |
86 | 86 | ||
87 | packagename=${i##*/}; packagename=${packagename%.control} | 87 | packagename=${i##*/}; packagename=${packagename%.control} |
88 | version=$(eval echo '"'$(sed -n -e "s/^Version: *//p" $i)'"') | 88 | version=$(eval echo '"'$(sed -n -e "s/^Version: *//p" $i)'"') |
89 | depends=$(eval echo '"'$(sed -n -e "s/^Depends: *//p" $i)'"') | 89 | depends=$(eval echo '"'$(sed -n -e "s/^Depends: *//p" $i)'"') |
90 | files=$(eval echo $(sed -n -e "s/^Files://p" $i)) | 90 | files=$(eval echo $(sed -n -e "s/^Files://p" $i)) |
91 | arch=$(eval echo $(sed -n -e "s/^Arch://p" $i)) | 91 | arch=$(eval echo $(sed -n -e "s/^Arch://p" $i)) |
92 | section=$(sed -n -e "s/^Section: *//p" $i) | 92 | section=$(sed -n -e "s/^Section: *//p" $i) |
93 | license=$(sed -n -e "s/^License: *//p" $i) | 93 | license=$(sed -n -e "s/^License: *//p" $i) |
94 | summary=$(sed -n -e "s/^Description: *//p" $i) | 94 | summary=$(sed -n -e "s/^Description: *//p" $i) |
95 | package=${packagename}_${version}_$ARCH | 95 | package=${packagename}_${version}_$ARCH |
96 | ERROR= | 96 | ERROR= |
97 | if [ -z "$files" ] | 97 | if [ -z "$files" ] |
98 | then | 98 | then |
99 | mkdir -p $DATADIR/usr/share/doc/$packagename | 99 | mkdir -p $DATADIR/usr/share/doc/$packagename |
100 | else | 100 | else |
101 | for f in $files | 101 | for f in $files |
102 | do | 102 | do |
103 | if [ -d $f ] | 103 | if [ -d $f ] |
104 | then | 104 | then |
105 | ffiles=$(find $f -type f -o -type b -o -type c -o -type l) | 105 | ffiles=$(find $f -type f -o -type b -o -type c -o -type l) |
106 | else | 106 | else |
107 | ffiles=$f | 107 | ffiles=$f |
108 | fi | 108 | fi |
109 | for ff in $ffiles | 109 | for ff in $ffiles |
110 | do | 110 | do |
111 | case $ff in | 111 | case $ff in |
112 | */CVS/*) | 112 | */CVS/*) |
113 | continue | 113 | continue |
114 | ;;*~) | 114 | ;;*~) |
115 | continue | 115 | continue |
116 | ;;*.control) | 116 | ;;*.control) |
117 | continue | 117 | continue |
118 | ;; $QTDIR/*) | 118 | ;; $QTDIR/*) |
119 | BASE=$(dirname /usr/${ff#$QTDIR/}) | 119 | BASE=$(dirname /usr/${ff#$QTDIR/}) |
120 | ;; etc/*.d/*) | 120 | ;; etc/*.d/*) |
121 | BASE=$(dirname /$ff) | 121 | BASE=$(dirname /$ff) |
122 | ;; ipaq/*) | 122 | ;; ipaq/*) |
123 | BASE=$(dirname ${ff#ipaq}) | 123 | BASE=$(dirname ${ff#ipaq}) |
124 | ;; *) | 124 | ;; *) |
125 | # For SHARP ROM compatibility. Should change to Qtopia. | 125 | # For SHARP ROM compatibility. Should change to Qtopia. |
126 | BASE=/opt/QtPalmtop/$(dirname $ff) | 126 | BASE=/opt/QtPalmtop/$(dirname $ff) |
127 | esac | 127 | esac |
128 | 128 | ||
129 | if [ -f $ff -o -b $ff -o -c $ff ] | 129 | if [ -f $ff -o -b $ff -o -c $ff ] |
130 | then | 130 | then |
131 | D=$DATADIR$BASE | 131 | D=$DATADIR$BASE |
132 | if [ -x $ff -a -n "$STRIP" ] | 132 | if [ -x $ff -a -n "$STRIP" ] |
133 | then | 133 | then |
134 | case $(file $ff) in | 134 | case $(file $ff) in |
135 | $STRIP_FILES) | 135 | $STRIP_FILES) |
136 | $STRIP $ff | 136 | $STRIP $ff |
137 | ;; *) | 137 | ;; *) |
138 | esac | 138 | esac |
139 | fi | 139 | fi |
140 | if [ -n "$RPM" ] | 140 | if [ -n "$RPM" ] |
141 | then | 141 | then |
142 | case "$ff" in | 142 | case "$ff" in |
143 | /*) RPMFILES="$RPMFILES $ff" | 143 | /*) RPMFILES="$RPMFILES $ff" |
144 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" | 144 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" |
145 | esac | 145 | esac |
146 | else | 146 | else |
147 | mkdir -p $D | 147 | mkdir -p $D |
148 | if cp -a $ff $D | 148 | if cp -a $ff $D |
149 | then | 149 | then |
150 | true | 150 | true |
151 | else | 151 | else |
152 | ERROR=1 | 152 | ERROR=1 |
153 | fi | 153 | fi |
154 | fi | 154 | fi |
155 | else | 155 | else |
156 | echo >&2 "$0: $i: No such file: $ff" | 156 | echo >&2 "$0: $i: No such file: $ff" |
157 | ERROR=1 | 157 | ERROR=1 |
158 | fi | 158 | fi |
159 | done | 159 | done |
160 | done | 160 | done |
161 | fi | 161 | fi |
162 | if [ -z "$ERROR" ] | 162 | if [ -z "$ERROR" ] |
163 | then | 163 | then |
164 | if [ -n "$RPM" ] | 164 | if [ -n "$RPM" ] |
165 | then | 165 | then |
166 | SPEC=/tmp/mkipks-rpm-$$.spec | 166 | SPEC=/tmp/mkipks-rpm-$$.spec |
167 | echo >$SPEC "Summary: $summary" | 167 | echo >$SPEC "Summary: $summary" |
168 | echo >>$SPEC "Name: $packagename" | 168 | echo >>$SPEC "Name: $packagename" |
169 | echo >>$SPEC "Group: $section" ########## | 169 | echo >>$SPEC "Group: $section" ########## |
170 | echo >>$SPEC "License: $license" | 170 | echo >>$SPEC "License: $license" |
171 | echo >>$SPEC "Version: ${version%-*}" | 171 | echo >>$SPEC "Version: ${version%-*}" |
172 | echo >>$SPEC "Release: ${version#*-}" | 172 | echo >>$SPEC "Release: ${version#*-}" |
173 | 173 | ||
174 | echo >>$SPEC "%description" | 174 | echo >>$SPEC "%description" |
175 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC | 175 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC |
176 | echo >>$SPEC "%files" | 176 | echo >>$SPEC "%files" |
177 | echo >>$SPEC "%defattr(-,root,root)" | 177 | echo >>$SPEC "%defattr(-,root,root)" |
178 | /bin/ls $RPMFILES >>$SPEC | 178 | /bin/ls $RPMFILES >>$SPEC |
179 | rpm -bb $SPEC --target $ARCH-unknown-linux | 179 | rpm -bb --target $ARCH-unknown-linux $SPEC |
180 | # rm $SPEC | 180 | # rm $SPEC |
181 | elif [ -z "$IMAGEDIR" ] | 181 | elif [ -z "$IMAGEDIR" ] |
182 | then | 182 | then |
183 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') | 183 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') |
184 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) | 184 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) |
185 | echo "Package: $packagename" >$CTRLDIR/control | 185 | echo "Package: $packagename" >$CTRLDIR/control |
186 | echo "Installed-Size: $size" >>$CTRLDIR/control | 186 | echo "Installed-Size: $size" >>$CTRLDIR/control |
187 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control | 187 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control |
188 | echo "Version: $version" >>$CTRLDIR/control | 188 | echo "Version: $version" >>$CTRLDIR/control |
189 | echo "Depends: $depends" >>$CTRLDIR/control | 189 | echo "Depends: $depends" >>$CTRLDIR/control |
190 | egrep -v "^(Files|Version|Depends):" >>$CTRLDIR/control $i | 190 | egrep -v "^(Files|Version|Depends):" >>$CTRLDIR/control $i |
191 | echo "$DEB_VERSION" >$TDIR/debian-binary | 191 | echo "$DEB_VERSION" >$TDIR/debian-binary |
192 | base=${i%.control} | 192 | base=${i%.control} |
193 | scripts="preinst postinst prerm postrm" | 193 | scripts="preinst postinst prerm postrm" |
194 | for pf in $scripts | 194 | for pf in $scripts |
195 | do | 195 | do |
196 | if [ -x ${base}.$pf ] | 196 | if [ -x ${base}.$pf ] |
197 | then | 197 | then |
198 | cp ${base}.$pf $CTRLDIR/$pf | 198 | cp ${base}.$pf $CTRLDIR/$pf |
199 | fi | 199 | fi |
200 | done | 200 | done |
201 | if [ "$UID" = 0 ] | 201 | if [ "$UID" = 0 ] |
202 | then | 202 | then |
203 | chown -R root.root $TDIR | 203 | chown -R root.root $TDIR |
204 | fi | 204 | fi |
205 | ( cd $CTRLDIR; tar cfz ../control.tar.gz ./*; ) | 205 | ( cd $CTRLDIR; tar cfz ../control.tar.gz ./*; ) |
206 | ( cd $DATADIR; tar cfz ../data.tar.gz ./*; ) | 206 | ( cd $DATADIR; tar cfz ../data.tar.gz ./*; ) |
207 | ( cd $TDIR; rm -rf control data; tar cf - ./debian-binary ./control.tar.gz ./data.tar.gz; ) | gzip >$RDIR/$package.ipk | 207 | ( cd $TDIR; rm -rf control data; tar cf - ./debian-binary ./control.tar.gz ./data.tar.gz; ) | gzip >$RDIR/$package.ipk |
208 | RESULT=$package.ipk | 208 | RESULT=$package.ipk |
209 | if [ -n "$VERB" ] | 209 | if [ -n "$VERB" ] |
210 | then | 210 | then |
211 | echo >&2 "Built $RESULT ($size)" | 211 | echo >&2 "Built $RESULT ($size)" |
212 | fi | 212 | fi |
213 | if [ -n "$LIST" ] | 213 | if [ -n "$LIST" ] |
214 | then | 214 | then |
215 | echo $RESULT | 215 | echo $RESULT |
216 | fi | 216 | fi |
217 | fi | 217 | fi |
218 | else | 218 | else |
219 | echo >&2 "Not building $package package" | 219 | echo >&2 "Not building $package package" |
220 | fi | 220 | fi |
221 | done | 221 | done |
diff --git a/noncore/games/minesweep/Makefile.in b/noncore/games/minesweep/Makefile.in index 67ea94c..6df2608 100644 --- a/noncore/games/minesweep/Makefile.in +++ b/noncore/games/minesweep/Makefile.in | |||
@@ -1,134 +1,136 @@ | |||
1 | ############################################################################# | 1 | ############################################################################# |
2 | 2 | ||
3 | ####### Compiler, tools and options | 3 | ####### Compiler, tools and options |
4 | 4 | ||
5 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) | 5 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) |
6 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) | 6 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) |
7 | CC =$(SYSCONF_CC) $(QT_C_MT) | 7 | CC =$(SYSCONF_CC) $(QT_C_MT) |
8 | CFLAGS =$(SYSCONF_CFLAGS) | 8 | CFLAGS =$(SYSCONF_CFLAGS) |
9 | INCPATH =-I$(OPIEDIR)/include | 9 | INCPATH =-I$(OPIEDIR)/include |
10 | LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) | 10 | LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) |
11 | LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) | 11 | LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) |
12 | MOC =$(SYSCONF_MOC) | 12 | MOC =$(SYSCONF_MOC) |
13 | UIC =$(SYSCONF_UIC) | 13 | UIC =$(SYSCONF_UIC) |
14 | 14 | ||
15 | ####### Target | 15 | ####### Target |
16 | 16 | ||
17 | DESTDIR = $(OPIEDIR)/bin/ | 17 | DESTDIR = $(OPIEDIR)/bin/ |
18 | VER_MAJ = 1 | 18 | VER_MAJ = 1 |
19 | VER_MIN = 0 | 19 | VER_MIN = 0 |
20 | VER_PATCH = 0 | 20 | VER_PATCH = 0 |
21 | TARGET= minesweep | 21 | TARGET= minesweep |
22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | 22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) |
23 | 23 | ||
24 | ####### Files | 24 | ####### Files |
25 | 25 | ||
26 | HEADERS =minefield.h \ | 26 | HEADERS =minefield.h \ |
27 | minesweep.h | 27 | minesweep.h |
28 | SOURCES =main.cpp \ | 28 | SOURCES =main.cpp \ |
29 | minefield.cpp \ | 29 | minefield.cpp \ |
30 | minesweep.cpp | 30 | minesweep.cpp |
31 | OBJECTS =main.o \ | 31 | OBJECTS =main.o \ |
32 | minefield.o \ | 32 | minefield.o \ |
33 | minesweep.o | 33 | minesweep.o |
34 | INTERFACES = | 34 | INTERFACES = |
35 | UICDECLS = | 35 | UICDECLS = |
36 | UICIMPLS = | 36 | UICIMPLS = |
37 | SRCMOC =moc_minefield.cpp \ | 37 | SRCMOC =moc_minefield.cpp \ |
38 | moc_minesweep.cpp | 38 | moc_minesweep.cpp |
39 | OBJMOC =moc_minefield.o \ | 39 | OBJMOC =moc_minefield.o \ |
40 | moc_minesweep.o | 40 | moc_minesweep.o |
41 | 41 | ||
42 | 42 | ||
43 | ####### Implicit rules | 43 | ####### Implicit rules |
44 | 44 | ||
45 | .SUFFIXES: .cpp .cxx .cc .C .c | 45 | .SUFFIXES: .cpp .cxx .cc .C .c |
46 | 46 | ||
47 | .cpp.o: | 47 | .cpp.o: |
48 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 48 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
49 | 49 | ||
50 | .cxx.o: | 50 | .cxx.o: |
51 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 51 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
52 | 52 | ||
53 | .cc.o: | 53 | .cc.o: |
54 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 54 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
55 | 55 | ||
56 | .C.o: | 56 | .C.o: |
57 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 57 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
58 | 58 | ||
59 | .c.o: | 59 | .c.o: |
60 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | 60 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< |
61 | 61 | ||
62 | ####### Build rules | 62 | ####### Build rules |
63 | 63 | ||
64 | 64 | ||
65 | all: $(DESTDIR)$(TARGET) | 65 | all: $(DESTDIR)$(TARGET) |
66 | 66 | ||
67 | $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) | 67 | $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) |
68 | $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | 68 | $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) |
69 | 69 | ||
70 | moc: $(SRCMOC) | 70 | moc: $(SRCMOC) |
71 | 71 | ||
72 | tmake: | 72 | tmake: Makefile.in |
73 | tmake minesweep.pro | 73 | |
74 | Makefile.in: minesweep.pro | ||
75 | tmake minesweep.pro -o Makefile.in | ||
74 | 76 | ||
75 | clean: | 77 | clean: |
76 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) | 78 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) |
77 | -rm -f *~ core | 79 | -rm -f *~ core |
78 | -rm -f allmoc.cpp | 80 | -rm -f allmoc.cpp |
79 | 81 | ||
80 | ####### Extension Modules | 82 | ####### Extension Modules |
81 | 83 | ||
82 | listpromodules: | 84 | listpromodules: |
83 | @echo | 85 | @echo |
84 | 86 | ||
85 | listallmodules: | 87 | listallmodules: |
86 | @echo | 88 | @echo |
87 | 89 | ||
88 | listaddonpromodules: | 90 | listaddonpromodules: |
89 | @echo | 91 | @echo |
90 | 92 | ||
91 | listaddonentmodules: | 93 | listaddonentmodules: |
92 | @echo | 94 | @echo |
93 | 95 | ||
94 | 96 | ||
95 | REQUIRES= | 97 | REQUIRES= |
96 | 98 | ||
97 | ####### Sub-libraries | 99 | ####### Sub-libraries |
98 | 100 | ||
99 | 101 | ||
100 | ###### Combined headers | 102 | ###### Combined headers |
101 | 103 | ||
102 | 104 | ||
103 | 105 | ||
104 | ####### Compile | 106 | ####### Compile |
105 | 107 | ||
106 | main.o: main.cpp \ | 108 | main.o: main.cpp \ |
107 | minesweep.h \ | 109 | minesweep.h \ |
108 | $(OPIEDIR)/include/qpe/qpeapplication.h | 110 | /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/qpeapplication.h |
109 | 111 | ||
110 | minefield.o: minefield.cpp \ | 112 | minefield.o: minefield.cpp \ |
111 | minefield.h \ | 113 | minefield.h \ |
112 | $(OPIEDIR)/include/qpe/config.h | 114 | /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/config.h |
113 | 115 | ||
114 | minesweep.o: minesweep.cpp \ | 116 | minesweep.o: minesweep.cpp \ |
115 | minesweep.h \ | 117 | minesweep.h \ |
116 | minefield.h \ | 118 | minefield.h \ |
117 | $(OPIEDIR)/include/qpe/resource.h \ | 119 | /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/resource.h \ |
118 | $(OPIEDIR)/include/qpe/config.h \ | 120 | /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/config.h \ |
119 | $(OPIEDIR)/include/qpe/qpetoolbar.h \ | 121 | /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/qpetoolbar.h \ |
120 | $(OPIEDIR)/include/qpe/qpemenubar.h | 122 | /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/qpemenubar.h |
121 | 123 | ||
122 | moc_minefield.o: moc_minefield.cpp \ | 124 | moc_minefield.o: moc_minefield.cpp \ |
123 | minefield.h | 125 | minefield.h |
124 | 126 | ||
125 | moc_minesweep.o: moc_minesweep.cpp \ | 127 | moc_minesweep.o: moc_minesweep.cpp \ |
126 | minesweep.h | 128 | minesweep.h |
127 | 129 | ||
128 | moc_minefield.cpp: minefield.h | 130 | moc_minefield.cpp: minefield.h |
129 | $(MOC) minefield.h -o moc_minefield.cpp | 131 | $(MOC) minefield.h -o moc_minefield.cpp |
130 | 132 | ||
131 | moc_minesweep.cpp: minesweep.h | 133 | moc_minesweep.cpp: minesweep.h |
132 | $(MOC) minesweep.h -o moc_minesweep.cpp | 134 | $(MOC) minesweep.h -o moc_minesweep.cpp |
133 | 135 | ||
134 | 136 | ||