-rw-r--r-- | core/launcher/documentlist.cpp | 17 | ||||
-rw-r--r-- | core/launcher/firstuse.cpp | 2 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 35 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 | ||||
-rw-r--r-- | core/settings/launcher/doctabsettings.cpp | 71 | ||||
-rw-r--r-- | core/settings/launcher/doctabsettings.h | 55 | ||||
-rw-r--r-- | core/settings/launcher/inputmethodsettings.cpp | 3 | ||||
-rw-r--r-- | core/settings/launcher/launcher.pro | 2 | ||||
-rw-r--r-- | core/settings/launcher/launchersettings.cpp | 5 | ||||
-rw-r--r-- | core/settings/launcher/launchersettings.h | 2 | ||||
-rw-r--r-- | noncore/settings/doctab/.cvsignore | 4 | ||||
-rw-r--r-- | noncore/settings/doctab/config.in | 4 | ||||
-rw-r--r-- | noncore/settings/doctab/doctab.cpp | 94 | ||||
-rw-r--r-- | noncore/settings/doctab/doctab.h | 57 | ||||
-rw-r--r-- | noncore/settings/doctab/doctab.pro | 10 | ||||
-rw-r--r-- | noncore/settings/doctab/doctabsettingsbase.ui | 115 | ||||
-rw-r--r-- | noncore/settings/doctab/main.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/doctab/opie-doctab.control | 10 | ||||
-rw-r--r-- | noncore/settings/language/config.in | 2 | ||||
-rw-r--r-- | noncore/settings/language/main.cpp | 2 |
20 files changed, 504 insertions, 13 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 7f9366e..dcea4b9 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp | |||
@@ -1,647 +1,662 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "documentlist.h" | 20 | #include "documentlist.h" |
21 | #include "serverinterface.h" | 21 | #include "serverinterface.h" |
22 | #include "launcherglobal.h" | 22 | #include "launcherglobal.h" |
23 | 23 | ||
24 | #include <qtopia/config.h> | ||
24 | #include <qtopia/mimetype.h> | 25 | #include <qtopia/mimetype.h> |
25 | #include <qtopia/resource.h> | 26 | #include <qtopia/resource.h> |
26 | #include <qtopia/global.h> | 27 | #include <qtopia/global.h> |
27 | #include <qtopia/private/categories.h> | 28 | #include <qtopia/private/categories.h> |
28 | #include <qtopia/qpeapplication.h> | 29 | #include <qtopia/qpeapplication.h> |
29 | #include <qtopia/applnk.h> | 30 | #include <qtopia/applnk.h> |
30 | #include <qtopia/storage.h> | 31 | #include <qtopia/storage.h> |
31 | #ifdef Q_WS_QWS | 32 | #ifdef Q_WS_QWS |
32 | #include <qtopia/qcopenvelope_qws.h> | 33 | #include <qtopia/qcopenvelope_qws.h> |
33 | #endif | 34 | #endif |
34 | 35 | ||
35 | #include <qtimer.h> | 36 | #include <qtimer.h> |
36 | #include <qfileinfo.h> | 37 | #include <qfileinfo.h> |
37 | #include <qtextstream.h> | 38 | #include <qtextstream.h> |
38 | #include <qfile.h> | 39 | #include <qfile.h> |
39 | #include <qdir.h> | 40 | #include <qdir.h> |
40 | #include <qpainter.h> | 41 | #include <qpainter.h> |
41 | #include <qimage.h> | 42 | #include <qimage.h> |
42 | #include <qcopchannel_qws.h> | 43 | #include <qcopchannel_qws.h> |
43 | #include <qlistview.h> | 44 | #include <qlistview.h> |
44 | #include <qlist.h> | 45 | #include <qlist.h> |
45 | #include <qpixmap.h> | 46 | #include <qpixmap.h> |
46 | 47 | ||
47 | 48 | ||
48 | AppLnkSet *DocumentList::appLnkSet = 0; | 49 | AppLnkSet *DocumentList::appLnkSet = 0; |
49 | 50 | ||
50 | static const int MAX_SEARCH_DEPTH = 10; | 51 | static const int MAX_SEARCH_DEPTH = 10; |
51 | 52 | ||
52 | 53 | ||
53 | class DocumentListPrivate : public QObject { | 54 | class DocumentListPrivate : public QObject { |
54 | Q_OBJECT | 55 | Q_OBJECT |
55 | public: | 56 | public: |
56 | DocumentListPrivate( ServerInterface *gui ); | 57 | DocumentListPrivate( ServerInterface *gui ); |
57 | ~DocumentListPrivate(); | 58 | ~DocumentListPrivate(); |
58 | 59 | ||
59 | void initialize(); | 60 | void initialize(); |
60 | 61 | ||
61 | const QString nextFile(); | 62 | const QString nextFile(); |
62 | const DocLnk *iterate(); | 63 | const DocLnk *iterate(); |
63 | bool store( DocLnk* dl ); | 64 | bool store( DocLnk* dl ); |
64 | void estimatedPercentScanned(); | 65 | void estimatedPercentScanned(); |
65 | 66 | ||
66 | DocLnkSet dls; | 67 | DocLnkSet dls; |
67 | QDict<void> reference; | 68 | QDict<void> reference; |
68 | QDictIterator<void> *dit; | 69 | QDictIterator<void> *dit; |
69 | enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; | 70 | enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; |
70 | 71 | ||
71 | QStringList docPaths; | 72 | QStringList docPaths; |
72 | unsigned int docPathsSearched; | 73 | unsigned int docPathsSearched; |
73 | 74 | ||
74 | int searchDepth; | 75 | int searchDepth; |
75 | QDir *listDirs[MAX_SEARCH_DEPTH]; | 76 | QDir *listDirs[MAX_SEARCH_DEPTH]; |
76 | const QFileInfoList *lists[MAX_SEARCH_DEPTH]; | 77 | const QFileInfoList *lists[MAX_SEARCH_DEPTH]; |
77 | unsigned int listPositions[MAX_SEARCH_DEPTH]; | 78 | unsigned int listPositions[MAX_SEARCH_DEPTH]; |
78 | 79 | ||
79 | StorageInfo *storage; | 80 | StorageInfo *storage; |
80 | 81 | ||
81 | int tid; | 82 | int tid; |
82 | 83 | ||
83 | ServerInterface *serverGui; | 84 | ServerInterface *serverGui; |
84 | 85 | ||
85 | bool needToSendAllDocLinks; | 86 | bool needToSendAllDocLinks; |
86 | bool sendAppLnks; | 87 | bool sendAppLnks; |
87 | bool sendDocLnks; | 88 | bool sendDocLnks; |
88 | bool scanDocs; | 89 | bool scanDocs; |
89 | }; | 90 | }; |
90 | 91 | ||
91 | 92 | ||
92 | DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, | 93 | DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, |
93 | QObject *parent, const char *name ) | 94 | QObject *parent, const char *name ) |
94 | : QObject( parent, name ) | 95 | : QObject( parent, name ) |
95 | { | 96 | { |
96 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); | 97 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); |
97 | d = new DocumentListPrivate( serverGui ); | 98 | d = new DocumentListPrivate( serverGui ); |
98 | d->scanDocs = scanDocs; | 99 | d->scanDocs = scanDocs; |
99 | d->needToSendAllDocLinks = false; | 100 | d->needToSendAllDocLinks = false; |
100 | 101 | ||
101 | QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); | 102 | QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); |
102 | } | 103 | } |
103 | 104 | ||
104 | void DocumentList::startInitialScan() | 105 | void DocumentList::startInitialScan() |
105 | { | 106 | { |
106 | reloadAppLnks(); | 107 | reloadAppLnks(); |
107 | reloadDocLnks(); | 108 | |
109 | Config cfg( "Launcher" ); | ||
110 | cfg.setGroup( "DocTab" ); | ||
111 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); | ||
112 | if ( docTabEnabled ) | ||
113 | reloadDocLnks(); | ||
114 | else | ||
115 | { | ||
116 | if ( d->sendDocLnks && d->serverGui ) | ||
117 | { | ||
118 | d->serverGui->documentScanningProgress( 0 ); | ||
119 | d->serverGui->allDocumentsRemoved(); | ||
120 | } | ||
121 | } | ||
122 | |||
108 | } | 123 | } |
109 | 124 | ||
110 | DocumentList::~DocumentList() | 125 | DocumentList::~DocumentList() |
111 | { | 126 | { |
112 | delete appLnkSet; | 127 | delete appLnkSet; |
113 | delete d; | 128 | delete d; |
114 | } | 129 | } |
115 | 130 | ||
116 | 131 | ||
117 | void DocumentList::add( const DocLnk& doc ) | 132 | void DocumentList::add( const DocLnk& doc ) |
118 | { | 133 | { |
119 | if ( d->serverGui && QFile::exists( doc.file() ) ) | 134 | if ( d->serverGui && QFile::exists( doc.file() ) ) |
120 | d->serverGui->documentAdded( doc ); | 135 | d->serverGui->documentAdded( doc ); |
121 | } | 136 | } |
122 | 137 | ||
123 | 138 | ||
124 | void DocumentList::start() | 139 | void DocumentList::start() |
125 | { | 140 | { |
126 | resume(); | 141 | resume(); |
127 | } | 142 | } |
128 | 143 | ||
129 | 144 | ||
130 | void DocumentList::pause() | 145 | void DocumentList::pause() |
131 | { | 146 | { |
132 | //qDebug("pause %i", d->tid); | 147 | //qDebug("pause %i", d->tid); |
133 | killTimer( d->tid ); | 148 | killTimer( d->tid ); |
134 | d->tid = 0; | 149 | d->tid = 0; |
135 | } | 150 | } |
136 | 151 | ||
137 | 152 | ||
138 | void DocumentList::resume() | 153 | void DocumentList::resume() |
139 | { | 154 | { |
140 | if ( d->tid == 0 ) { | 155 | if ( d->tid == 0 ) { |
141 | d->tid = startTimer( 0 ); | 156 | d->tid = startTimer( 0 ); |
142 | //qDebug("resumed %i", d->tid); | 157 | //qDebug("resumed %i", d->tid); |
143 | } | 158 | } |
144 | } | 159 | } |
145 | 160 | ||
146 | /* | 161 | /* |
147 | void DocumentList::resend() | 162 | void DocumentList::resend() |
148 | { | 163 | { |
149 | // Re-emits all the added items to the list (firstly letting everyone know to | 164 | // Re-emits all the added items to the list (firstly letting everyone know to |
150 | // clear what they have as it is being sent again) | 165 | // clear what they have as it is being sent again) |
151 | pause(); | 166 | pause(); |
152 | emit allRemoved(); | 167 | emit allRemoved(); |
153 | QTimer::singleShot( 5, this, SLOT( resendWorker() ) ); | 168 | QTimer::singleShot( 5, this, SLOT( resendWorker() ) ); |
154 | } | 169 | } |
155 | 170 | ||
156 | 171 | ||
157 | void DocumentList::resendWorker() | 172 | void DocumentList::resendWorker() |
158 | { | 173 | { |
159 | const QList<DocLnk> &list = d->dls.children(); | 174 | const QList<DocLnk> &list = d->dls.children(); |
160 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) | 175 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) |
161 | add( *(*it) ); | 176 | add( *(*it) ); |
162 | resume(); | 177 | resume(); |
163 | } | 178 | } |
164 | */ | 179 | */ |
165 | 180 | ||
166 | void DocumentList::rescan() | 181 | void DocumentList::rescan() |
167 | { | 182 | { |
168 | //qDebug("rescan"); | 183 | //qDebug("rescan"); |
169 | pause(); | 184 | pause(); |
170 | d->initialize(); | 185 | d->initialize(); |
171 | resume(); | 186 | resume(); |
172 | } | 187 | } |
173 | 188 | ||
174 | 189 | ||
175 | void DocumentList::timerEvent( QTimerEvent *te ) | 190 | void DocumentList::timerEvent( QTimerEvent *te ) |
176 | { | 191 | { |
177 | if ( te->timerId() == d->tid ) { | 192 | if ( te->timerId() == d->tid ) { |
178 | // Do 3 at a time | 193 | // Do 3 at a time |
179 | for (int i = 0; i < 3; i++ ) { | 194 | for (int i = 0; i < 3; i++ ) { |
180 | const DocLnk *lnk = d->iterate(); | 195 | const DocLnk *lnk = d->iterate(); |
181 | if ( lnk ) { | 196 | if ( lnk ) { |
182 | add( *lnk ); | 197 | add( *lnk ); |
183 | } else { | 198 | } else { |
184 | // stop when done | 199 | // stop when done |
185 | pause(); | 200 | pause(); |
186 | if ( d->serverGui ) | 201 | if ( d->serverGui ) |
187 | d->serverGui->documentScanningProgress( 100 ); | 202 | d->serverGui->documentScanningProgress( 100 ); |
188 | if ( d->needToSendAllDocLinks ) | 203 | if ( d->needToSendAllDocLinks ) |
189 | sendAllDocLinks(); | 204 | sendAllDocLinks(); |
190 | break; | 205 | break; |
191 | } | 206 | } |
192 | } | 207 | } |
193 | } | 208 | } |
194 | } | 209 | } |
195 | 210 | ||
196 | 211 | ||
197 | void DocumentList::reloadAppLnks() | 212 | void DocumentList::reloadAppLnks() |
198 | { | 213 | { |
199 | if ( d->sendAppLnks && d->serverGui ) { | 214 | if ( d->sendAppLnks && d->serverGui ) { |
200 | d->serverGui->applicationScanningProgress( 0 ); | 215 | d->serverGui->applicationScanningProgress( 0 ); |
201 | d->serverGui->allApplicationsRemoved(); | 216 | d->serverGui->allApplicationsRemoved(); |
202 | } | 217 | } |
203 | 218 | ||
204 | delete appLnkSet; | 219 | delete appLnkSet; |
205 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); | 220 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); |
206 | 221 | ||
207 | if ( d->sendAppLnks && d->serverGui ) { | 222 | if ( d->sendAppLnks && d->serverGui ) { |
208 | static QStringList prevTypeList; | 223 | static QStringList prevTypeList; |
209 | QStringList types = appLnkSet->types(); | 224 | QStringList types = appLnkSet->types(); |
210 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { | 225 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { |
211 | if ( !(*ittypes).isEmpty() ) { | 226 | if ( !(*ittypes).isEmpty() ) { |
212 | if ( !prevTypeList.contains(*ittypes) ) { | 227 | if ( !prevTypeList.contains(*ittypes) ) { |
213 | QString name = appLnkSet->typeName(*ittypes); | 228 | QString name = appLnkSet->typeName(*ittypes); |
214 | QPixmap pm = appLnkSet->typePixmap(*ittypes); | 229 | QPixmap pm = appLnkSet->typePixmap(*ittypes); |
215 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); | 230 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); |
216 | 231 | ||
217 | if (pm.isNull()) { | 232 | if (pm.isNull()) { |
218 | QImage img( Resource::loadImage( "UnknownDocument" ) ); | 233 | QImage img( Resource::loadImage( "UnknownDocument" ) ); |
219 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 234 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
220 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); | 235 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); |
221 | } | 236 | } |
222 | 237 | ||
223 | //qDebug("adding type %s", (*ittypes).latin1()); | 238 | //qDebug("adding type %s", (*ittypes).latin1()); |
224 | 239 | ||
225 | // ### our current launcher expects docs tab to be last | 240 | // ### our current launcher expects docs tab to be last |
226 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); | 241 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); |
227 | } | 242 | } |
228 | prevTypeList.remove(*ittypes); | 243 | prevTypeList.remove(*ittypes); |
229 | } | 244 | } |
230 | } | 245 | } |
231 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { | 246 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { |
232 | //qDebug("removing type %s", (*ittypes).latin1()); | 247 | //qDebug("removing type %s", (*ittypes).latin1()); |
233 | d->serverGui->typeRemoved(*ittypes); | 248 | d->serverGui->typeRemoved(*ittypes); |
234 | } | 249 | } |
235 | prevTypeList = types; | 250 | prevTypeList = types; |
236 | } | 251 | } |
237 | 252 | ||
238 | QListIterator<AppLnk> itapp( appLnkSet->children() ); | 253 | QListIterator<AppLnk> itapp( appLnkSet->children() ); |
239 | AppLnk* l; | 254 | AppLnk* l; |
240 | while ( (l=itapp.current()) ) { | 255 | while ( (l=itapp.current()) ) { |
241 | ++itapp; | 256 | ++itapp; |
242 | if ( d->sendAppLnks && d->serverGui ) | 257 | if ( d->sendAppLnks && d->serverGui ) |
243 | d->serverGui->applicationAdded( l->type(), *l ); | 258 | d->serverGui->applicationAdded( l->type(), *l ); |
244 | } | 259 | } |
245 | 260 | ||
246 | if ( d->sendAppLnks && d->serverGui ) | 261 | if ( d->sendAppLnks && d->serverGui ) |
247 | d->serverGui->applicationScanningProgress( 100 ); | 262 | d->serverGui->applicationScanningProgress( 100 ); |
248 | } | 263 | } |
249 | 264 | ||
250 | void DocumentList::reloadDocLnks() | 265 | void DocumentList::reloadDocLnks() |
251 | { | 266 | { |
252 | if ( !d->scanDocs ) | 267 | if ( !d->scanDocs ) |
253 | return; | 268 | return; |
254 | 269 | ||
255 | if ( d->sendDocLnks && d->serverGui ) { | 270 | if ( d->sendDocLnks && d->serverGui ) { |
256 | d->serverGui->documentScanningProgress( 0 ); | 271 | d->serverGui->documentScanningProgress( 0 ); |
257 | d->serverGui->allDocumentsRemoved(); | 272 | d->serverGui->allDocumentsRemoved(); |
258 | } | 273 | } |
259 | 274 | ||
260 | rescan(); | 275 | rescan(); |
261 | } | 276 | } |
262 | 277 | ||
263 | void DocumentList::linkChanged( QString arg ) | 278 | void DocumentList::linkChanged( QString arg ) |
264 | { | 279 | { |
265 | //qDebug( "linkchanged( %s )", arg.latin1() ); | 280 | //qDebug( "linkchanged( %s )", arg.latin1() ); |
266 | 281 | ||
267 | if ( arg.isNull() || Opie::Global::isAppLnkFileName( arg ) ) { | 282 | if ( arg.isNull() || Opie::Global::isAppLnkFileName( arg ) ) { |
268 | reloadAppLnks(); | 283 | reloadAppLnks(); |
269 | } else { | 284 | } else { |
270 | 285 | ||
271 | const QList<DocLnk> &list = d->dls.children(); | 286 | const QList<DocLnk> &list = d->dls.children(); |
272 | QListIterator<DocLnk> it( list ); | 287 | QListIterator<DocLnk> it( list ); |
273 | while ( it.current() ) { | 288 | while ( it.current() ) { |
274 | DocLnk *doc = it.current(); | 289 | DocLnk *doc = it.current(); |
275 | ++it; | 290 | ++it; |
276 | if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) | 291 | if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) |
277 | || ( doc->fileKnown() && doc->file() == arg ) ) { | 292 | || ( doc->fileKnown() && doc->file() == arg ) ) { |
278 | //qDebug( "found old link" ); | 293 | //qDebug( "found old link" ); |
279 | DocLnk* dl = new DocLnk( arg ); | 294 | DocLnk* dl = new DocLnk( arg ); |
280 | // add new one if it exists and matches the mimetype | 295 | // add new one if it exists and matches the mimetype |
281 | if ( d->store( dl ) ) { | 296 | if ( d->store( dl ) ) { |
282 | // Existing link has been changed, send old link ref and a ref | 297 | // Existing link has been changed, send old link ref and a ref |
283 | // to the new link | 298 | // to the new link |
284 | //qDebug( "change case" ); | 299 | //qDebug( "change case" ); |
285 | if ( d->serverGui ) | 300 | if ( d->serverGui ) |
286 | d->serverGui->documentChanged( *doc, *dl ); | 301 | d->serverGui->documentChanged( *doc, *dl ); |
287 | 302 | ||
288 | } else { | 303 | } else { |
289 | // Link has been removed or doesn't match the mimetypes any more | 304 | // Link has been removed or doesn't match the mimetypes any more |
290 | // so we aren't interested in it, so take it away from the list | 305 | // so we aren't interested in it, so take it away from the list |
291 | //qDebug( "removal case" ); | 306 | //qDebug( "removal case" ); |
292 | if ( d->serverGui ) | 307 | if ( d->serverGui ) |
293 | d->serverGui->documentRemoved( *doc ); | 308 | d->serverGui->documentRemoved( *doc ); |
294 | 309 | ||
295 | } | 310 | } |
296 | d->dls.remove( doc ); // remove old link from docLnkSet | 311 | d->dls.remove( doc ); // remove old link from docLnkSet |
297 | delete doc; | 312 | delete doc; |
298 | return; | 313 | return; |
299 | } | 314 | } |
300 | } | 315 | } |
301 | // Didn't find existing link, must be new | 316 | // Didn't find existing link, must be new |
302 | DocLnk* dl = new DocLnk( arg ); | 317 | DocLnk* dl = new DocLnk( arg ); |
303 | if ( d->store( dl ) ) { | 318 | if ( d->store( dl ) ) { |
304 | // Add if it's a link we are interested in | 319 | // Add if it's a link we are interested in |
305 | //qDebug( "add case" ); | 320 | //qDebug( "add case" ); |
306 | add( *dl ); | 321 | add( *dl ); |
307 | } | 322 | } |
308 | 323 | ||
309 | } | 324 | } |
310 | } | 325 | } |
311 | 326 | ||
312 | void DocumentList::restoreDone() | 327 | void DocumentList::restoreDone() |
313 | { | 328 | { |
314 | reloadAppLnks(); | 329 | reloadAppLnks(); |
315 | reloadDocLnks(); | 330 | reloadDocLnks(); |
316 | } | 331 | } |
317 | 332 | ||
318 | void DocumentList::storageChanged() | 333 | void DocumentList::storageChanged() |
319 | { | 334 | { |
320 | // ### can implement better | 335 | // ### can implement better |
321 | reloadAppLnks(); | 336 | reloadAppLnks(); |
322 | reloadDocLnks(); | 337 | reloadDocLnks(); |
323 | // ### Optimization opportunity | 338 | // ### Optimization opportunity |
324 | // Could be a bit more intelligent and somehow work out which | 339 | // Could be a bit more intelligent and somehow work out which |
325 | // mtab entry has changed and then only scan that and add and remove | 340 | // mtab entry has changed and then only scan that and add and remove |
326 | // links appropriately. | 341 | // links appropriately. |
327 | // rescan(); | 342 | // rescan(); |
328 | } | 343 | } |
329 | 344 | ||
330 | void DocumentList::sendAllDocLinks() | 345 | void DocumentList::sendAllDocLinks() |
331 | { | 346 | { |
332 | if ( d->tid != 0 ) { | 347 | if ( d->tid != 0 ) { |
333 | // We are in the middle of scanning, set a flag so | 348 | // We are in the middle of scanning, set a flag so |
334 | // we do this when we finish our scanning | 349 | // we do this when we finish our scanning |
335 | d->needToSendAllDocLinks = true; | 350 | d->needToSendAllDocLinks = true; |
336 | return; | 351 | return; |
337 | } | 352 | } |
338 | 353 | ||
339 | QString contents; | 354 | QString contents; |
340 | Categories cats; | 355 | Categories cats; |
341 | for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { | 356 | for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { |
342 | DocLnk *doc = it.current(); | 357 | DocLnk *doc = it.current(); |
343 | QFileInfo fi( doc->file() ); | 358 | QFileInfo fi( doc->file() ); |
344 | if ( !fi.exists() ) | 359 | if ( !fi.exists() ) |
345 | continue; | 360 | continue; |
346 | 361 | ||
347 | bool fake = !doc->linkFileKnown(); | 362 | bool fake = !doc->linkFileKnown(); |
348 | if ( !fake ) { | 363 | if ( !fake ) { |
349 | QFile f( doc->linkFile() ); | 364 | QFile f( doc->linkFile() ); |
350 | if ( f.open( IO_ReadOnly ) ) { | 365 | if ( f.open( IO_ReadOnly ) ) { |
351 | QTextStream ts( &f ); | 366 | QTextStream ts( &f ); |
352 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 367 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
353 | contents += ts.read(); | 368 | contents += ts.read(); |
354 | f.close(); | 369 | f.close(); |
355 | } else | 370 | } else |
356 | fake = TRUE; | 371 | fake = TRUE; |
357 | } | 372 | } |
358 | if (fake) { | 373 | if (fake) { |
359 | contents += "[Desktop Entry]\n"; // No tr | 374 | contents += "[Desktop Entry]\n"; // No tr |
360 | contents += "Categories = " + // No tr | 375 | contents += "Categories = " + // No tr |
361 | cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr | 376 | cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr |
362 | contents += "Name = "+doc->name()+"\n"; // No tr | 377 | contents += "Name = "+doc->name()+"\n"; // No tr |
363 | contents += "Type = "+doc->type()+"\n"; // No tr | 378 | contents += "Type = "+doc->type()+"\n"; // No tr |
364 | } | 379 | } |
365 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) | 380 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) |
366 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr | 381 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr |
367 | } | 382 | } |
368 | 383 | ||
369 | //qDebug( "sending length %d", contents.length() ); | 384 | //qDebug( "sending length %d", contents.length() ); |
370 | #ifndef QT_NO_COP | 385 | #ifndef QT_NO_COP |
371 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); | 386 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); |
372 | e << contents; | 387 | e << contents; |
373 | #endif | 388 | #endif |
374 | //qDebug( "================ \n\n%s\n\n===============", contents.latin1() ); | 389 | //qDebug( "================ \n\n%s\n\n===============", contents.latin1() ); |
375 | 390 | ||
376 | d->needToSendAllDocLinks = false; | 391 | d->needToSendAllDocLinks = false; |
377 | } | 392 | } |
378 | 393 | ||
379 | 394 | ||
380 | 395 | ||
381 | 396 | ||
382 | 397 | ||
383 | 398 | ||
384 | 399 | ||
385 | 400 | ||
386 | 401 | ||
387 | 402 | ||
388 | 403 | ||
389 | 404 | ||
390 | 405 | ||
391 | 406 | ||
392 | 407 | ||
393 | 408 | ||
394 | 409 | ||
395 | 410 | ||
396 | 411 | ||
397 | 412 | ||
398 | 413 | ||
399 | 414 | ||
400 | 415 | ||
401 | 416 | ||
402 | DocumentListPrivate::DocumentListPrivate( ServerInterface *gui ) | 417 | DocumentListPrivate::DocumentListPrivate( ServerInterface *gui ) |
403 | { | 418 | { |
404 | storage = new StorageInfo( this ); | 419 | storage = new StorageInfo( this ); |
405 | serverGui = gui; | 420 | serverGui = gui; |
406 | if ( serverGui ) { | 421 | if ( serverGui ) { |
407 | sendAppLnks = serverGui->requiresApplications(); | 422 | sendAppLnks = serverGui->requiresApplications(); |
408 | sendDocLnks = serverGui->requiresDocuments(); | 423 | sendDocLnks = serverGui->requiresDocuments(); |
409 | } else { | 424 | } else { |
410 | sendAppLnks = false; | 425 | sendAppLnks = false; |
411 | sendDocLnks = false; | 426 | sendDocLnks = false; |
412 | } | 427 | } |
413 | for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { | 428 | for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { |
414 | listDirs[i] = 0; | 429 | listDirs[i] = 0; |
415 | lists[i] = 0; | 430 | lists[i] = 0; |
416 | listPositions[i] = 0; | 431 | listPositions[i] = 0; |
417 | } | 432 | } |
418 | initialize(); | 433 | initialize(); |
419 | tid = 0; | 434 | tid = 0; |
420 | } | 435 | } |
421 | 436 | ||
422 | 437 | ||
423 | void DocumentListPrivate::initialize() | 438 | void DocumentListPrivate::initialize() |
424 | { | 439 | { |
425 | // Reset | 440 | // Reset |
426 | dls.clear(); | 441 | dls.clear(); |
427 | docPaths.clear(); | 442 | docPaths.clear(); |
428 | reference.clear(); | 443 | reference.clear(); |
429 | 444 | ||
430 | QDir docDir( QPEApplication::documentDir() ); | 445 | QDir docDir( QPEApplication::documentDir() ); |
431 | if ( docDir.exists() ) | 446 | if ( docDir.exists() ) |
432 | docPaths += QPEApplication::documentDir(); | 447 | docPaths += QPEApplication::documentDir(); |
433 | int i = 1; | 448 | int i = 1; |
434 | const QList<FileSystem> &fs = storage->fileSystems(); | 449 | const QList<FileSystem> &fs = storage->fileSystems(); |
435 | QListIterator<FileSystem> it( fs ); | 450 | QListIterator<FileSystem> it( fs ); |
436 | for ( ; it.current(); ++it ) | 451 | for ( ; it.current(); ++it ) |
437 | if ( (*it)->isRemovable() ) { | 452 | if ( (*it)->isRemovable() ) { |
438 | docPaths += (*it)->path(); | 453 | docPaths += (*it)->path(); |
439 | i++; | 454 | i++; |
440 | } | 455 | } |
441 | 456 | ||
442 | for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { | 457 | for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { |
443 | if ( listDirs[i] ) { | 458 | if ( listDirs[i] ) { |
444 | delete listDirs[i]; | 459 | delete listDirs[i]; |
445 | listDirs[i] = 0; | 460 | listDirs[i] = 0; |
446 | } | 461 | } |
447 | lists[i] = 0; | 462 | lists[i] = 0; |
448 | listPositions[i] = 0; | 463 | listPositions[i] = 0; |
449 | } | 464 | } |
450 | 465 | ||
451 | docPathsSearched = 0; | 466 | docPathsSearched = 0; |
452 | searchDepth = -1; | 467 | searchDepth = -1; |
453 | state = Find; | 468 | state = Find; |
454 | dit = 0; | 469 | dit = 0; |
455 | } | 470 | } |
456 | 471 | ||
457 | 472 | ||
458 | DocumentListPrivate::~DocumentListPrivate() | 473 | DocumentListPrivate::~DocumentListPrivate() |
459 | { | 474 | { |
460 | for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) | 475 | for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) |
461 | if ( listDirs[i] ) | 476 | if ( listDirs[i] ) |
462 | delete listDirs[i]; | 477 | delete listDirs[i]; |
463 | delete dit; | 478 | delete dit; |
464 | } | 479 | } |
465 | 480 | ||
466 | 481 | ||
467 | void DocumentListPrivate::estimatedPercentScanned() | 482 | void DocumentListPrivate::estimatedPercentScanned() |
468 | { | 483 | { |
469 | double overallProgress = 0.0; | 484 | double overallProgress = 0.0; |
470 | double levelWeight = 75.0; | 485 | double levelWeight = 75.0; |
471 | 486 | ||
472 | int topCount = docPaths.count(); | 487 | int topCount = docPaths.count(); |
473 | if ( topCount > 1 ) { | 488 | if ( topCount > 1 ) { |
474 | levelWeight = levelWeight / topCount; | 489 | levelWeight = levelWeight / topCount; |
475 | overallProgress += (docPathsSearched - 1) * levelWeight; | 490 | overallProgress += (docPathsSearched - 1) * levelWeight; |
476 | } | 491 | } |
477 | 492 | ||
478 | for ( int d = 0; d <= searchDepth; d++ ) { | 493 | for ( int d = 0; d <= searchDepth; d++ ) { |
479 | if ( listDirs[d] ) { | 494 | if ( listDirs[d] ) { |
480 | int items = lists[d]->count(); | 495 | int items = lists[d]->count(); |
481 | if ( items > 1 ) { | 496 | if ( items > 1 ) { |
482 | levelWeight = levelWeight / items; | 497 | levelWeight = levelWeight / items; |
483 | // Take in to account "." and ".." | 498 | // Take in to account "." and ".." |
484 | overallProgress += (listPositions[d] - 3) * levelWeight; | 499 | overallProgress += (listPositions[d] - 3) * levelWeight; |
485 | } | 500 | } |
486 | } else { | 501 | } else { |
487 | break; | 502 | break; |
488 | } | 503 | } |
489 | } | 504 | } |
490 | 505 | ||
491 | // qDebug( "overallProgress: %f", overallProgress ); | 506 | // qDebug( "overallProgress: %f", overallProgress ); |
492 | 507 | ||
493 | if ( serverGui ) | 508 | if ( serverGui ) |
494 | serverGui->documentScanningProgress( (int)overallProgress ); | 509 | serverGui->documentScanningProgress( (int)overallProgress ); |
495 | } | 510 | } |
496 | 511 | ||
497 | 512 | ||
498 | const QString DocumentListPrivate::nextFile() | 513 | const QString DocumentListPrivate::nextFile() |
499 | { | 514 | { |
500 | while ( TRUE ) { | 515 | while ( TRUE ) { |
501 | while ( searchDepth < 0 ) { | 516 | while ( searchDepth < 0 ) { |
502 | // go to next base path | 517 | // go to next base path |
503 | if ( docPathsSearched >= docPaths.count() ) { | 518 | if ( docPathsSearched >= docPaths.count() ) { |
504 | // end of base paths | 519 | // end of base paths |
505 | return QString::null; | 520 | return QString::null; |
506 | } else { | 521 | } else { |
507 | QDir dir( docPaths[docPathsSearched] ); | 522 | QDir dir( docPaths[docPathsSearched] ); |
508 | // qDebug("now using base path: %s", docPaths[docPathsSearched].latin1() ); | 523 | // qDebug("now using base path: %s", docPaths[docPathsSearched].latin1() ); |
509 | docPathsSearched++; | 524 | docPathsSearched++; |
510 | if ( !dir.exists( ".Qtopia-ignore" ) ) { | 525 | if ( !dir.exists( ".Qtopia-ignore" ) ) { |
511 | listDirs[0] = new QDir( dir ); | 526 | listDirs[0] = new QDir( dir ); |
512 | lists[0] = listDirs[0]->entryInfoList(); | 527 | lists[0] = listDirs[0]->entryInfoList(); |
513 | listPositions[0] = 0; | 528 | listPositions[0] = 0; |
514 | searchDepth = 0; | 529 | searchDepth = 0; |
515 | } | 530 | } |
516 | } | 531 | } |
517 | } | 532 | } |
518 | 533 | ||
519 | const QFileInfoList *fil = lists[searchDepth]; | 534 | const QFileInfoList *fil = lists[searchDepth]; |
520 | QFileInfoList *fl = (QFileInfoList *)fil; | 535 | QFileInfoList *fl = (QFileInfoList *)fil; |
521 | unsigned int pos = listPositions[searchDepth]; | 536 | unsigned int pos = listPositions[searchDepth]; |
522 | 537 | ||
523 | if ( pos >= fl->count() ) { | 538 | if ( pos >= fl->count() ) { |
524 | // go up a depth | 539 | // go up a depth |
525 | delete listDirs[searchDepth]; | 540 | delete listDirs[searchDepth]; |
526 | listDirs[searchDepth] = 0; | 541 | listDirs[searchDepth] = 0; |
527 | lists[searchDepth] = 0; | 542 | lists[searchDepth] = 0; |
528 | listPositions[searchDepth] = 0; | 543 | listPositions[searchDepth] = 0; |
529 | searchDepth--; | 544 | searchDepth--; |
530 | } else { | 545 | } else { |
531 | const QFileInfo *fi = fl->at(pos); | 546 | const QFileInfo *fi = fl->at(pos); |
532 | listPositions[searchDepth]++; | 547 | listPositions[searchDepth]++; |
533 | QString bn = fi->fileName(); | 548 | QString bn = fi->fileName(); |
534 | if ( bn[0] != '.' ) { | 549 | if ( bn[0] != '.' ) { |
535 | if ( fi->isDir() ) { | 550 | if ( fi->isDir() ) { |
536 | if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) { | 551 | if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) { |
537 | // go down a depth | 552 | // go down a depth |
538 | QDir dir( fi->filePath() ); | 553 | QDir dir( fi->filePath() ); |
539 | // qDebug("now going in to path: %s", bn.latin1() ); | 554 | // qDebug("now going in to path: %s", bn.latin1() ); |
540 | if ( !dir.exists( ".Qtopia-ignore" ) ) { | 555 | if ( !dir.exists( ".Qtopia-ignore" ) ) { |
541 | if ( searchDepth < MAX_SEARCH_DEPTH - 1) { | 556 | if ( searchDepth < MAX_SEARCH_DEPTH - 1) { |
542 | searchDepth++; | 557 | searchDepth++; |
543 | listDirs[searchDepth] = new QDir( dir ); | 558 | listDirs[searchDepth] = new QDir( dir ); |
544 | lists[searchDepth] = listDirs[searchDepth]->entryInfoList(); | 559 | lists[searchDepth] = listDirs[searchDepth]->entryInfoList(); |
545 | listPositions[searchDepth] = 0; | 560 | listPositions[searchDepth] = 0; |
546 | } | 561 | } |
547 | } | 562 | } |
548 | } | 563 | } |
549 | } else { | 564 | } else { |
550 | estimatedPercentScanned(); | 565 | estimatedPercentScanned(); |
551 | return fl->at(pos)->filePath(); | 566 | return fl->at(pos)->filePath(); |
552 | } | 567 | } |
553 | } | 568 | } |
554 | } | 569 | } |
555 | } | 570 | } |
556 | 571 | ||
557 | return QString::null; | 572 | return QString::null; |
558 | } | 573 | } |
559 | 574 | ||
560 | 575 | ||
561 | bool DocumentListPrivate::store( DocLnk* dl ) | 576 | bool DocumentListPrivate::store( DocLnk* dl ) |
562 | { | 577 | { |
563 | // if ( dl->fileKnown() && !dl->file().isEmpty() ) { | 578 | // if ( dl->fileKnown() && !dl->file().isEmpty() ) { |
564 | if ( dl && dl->fileKnown() ) { | 579 | if ( dl && dl->fileKnown() ) { |
565 | dls.add( dl ); // store | 580 | dls.add( dl ); // store |
566 | return TRUE; | 581 | return TRUE; |
567 | } | 582 | } |
568 | 583 | ||
569 | // don't store - delete | 584 | // don't store - delete |
570 | delete dl; | 585 | delete dl; |
571 | return FALSE; | 586 | return FALSE; |
572 | } | 587 | } |
573 | 588 | ||
574 | 589 | ||
575 | #define MAGIC_NUMBER((void*)2) | 590 | #define MAGIC_NUMBER((void*)2) |
576 | 591 | ||
577 | const DocLnk *DocumentListPrivate::iterate() | 592 | const DocLnk *DocumentListPrivate::iterate() |
578 | { | 593 | { |
579 | if ( state == Find ) { | 594 | if ( state == Find ) { |
580 | //qDebug("state Find"); | 595 | //qDebug("state Find"); |
581 | QString file = nextFile(); | 596 | QString file = nextFile(); |
582 | while ( !file.isNull() ) { | 597 | while ( !file.isNull() ) { |
583 | if ( file.right(8) == ".desktop" ) { // No tr | 598 | if ( file.right(8) == ".desktop" ) { // No tr |
584 | DocLnk* dl = new DocLnk( file ); | 599 | DocLnk* dl = new DocLnk( file ); |
585 | if ( store(dl) ) | 600 | if ( store(dl) ) |
586 | return dl; | 601 | return dl; |
587 | } else { | 602 | } else { |
588 | reference.insert( file, MAGIC_NUMBER ); | 603 | reference.insert( file, MAGIC_NUMBER ); |
589 | } | 604 | } |
590 | file = nextFile(); | 605 | file = nextFile(); |
591 | } | 606 | } |
592 | state = RemoveKnownFiles; | 607 | state = RemoveKnownFiles; |
593 | 608 | ||
594 | if ( serverGui ) | 609 | if ( serverGui ) |
595 | serverGui->documentScanningProgress( 75 ); | 610 | serverGui->documentScanningProgress( 75 ); |
596 | } | 611 | } |
597 | 612 | ||
598 | static int iterationI; | 613 | static int iterationI; |
599 | static int iterationCount; | 614 | static int iterationCount; |
600 | 615 | ||
601 | if ( state == RemoveKnownFiles ) { | 616 | if ( state == RemoveKnownFiles ) { |
602 | //qDebug("state RemoveKnownFiles"); | 617 | //qDebug("state RemoveKnownFiles"); |
603 | const QList<DocLnk> &list = dls.children(); | 618 | const QList<DocLnk> &list = dls.children(); |
604 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { | 619 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { |
605 | reference.remove( (*it)->file() ); | 620 | reference.remove( (*it)->file() ); |
606 | // ### does this need to be deleted? | 621 | // ### does this need to be deleted? |
607 | } | 622 | } |
608 | dit = new QDictIterator<void>(reference); | 623 | dit = new QDictIterator<void>(reference); |
609 | state = MakeUnknownFiles; | 624 | state = MakeUnknownFiles; |
610 | 625 | ||
611 | iterationI = 0; | 626 | iterationI = 0; |
612 | iterationCount = dit->count(); | 627 | iterationCount = dit->count(); |
613 | } | 628 | } |
614 | 629 | ||
615 | if ( state == MakeUnknownFiles ) { | 630 | if ( state == MakeUnknownFiles ) { |
616 | //qDebug("state MakeUnknownFiles"); | 631 | //qDebug("state MakeUnknownFiles"); |
617 | for (void* c; (c=dit->current()); ++(*dit) ) { | 632 | for (void* c; (c=dit->current()); ++(*dit) ) { |
618 | if ( c == MAGIC_NUMBER ) { | 633 | if ( c == MAGIC_NUMBER ) { |
619 | DocLnk* dl = new DocLnk; | 634 | DocLnk* dl = new DocLnk; |
620 | QFileInfo fi( dit->currentKey() ); | 635 | QFileInfo fi( dit->currentKey() ); |
621 | dl->setFile( fi.filePath() ); | 636 | dl->setFile( fi.filePath() ); |
622 | dl->setName( fi.baseName() ); | 637 | dl->setName( fi.baseName() ); |
623 | if ( store(dl) ) { | 638 | if ( store(dl) ) { |
624 | ++*dit; | 639 | ++*dit; |
625 | iterationI++; | 640 | iterationI++; |
626 | if ( serverGui ) | 641 | if ( serverGui ) |
627 | serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount ); | 642 | serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount ); |
628 | return dl; | 643 | return dl; |
629 | } | 644 | } |
630 | } | 645 | } |
631 | iterationI++; | 646 | iterationI++; |
632 | } | 647 | } |
633 | 648 | ||
634 | delete dit; | 649 | delete dit; |
635 | dit = 0; | 650 | dit = 0; |
636 | state = Done; | 651 | state = Done; |
637 | } | 652 | } |
638 | 653 | ||
639 | //qDebug("state Done"); | 654 | //qDebug("state Done"); |
640 | return NULL; | 655 | return NULL; |
641 | } | 656 | } |
642 | 657 | ||
643 | 658 | ||
644 | #include "documentlist.moc" | 659 | #include "documentlist.moc" |
645 | 660 | ||
646 | 661 | ||
647 | 662 | ||
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp index 57469cf..e07920f 100644 --- a/core/launcher/firstuse.cpp +++ b/core/launcher/firstuse.cpp | |||
@@ -1,519 +1,521 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // I need access to some things you don't normally get access to. | 21 | // I need access to some things you don't normally get access to. |
22 | 22 | ||
23 | #ifndef _MSC_VER | 23 | #ifndef _MSC_VER |
24 | //### revise to allow removal of translators under MSVC | 24 | //### revise to allow removal of translators under MSVC |
25 | #define private public | 25 | #define private public |
26 | #define protected public | 26 | #define protected public |
27 | #endif | 27 | #endif |
28 | #include "firstuse.h" | 28 | #include "firstuse.h" |
29 | #include "inputmethods.h" | 29 | #include "inputmethods.h" |
30 | #include "applauncher.h" | 30 | #include "applauncher.h" |
31 | #include "serverapp.h" | 31 | #include "serverapp.h" |
32 | //#include <qtopia/custom.h> | 32 | //#include <qtopia/custom.h> |
33 | 33 | ||
34 | #include "calibrate.h" | 34 | #include "calibrate.h" |
35 | #include "documentlist.h" | 35 | #include "documentlist.h" |
36 | 36 | ||
37 | #include <qtopia/resource.h> | 37 | #include <qtopia/resource.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
39 | #include <qtopia/qpeapplication.h> | 39 | #include <qtopia/qpeapplication.h> |
40 | #include <qtopia/config.h> | 40 | #include <qtopia/config.h> |
41 | #include <qtopia/applnk.h> | 41 | #include <qtopia/applnk.h> |
42 | #include <qtopia/mimetype.h> | 42 | #include <qtopia/mimetype.h> |
43 | #include <qtopia/fontmanager.h> | 43 | #include <qtopia/fontmanager.h> |
44 | 44 | ||
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <qfile.h> | 46 | #include <qfile.h> |
47 | #include <qpainter.h> | 47 | #include <qpainter.h> |
48 | #include <qcstring.h> | 48 | #include <qcstring.h> |
49 | #include <qsimplerichtext.h> | 49 | #include <qsimplerichtext.h> |
50 | #include <qcolor.h> | 50 | #include <qcolor.h> |
51 | #include <qpushbutton.h> | 51 | #include <qpushbutton.h> |
52 | #include <qhbox.h> | 52 | #include <qhbox.h> |
53 | #include <qlabel.h> | 53 | #include <qlabel.h> |
54 | #include <qtimer.h> | 54 | #include <qtimer.h> |
55 | 55 | ||
56 | #if defined( Q_WS_QWS ) | 56 | #if defined( Q_WS_QWS ) |
57 | #include <qwsdisplay_qws.h> | 57 | #include <qwsdisplay_qws.h> |
58 | #include <qgfx_qws.h> | 58 | #include <qgfx_qws.h> |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #include <qwindowsystem_qws.h> | 61 | #include <qwindowsystem_qws.h> |
62 | 62 | ||
63 | #include <stdlib.h> | 63 | #include <stdlib.h> |
64 | #include <sys/types.h> | 64 | #include <sys/types.h> |
65 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) | 65 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) |
66 | #include <unistd.h> | 66 | #include <unistd.h> |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | 69 | ||
70 | struct { | 70 | struct { |
71 | bool enabled; | 71 | bool enabled; |
72 | const char *app; | 72 | const char *app; |
73 | const char *start; | 73 | const char *start; |
74 | const char *stop; | 74 | const char *stop; |
75 | const char *desc; | 75 | const char *desc; |
76 | } | 76 | } |
77 | settingsTable [] = | 77 | settingsTable [] = |
78 | { | 78 | { |
79 | { FALSE, "language", "raise()", "accept()", // No tr | 79 | { FALSE, "language", "raise()", "accept()", // No tr |
80 | QT_TR_NOOP("Language") }, | 80 | QT_TR_NOOP("Language") }, |
81 | { FALSE, "doctab", "raise()", "accept()", // No tr | ||
82 | QT_TR_NOOP("DocTab") }, | ||
81 | #ifndef Q_OS_WIN32 | 83 | #ifndef Q_OS_WIN32 |
82 | { FALSE, "systemtime", "raise()", "accept()", // No tr | 84 | { FALSE, "systemtime", "raise()", "accept()", // No tr |
83 | QT_TR_NOOP("Time and Date") }, | 85 | QT_TR_NOOP("Time and Date") }, |
84 | #endif | 86 | #endif |
85 | { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr | 87 | { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr |
86 | QT_TR_NOOP("Personal Information") }, | 88 | QT_TR_NOOP("Personal Information") }, |
87 | { FALSE, 0, 0, 0, 0 } | 89 | { FALSE, 0, 0, 0, 0 } |
88 | }; | 90 | }; |
89 | 91 | ||
90 | 92 | ||
91 | FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : | 93 | FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : |
92 | QDialog( parent, name, TRUE, wf), | 94 | QDialog( parent, name, TRUE, wf), |
93 | transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), | 95 | transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), |
94 | waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) | 96 | waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) |
95 | { | 97 | { |
96 | ServerApplication::allowRestart = FALSE; | 98 | ServerApplication::allowRestart = FALSE; |
97 | // we force our height beyound the maximum (which we set anyway) | 99 | // we force our height beyound the maximum (which we set anyway) |
98 | QRect desk = qApp->desktop()->geometry(); | 100 | QRect desk = qApp->desktop()->geometry(); |
99 | setGeometry( 0, 0, desk.width(), desk.height() ); | 101 | setGeometry( 0, 0, desk.width(), desk.height() ); |
100 | 102 | ||
101 | connect(qwsServer, SIGNAL(newChannel(const QString&)), | 103 | connect(qwsServer, SIGNAL(newChannel(const QString&)), |
102 | this, SLOT(newQcopChannel(const QString&))); | 104 | this, SLOT(newQcopChannel(const QString&))); |
103 | 105 | ||
104 | // Create a DocumentList so appLauncher has appLnkSet to search | 106 | // Create a DocumentList so appLauncher has appLnkSet to search |
105 | docList = new DocumentList( 0, FALSE ); | 107 | docList = new DocumentList( 0, FALSE ); |
106 | appLauncher = new AppLauncher( this ); | 108 | appLauncher = new AppLauncher( this ); |
107 | connect( appLauncher, SIGNAL(terminated(int, const QString&)), | 109 | connect( appLauncher, SIGNAL(terminated(int, const QString&)), |
108 | this, SLOT(terminated(int, const QString&)) ); | 110 | this, SLOT(terminated(int, const QString&)) ); |
109 | 111 | ||
110 | // more hackery | 112 | // more hackery |
111 | // I will be run as either the main server or as part of the main server | 113 | // I will be run as either the main server or as part of the main server |
112 | QWSServer::setScreenSaverIntervals(0); | 114 | QWSServer::setScreenSaverIntervals(0); |
113 | loadPixmaps(); | 115 | loadPixmaps(); |
114 | 116 | ||
115 | //check if there is a language program | 117 | //check if there is a language program |
116 | #ifndef Q_OS_WIN32 | 118 | #ifndef Q_OS_WIN32 |
117 | QString exeSuffix; | 119 | QString exeSuffix; |
118 | #else | 120 | #else |
119 | QString exeSuffix(".exe"); | 121 | QString exeSuffix(".exe"); |
120 | #endif | 122 | #endif |
121 | 123 | ||
122 | for ( int i = 0; settingsTable[i].app; i++ ) { | 124 | for ( int i = 0; settingsTable[i].app; i++ ) { |
123 | QString file = QPEApplication::qpeDir() + "bin/"; | 125 | QString file = QPEApplication::qpeDir() + "bin/"; |
124 | file += settingsTable[i].app; | 126 | file += settingsTable[i].app; |
125 | file += exeSuffix; | 127 | file += exeSuffix; |
126 | if ( QFile::exists(file) ) | 128 | if ( QFile::exists(file) ) |
127 | settingsTable[i].enabled = TRUE; | 129 | settingsTable[i].enabled = TRUE; |
128 | } | 130 | } |
129 | 131 | ||
130 | setFocusPolicy(NoFocus); | 132 | setFocusPolicy(NoFocus); |
131 | 133 | ||
132 | taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); | 134 | taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); |
133 | 135 | ||
134 | inputMethods = new InputMethods(taskBar); | 136 | inputMethods = new InputMethods(taskBar); |
135 | connect(inputMethods, SIGNAL(inputToggled(bool)), | 137 | connect(inputMethods, SIGNAL(inputToggled(bool)), |
136 | this, SLOT(calcMaxWindowRect())); | 138 | this, SLOT(calcMaxWindowRect())); |
137 | 139 | ||
138 | back = new QPushButton(tr("<< Back"), taskBar); | 140 | back = new QPushButton(tr("<< Back"), taskBar); |
139 | back->setFocusPolicy(NoFocus); | 141 | back->setFocusPolicy(NoFocus); |
140 | connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); | 142 | connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); |
141 | 143 | ||
142 | next = new QPushButton(tr("Next >>"), taskBar); | 144 | next = new QPushButton(tr("Next >>"), taskBar); |
143 | next->setFocusPolicy(NoFocus); | 145 | next->setFocusPolicy(NoFocus); |
144 | connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); | 146 | connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); |
145 | 147 | ||
146 | // need to set the geom to lower corner | 148 | // need to set the geom to lower corner |
147 | QSize sz = inputMethods->sizeHint(); | 149 | QSize sz = inputMethods->sizeHint(); |
148 | int buttonWidth = (width() - sz.width()) / 2; | 150 | int buttonWidth = (width() - sz.width()) / 2; |
149 | int x = 0; | 151 | int x = 0; |
150 | 152 | ||
151 | controlHeight = back->sizeHint().height(); | 153 | controlHeight = back->sizeHint().height(); |
152 | 154 | ||
153 | inputMethods->setGeometry(0,0, sz.width(), controlHeight ); | 155 | inputMethods->setGeometry(0,0, sz.width(), controlHeight ); |
154 | x += sz.width(); | 156 | x += sz.width(); |
155 | 157 | ||
156 | back->setGeometry(x, 0, buttonWidth, controlHeight); | 158 | back->setGeometry(x, 0, buttonWidth, controlHeight); |
157 | x += buttonWidth; | 159 | x += buttonWidth; |
158 | next->setGeometry(x, 0, buttonWidth, controlHeight); | 160 | next->setGeometry(x, 0, buttonWidth, controlHeight); |
159 | 161 | ||
160 | taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); | 162 | taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); |
161 | taskBar->hide(); | 163 | taskBar->hide(); |
162 | 164 | ||
163 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 165 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
164 | qDebug("Setting up QCop to QPE/System"); | 166 | qDebug("Setting up QCop to QPE/System"); |
165 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 167 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
166 | connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 168 | connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
167 | this, SLOT(message(const QCString &, const QByteArray &)) ); | 169 | this, SLOT(message(const QCString &, const QByteArray &)) ); |
168 | #endif | 170 | #endif |
169 | calcMaxWindowRect(); | 171 | calcMaxWindowRect(); |
170 | 172 | ||
171 | m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; | 173 | m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; |
172 | 174 | ||
173 | if ( m_calHandler) { | 175 | if ( m_calHandler) { |
174 | if ( !QFile::exists("/etc/pointercal") ) { | 176 | if ( !QFile::exists("/etc/pointercal") ) { |
175 | needCalibrate = TRUE; | 177 | needCalibrate = TRUE; |
176 | grabMouse(); | 178 | grabMouse(); |
177 | } | 179 | } |
178 | } | 180 | } |
179 | 181 | ||
180 | Config config("locale"); | 182 | Config config("locale"); |
181 | config.setGroup( "Language"); | 183 | config.setGroup( "Language"); |
182 | lang = config.readEntry( "Language", "en"); | 184 | lang = config.readEntry( "Language", "en"); |
183 | 185 | ||
184 | defaultFont = font(); | 186 | defaultFont = font(); |
185 | 187 | ||
186 | //###language/font hack; should look it up somewhere | 188 | //###language/font hack; should look it up somewhere |
187 | #ifdef Q_WS_QWS | 189 | #ifdef Q_WS_QWS |
188 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 190 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
189 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 191 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
190 | qApp->setFont( fn, TRUE ); | 192 | qApp->setFont( fn, TRUE ); |
191 | } | 193 | } |
192 | #endif | 194 | #endif |
193 | } | 195 | } |
194 | 196 | ||
195 | FirstUse::~FirstUse() | 197 | FirstUse::~FirstUse() |
196 | { | 198 | { |
197 | delete appLauncher; | 199 | delete appLauncher; |
198 | delete docList; | 200 | delete docList; |
199 | delete taskBar; | 201 | delete taskBar; |
200 | ServerApplication::allowRestart = TRUE; | 202 | ServerApplication::allowRestart = TRUE; |
201 | } | 203 | } |
202 | 204 | ||
203 | void FirstUse::calcMaxWindowRect() | 205 | void FirstUse::calcMaxWindowRect() |
204 | { | 206 | { |
205 | #ifdef Q_WS_QWS | 207 | #ifdef Q_WS_QWS |
206 | QRect wr; | 208 | QRect wr; |
207 | int displayWidth = qApp->desktop()->width(); | 209 | int displayWidth = qApp->desktop()->width(); |
208 | QRect ir = inputMethods->inputRect(); | 210 | QRect ir = inputMethods->inputRect(); |
209 | if ( ir.isValid() ) { | 211 | if ( ir.isValid() ) { |
210 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); | 212 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); |
211 | } else { | 213 | } else { |
212 | wr.setCoords( 0, 0, displayWidth-1, | 214 | wr.setCoords( 0, 0, displayWidth-1, |
213 | qApp->desktop()->height() - controlHeight-1); | 215 | qApp->desktop()->height() - controlHeight-1); |
214 | } | 216 | } |
215 | 217 | ||
216 | #if QT_VERSION < 0x030000 | 218 | #if QT_VERSION < 0x030000 |
217 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, | 219 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, |
218 | QSize(qt_screen->width(),qt_screen->height())) | 220 | QSize(qt_screen->width(),qt_screen->height())) |
219 | ); | 221 | ); |
220 | #else | 222 | #else |
221 | QWSServer::setMaxWindowRect( wr ); | 223 | QWSServer::setMaxWindowRect( wr ); |
222 | #endif | 224 | #endif |
223 | #endif | 225 | #endif |
224 | } | 226 | } |
225 | 227 | ||
226 | /* cancel current dialog, and bring up next */ | 228 | /* cancel current dialog, and bring up next */ |
227 | void FirstUse::nextDialog() | 229 | void FirstUse::nextDialog() |
228 | { | 230 | { |
229 | int prevApp = currApp; | 231 | int prevApp = currApp; |
230 | do { | 232 | do { |
231 | currApp++; | 233 | currApp++; |
232 | qDebug( "currApp = %d", currApp ); | 234 | qDebug( "currApp = %d", currApp ); |
233 | if ( settingsTable[currApp].app == 0 ) { | 235 | if ( settingsTable[currApp].app == 0 ) { |
234 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { | 236 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { |
235 | // The last application is still running. | 237 | // The last application is still running. |
236 | // Tell it to stop, and when its done we'll come back | 238 | // Tell it to stop, and when its done we'll come back |
237 | // to nextDialog and exit. | 239 | // to nextDialog and exit. |
238 | qDebug( "Waiting for %s to exit", settingsTable[prevApp].app ); | 240 | qDebug( "Waiting for %s to exit", settingsTable[prevApp].app ); |
239 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 241 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
240 | settingsTable[prevApp].stop ); | 242 | settingsTable[prevApp].stop ); |
241 | currApp = prevApp; | 243 | currApp = prevApp; |
242 | } else { | 244 | } else { |
243 | qDebug( "Done!" ); | 245 | qDebug( "Done!" ); |
244 | Config config( "qpe" ); | 246 | Config config( "qpe" ); |
245 | config.setGroup( "Startup" ); | 247 | config.setGroup( "Startup" ); |
246 | config.writeEntry( "FirstUse", FALSE ); | 248 | config.writeEntry( "FirstUse", FALSE ); |
247 | QPixmap pix = Resource::loadPixmap("bigwait"); | 249 | QPixmap pix = Resource::loadPixmap("bigwait"); |
248 | QLabel *lblWait = new QLabel(0, "wait hack!", // No tr | 250 | QLabel *lblWait = new QLabel(0, "wait hack!", // No tr |
249 | QWidget::WStyle_Customize | QWidget::WDestructiveClose | | 251 | QWidget::WStyle_Customize | QWidget::WDestructiveClose | |
250 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool | | 252 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool | |
251 | QWidget::WStyle_StaysOnTop); | 253 | QWidget::WStyle_StaysOnTop); |
252 | lblWait->setPixmap( pix ); | 254 | lblWait->setPixmap( pix ); |
253 | lblWait->setAlignment( QWidget::AlignCenter ); | 255 | lblWait->setAlignment( QWidget::AlignCenter ); |
254 | lblWait->setGeometry( qApp->desktop()->geometry() ); | 256 | lblWait->setGeometry( qApp->desktop()->geometry() ); |
255 | lblWait->show(); | 257 | lblWait->show(); |
256 | qApp->processEvents(); | 258 | qApp->processEvents(); |
257 | QTimer::singleShot( 1000, lblWait, SLOT(close()) ); | 259 | QTimer::singleShot( 1000, lblWait, SLOT(close()) ); |
258 | repaint(); | 260 | repaint(); |
259 | close(); | 261 | close(); |
260 | ServerApplication::allowRestart = TRUE; | 262 | ServerApplication::allowRestart = TRUE; |
261 | } | 263 | } |
262 | return; | 264 | return; |
263 | } | 265 | } |
264 | } while ( !settingsTable[currApp].enabled ); | 266 | } while ( !settingsTable[currApp].enabled ); |
265 | 267 | ||
266 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { | 268 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { |
267 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); | 269 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); |
268 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 270 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
269 | settingsTable[prevApp].stop ); | 271 | settingsTable[prevApp].stop ); |
270 | waitForExit = prevApp; | 272 | waitForExit = prevApp; |
271 | } else { | 273 | } else { |
272 | qDebug( "Startup: %s", settingsTable[currApp].app ); | 274 | qDebug( "Startup: %s", settingsTable[currApp].app ); |
273 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, | 275 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, |
274 | settingsTable[currApp].start ); | 276 | settingsTable[currApp].start ); |
275 | waitingForLaunch = TRUE; | 277 | waitingForLaunch = TRUE; |
276 | } | 278 | } |
277 | 279 | ||
278 | updateButtons(); | 280 | updateButtons(); |
279 | } | 281 | } |
280 | 282 | ||
281 | /* accept current dialog and bring up previous */ | 283 | /* accept current dialog and bring up previous */ |
282 | void FirstUse::previousDialog() | 284 | void FirstUse::previousDialog() |
283 | { | 285 | { |
284 | int prevApp = currApp; | 286 | int prevApp = currApp; |
285 | do { | 287 | do { |
286 | currApp--; | 288 | currApp--; |
287 | if ( currApp < 0 ) { | 289 | if ( currApp < 0 ) { |
288 | currApp = prevApp; | 290 | currApp = prevApp; |
289 | return; | 291 | return; |
290 | } | 292 | } |
291 | } while ( !settingsTable[currApp].enabled ); | 293 | } while ( !settingsTable[currApp].enabled ); |
292 | 294 | ||
293 | if ( prevApp >= 0 ) { | 295 | if ( prevApp >= 0 ) { |
294 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); | 296 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); |
295 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 297 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
296 | settingsTable[prevApp].stop ); | 298 | settingsTable[prevApp].stop ); |
297 | /* | 299 | /* |
298 | if (settingsTable[prevApp].app == QString("systemtime")) | 300 | if (settingsTable[prevApp].app == QString("systemtime")) |
299 | QCopEnvelope e("QPE/Application/citytime", "close()"); | 301 | QCopEnvelope e("QPE/Application/citytime", "close()"); |
300 | */ | 302 | */ |
301 | waitForExit = prevApp; | 303 | waitForExit = prevApp; |
302 | } else { | 304 | } else { |
303 | qDebug( "Startup: %s", settingsTable[currApp].app ); | 305 | qDebug( "Startup: %s", settingsTable[currApp].app ); |
304 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, | 306 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, |
305 | settingsTable[currApp].start ); | 307 | settingsTable[currApp].start ); |
306 | waitingForLaunch = TRUE; | 308 | waitingForLaunch = TRUE; |
307 | } | 309 | } |
308 | 310 | ||
309 | updateButtons(); | 311 | updateButtons(); |
310 | } | 312 | } |
311 | 313 | ||
312 | void FirstUse::message(const QCString &msg, const QByteArray &data) | 314 | void FirstUse::message(const QCString &msg, const QByteArray &data) |
313 | { | 315 | { |
314 | QDataStream stream( data, IO_ReadOnly ); | 316 | QDataStream stream( data, IO_ReadOnly ); |
315 | if ( msg == "timeChange(QString)" ) { | 317 | if ( msg == "timeChange(QString)" ) { |
316 | QString t; | 318 | QString t; |
317 | stream >> t; | 319 | stream >> t; |
318 | if ( t.isNull() ) | 320 | if ( t.isNull() ) |
319 | unsetenv("TZ"); | 321 | unsetenv("TZ"); |
320 | else | 322 | else |
321 | setenv( "TZ", t.latin1(), 1 ); | 323 | setenv( "TZ", t.latin1(), 1 ); |
322 | } | 324 | } |
323 | } | 325 | } |
324 | 326 | ||
325 | void FirstUse::terminated( int, const QString &app ) | 327 | void FirstUse::terminated( int, const QString &app ) |
326 | { | 328 | { |
327 | qDebug( "--- terminated: %s", app.latin1() ); | 329 | qDebug( "--- terminated: %s", app.latin1() ); |
328 | if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) { | 330 | if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) { |
329 | qDebug( "Startup: %s", settingsTable[currApp].app ); | 331 | qDebug( "Startup: %s", settingsTable[currApp].app ); |
330 | if ( settingsTable[waitForExit].app == "language" ) { // No tr | 332 | if ( settingsTable[waitForExit].app == "language" ) { // No tr |
331 | Config config("locale"); | 333 | Config config("locale"); |
332 | config.setGroup( "Language"); | 334 | config.setGroup( "Language"); |
333 | QString l = config.readEntry( "Language", "en"); | 335 | QString l = config.readEntry( "Language", "en"); |
334 | if ( l != lang ) { | 336 | if ( l != lang ) { |
335 | reloadLanguages(); | 337 | reloadLanguages(); |
336 | needRestart = TRUE; | 338 | needRestart = TRUE; |
337 | lang = l; | 339 | lang = l; |
338 | } | 340 | } |
339 | } | 341 | } |
340 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, | 342 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, |
341 | settingsTable[currApp].start ); | 343 | settingsTable[currApp].start ); |
342 | waitingForLaunch = TRUE; | 344 | waitingForLaunch = TRUE; |
343 | updateButtons(); | 345 | updateButtons(); |
344 | repaint(); | 346 | repaint(); |
345 | waitForExit = -1; | 347 | waitForExit = -1; |
346 | } else if ( settingsTable[currApp].app == app ) { | 348 | } else if ( settingsTable[currApp].app == app ) { |
347 | nextDialog(); | 349 | nextDialog(); |
348 | } else { | 350 | } else { |
349 | back->setEnabled(TRUE); | 351 | back->setEnabled(TRUE); |
350 | next->setEnabled(TRUE); | 352 | next->setEnabled(TRUE); |
351 | } | 353 | } |
352 | } | 354 | } |
353 | 355 | ||
354 | void FirstUse::newQcopChannel(const QString& channelName) | 356 | void FirstUse::newQcopChannel(const QString& channelName) |
355 | { | 357 | { |
356 | qDebug("channel %s added", channelName.data() ); | 358 | qDebug("channel %s added", channelName.data() ); |
357 | QString prefix("QPE/Application/"); | 359 | QString prefix("QPE/Application/"); |
358 | if (channelName.startsWith(prefix)) { | 360 | if (channelName.startsWith(prefix)) { |
359 | QString appName = channelName.mid(prefix.length()); | 361 | QString appName = channelName.mid(prefix.length()); |
360 | if ( currApp >= 0 && appName == settingsTable[currApp].app ) { | 362 | if ( currApp >= 0 && appName == settingsTable[currApp].app ) { |
361 | qDebug( "Application: %s started", settingsTable[currApp].app ); | 363 | qDebug( "Application: %s started", settingsTable[currApp].app ); |
362 | waitingForLaunch = FALSE; | 364 | waitingForLaunch = FALSE; |
363 | updateButtons(); | 365 | updateButtons(); |
364 | repaint(); | 366 | repaint(); |
365 | } else if (appName != "quicklauncher") { | 367 | } else if (appName != "quicklauncher") { |
366 | back->setEnabled(FALSE); | 368 | back->setEnabled(FALSE); |
367 | next->setEnabled(FALSE); | 369 | next->setEnabled(FALSE); |
368 | } | 370 | } |
369 | } | 371 | } |
370 | } | 372 | } |
371 | 373 | ||
372 | void FirstUse::reloadLanguages() | 374 | void FirstUse::reloadLanguages() |
373 | { | 375 | { |
374 | // read language from config file. Waiting on QCop takes too long. | 376 | // read language from config file. Waiting on QCop takes too long. |
375 | Config config("locale"); | 377 | Config config("locale"); |
376 | config.setGroup( "Language"); | 378 | config.setGroup( "Language"); |
377 | QString l = config.readEntry( "Language", "en"); | 379 | QString l = config.readEntry( "Language", "en"); |
378 | QString cl = getenv("LANG"); | 380 | QString cl = getenv("LANG"); |
379 | qWarning("language message - " + l); | 381 | qWarning("language message - " + l); |
380 | // setting anyway... | 382 | // setting anyway... |
381 | if (l.isNull() ) | 383 | if (l.isNull() ) |
382 | unsetenv( "LANG" ); | 384 | unsetenv( "LANG" ); |
383 | else { | 385 | else { |
384 | qWarning("and its not null"); | 386 | qWarning("and its not null"); |
385 | setenv( "LANG", l.latin1(), 1 ); | 387 | setenv( "LANG", l.latin1(), 1 ); |
386 | } | 388 | } |
387 | #ifndef QT_NO_TRANSLATION | 389 | #ifndef QT_NO_TRANSLATION |
388 | // clear old translators | 390 | // clear old translators |
389 | #ifndef _MSC_VER | 391 | #ifndef _MSC_VER |
390 | //### revise to allow removal of translators under MSVC | 392 | //### revise to allow removal of translators under MSVC |
391 | if(qApp->translators) { | 393 | if(qApp->translators) { |
392 | qApp->translators->setAutoDelete(TRUE); | 394 | qApp->translators->setAutoDelete(TRUE); |
393 | delete (qApp->translators); | 395 | delete (qApp->translators); |
394 | qApp->translators = 0; | 396 | qApp->translators = 0; |
395 | } | 397 | } |
396 | #endif | 398 | #endif |
397 | 399 | ||
398 | // load translation tables | 400 | // load translation tables |
399 | transApp = new QTranslator(qApp); | 401 | transApp = new QTranslator(qApp); |
400 | QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm"; | 402 | QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm"; |
401 | qWarning("loading " + tfn); | 403 | qWarning("loading " + tfn); |
402 | if ( transApp->load(tfn) ) { | 404 | if ( transApp->load(tfn) ) { |
403 | qWarning("installing translator"); | 405 | qWarning("installing translator"); |
404 | qApp->installTranslator( transApp ); | 406 | qApp->installTranslator( transApp ); |
405 | } else { | 407 | } else { |
406 | delete transApp; | 408 | delete transApp; |
407 | transApp = 0; | 409 | transApp = 0; |
408 | } | 410 | } |
409 | 411 | ||
410 | transLib = new QTranslator(qApp); | 412 | transLib = new QTranslator(qApp); |
411 | tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm"; | 413 | tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm"; |
412 | qWarning("loading " + tfn); | 414 | qWarning("loading " + tfn); |
413 | if ( transLib->load(tfn) ) { | 415 | if ( transLib->load(tfn) ) { |
414 | qWarning("installing translator library"); | 416 | qWarning("installing translator library"); |
415 | qApp->installTranslator( transLib ); | 417 | qApp->installTranslator( transLib ); |
416 | } else { | 418 | } else { |
417 | delete transLib; | 419 | delete transLib; |
418 | transLib = 0; | 420 | transLib = 0; |
419 | } | 421 | } |
420 | loadPixmaps(); | 422 | loadPixmaps(); |
421 | //###language/font hack; should look it up somewhere | 423 | //###language/font hack; should look it up somewhere |
422 | #ifdef Q_WS_QWS | 424 | #ifdef Q_WS_QWS |
423 | if ( l == "ja" || l == "zh_CN" || l == "zh_TW" || l == "ko" ) { | 425 | if ( l == "ja" || l == "zh_CN" || l == "zh_TW" || l == "ko" ) { |
424 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 426 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
425 | qApp->setFont( fn, TRUE ); | 427 | qApp->setFont( fn, TRUE ); |
426 | } else { | 428 | } else { |
427 | qApp->setFont( defaultFont, TRUE ); | 429 | qApp->setFont( defaultFont, TRUE ); |
428 | } | 430 | } |
429 | #endif | 431 | #endif |
430 | #endif | 432 | #endif |
431 | } | 433 | } |
432 | 434 | ||
433 | void FirstUse::paintEvent( QPaintEvent * ) | 435 | void FirstUse::paintEvent( QPaintEvent * ) |
434 | { | 436 | { |
435 | QPainter p( this ); | 437 | QPainter p( this ); |
436 | 438 | ||
437 | p.drawPixmap(0,0, splash); | 439 | p.drawPixmap(0,0, splash); |
438 | 440 | ||
439 | QFont f = p.font(); | 441 | QFont f = p.font(); |
440 | f.setPointSize(15); | 442 | f.setPointSize(15); |
441 | f.setItalic(FALSE); | 443 | f.setItalic(FALSE); |
442 | f.setBold(FALSE); | 444 | f.setBold(FALSE); |
443 | p.setFont(f); | 445 | p.setFont(f); |
444 | 446 | ||
445 | if ( currApp < 0 ) { | 447 | if ( currApp < 0 ) { |
446 | drawText(p, tr( "Tap anywhere on the screen to continue." )); | 448 | drawText(p, tr( "Tap anywhere on the screen to continue." )); |
447 | } else if ( settingsTable[currApp].app ) { | 449 | } else if ( settingsTable[currApp].app ) { |
448 | if ( waitingForLaunch ) | 450 | if ( waitingForLaunch ) |
449 | drawText(p, tr("Please wait, loading %1 settings.").arg(tr(settingsTable[currApp].desc)) ); | 451 | drawText(p, tr("Please wait, loading %1 settings.").arg(tr(settingsTable[currApp].desc)) ); |
450 | } else { | 452 | } else { |
451 | drawText(p, tr("Please wait...")); | 453 | drawText(p, tr("Please wait...")); |
452 | } | 454 | } |
453 | } | 455 | } |
454 | 456 | ||
455 | void FirstUse::loadPixmaps() | 457 | void FirstUse::loadPixmaps() |
456 | { | 458 | { |
457 | /* create background, tr so can change image with language. | 459 | /* create background, tr so can change image with language. |
458 | images will likely contain text. */ | 460 | images will likely contain text. */ |
459 | splash.convertFromImage( Resource::loadImage(tr("FirstUseBackground")) | 461 | splash.convertFromImage( Resource::loadImage(tr("FirstUseBackground")) |
460 | .smoothScale( width(), height() ) ); | 462 | .smoothScale( width(), height() ) ); |
461 | 463 | ||
462 | setBackgroundPixmap(splash); | 464 | setBackgroundPixmap(splash); |
463 | } | 465 | } |
464 | 466 | ||
465 | void FirstUse::drawText(QPainter &p, const QString &text) | 467 | void FirstUse::drawText(QPainter &p, const QString &text) |
466 | { | 468 | { |
467 | QString altered = "<CENTER>" + text + "</CENTER>"; | 469 | QString altered = "<CENTER>" + text + "</CENTER>"; |
468 | 470 | ||
469 | QSimpleRichText rt(altered, p.font()); | 471 | QSimpleRichText rt(altered, p.font()); |
470 | rt.setWidth(width() - 20); | 472 | rt.setWidth(width() - 20); |
471 | 473 | ||
472 | int h = (height() * 3) / 10; // start at 30% | 474 | int h = (height() * 3) / 10; // start at 30% |
473 | if (rt.height() < height() / 2) | 475 | if (rt.height() < height() / 2) |
474 | h += ((height() / 2) - rt.height()) / 2; | 476 | h += ((height() / 2) - rt.height()) / 2; |
475 | rt.draw(&p, 10, h, QRegion(0,0, width()-20, height()), palette()); | 477 | rt.draw(&p, 10, h, QRegion(0,0, width()-20, height()), palette()); |
476 | } | 478 | } |
477 | 479 | ||
478 | void FirstUse::updateButtons() | 480 | void FirstUse::updateButtons() |
479 | { | 481 | { |
480 | if ( currApp >= 0 ) { | 482 | if ( currApp >= 0 ) { |
481 | taskBar->show(); | 483 | taskBar->show(); |
482 | } | 484 | } |
483 | 485 | ||
484 | int i = currApp-1; | 486 | int i = currApp-1; |
485 | while ( i >= 0 && !settingsTable[i].enabled ) | 487 | while ( i >= 0 && !settingsTable[i].enabled ) |
486 | i--; | 488 | i--; |
487 | back->setText(tr("<< Back")); | 489 | back->setText(tr("<< Back")); |
488 | back->setEnabled( i >= 0 && !waitingForLaunch ); | 490 | back->setEnabled( i >= 0 && !waitingForLaunch ); |
489 | 491 | ||
490 | i = currApp+1; | 492 | i = currApp+1; |
491 | while ( settingsTable[i].app && !settingsTable[i].enabled ) | 493 | while ( settingsTable[i].app && !settingsTable[i].enabled ) |
492 | i++; | 494 | i++; |
493 | if ( !settingsTable[i].app ) | 495 | if ( !settingsTable[i].app ) |
494 | next->setText(tr("Finish")); | 496 | next->setText(tr("Finish")); |
495 | else | 497 | else |
496 | next->setText(tr("Next >>")); | 498 | next->setText(tr("Next >>")); |
497 | 499 | ||
498 | next->setEnabled( !waitingForLaunch ); | 500 | next->setEnabled( !waitingForLaunch ); |
499 | } | 501 | } |
500 | 502 | ||
501 | void FirstUse::keyPressEvent( QKeyEvent *e ) | 503 | void FirstUse::keyPressEvent( QKeyEvent *e ) |
502 | { | 504 | { |
503 | // Allow cancelling at first dialog, in case display is broken. | 505 | // Allow cancelling at first dialog, in case display is broken. |
504 | if ( e->key() == Key_Escape && currApp < 0 ) | 506 | if ( e->key() == Key_Escape && currApp < 0 ) |
505 | QDialog::keyPressEvent(e); | 507 | QDialog::keyPressEvent(e); |
506 | } | 508 | } |
507 | 509 | ||
508 | void FirstUse::mouseReleaseEvent( QMouseEvent * ) | 510 | void FirstUse::mouseReleaseEvent( QMouseEvent * ) |
509 | { | 511 | { |
510 | if ( currApp < 0 ) { | 512 | if ( currApp < 0 ) { |
511 | if ( m_calHandler && needCalibrate ) { | 513 | if ( m_calHandler && needCalibrate ) { |
512 | releaseMouse(); | 514 | releaseMouse(); |
513 | Calibrate *cal = new Calibrate; | 515 | Calibrate *cal = new Calibrate; |
514 | cal->exec(); | 516 | cal->exec(); |
515 | delete cal; | 517 | delete cal; |
516 | } | 518 | } |
517 | nextDialog(); | 519 | nextDialog(); |
518 | } | 520 | } |
519 | } | 521 | } |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index d697c43..b312672 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,757 +1,780 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qtopia/global.h> | 21 | #include <qtopia/global.h> |
22 | #ifdef Q_WS_QWS | 22 | #ifdef Q_WS_QWS |
23 | #include <qtopia/qcopenvelope_qws.h> | 23 | #include <qtopia/qcopenvelope_qws.h> |
24 | #endif | 24 | #endif |
25 | #include <qtopia/resource.h> | 25 | #include <qtopia/resource.h> |
26 | #include <qtopia/applnk.h> | 26 | #include <qtopia/applnk.h> |
27 | #include <qtopia/config.h> | 27 | #include <qtopia/config.h> |
28 | #include <qtopia/global.h> | 28 | #include <qtopia/global.h> |
29 | #include <qtopia/qpeapplication.h> | 29 | #include <qtopia/qpeapplication.h> |
30 | #include <qtopia/mimetype.h> | 30 | #include <qtopia/mimetype.h> |
31 | #include <qtopia/private/categories.h> | 31 | #include <qtopia/private/categories.h> |
32 | //#include <qtopia/custom.h> | 32 | //#include <qtopia/custom.h> |
33 | 33 | ||
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #ifdef Q_WS_QWS | 35 | #ifdef Q_WS_QWS |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | #endif | 37 | #endif |
38 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qvbox.h> | 40 | #include <qvbox.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qstyle.h> | 42 | #include <qstyle.h> |
43 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
44 | #include <qtabbar.h> | 44 | #include <qtabbar.h> |
45 | #include <qwidgetstack.h> | 45 | #include <qwidgetstack.h> |
46 | #include <qlayout.h> | 46 | #include <qlayout.h> |
47 | #include <qregexp.h> | 47 | #include <qregexp.h> |
48 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
49 | #include <qframe.h> | 49 | #include <qframe.h> |
50 | #include <qpainter.h> | 50 | #include <qpainter.h> |
51 | #include <qlabel.h> | 51 | #include <qlabel.h> |
52 | #include <qtextstream.h> | 52 | #include <qtextstream.h> |
53 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
54 | 54 | ||
55 | #include "startmenu.h" | 55 | #include "startmenu.h" |
56 | #include "taskbar.h" | 56 | #include "taskbar.h" |
57 | 57 | ||
58 | #include "serverinterface.h" | 58 | #include "serverinterface.h" |
59 | #include "launcherview.h" | 59 | #include "launcherview.h" |
60 | #include "launcher.h" | 60 | #include "launcher.h" |
61 | #include "server.h" | 61 | #include "server.h" |
62 | 62 | ||
63 | #define QTOPIA_INTERNAL_FSLP | 63 | #define QTOPIA_INTERNAL_FSLP |
64 | #include <qtopia/lnkproperties.h> | 64 | #include <qtopia/lnkproperties.h> |
65 | #include <stdlib.h> | 65 | #include <stdlib.h> |
66 | #include <assert.h> | 66 | #include <assert.h> |
67 | 67 | ||
68 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 68 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
69 | #include <unistd.h> | 69 | #include <unistd.h> |
70 | #include <stdio.h> | 70 | #include <stdio.h> |
71 | #include <sys/vfs.h> | 71 | #include <sys/vfs.h> |
72 | #include <mntent.h> | 72 | #include <mntent.h> |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | #ifdef Q_WS_QWS | 75 | #ifdef Q_WS_QWS |
76 | #include <qkeyboard_qws.h> | 76 | #include <qkeyboard_qws.h> |
77 | #include <qpe/lnkproperties.h> | 77 | #include <qpe/lnkproperties.h> |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | 80 | ||
81 | static bool isVisibleWindow( int ); | 81 | static bool isVisibleWindow( int ); |
82 | //=========================================================================== | 82 | //=========================================================================== |
83 | 83 | ||
84 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : | 84 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : |
85 | QVBox( parent ) | 85 | QVBox( parent ), docview( 0 ) |
86 | { | 86 | { |
87 | docLoadingWidgetEnabled = false; | 87 | docLoadingWidgetEnabled = false; |
88 | docLoadingWidget = 0; | 88 | docLoadingWidget = 0; |
89 | docLoadingWidgetProgress = 0; | 89 | docLoadingWidgetProgress = 0; |
90 | launcher = parent; | 90 | launcher = parent; |
91 | categoryBar = new LauncherTabBar( this ); | 91 | categoryBar = new LauncherTabBar( this ); |
92 | QPalette pal = categoryBar->palette(); | 92 | QPalette pal = categoryBar->palette(); |
93 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 93 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
94 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 94 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
95 | categoryBar->setPalette( pal ); | 95 | categoryBar->setPalette( pal ); |
96 | stack = new QWidgetStack(this); | 96 | stack = new QWidgetStack(this); |
97 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); | 97 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); |
98 | categoryBar->show(); | 98 | categoryBar->show(); |
99 | stack->show(); | 99 | stack->show(); |
100 | 100 | ||
101 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 101 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
102 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); | 102 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); |
103 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 103 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
104 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); | 104 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); |
105 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 105 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), |
106 | this, SLOT(appMessage(const QCString&, const QByteArray&))); | 106 | this, SLOT(appMessage(const QCString&, const QByteArray&))); |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | createDocLoadingWidget(); | 109 | createDocLoadingWidget(); |
110 | } | 110 | } |
111 | 111 | ||
112 | void LauncherTabWidget::createDocLoadingWidget() | 112 | void LauncherTabWidget::createDocLoadingWidget() |
113 | { | 113 | { |
114 | // Construct the 'doc loading widget' shown when finding documents | 114 | // Construct the 'doc loading widget' shown when finding documents |
115 | 115 | ||
116 | // ### LauncherView class needs changing to be more generic so | 116 | // ### LauncherView class needs changing to be more generic so |
117 | // this widget can change its background similar to the iconviews | 117 | // this widget can change its background similar to the iconviews |
118 | // so the background for this matches | 118 | // so the background for this matches |
119 | docLoadingWidget = new LauncherView( stack ); | 119 | docLoadingWidget = new LauncherView( stack ); |
120 | docLoadingWidget->hideIcons(); | 120 | docLoadingWidget->hideIcons(); |
121 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); | 121 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); |
122 | 122 | ||
123 | docLoadingVBox->setSpacing( 20 ); | 123 | docLoadingVBox->setSpacing( 20 ); |
124 | docLoadingVBox->setMargin( 10 ); | 124 | docLoadingVBox->setMargin( 10 ); |
125 | 125 | ||
126 | QWidget *space1 = new QWidget( docLoadingVBox ); | 126 | QWidget *space1 = new QWidget( docLoadingVBox ); |
127 | docLoadingVBox->setStretchFactor( space1, 1 ); | 127 | docLoadingVBox->setStretchFactor( space1, 1 ); |
128 | 128 | ||
129 | QLabel *waitPixmap = new QLabel( docLoadingVBox ); | 129 | QLabel *waitPixmap = new QLabel( docLoadingVBox ); |
130 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); | 130 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); |
131 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); | 131 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); |
132 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); | 132 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); |
133 | 133 | ||
134 | Config cfg( "Launcher" ); | ||
135 | cfg.setGroup( "DocTab" ); | ||
136 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); | ||
137 | |||
134 | QLabel *textLabel = new QLabel( docLoadingVBox ); | 138 | QLabel *textLabel = new QLabel( docLoadingVBox ); |
135 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); | ||
136 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); | 139 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); |
137 | |||
138 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); | 140 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); |
139 | docLoadingWidgetProgress->setProgress( 0 ); | 141 | docLoadingWidgetProgress->setProgress( 0 ); |
140 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); | 142 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); |
141 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker | 143 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker |
142 | setProgressStyle(); | 144 | setProgressStyle(); |
143 | 145 | ||
146 | if ( docTabEnabled ) | ||
147 | { | ||
148 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); | ||
149 | } | ||
150 | else | ||
151 | { | ||
152 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" | ||
153 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); | ||
154 | docLoadingWidgetProgress->hide(); | ||
155 | } | ||
156 | |||
144 | QWidget *space2 = new QWidget( docLoadingVBox ); | 157 | QWidget *space2 = new QWidget( docLoadingVBox ); |
145 | docLoadingVBox->setStretchFactor( space2, 1 ); | 158 | docLoadingVBox->setStretchFactor( space2, 1 ); |
146 | 159 | ||
147 | Config cfg("Launcher"); | ||
148 | cfg.setGroup( "Tab Documents" ); // No tr | 160 | cfg.setGroup( "Tab Documents" ); // No tr |
149 | setTabViewAppearance( docLoadingWidget, cfg ); | 161 | setTabViewAppearance( docLoadingWidget, cfg ); |
150 | 162 | ||
151 | stack->addWidget( docLoadingWidget, 0 ); | 163 | stack->addWidget( docLoadingWidget, 0 ); |
152 | } | 164 | } |
153 | 165 | ||
154 | void LauncherTabWidget::initLayout() | 166 | void LauncherTabWidget::initLayout() |
155 | { | 167 | { |
156 | layout()->activate(); | 168 | layout()->activate(); |
157 | docView()->setFocus(); | 169 | docView()->setFocus(); |
158 | categoryBar->showTab("Documents"); | 170 | categoryBar->showTab("Documents"); |
159 | } | 171 | } |
160 | 172 | ||
161 | void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) | 173 | void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) |
162 | { | 174 | { |
163 | if ( message == "nextView()" ) | 175 | if ( message == "nextView()" ) |
164 | categoryBar->nextTab(); | 176 | categoryBar->nextTab(); |
165 | } | 177 | } |
166 | 178 | ||
167 | void LauncherTabWidget::raiseTabWidget() | 179 | void LauncherTabWidget::raiseTabWidget() |
168 | { | 180 | { |
169 | if ( categoryBar->currentView() == docView() | 181 | if ( categoryBar->currentView() == docView() |
170 | && docLoadingWidgetEnabled ) { | 182 | && docLoadingWidgetEnabled ) { |
171 | stack->raiseWidget( docLoadingWidget ); | 183 | stack->raiseWidget( docLoadingWidget ); |
172 | docLoadingWidget->updateGeometry(); | 184 | docLoadingWidget->updateGeometry(); |
173 | } else { | 185 | } else { |
174 | stack->raiseWidget( categoryBar->currentView() ); | 186 | stack->raiseWidget( categoryBar->currentView() ); |
175 | } | 187 | } |
176 | } | 188 | } |
177 | 189 | ||
178 | void LauncherTabWidget::tabProperties() | 190 | void LauncherTabWidget::tabProperties() |
179 | { | 191 | { |
180 | LauncherView *view = categoryBar->currentView(); | 192 | LauncherView *view = categoryBar->currentView(); |
181 | QPopupMenu *m = new QPopupMenu( this ); | 193 | QPopupMenu *m = new QPopupMenu( this ); |
182 | m->insertItem( tr("Icon View"), LauncherView::Icon ); | 194 | m->insertItem( tr("Icon View"), LauncherView::Icon ); |
183 | m->insertItem( tr("List View"), LauncherView::List ); | 195 | m->insertItem( tr("List View"), LauncherView::List ); |
184 | m->setItemChecked( (int)view->viewMode(), TRUE ); | 196 | m->setItemChecked( (int)view->viewMode(), TRUE ); |
185 | int rv = m->exec( QCursor::pos() ); | 197 | int rv = m->exec( QCursor::pos() ); |
186 | if ( rv >= 0 && rv != view->viewMode() ) { | 198 | if ( rv >= 0 && rv != view->viewMode() ) { |
187 | view->setViewMode( (LauncherView::ViewMode)rv ); | 199 | view->setViewMode( (LauncherView::ViewMode)rv ); |
188 | } | 200 | } |
189 | 201 | ||
190 | delete m; | 202 | delete m; |
191 | } | 203 | } |
192 | 204 | ||
193 | void LauncherTabWidget::deleteView( const QString& id ) | 205 | void LauncherTabWidget::deleteView( const QString& id ) |
194 | { | 206 | { |
195 | LauncherTab *t = categoryBar->launcherTab(id); | 207 | LauncherTab *t = categoryBar->launcherTab(id); |
196 | if ( t ) { | 208 | if ( t ) { |
197 | stack->removeWidget( t->view ); | 209 | stack->removeWidget( t->view ); |
198 | delete t->view; | 210 | delete t->view; |
199 | categoryBar->removeTab( t ); | 211 | categoryBar->removeTab( t ); |
200 | } | 212 | } |
201 | } | 213 | } |
202 | 214 | ||
203 | LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 215 | LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) |
204 | { | 216 | { |
205 | LauncherView* view = new LauncherView( stack ); | 217 | LauncherView* view = new LauncherView( stack ); |
206 | connect( view, SIGNAL(clicked(const AppLnk*)), | 218 | connect( view, SIGNAL(clicked(const AppLnk*)), |
207 | this, SIGNAL(clicked(const AppLnk*))); | 219 | this, SIGNAL(clicked(const AppLnk*))); |
208 | connect( view, SIGNAL(rightPressed(AppLnk*)), | 220 | connect( view, SIGNAL(rightPressed(AppLnk*)), |
209 | this, SIGNAL(rightPressed(AppLnk*))); | 221 | this, SIGNAL(rightPressed(AppLnk*))); |
210 | 222 | ||
211 | int n = categoryBar->count(); | 223 | int n = categoryBar->count(); |
212 | stack->addWidget( view, n ); | 224 | stack->addWidget( view, n ); |
213 | 225 | ||
214 | LauncherTab *tab = new LauncherTab( id, view, pm, label ); | 226 | LauncherTab *tab = new LauncherTab( id, view, pm, label ); |
215 | categoryBar->insertTab( tab, n-1 ); | 227 | categoryBar->insertTab( tab, n-1 ); |
216 | 228 | ||
217 | if ( id == "Documents" ) | 229 | if ( id == "Documents" ) |
218 | docview = view; | 230 | docview = view; |
219 | 231 | ||
220 | qDebug("inserting %s at %d", id.latin1(), n-1 ); | 232 | qDebug("inserting %s at %d", id.latin1(), n-1 ); |
221 | 233 | ||
222 | Config cfg("Launcher"); | 234 | Config cfg("Launcher"); |
223 | setTabAppearance( tab, cfg ); | 235 | setTabAppearance( tab, cfg ); |
224 | 236 | ||
225 | cfg.setGroup( "GUI" ); | 237 | cfg.setGroup( "GUI" ); |
226 | view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); | 238 | view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); |
227 | 239 | ||
228 | return view; | 240 | return view; |
229 | } | 241 | } |
230 | 242 | ||
231 | LauncherView *LauncherTabWidget::view( const QString &id ) | 243 | LauncherView *LauncherTabWidget::view( const QString &id ) |
232 | { | 244 | { |
233 | LauncherTab *t = categoryBar->launcherTab(id); | 245 | LauncherTab *t = categoryBar->launcherTab(id); |
234 | if ( !t ) | 246 | if ( !t ) |
235 | return 0; | 247 | return 0; |
236 | return t->view; | 248 | return t->view; |
237 | } | 249 | } |
238 | 250 | ||
239 | LauncherView *LauncherTabWidget::docView() | 251 | LauncherView *LauncherTabWidget::docView() |
240 | { | 252 | { |
241 | return docview; | 253 | return docview; |
242 | } | 254 | } |
243 | 255 | ||
244 | void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) | 256 | void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) |
245 | { | 257 | { |
246 | if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { | 258 | if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { |
247 | docLoadingWidgetEnabled = v; | 259 | docLoadingWidgetEnabled = v; |
248 | raiseTabWidget(); | 260 | raiseTabWidget(); |
249 | } | 261 | } |
250 | } | 262 | } |
251 | 263 | ||
252 | void LauncherTabWidget::setLoadingProgress( int percent ) | 264 | void LauncherTabWidget::setLoadingProgress( int percent ) |
253 | { | 265 | { |
254 | docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); | 266 | docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); |
255 | } | 267 | } |
256 | 268 | ||
257 | // ### this function could more to LauncherView | 269 | // ### this function could more to LauncherView |
258 | void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) | 270 | void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) |
259 | { | 271 | { |
260 | // View | 272 | // View |
261 | QString view = cfg.readEntry( "View", "Icon" ); | 273 | QString view = cfg.readEntry( "View", "Icon" ); |
262 | if ( view == "List" ) // No tr | 274 | if ( view == "List" ) // No tr |
263 | v->setViewMode( LauncherView::List ); | 275 | v->setViewMode( LauncherView::List ); |
264 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); | 276 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); |
265 | if ( bgType == "Image" ) { // No tr | 277 | if ( bgType == "Image" ) { // No tr |
266 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); | 278 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); |
267 | v->setBackgroundType( LauncherView::Image, pm ); | 279 | v->setBackgroundType( LauncherView::Image, pm ); |
268 | } else if ( bgType == "SolidColor" ) { | 280 | } else if ( bgType == "SolidColor" ) { |
269 | QString c = cfg.readEntry( "BackgroundColor" ); | 281 | QString c = cfg.readEntry( "BackgroundColor" ); |
270 | v->setBackgroundType( LauncherView::SolidColor, c ); | 282 | v->setBackgroundType( LauncherView::SolidColor, c ); |
271 | } else { | 283 | } else { |
272 | v->setBackgroundType( LauncherView::Ruled, QString::null ); | 284 | v->setBackgroundType( LauncherView::Ruled, QString::null ); |
273 | } | 285 | } |
274 | QString textCol = cfg.readEntry( "TextColor" ); | 286 | QString textCol = cfg.readEntry( "TextColor" ); |
275 | if ( textCol.isEmpty() ) | 287 | if ( textCol.isEmpty() ) |
276 | v->setTextColor( QColor() ); | 288 | v->setTextColor( QColor() ); |
277 | else | 289 | else |
278 | v->setTextColor( QColor(textCol) ); | 290 | v->setTextColor( QColor(textCol) ); |
279 | // bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); | 291 | // bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); |
280 | 292 | ||
281 | 293 | ||
282 | QStringList font = cfg.readListEntry( "Font", ',' ); | 294 | QStringList font = cfg.readListEntry( "Font", ',' ); |
283 | if ( font.count() == 4 ) | 295 | if ( font.count() == 4 ) |
284 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); | 296 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); |
285 | 297 | ||
286 | // ### FIXME TabColor TabTextColor | 298 | // ### FIXME TabColor TabTextColor |
287 | 299 | ||
288 | } | 300 | } |
289 | 301 | ||
290 | // ### Could move to LauncherTab | 302 | // ### Could move to LauncherTab |
291 | void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) | 303 | void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) |
292 | { | 304 | { |
293 | cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr | 305 | cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr |
294 | 306 | ||
295 | setTabViewAppearance( tab->view, cfg ); | 307 | setTabViewAppearance( tab->view, cfg ); |
296 | 308 | ||
297 | // Tabs | 309 | // Tabs |
298 | QString tabCol = cfg.readEntry( "TabColor" ); | 310 | QString tabCol = cfg.readEntry( "TabColor" ); |
299 | if ( tabCol.isEmpty() ) | 311 | if ( tabCol.isEmpty() ) |
300 | tab->bgColor = QColor(); | 312 | tab->bgColor = QColor(); |
301 | else | 313 | else |
302 | tab->bgColor = QColor(tabCol); | 314 | tab->bgColor = QColor(tabCol); |
303 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); | 315 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); |
304 | if ( tabTextCol.isEmpty() ) | 316 | if ( tabTextCol.isEmpty() ) |
305 | tab->fgColor = QColor(); | 317 | tab->fgColor = QColor(); |
306 | else | 318 | else |
307 | tab->fgColor = QColor(tabTextCol); | 319 | tab->fgColor = QColor(tabTextCol); |
308 | } | 320 | } |
309 | 321 | ||
310 | void LauncherTabWidget::paletteChange( const QPalette &p ) | 322 | void LauncherTabWidget::paletteChange( const QPalette &p ) |
311 | { | 323 | { |
312 | QVBox::paletteChange( p ); | 324 | QVBox::paletteChange( p ); |
313 | QPalette pal = palette(); | 325 | QPalette pal = palette(); |
314 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 326 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
315 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 327 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
316 | categoryBar->setPalette( pal ); | 328 | categoryBar->setPalette( pal ); |
317 | categoryBar->update(); | 329 | categoryBar->update(); |
318 | } | 330 | } |
319 | 331 | ||
320 | void LauncherTabWidget::styleChange( QStyle & ) | 332 | void LauncherTabWidget::styleChange( QStyle & ) |
321 | { | 333 | { |
322 | QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); | 334 | QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); |
323 | } | 335 | } |
324 | 336 | ||
325 | void LauncherTabWidget::setProgressStyle() | 337 | void LauncherTabWidget::setProgressStyle() |
326 | { | 338 | { |
327 | if (docLoadingWidgetProgress) { | 339 | if (docLoadingWidgetProgress) { |
328 | docLoadingWidgetProgress->setFrameShape( QProgressBar::Box ); | 340 | docLoadingWidgetProgress->setFrameShape( QProgressBar::Box ); |
329 | docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain ); | 341 | docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain ); |
330 | docLoadingWidgetProgress->setMargin( 1 ); | 342 | docLoadingWidgetProgress->setMargin( 1 ); |
331 | docLoadingWidgetProgress->setLineWidth( 1 ); | 343 | docLoadingWidgetProgress->setLineWidth( 1 ); |
332 | } | 344 | } |
333 | } | 345 | } |
334 | 346 | ||
335 | void LauncherTabWidget::setBusy(bool on) | 347 | void LauncherTabWidget::setBusy(bool on) |
336 | { | 348 | { |
337 | if ( on ) | 349 | if ( on ) |
338 | currentView()->setBusy(TRUE); | 350 | currentView()->setBusy(TRUE); |
339 | else { | 351 | else { |
340 | for ( int i = 0; i < categoryBar->count(); i++ ) { | 352 | for ( int i = 0; i < categoryBar->count(); i++ ) { |
341 | LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; | 353 | LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; |
342 | view->setBusy( FALSE ); | 354 | view->setBusy( FALSE ); |
343 | } | 355 | } |
344 | } | 356 | } |
345 | } | 357 | } |
346 | 358 | ||
347 | void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { | 359 | void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { |
348 | for (int i = 0; i < categoryBar->count(); i++ ) { | 360 | for (int i = 0; i < categoryBar->count(); i++ ) { |
349 | LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; | 361 | LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; |
350 | view->setBusyIndicatorType( str ); | 362 | view->setBusyIndicatorType( str ); |
351 | } | 363 | } |
352 | } | 364 | } |
353 | 365 | ||
354 | LauncherView *LauncherTabWidget::currentView(void) | 366 | LauncherView *LauncherTabWidget::currentView(void) |
355 | { | 367 | { |
356 | return (LauncherView*)stack->visibleWidget(); | 368 | return (LauncherView*)stack->visibleWidget(); |
357 | } | 369 | } |
358 | 370 | ||
359 | 371 | ||
360 | 372 | ||
361 | void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) | 373 | void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) |
362 | { | 374 | { |
363 | QDataStream stream( data, IO_ReadOnly ); | 375 | QDataStream stream( data, IO_ReadOnly ); |
364 | if ( msg == "setTabView(QString,int)" ) { | 376 | if ( msg == "setTabView(QString,int)" ) { |
365 | QString id; | 377 | QString id; |
366 | stream >> id; | 378 | stream >> id; |
367 | int mode; | 379 | int mode; |
368 | stream >> mode; | 380 | stream >> mode; |
369 | if ( view(id) ) | 381 | if ( view(id) ) |
370 | view(id)->setViewMode( (LauncherView::ViewMode)mode ); | 382 | view(id)->setViewMode( (LauncherView::ViewMode)mode ); |
371 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { | 383 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { |
372 | QString id; | 384 | QString id; |
373 | stream >> id; | 385 | stream >> id; |
374 | int mode; | 386 | int mode; |
375 | stream >> mode; | 387 | stream >> mode; |
376 | QString pixmapOrColor; | 388 | QString pixmapOrColor; |
377 | stream >> pixmapOrColor; | 389 | stream >> pixmapOrColor; |
378 | if ( view(id) ) | 390 | if ( view(id) ) |
379 | view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 391 | view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
380 | if ( id == "Documents" ) | 392 | if ( id == "Documents" ) |
381 | docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 393 | docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
382 | } else if ( msg == "setTextColor(QString,QString)" ) { | 394 | } else if ( msg == "setTextColor(QString,QString)" ) { |
383 | QString id; | 395 | QString id; |
384 | stream >> id; | 396 | stream >> id; |
385 | QString color; | 397 | QString color; |
386 | stream >> color; | 398 | stream >> color; |
387 | if ( view(id) ) | 399 | if ( view(id) ) |
388 | view(id)->setTextColor( QColor(color) ); | 400 | view(id)->setTextColor( QColor(color) ); |
389 | if ( id == "Documents" ) | 401 | if ( id == "Documents" ) |
390 | docLoadingWidget->setTextColor( QColor(color) ); | 402 | docLoadingWidget->setTextColor( QColor(color) ); |
391 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { | 403 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { |
392 | QString id; | 404 | QString id; |
393 | stream >> id; | 405 | stream >> id; |
394 | QString fam; | 406 | QString fam; |
395 | stream >> fam; | 407 | stream >> fam; |
396 | int size; | 408 | int size; |
397 | stream >> size; | 409 | stream >> size; |
398 | int weight; | 410 | int weight; |
399 | stream >> weight; | 411 | stream >> weight; |
400 | int italic; | 412 | int italic; |
401 | stream >> italic; | 413 | stream >> italic; |
402 | if ( view(id) ) { | 414 | if ( view(id) ) { |
403 | if ( !fam.isEmpty() ) { | 415 | if ( !fam.isEmpty() ) { |
404 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 416 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
405 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); | 417 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); |
406 | } else { | 418 | } else { |
407 | view(id)->clearViewFont(); | 419 | view(id)->clearViewFont(); |
408 | } | 420 | } |
409 | } | 421 | } |
410 | }else if ( msg == "setBusyIndicatorType(QString)" ) { | 422 | }else if ( msg == "setBusyIndicatorType(QString)" ) { |
411 | QString type; | 423 | QString type; |
412 | stream >> type; | 424 | stream >> type; |
413 | setBusyIndicatorType( type ); | 425 | setBusyIndicatorType( type ); |
414 | }else if ( msg == "home()" ) { | 426 | }else if ( msg == "home()" ) { |
415 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { | 427 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { |
416 | if (categoryBar) | 428 | if (categoryBar) |
417 | categoryBar->nextTab(); | 429 | categoryBar->nextTab(); |
418 | }else | 430 | }else |
419 | static_cast<QWidget*>(parent())->raise(); | 431 | static_cast<QWidget*>(parent())->raise(); |
420 | } | 432 | } |
421 | } | 433 | } |
422 | 434 | ||
423 | 435 | ||
424 | 436 | ||
425 | //--------------------------------------------------------------------------- | 437 | //--------------------------------------------------------------------------- |
426 | 438 | ||
427 | Launcher::Launcher() | 439 | Launcher::Launcher() |
428 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) | 440 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) |
429 | { | 441 | { |
430 | tabs = 0; | 442 | tabs = 0; |
431 | tb = 0; | 443 | tb = 0; |
444 | Config cfg( "Launcher" ); | ||
445 | cfg.setGroup( "DocTab" ); | ||
446 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); | ||
432 | } | 447 | } |
433 | 448 | ||
434 | void Launcher::createGUI() | 449 | void Launcher::createGUI() |
435 | { | 450 | { |
436 | setCaption( tr("Launcher") ); | 451 | setCaption( tr("Launcher") ); |
437 | 452 | ||
438 | // we have a pretty good idea how big we'll be | 453 | // we have a pretty good idea how big we'll be |
439 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); | 454 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); |
440 | 455 | ||
441 | tb = new TaskBar; | 456 | tb = new TaskBar; |
442 | tabs = new LauncherTabWidget( this ); | 457 | tabs = new LauncherTabWidget( this ); |
443 | setCentralWidget( tabs ); | 458 | setCentralWidget( tabs ); |
444 | 459 | ||
445 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); | 460 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); |
446 | tb->show(); | 461 | tb->show(); |
447 | 462 | ||
448 | qApp->installEventFilter( this ); | 463 | qApp->installEventFilter( this ); |
449 | 464 | ||
450 | 465 | ||
451 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); | 466 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); |
452 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); | 467 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); |
453 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); | 468 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); |
454 | 469 | ||
455 | connect( tb, SIGNAL(tabSelected(const QString&)), | 470 | connect( tb, SIGNAL(tabSelected(const QString&)), |
456 | this, SLOT(showTab(const QString&)) ); | 471 | this, SLOT(showTab(const QString&)) ); |
457 | connect( tabs, SIGNAL(selected(const QString&)), | 472 | connect( tabs, SIGNAL(selected(const QString&)), |
458 | this, SLOT(viewSelected(const QString&)) ); | 473 | this, SLOT(viewSelected(const QString&)) ); |
459 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 474 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
460 | this, SLOT(select(const AppLnk*))); | 475 | this, SLOT(select(const AppLnk*))); |
461 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 476 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
462 | this, SLOT(properties(AppLnk*))); | 477 | this, SLOT(properties(AppLnk*))); |
463 | 478 | ||
464 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 479 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
465 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 480 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
466 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 481 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
467 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 482 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
468 | #endif | 483 | #endif |
469 | 484 | ||
470 | // all documents | 485 | // all documents |
471 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 486 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
472 | QPixmap pm; | 487 | QPixmap pm; |
473 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 488 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
474 | // It could add this itself if it handles docs | 489 | // It could add this itself if it handles docs |
490 | |||
475 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); | 491 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); |
476 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | ||
477 | 492 | ||
493 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | ||
478 | qApp->setMainWidget( this ); | 494 | qApp->setMainWidget( this ); |
479 | |||
480 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); | 495 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); |
481 | } | 496 | } |
482 | 497 | ||
483 | Launcher::~Launcher() | 498 | Launcher::~Launcher() |
484 | { | 499 | { |
485 | if ( tb ) | 500 | if ( tb ) |
486 | destroyGUI(); | 501 | destroyGUI(); |
487 | } | 502 | } |
488 | 503 | ||
489 | void Launcher::makeVisible() | 504 | void Launcher::makeVisible() |
490 | { | 505 | { |
491 | showMaximized(); | 506 | showMaximized(); |
492 | } | 507 | } |
493 | 508 | ||
494 | void Launcher::destroyGUI() | 509 | void Launcher::destroyGUI() |
495 | { | 510 | { |
496 | delete tb; | 511 | delete tb; |
497 | tb = 0; | 512 | tb = 0; |
498 | delete tabs; | 513 | delete tabs; |
499 | tabs =0; | 514 | tabs =0; |
500 | } | 515 | } |
501 | 516 | ||
502 | bool Launcher::eventFilter( QObject*, QEvent *ev ) | 517 | bool Launcher::eventFilter( QObject*, QEvent *ev ) |
503 | { | 518 | { |
504 | #ifdef QT_QWS_CUSTOM | 519 | #ifdef QT_QWS_CUSTOM |
505 | if ( ev->type() == QEvent::KeyPress ) { | 520 | if ( ev->type() == QEvent::KeyPress ) { |
506 | QKeyEvent *ke = (QKeyEvent *)ev; | 521 | QKeyEvent *ke = (QKeyEvent *)ev; |
507 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 522 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
508 | QWidget *active = qApp->activeWindow(); | 523 | QWidget *active = qApp->activeWindow(); |
509 | if ( active && active->isPopup() ) | 524 | if ( active && active->isPopup() ) |
510 | active->close(); | 525 | active->close(); |
511 | else { | 526 | else { |
512 | Global::terminateBuiltin("calibrate"); // No tr | 527 | Global::terminateBuiltin("calibrate"); // No tr |
513 | tb->launchStartMenu(); | 528 | tb->launchStartMenu(); |
514 | } | 529 | } |
515 | return TRUE; | 530 | return TRUE; |
516 | } | 531 | } |
517 | } | 532 | } |
518 | #else | 533 | #else |
519 | Q_UNUSED(ev); | 534 | Q_UNUSED(ev); |
520 | #endif | 535 | #endif |
521 | return FALSE; | 536 | return FALSE; |
522 | } | 537 | } |
523 | 538 | ||
524 | void Launcher::toggleSymbolInput() | 539 | void Launcher::toggleSymbolInput() |
525 | { | 540 | { |
526 | tb->toggleSymbolInput(); | 541 | tb->toggleSymbolInput(); |
527 | } | 542 | } |
528 | 543 | ||
529 | void Launcher::toggleNumLockState() | 544 | void Launcher::toggleNumLockState() |
530 | { | 545 | { |
531 | tb->toggleNumLockState(); | 546 | tb->toggleNumLockState(); |
532 | } | 547 | } |
533 | 548 | ||
534 | void Launcher::toggleCapsLockState() | 549 | void Launcher::toggleCapsLockState() |
535 | { | 550 | { |
536 | tb->toggleCapsLockState(); | 551 | tb->toggleCapsLockState(); |
537 | } | 552 | } |
538 | 553 | ||
539 | static bool isVisibleWindow(int wid) | 554 | static bool isVisibleWindow(int wid) |
540 | { | 555 | { |
541 | #ifdef Q_WS_QWS | 556 | #ifdef Q_WS_QWS |
542 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 557 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
543 | QWSWindow* w; | 558 | QWSWindow* w; |
544 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 559 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
545 | if ( w->winId() == wid ) | 560 | if ( w->winId() == wid ) |
546 | return !w->isFullyObscured(); | 561 | return !w->isFullyObscured(); |
547 | } | 562 | } |
548 | #endif | 563 | #endif |
549 | return FALSE; | 564 | return FALSE; |
550 | } | 565 | } |
551 | 566 | ||
552 | void Launcher::viewSelected(const QString& s) | 567 | void Launcher::viewSelected(const QString& s) |
553 | { | 568 | { |
554 | setCaption( s + tr(" - Launcher") ); | 569 | setCaption( s + tr(" - Launcher") ); |
555 | } | 570 | } |
556 | 571 | ||
557 | void Launcher::showTab(const QString& id) | 572 | void Launcher::showTab(const QString& id) |
558 | { | 573 | { |
559 | tabs->categoryBar->showTab(id); | 574 | tabs->categoryBar->showTab(id); |
560 | raise(); | 575 | raise(); |
561 | } | 576 | } |
562 | 577 | ||
563 | void Launcher::select( const AppLnk *appLnk ) | 578 | void Launcher::select( const AppLnk *appLnk ) |
564 | { | 579 | { |
565 | if ( appLnk->type() == "Folder" ) { // No tr | 580 | if ( appLnk->type() == "Folder" ) { // No tr |
566 | // Not supported: flat is simpler for the user | 581 | // Not supported: flat is simpler for the user |
567 | } else { | 582 | } else { |
568 | if ( appLnk->exec().isNull() ) { | 583 | if ( appLnk->exec().isNull() ) { |
569 | int i = QMessageBox::information(this,tr("No application"), | 584 | int i = QMessageBox::information(this,tr("No application"), |
570 | tr("<p>No application is defined for this document." | 585 | tr("<p>No application is defined for this document." |
571 | "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); | 586 | "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); |
572 | 587 | ||
573 | #if 0 | 588 | #if 0 |
574 | /* ### Fixme */ | 589 | /* ### Fixme */ |
575 | if ( i == 1 ) | 590 | if ( i == 1 ) |
576 | Global::execute(Service::app("Open/text/*"),appLnk->file()); | 591 | Global::execute(Service::app("Open/text/*"),appLnk->file()); |
577 | #endif | 592 | #endif |
578 | return; | 593 | return; |
579 | } | 594 | } |
580 | tabs->setBusy(TRUE); | 595 | tabs->setBusy(TRUE); |
581 | emit executing( appLnk ); | 596 | emit executing( appLnk ); |
582 | appLnk->execute(); | 597 | appLnk->execute(); |
583 | } | 598 | } |
584 | } | 599 | } |
585 | 600 | ||
586 | void Launcher::properties( AppLnk *appLnk ) | 601 | void Launcher::properties( AppLnk *appLnk ) |
587 | { | 602 | { |
588 | if ( appLnk->type() == "Folder" ) { // No tr | 603 | if ( appLnk->type() == "Folder" ) { // No tr |
589 | // Not supported: flat is simpler for the user | 604 | // Not supported: flat is simpler for the user |
590 | } else { | 605 | } else { |
591 | /* ### libqtopia FIXME also moving docLnks... */ | 606 | /* ### libqtopia FIXME also moving docLnks... */ |
592 | LnkProperties prop(appLnk,0 ); | 607 | LnkProperties prop(appLnk,0 ); |
593 | 608 | ||
594 | prop.showMaximized(); | 609 | prop.showMaximized(); |
595 | prop.exec(); | 610 | prop.exec(); |
596 | } | 611 | } |
597 | } | 612 | } |
598 | 613 | ||
599 | void Launcher::storageChanged( const QList<FileSystem> &fs ) | 614 | void Launcher::storageChanged( const QList<FileSystem> &fs ) |
600 | { | 615 | { |
601 | // ### update combo boxes if we had a combo box for the storage type | 616 | // ### update combo boxes if we had a combo box for the storage type |
602 | } | 617 | } |
603 | 618 | ||
604 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 619 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) |
605 | { | 620 | { |
606 | QDataStream stream( data, IO_ReadOnly ); | 621 | QDataStream stream( data, IO_ReadOnly ); |
607 | if ( msg == "busy()" ) { | 622 | if ( msg == "busy()" ) { |
608 | tb->startWait(); | 623 | tb->startWait(); |
609 | } else if ( msg == "notBusy(QString)" ) { | 624 | } else if ( msg == "notBusy(QString)" ) { |
610 | QString app; | 625 | QString app; |
611 | stream >> app; | 626 | stream >> app; |
612 | tabs->setBusy(FALSE); | 627 | tabs->setBusy(FALSE); |
613 | tb->stopWait(app); | 628 | tb->stopWait(app); |
614 | } else if (msg == "applyStyle()") { | 629 | } else if (msg == "applyStyle()") { |
615 | tabs->currentView()->relayout(); | 630 | tabs->currentView()->relayout(); |
616 | } | 631 | } |
617 | } | 632 | } |
618 | 633 | ||
619 | // These are the update functions from the server | 634 | // These are the update functions from the server |
620 | void Launcher::typeAdded( const QString& type, const QString& name, | 635 | void Launcher::typeAdded( const QString& type, const QString& name, |
621 | const QPixmap& pixmap, const QPixmap& ) | 636 | const QPixmap& pixmap, const QPixmap& ) |
622 | { | 637 | { |
623 | tabs->newView( type, pixmap, name ); | 638 | tabs->newView( type, pixmap, name ); |
624 | ids.append( type ); | 639 | ids.append( type ); |
625 | tb->refreshStartMenu(); | 640 | tb->refreshStartMenu(); |
626 | 641 | ||
627 | static bool first = TRUE; | 642 | static bool first = TRUE; |
628 | if ( first ) { | 643 | if ( first ) { |
629 | first = FALSE; | 644 | first = FALSE; |
630 | tabs->categoryBar->showTab(type); | 645 | tabs->categoryBar->showTab(type); |
631 | } | 646 | } |
632 | 647 | ||
633 | tabs->view( type )->setUpdatesEnabled( FALSE ); | 648 | tabs->view( type )->setUpdatesEnabled( FALSE ); |
634 | tabs->view( type )->setSortEnabled( FALSE ); | 649 | tabs->view( type )->setSortEnabled( FALSE ); |
635 | } | 650 | } |
636 | 651 | ||
637 | void Launcher::typeRemoved( const QString& type ) | 652 | void Launcher::typeRemoved( const QString& type ) |
638 | { | 653 | { |
639 | tabs->view( type )->removeAllItems(); | 654 | tabs->view( type )->removeAllItems(); |
640 | tabs->deleteView( type ); | 655 | tabs->deleteView( type ); |
641 | ids.remove( type ); | 656 | ids.remove( type ); |
642 | tb->refreshStartMenu(); | 657 | tb->refreshStartMenu(); |
643 | } | 658 | } |
644 | 659 | ||
645 | void Launcher::applicationAdded( const QString& type, const AppLnk& app ) | 660 | void Launcher::applicationAdded( const QString& type, const AppLnk& app ) |
646 | { | 661 | { |
647 | if ( app.type() == "Separator" ) // No tr | 662 | if ( app.type() == "Separator" ) // No tr |
648 | return; | 663 | return; |
649 | 664 | ||
650 | LauncherView *view = tabs->view( type ); | 665 | LauncherView *view = tabs->view( type ); |
651 | if ( view ) | 666 | if ( view ) |
652 | view->addItem( new AppLnk( app ), FALSE ); | 667 | view->addItem( new AppLnk( app ), FALSE ); |
653 | else | 668 | else |
654 | qWarning("addAppLnk: No view for type %s. Can't add app %s!", | 669 | qWarning("addAppLnk: No view for type %s. Can't add app %s!", |
655 | type.latin1(),app.name().latin1() ); | 670 | type.latin1(),app.name().latin1() ); |
656 | 671 | ||
657 | MimeType::registerApp( app ); | 672 | MimeType::registerApp( app ); |
658 | } | 673 | } |
659 | 674 | ||
660 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) | 675 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) |
661 | { | 676 | { |
662 | LauncherView *view = tabs->view( type ); | 677 | LauncherView *view = tabs->view( type ); |
663 | if ( view ) | 678 | if ( view ) |
664 | view->removeLink( app.linkFile() ); | 679 | view->removeLink( app.linkFile() ); |
665 | else | 680 | else |
666 | qWarning("removeAppLnk: No view for %s!", type.latin1() ); | 681 | qWarning("removeAppLnk: No view for %s!", type.latin1() ); |
667 | } | 682 | } |
668 | 683 | ||
669 | void Launcher::allApplicationsRemoved() | 684 | void Launcher::allApplicationsRemoved() |
670 | { | 685 | { |
671 | MimeType::clear(); | 686 | MimeType::clear(); |
672 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) | 687 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) |
673 | tabs->view( (*it) )->removeAllItems(); | 688 | tabs->view( (*it) )->removeAllItems(); |
674 | } | 689 | } |
675 | 690 | ||
676 | void Launcher::documentAdded( const DocLnk& doc ) | 691 | void Launcher::documentAdded( const DocLnk& doc ) |
677 | { | 692 | { |
678 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); | 693 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); |
679 | } | 694 | } |
680 | 695 | ||
681 | void Launcher::showLoadingDocs() | 696 | void Launcher::showLoadingDocs() |
682 | { | 697 | { |
683 | tabs->docView()->hide(); | 698 | tabs->docView()->hide(); |
684 | } | 699 | } |
685 | 700 | ||
686 | void Launcher::showDocTab() | 701 | void Launcher::showDocTab() |
687 | { | 702 | { |
688 | if ( tabs->categoryBar->currentView() == tabs->docView() ) | 703 | if ( tabs->categoryBar->currentView() == tabs->docView() ) |
689 | tabs->docView()->show(); | 704 | tabs->docView()->show(); |
690 | } | 705 | } |
691 | 706 | ||
692 | void Launcher::documentRemoved( const DocLnk& doc ) | 707 | void Launcher::documentRemoved( const DocLnk& doc ) |
693 | { | 708 | { |
694 | tabs->docView()->removeLink( doc.linkFile() ); | 709 | tabs->docView()->removeLink( doc.linkFile() ); |
695 | } | 710 | } |
696 | 711 | ||
697 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) | 712 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) |
698 | { | 713 | { |
699 | documentRemoved( oldDoc ); | 714 | documentRemoved( oldDoc ); |
700 | documentAdded( newDoc ); | 715 | documentAdded( newDoc ); |
701 | } | 716 | } |
702 | 717 | ||
703 | void Launcher::allDocumentsRemoved() | 718 | void Launcher::allDocumentsRemoved() |
704 | { | 719 | { |
705 | tabs->docView()->removeAllItems(); | 720 | tabs->docView()->removeAllItems(); |
706 | } | 721 | } |
707 | 722 | ||
708 | void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) | 723 | void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) |
709 | { | 724 | { |
710 | tb->setApplicationState( name, state ); | 725 | tb->setApplicationState( name, state ); |
711 | } | 726 | } |
712 | 727 | ||
713 | void Launcher::applicationScanningProgress( int percent ) | 728 | void Launcher::applicationScanningProgress( int percent ) |
714 | { | 729 | { |
715 | switch ( percent ) { | 730 | switch ( percent ) { |
716 | case 0: { | 731 | case 0: { |
717 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { | 732 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { |
718 | tabs->view( (*it) )->setUpdatesEnabled( FALSE ); | 733 | tabs->view( (*it) )->setUpdatesEnabled( FALSE ); |
719 | tabs->view( (*it) )->setSortEnabled( FALSE ); | 734 | tabs->view( (*it) )->setSortEnabled( FALSE ); |
720 | } | 735 | } |
721 | break; | 736 | break; |
722 | } | 737 | } |
723 | case 100: { | 738 | case 100: { |
724 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { | 739 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { |
725 | tabs->view( (*it) )->setUpdatesEnabled( TRUE ); | 740 | tabs->view( (*it) )->setUpdatesEnabled( TRUE ); |
726 | tabs->view( (*it) )->setSortEnabled( TRUE ); | 741 | tabs->view( (*it) )->setSortEnabled( TRUE ); |
727 | } | 742 | } |
728 | break; | 743 | break; |
729 | } | 744 | } |
730 | default: | 745 | default: |
731 | break; | 746 | break; |
732 | } | 747 | } |
733 | } | 748 | } |
734 | 749 | ||
735 | void Launcher::documentScanningProgress( int percent ) | 750 | void Launcher::documentScanningProgress( int percent ) |
736 | { | 751 | { |
752 | if ( !docTabEnabled ) | ||
753 | { | ||
754 | qDebug( "Launcher: document tab disabled!" ); | ||
755 | tabs->setLoadingProgress( 100 ); | ||
756 | tabs->setLoadingWidgetEnabled( TRUE ); | ||
757 | return; | ||
758 | } | ||
759 | |||
737 | switch ( percent ) { | 760 | switch ( percent ) { |
738 | case 0: { | 761 | case 0: { |
739 | tabs->setLoadingProgress( 0 ); | 762 | tabs->setLoadingProgress( 0 ); |
740 | tabs->setLoadingWidgetEnabled( TRUE ); | 763 | tabs->setLoadingWidgetEnabled( TRUE ); |
741 | tabs->docView()->setUpdatesEnabled( FALSE ); | 764 | tabs->docView()->setUpdatesEnabled( FALSE ); |
742 | tabs->docView()->setSortEnabled( FALSE ); | 765 | tabs->docView()->setSortEnabled( FALSE ); |
743 | break; | 766 | break; |
744 | } | 767 | } |
745 | case 100: { | 768 | case 100: { |
746 | tabs->docView()->updateTools(); | 769 | tabs->docView()->updateTools(); |
747 | tabs->docView()->setSortEnabled( TRUE ); | 770 | tabs->docView()->setSortEnabled( TRUE ); |
748 | tabs->docView()->setUpdatesEnabled( TRUE ); | 771 | tabs->docView()->setUpdatesEnabled( TRUE ); |
749 | tabs->setLoadingWidgetEnabled( FALSE ); | 772 | tabs->setLoadingWidgetEnabled( FALSE ); |
750 | break; | 773 | break; |
751 | } | 774 | } |
752 | default: | 775 | default: |
753 | tabs->setLoadingProgress( percent ); | 776 | tabs->setLoadingProgress( percent ); |
754 | break; | 777 | break; |
755 | } | 778 | } |
756 | } | 779 | } |
757 | 780 | ||
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 2917027..1d046ee 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h | |||
@@ -1,155 +1,157 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef LAUNCHER_H | 20 | #ifndef LAUNCHER_H |
21 | #define LAUNCHER_H | 21 | #define LAUNCHER_H |
22 | 22 | ||
23 | #include <qtopia/config.h> | 23 | #include <qtopia/config.h> |
24 | #include <qtopia/storage.h> | 24 | #include <qtopia/storage.h> |
25 | #include <qtopia/applnk.h> | 25 | #include <qtopia/applnk.h> |
26 | #include <qmainwindow.h> | 26 | #include <qmainwindow.h> |
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qprogressbar.h> | 28 | #include <qprogressbar.h> |
29 | #include <qvbox.h> | 29 | #include <qvbox.h> |
30 | #include <qlist.h> | 30 | #include <qlist.h> |
31 | #include <qdict.h> | 31 | #include <qdict.h> |
32 | #include "launcherview.h" | 32 | #include "launcherview.h" |
33 | #include "launchertab.h" | 33 | #include "launchertab.h" |
34 | #include "serverinterface.h" | 34 | #include "serverinterface.h" |
35 | 35 | ||
36 | class QWidgetStack; | 36 | class QWidgetStack; |
37 | class TaskBar; | 37 | class TaskBar; |
38 | class Launcher; | 38 | class Launcher; |
39 | 39 | ||
40 | class LauncherTabWidget : public QVBox { | 40 | class LauncherTabWidget : public QVBox { |
41 | // can't use a QTabWidget, since it won't let us set the frame style. | 41 | // can't use a QTabWidget, since it won't let us set the frame style. |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | public: | 43 | public: |
44 | LauncherTabWidget( Launcher* parent ); | 44 | LauncherTabWidget( Launcher* parent ); |
45 | 45 | ||
46 | void updateDocs(AppLnkSet* docFolder); | 46 | void updateDocs(AppLnkSet* docFolder); |
47 | void setBusy(bool on); | 47 | void setBusy(bool on); |
48 | LauncherView *currentView(void); | 48 | LauncherView *currentView(void); |
49 | 49 | ||
50 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); | 50 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); |
51 | void deleteView( const QString& ); | 51 | void deleteView( const QString& ); |
52 | void setTabViewAppearance( LauncherView *v, Config &cfg ); | 52 | void setTabViewAppearance( LauncherView *v, Config &cfg ); |
53 | void setTabAppearance( LauncherTab *, Config &cfg ); | 53 | void setTabAppearance( LauncherTab *, Config &cfg ); |
54 | 54 | ||
55 | LauncherView *view( const QString & ); | 55 | LauncherView *view( const QString & ); |
56 | LauncherView *docView(); | 56 | LauncherView *docView(); |
57 | 57 | ||
58 | void createDocLoadingWidget(); | 58 | void createDocLoadingWidget(); |
59 | void setLoadingWidgetEnabled( bool v ); | 59 | void setLoadingWidgetEnabled( bool v ); |
60 | void setLoadingProgress( int percent ); | 60 | void setLoadingProgress( int percent ); |
61 | 61 | ||
62 | LauncherTabBar* categoryBar; | 62 | LauncherTabBar* categoryBar; |
63 | 63 | ||
64 | void setBusyIndicatorType( const QString& type ); | 64 | void setBusyIndicatorType( const QString& type ); |
65 | 65 | ||
66 | signals: | 66 | signals: |
67 | void selected(const QString&); | 67 | void selected(const QString&); |
68 | void clicked(const AppLnk*); | 68 | void clicked(const AppLnk*); |
69 | void rightPressed(AppLnk*); | 69 | void rightPressed(AppLnk*); |
70 | 70 | ||
71 | protected slots: | 71 | protected slots: |
72 | void raiseTabWidget(); | 72 | void raiseTabWidget(); |
73 | void tabProperties(); | 73 | void tabProperties(); |
74 | void initLayout(); | 74 | void initLayout(); |
75 | 75 | ||
76 | private slots: | 76 | private slots: |
77 | void launcherMessage( const QCString &, const QByteArray &); | 77 | void launcherMessage( const QCString &, const QByteArray &); |
78 | void appMessage( const QCString &, const QByteArray &); | 78 | void appMessage( const QCString &, const QByteArray &); |
79 | void setProgressStyle(); | 79 | void setProgressStyle(); |
80 | 80 | ||
81 | protected: | 81 | protected: |
82 | void paletteChange( const QPalette &p ); | 82 | void paletteChange( const QPalette &p ); |
83 | void styleChange( QStyle & ); | 83 | void styleChange( QStyle & ); |
84 | 84 | ||
85 | private: | 85 | private: |
86 | Launcher *launcher; | 86 | Launcher *launcher; |
87 | LauncherView *docview; | 87 | LauncherView *docview; |
88 | 88 | ||
89 | QWidgetStack *stack; | 89 | QWidgetStack *stack; |
90 | LauncherView *docLoadingWidget; | 90 | LauncherView *docLoadingWidget; |
91 | QProgressBar *docLoadingWidgetProgress; | 91 | QProgressBar *docLoadingWidgetProgress; |
92 | bool docLoadingWidgetEnabled; | 92 | bool docLoadingWidgetEnabled; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | class Launcher : public QMainWindow, public ServerInterface | 95 | class Launcher : public QMainWindow, public ServerInterface |
96 | { | 96 | { |
97 | Q_OBJECT | 97 | Q_OBJECT |
98 | public: | 98 | public: |
99 | Launcher(); | 99 | Launcher(); |
100 | ~Launcher(); | 100 | ~Launcher(); |
101 | 101 | ||
102 | // implementing ServerInterface | 102 | // implementing ServerInterface |
103 | void createGUI(); | 103 | void createGUI(); |
104 | void destroyGUI(); | 104 | void destroyGUI(); |
105 | void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); | 105 | void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); |
106 | void typeRemoved( const QString& type ); | 106 | void typeRemoved( const QString& type ); |
107 | void applicationAdded( const QString& type, const AppLnk& doc ); | 107 | void applicationAdded( const QString& type, const AppLnk& doc ); |
108 | void applicationRemoved( const QString& type, const AppLnk& doc ); | 108 | void applicationRemoved( const QString& type, const AppLnk& doc ); |
109 | void allApplicationsRemoved(); | 109 | void allApplicationsRemoved(); |
110 | void applicationStateChanged( const QString& name, ApplicationState state ); | 110 | void applicationStateChanged( const QString& name, ApplicationState state ); |
111 | void documentAdded( const DocLnk& doc ); | 111 | void documentAdded( const DocLnk& doc ); |
112 | void documentRemoved( const DocLnk& doc ); | 112 | void documentRemoved( const DocLnk& doc ); |
113 | void allDocumentsRemoved(); | 113 | void allDocumentsRemoved(); |
114 | void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); | 114 | void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); |
115 | void storageChanged( const QList<FileSystem> & ); | 115 | void storageChanged( const QList<FileSystem> & ); |
116 | void applicationScanningProgress( int percent ); | 116 | void applicationScanningProgress( int percent ); |
117 | void documentScanningProgress( int percent ); | 117 | void documentScanningProgress( int percent ); |
118 | bool requiresApplications() const { return TRUE; } | 118 | bool requiresApplications() const { return TRUE; } |
119 | bool requiresDocuments() const { return TRUE; } | 119 | bool requiresDocuments() const { return TRUE; } |
120 | void showLoadingDocs(); | 120 | void showLoadingDocs(); |
121 | void showDocTab(); | 121 | void showDocTab(); |
122 | 122 | ||
123 | QStringList idList() const { return ids; } | 123 | QStringList idList() const { return ids; } |
124 | 124 | ||
125 | public slots: | 125 | public slots: |
126 | void viewSelected(const QString&); | 126 | void viewSelected(const QString&); |
127 | void showTab(const QString&); | 127 | void showTab(const QString&); |
128 | void select( const AppLnk * ); | 128 | void select( const AppLnk * ); |
129 | void properties( AppLnk * ); | 129 | void properties( AppLnk * ); |
130 | void makeVisible(); | 130 | void makeVisible(); |
131 | 131 | ||
132 | signals: | 132 | signals: |
133 | void executing( const AppLnk * ); | 133 | void executing( const AppLnk * ); |
134 | 134 | ||
135 | private slots: | 135 | private slots: |
136 | void systemMessage( const QCString &, const QByteArray &); | 136 | void systemMessage( const QCString &, const QByteArray &); |
137 | void toggleSymbolInput(); | 137 | void toggleSymbolInput(); |
138 | void toggleNumLockState(); | 138 | void toggleNumLockState(); |
139 | void toggleCapsLockState(); | 139 | void toggleCapsLockState(); |
140 | 140 | ||
141 | protected: | 141 | protected: |
142 | bool eventFilter( QObject *o, QEvent *ev ); | 142 | bool eventFilter( QObject *o, QEvent *ev ); |
143 | 143 | ||
144 | private: | 144 | private: |
145 | void updateApps(); | 145 | void updateApps(); |
146 | void loadDocs(); | 146 | void loadDocs(); |
147 | void updateDocs(); | 147 | void updateDocs(); |
148 | void updateTabs(); | 148 | void updateTabs(); |
149 | 149 | ||
150 | LauncherTabWidget *tabs; | 150 | LauncherTabWidget *tabs; |
151 | QStringList ids; | 151 | QStringList ids; |
152 | TaskBar *tb; | 152 | TaskBar *tb; |
153 | |||
154 | bool docTabEnabled; | ||
153 | }; | 155 | }; |
154 | 156 | ||
155 | #endif // LAUNCHERVIEW_H | 157 | #endif // LAUNCHERVIEW_H |
diff --git a/core/settings/launcher/doctabsettings.cpp b/core/settings/launcher/doctabsettings.cpp new file mode 100644 index 0000000..8077b8c --- a/dev/null +++ b/core/settings/launcher/doctabsettings.cpp | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | ||
4 | .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #include "doctabsettings.h" | ||
30 | |||
31 | #include <qpe/config.h> | ||
32 | #include <qpe/qlibrary.h> | ||
33 | #include <qpe/qpeapplication.h> | ||
34 | |||
35 | #include <qspinbox.h> | ||
36 | #include <qcheckbox.h> | ||
37 | #include <qlayout.h> | ||
38 | #include <qlabel.h> | ||
39 | #include <qwhatsthis.h> | ||
40 | |||
41 | DocTabSettings::DocTabSettings( QWidget *parent, const char *name ):QWidget( parent, name ) | ||
42 | { | ||
43 | QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); | ||
44 | |||
45 | _enable = new QCheckBox( tr( "Enable the Documents Tab" ), this ); | ||
46 | |||
47 | Config cfg( "Launcher" ); | ||
48 | cfg.setGroup( "DocTab" ); | ||
49 | _enable->setChecked( cfg.readBoolEntry( "Enable", true ) ); | ||
50 | |||
51 | lay->addWidget( _enable ); | ||
52 | lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); | ||
53 | |||
54 | lay->addStretch(); | ||
55 | |||
56 | QWhatsThis::add( _enable, tr( "Check, if you want the Documents Tab to be visible." ) ); | ||
57 | } | ||
58 | |||
59 | void DocTabSettings::appletChanged() | ||
60 | { | ||
61 | } | ||
62 | |||
63 | void DocTabSettings::accept() | ||
64 | { | ||
65 | qDebug( "DocTabSettings::accept()" ); | ||
66 | Config cfg( "Launcher" ); | ||
67 | cfg.setGroup( "DocTab" ); | ||
68 | cfg.writeEntry( "Enable", _enable->isChecked() ); | ||
69 | cfg.write(); | ||
70 | } | ||
71 | |||
diff --git a/core/settings/launcher/doctabsettings.h b/core/settings/launcher/doctabsettings.h new file mode 100644 index 0000000..ad6447c --- a/dev/null +++ b/core/settings/launcher/doctabsettings.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
27 | |||
28 | #ifndef __DOCTAB_SETTINGS_H__ | ||
29 | #define __DOCTAB_SETTINGS_H__ | ||
30 | |||
31 | #include <qwidget.h> | ||
32 | |||
33 | class QCheckBox; | ||
34 | class QSpinBox; | ||
35 | |||
36 | class DocTabSettings : public QWidget | ||
37 | { | ||
38 | Q_OBJECT | ||
39 | |||
40 | public: | ||
41 | DocTabSettings ( QWidget *parent = 0, const char *name = 0 ); | ||
42 | |||
43 | void accept ( ); | ||
44 | |||
45 | protected slots: | ||
46 | void appletChanged ( ); | ||
47 | |||
48 | protected: | ||
49 | void init ( ); | ||
50 | |||
51 | private: | ||
52 | QCheckBox* _enable; | ||
53 | }; | ||
54 | |||
55 | #endif | ||
diff --git a/core/settings/launcher/inputmethodsettings.cpp b/core/settings/launcher/inputmethodsettings.cpp index 1aa1ae8..147a00d 100644 --- a/core/settings/launcher/inputmethodsettings.cpp +++ b/core/settings/launcher/inputmethodsettings.cpp | |||
@@ -1,87 +1,86 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> | 4 | .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "inputmethodsettings.h" | 29 | #include "inputmethodsettings.h" |
30 | 30 | ||
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | #include <qpe/qlibrary.h> | 32 | #include <qpe/qlibrary.h> |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | 34 | ||
35 | #include <qspinbox.h> | 35 | #include <qspinbox.h> |
36 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
37 | #include <qlayout.h> | 37 | #include <qlayout.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qwhatsthis.h> | 39 | #include <qwhatsthis.h> |
40 | 40 | ||
41 | InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name ) | 41 | InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name ) |
42 | { | 42 | { |
43 | QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); | 43 | QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); |
44 | 44 | ||
45 | _resize = new QCheckBox( tr( "Resize application on Popup" ), this ); | 45 | _resize = new QCheckBox( tr( "Resize application on Popup" ), this ); |
46 | _float = new QCheckBox( tr( "Enable floating and resizing" ), this ); | 46 | _float = new QCheckBox( tr( "Enable floating and resizing" ), this ); |
47 | 47 | ||
48 | QHBoxLayout* hbox = new QHBoxLayout( this, 4, 4 ); | 48 | QHBoxLayout* hbox = new QHBoxLayout( lay, 4 ); |
49 | hbox->addWidget( new QLabel( "Initial Width:", this ) ); | 49 | hbox->addWidget( new QLabel( "Initial Width:", this ) ); |
50 | _size = new QSpinBox( 10, 100, 10, this ); | 50 | _size = new QSpinBox( 10, 100, 10, this ); |
51 | _size->setSuffix( "%" ); | 51 | _size->setSuffix( "%" ); |
52 | hbox->addWidget( _size ); | 52 | hbox->addWidget( _size ); |
53 | hbox->addStretch(); | 53 | hbox->addStretch(); |
54 | 54 | ||
55 | Config cfg( "Launcher" ); | 55 | Config cfg( "Launcher" ); |
56 | cfg.setGroup( "InputMethods" ); | 56 | cfg.setGroup( "InputMethods" ); |
57 | _resize->setChecked( cfg.readBoolEntry( "Resize", true ) ); | 57 | _resize->setChecked( cfg.readBoolEntry( "Resize", true ) ); |
58 | _float->setChecked( cfg.readBoolEntry( "Float", false ) ); | 58 | _float->setChecked( cfg.readBoolEntry( "Float", false ) ); |
59 | _size->setValue( cfg.readNumEntry( "Width", 100 ) ); | 59 | _size->setValue( cfg.readNumEntry( "Width", 100 ) ); |
60 | 60 | ||
61 | lay->addWidget( _resize ); | 61 | lay->addWidget( _resize ); |
62 | lay->addWidget( _float ); | 62 | lay->addWidget( _float ); |
63 | lay->addLayout( hbox ); | ||
64 | lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); | 63 | lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); |
65 | 64 | ||
66 | lay->addStretch(); | 65 | lay->addStretch(); |
67 | 66 | ||
68 | QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) ); | 67 | QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) ); |
69 | QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) ); | 68 | QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) ); |
70 | QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) ); | 69 | QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) ); |
71 | } | 70 | } |
72 | 71 | ||
73 | void InputMethodSettings::appletChanged() | 72 | void InputMethodSettings::appletChanged() |
74 | { | 73 | { |
75 | } | 74 | } |
76 | 75 | ||
77 | void InputMethodSettings::accept() | 76 | void InputMethodSettings::accept() |
78 | { | 77 | { |
79 | qDebug( "InputMethodSettings::accept()" ); | 78 | qDebug( "InputMethodSettings::accept()" ); |
80 | Config cfg( "Launcher" ); | 79 | Config cfg( "Launcher" ); |
81 | cfg.setGroup( "InputMethods" ); | 80 | cfg.setGroup( "InputMethods" ); |
82 | cfg.writeEntry( "Resize", _resize->isChecked() ); | 81 | cfg.writeEntry( "Resize", _resize->isChecked() ); |
83 | cfg.writeEntry( "Float", _float->isChecked() ); | 82 | cfg.writeEntry( "Float", _float->isChecked() ); |
84 | cfg.writeEntry( "Width", _size->value() ); | 83 | cfg.writeEntry( "Width", _size->value() ); |
85 | cfg.write(); | 84 | cfg.write(); |
86 | } | 85 | } |
87 | 86 | ||
diff --git a/core/settings/launcher/launcher.pro b/core/settings/launcher/launcher.pro index 9d05832..3261ee8 100644 --- a/core/settings/launcher/launcher.pro +++ b/core/settings/launcher/launcher.pro | |||
@@ -1,26 +1,28 @@ | |||
1 | CONFIG += qt warn_on release quick-app | 1 | CONFIG += qt warn_on release quick-app |
2 | HEADERS = launchersettings.h \ | 2 | HEADERS = launchersettings.h \ |
3 | tabssettings.h \ | 3 | tabssettings.h \ |
4 | taskbarsettings.h \ | 4 | taskbarsettings.h \ |
5 | menusettings.h \ | 5 | menusettings.h \ |
6 | inputmethodsettings.h \ | 6 | inputmethodsettings.h \ |
7 | doctabsettings.h \ | ||
7 | tabconfig.h \ | 8 | tabconfig.h \ |
8 | tabdialog.h | 9 | tabdialog.h |
9 | 10 | ||
10 | SOURCES = main.cpp \ | 11 | SOURCES = main.cpp \ |
11 | launchersettings.cpp \ | 12 | launchersettings.cpp \ |
12 | tabssettings.cpp \ | 13 | tabssettings.cpp \ |
13 | taskbarsettings.cpp \ | 14 | taskbarsettings.cpp \ |
14 | menusettings.cpp \ | 15 | menusettings.cpp \ |
15 | inputmethodsettings.cpp \ | 16 | inputmethodsettings.cpp \ |
17 | doctabsettings.cpp \ | ||
16 | tabdialog.cpp | 18 | tabdialog.cpp |
17 | 19 | ||
18 | INCLUDEPATH += $(OPIEDIR)/include | 20 | INCLUDEPATH += $(OPIEDIR)/include |
19 | DEPENDPATH += $(OPIEDIR)/include | 21 | DEPENDPATH += $(OPIEDIR)/include |
20 | LIBS += -lqpe -lopie | 22 | LIBS += -lqpe -lopie |
21 | TARGET = launchersettings | 23 | TARGET = launchersettings |
22 | 24 | ||
23 | 25 | ||
24 | 26 | ||
25 | 27 | ||
26 | include ( $(OPIEDIR)/include.pro ) | 28 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp index efc4a86..e129849 100644 --- a/core/settings/launcher/launchersettings.cpp +++ b/core/settings/launcher/launchersettings.cpp | |||
@@ -1,77 +1,80 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | =. This file is part of the OPIE Project | 3 | =. This file is part of the OPIE Project |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | 31 | ||
32 | #include <opie/otabwidget.h> | 32 | #include <opie/otabwidget.h> |
33 | 33 | ||
34 | #include "launchersettings.h" | 34 | #include "launchersettings.h" |
35 | #include "tabssettings.h" | 35 | #include "tabssettings.h" |
36 | #include "menusettings.h" | 36 | #include "menusettings.h" |
37 | #include "taskbarsettings.h" | 37 | #include "taskbarsettings.h" |
38 | #include "inputmethodsettings.h" | 38 | #include "inputmethodsettings.h" |
39 | #include "doctabsettings.h" | ||
39 | 40 | ||
40 | LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags) | 41 | LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags) |
41 | : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) | 42 | : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) |
42 | { | 43 | { |
43 | setCaption ( tr( "Launcher Settings" )); | 44 | setCaption ( tr( "Launcher Settings" )); |
44 | 45 | ||
45 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 46 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
46 | 47 | ||
47 | OTabWidget *tw = new OTabWidget ( this, "otab" ); | 48 | OTabWidget *tw = new OTabWidget ( this, "otab" ); |
48 | lay-> addWidget ( tw ); | 49 | lay-> addWidget ( tw ); |
49 | 50 | ||
50 | m_tabs = new TabsSettings ( tw ); | 51 | m_tabs = new TabsSettings ( tw ); |
51 | m_taskbar = new TaskbarSettings ( tw ); | 52 | m_taskbar = new TaskbarSettings ( tw ); |
52 | m_menu = new MenuSettings ( tw ); | 53 | m_menu = new MenuSettings ( tw ); |
53 | m_imethods = new InputMethodSettings ( tw ); | 54 | m_imethods = new InputMethodSettings ( tw ); |
55 | m_doctab = new DocTabSettings ( tw ); | ||
54 | 56 | ||
55 | tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" )); | 57 | tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" )); |
56 | tw-> addTab ( m_menu, "go", tr( "O-Menu" )); | 58 | tw-> addTab ( m_menu, "go", tr( "O-Menu" )); |
57 | tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); | 59 | tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); |
58 | tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" )); | 60 | tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" )); |
59 | 61 | tw-> addTab ( m_doctab, "DocsIcon", tr( "DocTab" ) ); | |
60 | tw-> setCurrentTab ( m_taskbar ); | 62 | tw-> setCurrentTab ( m_taskbar ); |
61 | } | 63 | } |
62 | 64 | ||
63 | void LauncherSettings::accept ( ) | 65 | void LauncherSettings::accept ( ) |
64 | { | 66 | { |
65 | m_taskbar-> accept ( ); | 67 | m_taskbar-> accept ( ); |
66 | m_menu-> accept ( ); | 68 | m_menu-> accept ( ); |
67 | m_tabs-> accept ( ); | 69 | m_tabs-> accept ( ); |
68 | m_imethods-> accept ( ); | 70 | m_imethods-> accept ( ); |
71 | m_doctab-> accept ( ); | ||
69 | 72 | ||
70 | QDialog::accept ( ); | 73 | QDialog::accept ( ); |
71 | } | 74 | } |
72 | 75 | ||
73 | void LauncherSettings::done ( int r ) | 76 | void LauncherSettings::done ( int r ) |
74 | { | 77 | { |
75 | QDialog::done ( r ); | 78 | QDialog::done ( r ); |
76 | close ( ); | 79 | close ( ); |
77 | } | 80 | } |
diff --git a/core/settings/launcher/launchersettings.h b/core/settings/launcher/launchersettings.h index 7458d8b..9ba2942 100644 --- a/core/settings/launcher/launchersettings.h +++ b/core/settings/launcher/launchersettings.h | |||
@@ -1,55 +1,57 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef __LAUNCHER_SETTINGS_H__ | 28 | #ifndef __LAUNCHER_SETTINGS_H__ |
29 | #define __LAUNCHER_SETTINGS_H__ | 29 | #define __LAUNCHER_SETTINGS_H__ |
30 | 30 | ||
31 | #include <qdialog.h> | 31 | #include <qdialog.h> |
32 | 32 | ||
33 | class TabsSettings; | 33 | class TabsSettings; |
34 | class TaskbarSettings; | 34 | class TaskbarSettings; |
35 | class MenuSettings; | 35 | class MenuSettings; |
36 | class InputMethodSettings; | 36 | class InputMethodSettings; |
37 | class DocTabSettings; | ||
37 | 38 | ||
38 | class LauncherSettings : public QDialog { | 39 | class LauncherSettings : public QDialog { |
39 | Q_OBJECT | 40 | Q_OBJECT |
40 | 41 | ||
41 | public: | 42 | public: |
42 | static QString appName() { return QString::fromLatin1("launchersettings"); } | 43 | static QString appName() { return QString::fromLatin1("launchersettings"); } |
43 | LauncherSettings (QWidget *parent = 0, const char* name = 0, WFlags fl = 0 ); | 44 | LauncherSettings (QWidget *parent = 0, const char* name = 0, WFlags fl = 0 ); |
44 | 45 | ||
45 | virtual void accept ( ); | 46 | virtual void accept ( ); |
46 | virtual void done ( int r ); | 47 | virtual void done ( int r ); |
47 | 48 | ||
48 | private: | 49 | private: |
49 | TabsSettings *m_tabs; | 50 | TabsSettings *m_tabs; |
50 | TaskbarSettings *m_taskbar; | 51 | TaskbarSettings *m_taskbar; |
51 | MenuSettings *m_menu; | 52 | MenuSettings *m_menu; |
52 | InputMethodSettings* m_imethods; | 53 | InputMethodSettings* m_imethods; |
54 | DocTabSettings *m_doctab; | ||
53 | }; | 55 | }; |
54 | 56 | ||
55 | #endif | 57 | #endif |
diff --git a/noncore/settings/doctab/.cvsignore b/noncore/settings/doctab/.cvsignore new file mode 100644 index 0000000..50a4b1c --- a/dev/null +++ b/noncore/settings/doctab/.cvsignore | |||
@@ -0,0 +1,4 @@ | |||
1 | Makefile* | ||
2 | languagesettingsbase.cpp | ||
3 | languagesettingsbase.h | ||
4 | moc_* | ||
diff --git a/noncore/settings/doctab/config.in b/noncore/settings/doctab/config.in new file mode 100644 index 0000000..5decda5 --- a/dev/null +++ b/noncore/settings/doctab/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config DOCTAB | ||
2 | boolean "opie-doctab (select doctab for Opie)" | ||
3 | default "y" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) | ||
diff --git a/noncore/settings/doctab/doctab.cpp b/noncore/settings/doctab/doctab.cpp new file mode 100644 index 0000000..feaf538 --- a/dev/null +++ b/noncore/settings/doctab/doctab.cpp | |||
@@ -0,0 +1,94 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include "doctab.h" | ||
22 | |||
23 | #include <qpe/global.h> | ||
24 | #include <qpe/fontmanager.h> | ||
25 | #include <qpe/config.h> | ||
26 | #include <qpe/applnk.h> | ||
27 | #include <qpe/qpedialog.h> | ||
28 | #include <qpe/qpeapplication.h> | ||
29 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | ||
30 | #include <qpe/qcopenvelope_qws.h> | ||
31 | #endif | ||
32 | |||
33 | #include <qlabel.h> | ||
34 | #include <qcheckbox.h> | ||
35 | #include <qradiobutton.h> | ||
36 | #include <qtabwidget.h> | ||
37 | #include <qslider.h> | ||
38 | #include <qfile.h> | ||
39 | #include <qtextstream.h> | ||
40 | #include <qdatastream.h> | ||
41 | #include <qmessagebox.h> | ||
42 | #include <qcombobox.h> | ||
43 | #include <qspinbox.h> | ||
44 | #include <qlistbox.h> | ||
45 | #include <qdir.h> | ||
46 | #if QT_VERSION >= 300 | ||
47 | #include <qstylefactory.h> | ||
48 | #endif | ||
49 | |||
50 | #include <stdlib.h> | ||
51 | |||
52 | |||
53 | DocTabSettings::DocTabSettings( QWidget* parent, const char* name, WFlags fl ) | ||
54 | : DocTabSettingsBase( parent, name, TRUE, fl ) | ||
55 | { | ||
56 | dl = new QPEDialogListener(this); | ||
57 | reset(); | ||
58 | } | ||
59 | |||
60 | DocTabSettings::~DocTabSettings() | ||
61 | {} | ||
62 | |||
63 | void DocTabSettings::accept() | ||
64 | { | ||
65 | applyDocTab(); | ||
66 | QDialog::accept(); | ||
67 | } | ||
68 | |||
69 | void DocTabSettings::applyDocTab() | ||
70 | { | ||
71 | Config cfg( "Launcher" ); | ||
72 | cfg.setGroup( "DocTab" ); | ||
73 | cfg.writeEntry( "Enable", yes->isChecked() ); | ||
74 | cfg.write(); | ||
75 | } | ||
76 | |||
77 | |||
78 | void DocTabSettings::reject() | ||
79 | { | ||
80 | reset(); | ||
81 | QDialog::reject(); | ||
82 | } | ||
83 | |||
84 | void DocTabSettings::reset() | ||
85 | { | ||
86 | } | ||
87 | |||
88 | QString DocTabSettings::actualDocTab; | ||
89 | |||
90 | void DocTabSettings::done(int r) | ||
91 | { | ||
92 | QDialog::done(r); | ||
93 | close(); | ||
94 | } | ||
diff --git a/noncore/settings/doctab/doctab.h b/noncore/settings/doctab/doctab.h new file mode 100644 index 0000000..ed71978 --- a/dev/null +++ b/noncore/settings/doctab/doctab.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef DOCTAB_H | ||
21 | #define DOCTAB_H | ||
22 | |||
23 | |||
24 | #include <qstrlist.h> | ||
25 | #include <qasciidict.h> | ||
26 | #include "doctabsettingsbase.h" | ||
27 | |||
28 | class QPEDialogListener; | ||
29 | |||
30 | class DocTabSettings : public DocTabSettingsBase | ||
31 | { | ||
32 | Q_OBJECT | ||
33 | |||
34 | public: | ||
35 | DocTabSettings( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
36 | ~DocTabSettings(); | ||
37 | |||
38 | static QString appName() { return QString::fromLatin1("doctab"); } | ||
39 | |||
40 | protected: | ||
41 | void accept(); | ||
42 | void reject(); | ||
43 | void done(int); | ||
44 | |||
45 | private slots: | ||
46 | void applyDocTab(); | ||
47 | void reset(); | ||
48 | |||
49 | private: | ||
50 | static QString actualDocTab; | ||
51 | |||
52 | QPEDialogListener *dl; | ||
53 | }; | ||
54 | |||
55 | |||
56 | #endif // SETTINGS_H | ||
57 | |||
diff --git a/noncore/settings/doctab/doctab.pro b/noncore/settings/doctab/doctab.pro new file mode 100644 index 0000000..d12ac2d --- a/dev/null +++ b/noncore/settings/doctab/doctab.pro | |||
@@ -0,0 +1,10 @@ | |||
1 | CONFIG += qt warn_on release quick-app | ||
2 | HEADERS = doctab.h | ||
3 | SOURCES = doctab.cpp main.cpp | ||
4 | INTERFACES= doctabsettingsbase.ui | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH+= ../$(OPIEDIR)/include | ||
7 | LIBS += -lqpe | ||
8 | TARGET = doctab | ||
9 | |||
10 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/settings/doctab/doctabsettingsbase.ui b/noncore/settings/doctab/doctabsettingsbase.ui new file mode 100644 index 0000000..e3bb39b --- a/dev/null +++ b/noncore/settings/doctab/doctabsettingsbase.ui | |||
@@ -0,0 +1,115 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>DocTabSettingsBase</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>DocTabSettingsBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>273</width> | ||
15 | <height>293</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>DocTab Settings</string> | ||
21 | </property> | ||
22 | <vbox> | ||
23 | <property stdset="1"> | ||
24 | <name>margin</name> | ||
25 | <number>11</number> | ||
26 | </property> | ||
27 | <property stdset="1"> | ||
28 | <name>spacing</name> | ||
29 | <number>6</number> | ||
30 | </property> | ||
31 | <widget> | ||
32 | <class>QLabel</class> | ||
33 | <property stdset="1"> | ||
34 | <name>name</name> | ||
35 | <cstring>TextLabel1</cstring> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>text</name> | ||
39 | <string><b>Do you want a Documents Tab?</b><p> | ||
40 | (Note that such a tab scans <i>all</i> documents | ||
41 | on <i>all</i> external media, which can be quite | ||
42 | slow and annyoing...)</string> | ||
43 | </property> | ||
44 | </widget> | ||
45 | <widget> | ||
46 | <class>QButtonGroup</class> | ||
47 | <property stdset="1"> | ||
48 | <name>name</name> | ||
49 | <cstring>ButtonGroup1</cstring> | ||
50 | </property> | ||
51 | <property stdset="1"> | ||
52 | <name>title</name> | ||
53 | <string>Enable the DocTab</string> | ||
54 | </property> | ||
55 | <vbox> | ||
56 | <property stdset="1"> | ||
57 | <name>margin</name> | ||
58 | <number>11</number> | ||
59 | </property> | ||
60 | <property stdset="1"> | ||
61 | <name>spacing</name> | ||
62 | <number>6</number> | ||
63 | </property> | ||
64 | <widget> | ||
65 | <class>QRadioButton</class> | ||
66 | <property stdset="1"> | ||
67 | <name>name</name> | ||
68 | <cstring>yes</cstring> | ||
69 | </property> | ||
70 | <property stdset="1"> | ||
71 | <name>text</name> | ||
72 | <string>Yes, please!</string> | ||
73 | </property> | ||
74 | <property stdset="1"> | ||
75 | <name>checked</name> | ||
76 | <bool>true</bool> | ||
77 | </property> | ||
78 | </widget> | ||
79 | <widget> | ||
80 | <class>QRadioButton</class> | ||
81 | <property stdset="1"> | ||
82 | <name>name</name> | ||
83 | <cstring>no</cstring> | ||
84 | </property> | ||
85 | <property stdset="1"> | ||
86 | <name>text</name> | ||
87 | <string>No, thanks.</string> | ||
88 | </property> | ||
89 | </widget> | ||
90 | </vbox> | ||
91 | </widget> | ||
92 | <spacer> | ||
93 | <property> | ||
94 | <name>name</name> | ||
95 | <cstring>Spacer1</cstring> | ||
96 | </property> | ||
97 | <property stdset="1"> | ||
98 | <name>orientation</name> | ||
99 | <enum>Vertical</enum> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>sizeType</name> | ||
103 | <enum>Expanding</enum> | ||
104 | </property> | ||
105 | <property> | ||
106 | <name>sizeHint</name> | ||
107 | <size> | ||
108 | <width>20</width> | ||
109 | <height>20</height> | ||
110 | </size> | ||
111 | </property> | ||
112 | </spacer> | ||
113 | </vbox> | ||
114 | </widget> | ||
115 | </UI> | ||
diff --git a/noncore/settings/doctab/main.cpp b/noncore/settings/doctab/main.cpp new file mode 100644 index 0000000..bfeb2a3 --- a/dev/null +++ b/noncore/settings/doctab/main.cpp | |||
@@ -0,0 +1,25 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include "settings.h" | ||
22 | |||
23 | #include <opie/oapplicationfactory.h> | ||
24 | |||
25 | OPIE_EXPORT_APP( OApplicationFactory<DocTabSettings> ) | ||
diff --git a/noncore/settings/doctab/opie-doctab.control b/noncore/settings/doctab/opie-doctab.control new file mode 100644 index 0000000..9951561 --- a/dev/null +++ b/noncore/settings/doctab/opie-doctab.control | |||
@@ -0,0 +1,10 @@ | |||
1 | Package: opie-doctab | ||
2 | Files: plugins/application/libdoctab.so* bin/doctab apps/Settings/DocTab.desktop | ||
3 | Priority: optional | ||
4 | Section: opie/settings | ||
5 | Maintainer: The Opie Team <opie-devel@handhelds.org> | ||
6 | Architecture: arm | ||
7 | Depends: task-opie-minimal | ||
8 | Description: DocTab settings dialog | ||
9 | For the Opie environment. | ||
10 | Version: $QPE_VERSION$EXTRAVERSION | ||
diff --git a/noncore/settings/language/config.in b/noncore/settings/language/config.in index dbdfdab..489d11c 100644 --- a/noncore/settings/language/config.in +++ b/noncore/settings/language/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config LANGUAGE | 1 | config LANGUAGE |
2 | boolean "opie-language (select language for Opie)" | 2 | boolean "opie-language (select language for Opie)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) |
diff --git a/noncore/settings/language/main.cpp b/noncore/settings/language/main.cpp index 8bdf8a5..709a3f8 100644 --- a/noncore/settings/language/main.cpp +++ b/noncore/settings/language/main.cpp | |||
@@ -1,27 +1,25 @@ | |||
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 | 20 | ||
21 | #include "settings.h" | 21 | #include "settings.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | #include <opie/oapplicationfactory.h> | 23 | #include <opie/oapplicationfactory.h> |
25 | 24 | ||
26 | |||
27 | OPIE_EXPORT_APP( OApplicationFactory<LanguageSettings> ) | 25 | OPIE_EXPORT_APP( OApplicationFactory<LanguageSettings> ) |