summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-11-17 15:16:13 (UTC)
committer mickeyl <mickeyl>2003-11-17 15:16:13 (UTC)
commitc4a6e9c529ea6bcb1c9a42fee33a70300f116c98 (patch) (unidiff)
tree1ee68a2035b0218ba99662db1dff4c4067064cde
parent725e2723291fe1d71ca68cb59cec83428d40b8af (diff)
downloadopie-c4a6e9c529ea6bcb1c9a42fee33a70300f116c98.zip
opie-c4a6e9c529ea6bcb1c9a42fee33a70300f116c98.tar.gz
opie-c4a6e9c529ea6bcb1c9a42fee33a70300f116c98.tar.bz2
This patch makes the famous Documents Tab customizably optional.
Note that the document tab is so tight coupled to the rest of the launcher that it proved impossible for me to remove the tab as is. However I could make all the scanning and the displaying optional. The customization can be done via the launcher settings applications - a new doc tab category has been added. Further customization can be added to that tab. I also added a doc tab settings application for use with the "first usage wizard"
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp17
-rw-r--r--core/launcher/firstuse.cpp2
-rw-r--r--core/launcher/launcher.cpp35
-rw-r--r--core/launcher/launcher.h2
-rw-r--r--core/settings/launcher/doctabsettings.cpp71
-rw-r--r--core/settings/launcher/doctabsettings.h55
-rw-r--r--core/settings/launcher/inputmethodsettings.cpp3
-rw-r--r--core/settings/launcher/launcher.pro2
-rw-r--r--core/settings/launcher/launchersettings.cpp5
-rw-r--r--core/settings/launcher/launchersettings.h2
-rw-r--r--noncore/settings/doctab/.cvsignore4
-rw-r--r--noncore/settings/doctab/config.in4
-rw-r--r--noncore/settings/doctab/doctab.cpp94
-rw-r--r--noncore/settings/doctab/doctab.h57
-rw-r--r--noncore/settings/doctab/doctab.pro10
-rw-r--r--noncore/settings/doctab/doctabsettingsbase.ui115
-rw-r--r--noncore/settings/doctab/main.cpp25
-rw-r--r--noncore/settings/doctab/opie-doctab.control10
-rw-r--r--noncore/settings/language/config.in2
-rw-r--r--noncore/settings/language/main.cpp2
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,299 +1,314 @@
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
48AppLnkSet *DocumentList::appLnkSet = 0; 49AppLnkSet *DocumentList::appLnkSet = 0;
49 50
50static const int MAX_SEARCH_DEPTH = 10; 51static const int MAX_SEARCH_DEPTH = 10;
51 52
52 53
53class DocumentListPrivate : public QObject { 54class DocumentListPrivate : public QObject {
54 Q_OBJECT 55 Q_OBJECT
55public: 56public:
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
92DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, 93DocumentList::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
104void DocumentList::startInitialScan() 105void 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
110DocumentList::~DocumentList() 125DocumentList::~DocumentList()
111{ 126{
112 delete appLnkSet; 127 delete appLnkSet;
113 delete d; 128 delete d;
114} 129}
115 130
116 131
117void DocumentList::add( const DocLnk& doc ) 132void 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
124void DocumentList::start() 139void DocumentList::start()
125{ 140{
126 resume(); 141 resume();
127} 142}
128 143
129 144
130void DocumentList::pause() 145void 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
138void DocumentList::resume() 153void 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/*
147void DocumentList::resend() 162void 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
157void DocumentList::resendWorker() 172void 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
166void DocumentList::rescan() 181void 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
175void DocumentList::timerEvent( QTimerEvent *te ) 190void 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
197void DocumentList::reloadAppLnks() 212void 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
250void DocumentList::reloadDocLnks() 265void 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
263void DocumentList::linkChanged( QString arg ) 278void 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 }
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,272 +1,274 @@
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
70struct { 70struct {
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}
77settingsTable [] = 77settingsTable [] =
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
91FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : 93FirstUse::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
195FirstUse::~FirstUse() 197FirstUse::~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
203void FirstUse::calcMaxWindowRect() 205void 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 */
227void FirstUse::nextDialog() 229void 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 );
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
81static bool isVisibleWindow( int ); 81static bool isVisibleWindow( int );
82//=========================================================================== 82//===========================================================================
83 83
84LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : 84LauncherTabWidget::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
112void LauncherTabWidget::createDocLoadingWidget() 112void 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
154void LauncherTabWidget::initLayout() 166void 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
161void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) 173void 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
167void LauncherTabWidget::raiseTabWidget() 179void 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
178void LauncherTabWidget::tabProperties() 190void 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
193void LauncherTabWidget::deleteView( const QString& id ) 205void 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
203LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 215LauncherView* 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
231LauncherView *LauncherTabWidget::view( const QString &id ) 243LauncherView *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
239LauncherView *LauncherTabWidget::docView() 251LauncherView *LauncherTabWidget::docView()
240{ 252{
241 return docview; 253 return docview;
242} 254}
243 255
244void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) 256void 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
252void LauncherTabWidget::setLoadingProgress( int percent ) 264void 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
258void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) 270void 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
291void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) 303void 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
310void LauncherTabWidget::paletteChange( const QPalette &p ) 322void 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
320void LauncherTabWidget::styleChange( QStyle & ) 332void LauncherTabWidget::styleChange( QStyle & )
321{ 333{
322 QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); 334 QTimer::singleShot( 0, this, SLOT(setProgressStyle()) );
323} 335}
324 336
325void LauncherTabWidget::setProgressStyle() 337void 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
335void LauncherTabWidget::setBusy(bool on) 347void 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
347void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { 359void 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
354LauncherView *LauncherTabWidget::currentView(void) 366LauncherView *LauncherTabWidget::currentView(void)
355{ 367{
356 return (LauncherView*)stack->visibleWidget(); 368 return (LauncherView*)stack->visibleWidget();
357} 369}
358 370
359 371
360 372
361void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) 373void 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
427Launcher::Launcher() 439Launcher::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
434void Launcher::createGUI() 449void 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
483Launcher::~Launcher() 498Launcher::~Launcher()
484{ 499{
485 if ( tb ) 500 if ( tb )
486 destroyGUI(); 501 destroyGUI();
487} 502}
488 503
489void Launcher::makeVisible() 504void Launcher::makeVisible()
490{ 505{
491 showMaximized(); 506 showMaximized();
492} 507}
493 508
494void Launcher::destroyGUI() 509void 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
502bool Launcher::eventFilter( QObject*, QEvent *ev ) 517bool 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
524void Launcher::toggleSymbolInput() 539void Launcher::toggleSymbolInput()
525{ 540{
526 tb->toggleSymbolInput(); 541 tb->toggleSymbolInput();
527} 542}
528 543
529void Launcher::toggleNumLockState() 544void Launcher::toggleNumLockState()
530{ 545{
531 tb->toggleNumLockState(); 546 tb->toggleNumLockState();
532} 547}
533 548
534void Launcher::toggleCapsLockState() 549void Launcher::toggleCapsLockState()
535{ 550{
536 tb->toggleCapsLockState(); 551 tb->toggleCapsLockState();
537} 552}
538 553
539static bool isVisibleWindow(int wid) 554static 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
552void Launcher::viewSelected(const QString& s) 567void Launcher::viewSelected(const QString& s)
553{ 568{
554 setCaption( s + tr(" - Launcher") ); 569 setCaption( s + tr(" - Launcher") );
555} 570}
556 571
557void Launcher::showTab(const QString& id) 572void 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
563void Launcher::select( const AppLnk *appLnk ) 578void 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
586void Launcher::properties( AppLnk *appLnk ) 601void 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
599void Launcher::storageChanged( const QList<FileSystem> &fs ) 614void 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
604void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 619void 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
620void Launcher::typeAdded( const QString& type, const QString& name, 635void 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
637void Launcher::typeRemoved( const QString& type ) 652void 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
645void Launcher::applicationAdded( const QString& type, const AppLnk& app ) 660void 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
660void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) 675void 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
669void Launcher::allApplicationsRemoved() 684void 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
676void Launcher::documentAdded( const DocLnk& doc ) 691void 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
681void Launcher::showLoadingDocs() 696void Launcher::showLoadingDocs()
682{ 697{
683 tabs->docView()->hide(); 698 tabs->docView()->hide();
684} 699}
685 700
686void Launcher::showDocTab() 701void 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
692void Launcher::documentRemoved( const DocLnk& doc ) 707void Launcher::documentRemoved( const DocLnk& doc )
693{ 708{
694 tabs->docView()->removeLink( doc.linkFile() ); 709 tabs->docView()->removeLink( doc.linkFile() );
695} 710}
696 711
697void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) 712void 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
703void Launcher::allDocumentsRemoved() 718void Launcher::allDocumentsRemoved()
704{ 719{
705 tabs->docView()->removeAllItems(); 720 tabs->docView()->removeAllItems();
706} 721}
707 722
708void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) 723void Launcher::applicationStateChanged( const QString& name, ApplicationState state )
709{ 724{
710 tb->setApplicationState( name, state ); 725 tb->setApplicationState( name, state );
711} 726}
712 727
713void Launcher::applicationScanningProgress( int percent ) 728void 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
735void Launcher::documentScanningProgress( int percent ) 750void 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
36class QWidgetStack; 36class QWidgetStack;
37class TaskBar; 37class TaskBar;
38class Launcher; 38class Launcher;
39 39
40class LauncherTabWidget : public QVBox { 40class 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
43public: 43public:
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
66signals: 66signals:
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
71protected slots: 71protected slots:
72 void raiseTabWidget(); 72 void raiseTabWidget();
73 void tabProperties(); 73 void tabProperties();
74 void initLayout(); 74 void initLayout();
75 75
76private slots: 76private 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
81protected: 81protected:
82 void paletteChange( const QPalette &p ); 82 void paletteChange( const QPalette &p );
83 void styleChange( QStyle & ); 83 void styleChange( QStyle & );
84 84
85private: 85private:
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
95class Launcher : public QMainWindow, public ServerInterface 95class Launcher : public QMainWindow, public ServerInterface
96{ 96{
97 Q_OBJECT 97 Q_OBJECT
98public: 98public:
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
125public slots: 125public 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
132signals: 132signals:
133 void executing( const AppLnk * ); 133 void executing( const AppLnk * );
134 134
135private slots: 135private 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
141protected: 141protected:
142 bool eventFilter( QObject *o, QEvent *ev ); 142 bool eventFilter( QObject *o, QEvent *ev );
143 143
144private: 144private:
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
41DocTabSettings::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
59void DocTabSettings::appletChanged()
60{
61}
62
63void 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
33class QCheckBox;
34class QSpinBox;
35
36class 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
41InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name ) 41InputMethodSettings::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
73void InputMethodSettings::appletChanged() 72void InputMethodSettings::appletChanged()
74{ 73{
75} 74}
76 75
77void InputMethodSettings::accept() 76void 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 @@
1CONFIG += qt warn_on release quick-app 1CONFIG += qt warn_on release quick-app
2HEADERS = launchersettings.h \ 2HEADERS = 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
10SOURCES = main.cpp \ 11SOURCES = 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
18INCLUDEPATH += $(OPIEDIR)/include 20INCLUDEPATH += $(OPIEDIR)/include
19DEPENDPATH += $(OPIEDIR)/include 21DEPENDPATH += $(OPIEDIR)/include
20LIBS += -lqpe -lopie 22LIBS += -lqpe -lopie
21TARGET = launchersettings 23TARGET = launchersettings
22 24
23 25
24 26
25 27
26include ( $(OPIEDIR)/include.pro ) 28include ( $(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
40LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags) 41LauncherSettings::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
63void LauncherSettings::accept ( ) 65void 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
73void LauncherSettings::done ( int r ) 76void 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
33class TabsSettings; 33class TabsSettings;
34class TaskbarSettings; 34class TaskbarSettings;
35class MenuSettings; 35class MenuSettings;
36class InputMethodSettings; 36class InputMethodSettings;
37class DocTabSettings;
37 38
38class LauncherSettings : public QDialog { 39class LauncherSettings : public QDialog {
39 Q_OBJECT 40 Q_OBJECT
40 41
41public: 42public:
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
48private: 49private:
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 @@
1Makefile*
2languagesettingsbase.cpp
3languagesettingsbase.h
4moc_*
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
53DocTabSettings::DocTabSettings( QWidget* parent, const char* name, WFlags fl )
54 : DocTabSettingsBase( parent, name, TRUE, fl )
55{
56 dl = new QPEDialogListener(this);
57 reset();
58}
59
60DocTabSettings::~DocTabSettings()
61{}
62
63void DocTabSettings::accept()
64{
65 applyDocTab();
66 QDialog::accept();
67}
68
69void DocTabSettings::applyDocTab()
70{
71 Config cfg( "Launcher" );
72 cfg.setGroup( "DocTab" );
73 cfg.writeEntry( "Enable", yes->isChecked() );
74 cfg.write();
75}
76
77
78void DocTabSettings::reject()
79{
80 reset();
81 QDialog::reject();
82}
83
84void DocTabSettings::reset()
85{
86}
87
88QString DocTabSettings::actualDocTab;
89
90void 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
28class QPEDialogListener;
29
30class DocTabSettings : public DocTabSettingsBase
31{
32 Q_OBJECT
33
34public:
35 DocTabSettings( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
36 ~DocTabSettings();
37
38 static QString appName() { return QString::fromLatin1("doctab"); }
39
40protected:
41 void accept();
42 void reject();
43 void done(int);
44
45private slots:
46 void applyDocTab();
47 void reset();
48
49private:
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
5INCLUDEPATH += $(OPIEDIR)/include
6 DEPENDPATH+= ../$(OPIEDIR)/include
7LIBS += -lqpe
8 TARGET = doctab
9
10include ( $(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>&lt;b&gt;Do you want a Documents Tab?&lt;/b&gt;&lt;p&gt;
40(Note that such a tab scans &lt;i&gt;all&lt;/i&gt; documents
41on &lt;i&gt;all&lt;/i&gt; external media, which can be quite
42slow 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
25OPIE_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 @@
1Package: opie-doctab
2Files: plugins/application/libdoctab.so* bin/doctab apps/Settings/DocTab.desktop
3Priority: optional
4Section: opie/settings
5Maintainer: The Opie Team <opie-devel@handhelds.org>
6Architecture: arm
7Depends: task-opie-minimal
8Description: DocTab settings dialog
9 For the Opie environment.
10Version: $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
27OPIE_EXPORT_APP( OApplicationFactory<LanguageSettings> ) 25OPIE_EXPORT_APP( OApplicationFactory<LanguageSettings> )