summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index e74301c..3eb561a 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -1,185 +1,188 @@
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// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT 21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
22// have this class. 22// have this class.
23#define QTOPIA_INTERNAL_FSLP 23#define QTOPIA_INTERNAL_FSLP
24 24
25#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29#include <qpe/global.h> 29#include <qpe/global.h>
30#include <qpe/qpeapplication.h> 30#include <qpe/qpeapplication.h>
31#include <qpe/mimetype.h> 31#include <qpe/mimetype.h>
32#include <qpe/storage.h> 32#include <qpe/storage.h>
33#include <qpe/palmtoprecord.h> 33#include <qpe/palmtoprecord.h>
34 34
35#include <qpe/version.h> 35#include <qpe/version.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#ifdef QWS 38#ifdef QWS
39#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
40#endif 40#endif
41#include <qtimer.h> 41#include <qtimer.h>
42#include <qcombobox.h> 42#include <qcombobox.h>
43#include <qvbox.h> 43#include <qvbox.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qstyle.h> 45#include <qstyle.h>
46#include <qpushbutton.h> 46#include <qpushbutton.h>
47#include <qtabbar.h> 47#include <qtabbar.h>
48#include <qwidgetstack.h> 48#include <qwidgetstack.h>
49#include <qlayout.h> 49#include <qlayout.h>
50#include <qregexp.h> 50#include <qregexp.h>
51#include <qmessagebox.h> 51#include <qmessagebox.h>
52#include <qframe.h> 52#include <qframe.h>
53#include <qpainter.h> 53#include <qpainter.h>
54#include <qlabel.h> 54#include <qlabel.h>
55#include <qtextstream.h> 55#include <qtextstream.h>
56#include <qpopupmenu.h> 56#include <qpopupmenu.h>
57 57
58#include <opie/owait.h>
59
60
58#include "launcherview.h" 61#include "launcherview.h"
59#include "launcher.h" 62#include "launcher.h"
60#include "syncdialog.h" 63#include "syncdialog.h"
61#include "desktop.h" 64#include "desktop.h"
62#include <qpe/lnkproperties.h> 65#include <qpe/lnkproperties.h>
63//#include "mrulist.h" 66//#include "mrulist.h"
64#include "qrsync.h" 67#include "qrsync.h"
65#include <stdlib.h> 68#include <stdlib.h>
66#include <unistd.h> 69#include <unistd.h>
67 70
68#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 71#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
69#include <stdio.h> 72#include <stdio.h>
70#include <sys/vfs.h> 73#include <sys/vfs.h>
71#include <mntent.h> 74#include <mntent.h>
72#endif 75#endif
73 76
74#include <qpe/storage.h> 77#include <qpe/storage.h>
75#include "mediummountgui.h" 78#include "mediummountgui.h"
76 79
77namespace { 80namespace {
78 QStringList configToMime( Config *cfg ){ 81 QStringList configToMime( Config *cfg ){
79 QStringList mimes; 82 QStringList mimes;
80 bool tmpMime = true; 83 bool tmpMime = true;
81 cfg->setGroup("mimetypes" ); 84 cfg->setGroup("mimetypes" );
82 tmpMime = cfg->readBoolEntry("all" ,true); 85 tmpMime = cfg->readBoolEntry("all" ,true);
83 if( tmpMime ){ 86 if( tmpMime ){
84 mimes << QString::null; 87 mimes << QString::null;
85 return mimes; 88 return mimes;
86 }else{ 89 }else{
87 tmpMime = cfg->readBoolEntry("audio", true ); 90 tmpMime = cfg->readBoolEntry("audio", true );
88 if(tmpMime ) 91 if(tmpMime )
89 mimes.append("audio/*" ); 92 mimes.append("audio/*" );
90 93
91 tmpMime = cfg->readBoolEntry("image", true ); 94 tmpMime = cfg->readBoolEntry("image", true );
92 if(tmpMime ) 95 if(tmpMime )
93 mimes.append("image/*" ); 96 mimes.append("image/*" );
94 97
95 tmpMime = cfg->readBoolEntry("text", true ); 98 tmpMime = cfg->readBoolEntry("text", true );
96 if(tmpMime ) 99 if(tmpMime )
97 mimes.append("text/*"); 100 mimes.append("text/*");
98 101
99 tmpMime = cfg->readBoolEntry("video", true ); 102 tmpMime = cfg->readBoolEntry("video", true );
100 if(tmpMime ) 103 if(tmpMime )
101 mimes.append("video/*" ); 104 mimes.append("video/*" );
102 } 105 }
103 return mimes; 106 return mimes;
104 } 107 }
105 108
106} 109}
107 110
108 111
109 112
110//#define SHOW_ALL 113//#define SHOW_ALL
111 114
112class CategoryTab : public QTab 115class CategoryTab : public QTab
113{ 116{
114public: 117public:
115 CategoryTab( const QIconSet &icon, const QString &text=QString::null ) 118 CategoryTab( const QIconSet &icon, const QString &text=QString::null )
116 : QTab( icon, text ) 119 : QTab( icon, text )
117 { 120 {
118 } 121 }
119 122
120 QColor bgColor; 123 QColor bgColor;
121 QColor fgColor; 124 QColor fgColor;
122}; 125};
123 126
124//=========================================================================== 127//===========================================================================
125 128
126CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : 129CategoryTabWidget::CategoryTabWidget( QWidget* parent ) :
127 QVBox( parent ) 130 QVBox( parent )
128{ 131{
129 categoryBar = 0; 132 categoryBar = 0;
130 stack = 0; 133 stack = 0;
131} 134}
132 135
133void CategoryTabWidget::prevTab() 136void CategoryTabWidget::prevTab()
134{ 137{
135 if ( categoryBar ) { 138 if ( categoryBar ) {
136 int n = categoryBar->count(); 139 int n = categoryBar->count();
137 int tab = categoryBar->currentTab(); 140 int tab = categoryBar->currentTab();
138 if ( tab >= 0 ) 141 if ( tab >= 0 )
139 categoryBar->setCurrentTab( (tab - 1 + n)%n ); 142 categoryBar->setCurrentTab( (tab - 1 + n)%n );
140 } 143 }
141} 144}
142 145
143void CategoryTabWidget::nextTab() 146void CategoryTabWidget::nextTab()
144{ 147{
145 if ( categoryBar ) { 148 if ( categoryBar ) {
146 int n = categoryBar->count(); 149 int n = categoryBar->count();
147 int tab = categoryBar->currentTab(); 150 int tab = categoryBar->currentTab();
148 categoryBar->setCurrentTab( (tab + 1)%n ); 151 categoryBar->setCurrentTab( (tab + 1)%n );
149 } 152 }
150} 153}
151 154
152 155
153void CategoryTabWidget::showTab(const QString& id) 156void CategoryTabWidget::showTab(const QString& id)
154{ 157{
155 if ( categoryBar ) { 158 if ( categoryBar ) {
156 int idx = ids.findIndex( id ); 159 int idx = ids.findIndex( id );
157 categoryBar->setCurrentTab( idx ); 160 categoryBar->setCurrentTab( idx );
158 } 161 }
159} 162}
160 163
161void CategoryTabWidget::addItem( const QString& linkfile ) 164void CategoryTabWidget::addItem( const QString& linkfile )
162{ 165{
163 int i=0; 166 int i=0;
164 AppLnk *app = new AppLnk(linkfile); 167 AppLnk *app = new AppLnk(linkfile);
165 if ( !app->isValid() ) { 168 if ( !app->isValid() ) {
166 delete app; 169 delete app;
167 app=0; 170 app=0;
168 } 171 }
169 if ( !app || !app->file().isEmpty() ) { 172 if ( !app || !app->file().isEmpty() ) {
170 // A document 173 // A document
171 delete app; 174 delete app;
172 app = new DocLnk(linkfile); 175 app = new DocLnk(linkfile);
173 if ( app->fileKnown() ) { 176 if ( app->fileKnown() ) {
174 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); 177 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
175 } else { 178 } else {
176 ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); 179 ((LauncherView*)(stack->widget(ids.count()-1)))->sort();
177 delete app; 180 delete app;
178 } 181 }
179 return; 182 return;
180 } 183 }
181 // An application 184 // An application
182 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { 185 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) {
183 if ( !(*it).isEmpty() ) { 186 if ( !(*it).isEmpty() ) {
184 QRegExp tf(*it,FALSE,TRUE); 187 QRegExp tf(*it,FALSE,TRUE);
185 if ( tf.match(app->type()) >= 0 ) { 188 if ( tf.match(app->type()) >= 0 ) {
@@ -235,256 +238,257 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
235 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 238 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
236 if ( *it == l->type() ) 239 if ( *it == l->type() )
237 ((LauncherView*)stack->widget(i))->addItem(l,FALSE); 240 ((LauncherView*)stack->widget(i))->addItem(l,FALSE);
238 i++; 241 i++;
239 } 242 }
240 } 243 }
241 ++it; 244 ++it;
242 } 245 }
243 rootFolder->detachChildren(); 246 rootFolder->detachChildren();
244 for (int i=0; i<tabs; i++) 247 for (int i=0; i<tabs; i++)
245 ((LauncherView*)stack->widget(i))->sort(); 248 ((LauncherView*)stack->widget(i))->sort();
246 249
247 // all documents 250 // all documents
248 QImage img( Resource::loadImage( "DocsIcon" ) ); 251 QImage img( Resource::loadImage( "DocsIcon" ) );
249 QPixmap pm; 252 QPixmap pm;
250 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 253 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
251 docview = newView( "Documents", // No tr 254 docview = newView( "Documents", // No tr
252 pm, tr("Documents")); 255 pm, tr("Documents"));
253 docview->populate( docFolder, QString::null ); 256 docview->populate( docFolder, QString::null );
254 docFolder->detachChildren(); 257 docFolder->detachChildren();
255 docview->setFileSystems(fs); 258 docview->setFileSystems(fs);
256 docview->setToolsEnabled(TRUE); 259 docview->setToolsEnabled(TRUE);
257 setTabAppearance( "Documents", cfg ); // No tr 260 setTabAppearance( "Documents", cfg ); // No tr
258 261
259 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); 262 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) );
260 263
261 ((LauncherView*)stack->widget(0))->setFocus(); 264 ((LauncherView*)stack->widget(0))->setFocus();
262 265
263 cfg. setGroup ( "GUI" ); 266 cfg. setGroup ( "GUI" );
264 setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); 267 setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null ));
265 268
266 if ( !current.isNull() ) { 269 if ( !current.isNull() ) {
267 showTab(current); 270 showTab(current);
268 } 271 }
269 272
270 categoryBar->show(); 273 categoryBar->show();
271 stack->show(); 274 stack->show();
272 275
273 QCopEnvelope e("QPE/TaskBar","reloadApps()"); 276 QCopEnvelope e("QPE/TaskBar","reloadApps()");
274} 277}
275 278
276void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) 279void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
277{ 280{
278 QString grp( "Tab %1" ); // No tr 281 QString grp( "Tab %1" ); // No tr
279 cfg.setGroup( grp.arg(id) ); 282 cfg.setGroup( grp.arg(id) );
280 LauncherView *v = view( id ); 283 LauncherView *v = view( id );
281 int idx = ids.findIndex( id ); 284 int idx = ids.findIndex( id );
282 CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); 285 CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx );
283 286
284 // View 287 // View
285 QString view = cfg.readEntry( "View", "Icon" ); 288 QString view = cfg.readEntry( "View", "Icon" );
286 if ( view == "List" ) // No tr 289 if ( view == "List" ) // No tr
287 v->setViewMode( LauncherView::List ); 290 v->setViewMode( LauncherView::List );
288 QString bgType = cfg.readEntry( "BackgroundType", "Image" ); 291 QString bgType = cfg.readEntry( "BackgroundType", "Image" );
289 if ( bgType == "Image" ) { // No tr 292 if ( bgType == "Image" ) { // No tr
290 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); 293 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" );
291 v->setBackgroundType( LauncherView::Image, pm ); 294 v->setBackgroundType( LauncherView::Image, pm );
292 } else if ( bgType == "SolidColor" ) { 295 } else if ( bgType == "SolidColor" ) {
293 QString c = cfg.readEntry( "BackgroundColor" ); 296 QString c = cfg.readEntry( "BackgroundColor" );
294 v->setBackgroundType( LauncherView::SolidColor, c ); 297 v->setBackgroundType( LauncherView::SolidColor, c );
295 } 298 }
296 QString textCol = cfg.readEntry( "TextColor" ); 299 QString textCol = cfg.readEntry( "TextColor" );
297 if ( textCol.isEmpty() ) 300 if ( textCol.isEmpty() )
298 v->setTextColor( QColor() ); 301 v->setTextColor( QColor() );
299 else 302 else
300 v->setTextColor( QColor(textCol) ); 303 v->setTextColor( QColor(textCol) );
301 QStringList font = cfg.readListEntry( "Font", ',' ); 304 QStringList font = cfg.readListEntry( "Font", ',' );
302 if ( font.count() == 4 ) 305 if ( font.count() == 4 )
303 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); 306 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) );
304 307
305 // Tabs 308 // Tabs
306 QString tabCol = cfg.readEntry( "TabColor" ); 309 QString tabCol = cfg.readEntry( "TabColor" );
307 if ( tabCol.isEmpty() ) 310 if ( tabCol.isEmpty() )
308 tab->bgColor = QColor(); 311 tab->bgColor = QColor();
309 else 312 else
310 tab->bgColor = QColor(tabCol); 313 tab->bgColor = QColor(tabCol);
311 QString tabTextCol = cfg.readEntry( "TabTextColor" ); 314 QString tabTextCol = cfg.readEntry( "TabTextColor" );
312 if ( tabTextCol.isEmpty() ) 315 if ( tabTextCol.isEmpty() )
313 tab->fgColor = QColor(); 316 tab->fgColor = QColor();
314 else 317 else
315 tab->fgColor = QColor(tabTextCol); 318 tab->fgColor = QColor(tabTextCol);
316} 319}
317 320
318void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) 321void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs)
319{ 322{
320 docview->populate( docFolder, QString::null ); 323 docview->populate( docFolder, QString::null );
321 docFolder->detachChildren(); 324 docFolder->detachChildren();
322 docview->setFileSystems(fs); 325 docview->setFileSystems(fs);
323 docview->updateTools(); 326 docview->updateTools();
324} 327}
325 328
326void CategoryTabWidget::tabProperties() 329void CategoryTabWidget::tabProperties()
327{ 330{
328 LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() ); 331 LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() );
329 QPopupMenu *m = new QPopupMenu( this ); 332 QPopupMenu *m = new QPopupMenu( this );
330 m->insertItem( tr("Icon View"), LauncherView::Icon ); 333 m->insertItem( tr("Icon View"), LauncherView::Icon );
331 m->insertItem( tr("List View"), LauncherView::List ); 334 m->insertItem( tr("List View"), LauncherView::List );
332 m->setItemChecked( (int)view->viewMode(), TRUE ); 335 m->setItemChecked( (int)view->viewMode(), TRUE );
333 int rv = m->exec( QCursor::pos() ); 336 int rv = m->exec( QCursor::pos() );
334 if ( rv >= 0 && rv != view->viewMode() ) { 337 if ( rv >= 0 && rv != view->viewMode() ) {
335 view->setViewMode( (LauncherView::ViewMode)rv ); 338 view->setViewMode( (LauncherView::ViewMode)rv );
336 } 339 }
337 340
338 delete m; 341 delete m;
339} 342}
340 343
341QString CategoryTabWidget::getAllDocLinkInfo() const 344QString CategoryTabWidget::getAllDocLinkInfo() const
342{ 345{
343 return docview->getAllDocLinkInfo(); 346 return docview->getAllDocLinkInfo();
344} 347}
345 348
346LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 349LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
347{ 350{
348 LauncherView* view = new LauncherView( stack ); 351 LauncherView* view = new LauncherView( stack );
349 connect( view, SIGNAL(clicked(const AppLnk*)), 352 connect( view, SIGNAL(clicked(const AppLnk*)),
350 this, SIGNAL(clicked(const AppLnk*))); 353 this, SIGNAL(clicked(const AppLnk*)));
351 connect( view, SIGNAL(rightPressed(AppLnk*)), 354 connect( view, SIGNAL(rightPressed(AppLnk*)),
352 this, SIGNAL(rightPressed(AppLnk*))); 355 this, SIGNAL(rightPressed(AppLnk*)));
353 ids.append(id); 356 ids.append(id);
354 categoryBar->addTab( new CategoryTab( pm, label ) ); 357 categoryBar->addTab( new CategoryTab( pm, label ) );
355 stack->addWidget( view, tabs++ ); 358 stack->addWidget( view, tabs++ );
356 return view; 359 return view;
357} 360}
358 361
359void CategoryTabWidget::updateLink(const QString& linkfile) 362void CategoryTabWidget::updateLink(const QString& linkfile)
360{ 363{
361 int i=0; 364 int i=0;
362 LauncherView* view; 365 LauncherView* view;
366 qApp->processEvents();
363 while ((view = (LauncherView*)stack->widget(i++))) { 367 while ((view = (LauncherView*)stack->widget(i++))) {
364 if ( view->removeLink(linkfile) ) 368 if ( view->removeLink(linkfile) )
365 break; 369 break;
366 } 370 }
367 addItem(linkfile); 371 addItem(linkfile);
368 docview->updateTools(); 372 docview->updateTools();
369} 373}
370 374
371void CategoryTabWidget::paletteChange( const QPalette &p ) 375void CategoryTabWidget::paletteChange( const QPalette &p )
372{ 376{
373 QVBox::paletteChange( p ); 377 QVBox::paletteChange( p );
374 QPalette pal = palette(); 378 QPalette pal = palette();
375 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 379 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
376 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 380 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
377 categoryBar->setPalette( pal ); 381 categoryBar->setPalette( pal );
378 categoryBar->update(); 382 categoryBar->update();
379} 383}
380 384
381void CategoryTabWidget::setBusy(bool on) 385void CategoryTabWidget::setBusy(bool on)
382{ 386{
383 if ( on ) 387 if ( on )
384 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); 388 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE);
385 else 389 else
386 for (int i=0; i<tabs; i++) 390 for (int i=0; i<tabs; i++)
387 ((LauncherView*)stack->widget(i))->setBusy(FALSE); 391 ((LauncherView*)stack->widget(i))->setBusy(FALSE);
388} 392}
389 393
390LauncherView *CategoryTabWidget::view( const QString &id ) 394LauncherView *CategoryTabWidget::view( const QString &id )
391{ 395{
392 int idx = ids.findIndex( id ); 396 int idx = ids.findIndex( id );
393 return (LauncherView *)stack->widget(idx); 397 return (LauncherView *)stack->widget(idx);
394} 398}
395 399
396void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) 400void CategoryTabWidget::setBusyIndicatorType ( const QString &type )
397{ 401{
398 for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) 402 for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it )
399 view ( *it )-> setBusyIndicatorType ( type ); 403 view ( *it )-> setBusyIndicatorType ( type );
400} 404}
401 405
402//=========================================================================== 406//===========================================================================
403 407
404CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) 408CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name )
405 : QTabBar( parent, name ) 409 : QTabBar( parent, name )
406{ 410{
407 setFocusPolicy( NoFocus ); 411 setFocusPolicy( NoFocus );
408 connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); 412 connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) );
409} 413}
410 414
411CategoryTabBar::~CategoryTabBar() 415CategoryTabBar::~CategoryTabBar()
412{ 416{
413} 417}
414 418
415void CategoryTabBar::layoutTabs() 419void CategoryTabBar::layoutTabs()
416{ 420{
417 if ( !count() ) 421 if ( !count() )
418 return; 422 return;
419 423
420// int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; 424// int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 };
421 int available = width()-1; 425 int available = width()-1;
422 QFontMetrics fm = fontMetrics(); 426 QFontMetrics fm = fontMetrics();
423 int hiddenTabWidth = -7; 427 int hiddenTabWidth = -7;
424 int middleTab = currentTab(); 428 int middleTab = currentTab();
425 int hframe, vframe, overlap; 429 int hframe, vframe, overlap;
426 style().tabbarMetrics( this, hframe, vframe, overlap ); 430 style().tabbarMetrics( this, hframe, vframe, overlap );
427 int x = 0; 431 int x = 0;
428 QRect r; 432 QRect r;
429 QTab *t; 433 QTab *t;
430 int required = 0; 434 int required = 0;
431 int eventabwidth = (width()-1)/count(); 435 int eventabwidth = (width()-1)/count();
432 enum Mode { HideBackText, Pack, Even } mode=Even; 436 enum Mode { HideBackText, Pack, Even } mode=Even;
433 for ( int i = 0; i < count(); i++ ) { 437 for ( int i = 0; i < count(); i++ ) {
434 t = tab(i); 438 t = tab(i);
435 int iw = fm.width( t->text() ) + hframe - overlap; 439 int iw = fm.width( t->text() ) + hframe - overlap;
436 if ( i != middleTab ) { 440 if ( i != middleTab ) {
437 available -= hiddenTabWidth + hframe - overlap; 441 available -= hiddenTabWidth + hframe - overlap;
438 if ( t->iconSet() != 0 ) 442 if ( t->iconSet() != 0 )
439 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 443 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
440 } 444 }
441 if ( t->iconSet() != 0 ) 445 if ( t->iconSet() != 0 )
442 iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 446 iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
443 required += iw; 447 required += iw;
444 // As space gets tight, packed looks better than even. "10" must be at least 0. 448 // As space gets tight, packed looks better than even. "10" must be at least 0.
445 if ( iw >= eventabwidth-10 ) 449 if ( iw >= eventabwidth-10 )
446 mode = Pack; 450 mode = Pack;
447 } 451 }
448 if ( mode == Pack && required > width()-1 ) 452 if ( mode == Pack && required > width()-1 )
449 mode = HideBackText; 453 mode = HideBackText;
450 for ( int i = 0; i < count(); i++ ) { 454 for ( int i = 0; i < count(); i++ ) {
451 t = tab(i); 455 t = tab(i);
452 if ( mode != HideBackText ) { 456 if ( mode != HideBackText ) {
453 int w = fm.width( t->text() ); 457 int w = fm.width( t->text() );
454 int ih = 0; 458 int ih = 0;
455 if ( t->iconSet() != 0 ) { 459 if ( t->iconSet() != 0 ) {
456 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 460 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
457 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 461 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
458 } 462 }
459 int h = QMAX( fm.height(), ih ); 463 int h = QMAX( fm.height(), ih );
460 h = QMAX( h, QApplication::globalStrut().height() ); 464 h = QMAX( h, QApplication::globalStrut().height() );
461 465
462 h += vframe; 466 h += vframe;
463 w += hframe; 467 w += hframe;
464 468
465 QRect tr(x, 0, 469 QRect tr(x, 0,
466 mode == Even ? eventabwidth : w * (width()-1)/required, h); 470 mode == Even ? eventabwidth : w * (width()-1)/required, h);
467 t->setRect(tr); 471 t->setRect(tr);
468 x += tr.width() - overlap; 472 x += tr.width() - overlap;
469 r = r.unite(tr); 473 r = r.unite(tr);
470 } else if ( i != middleTab ) { 474 } else if ( i != middleTab ) {
471 int w = hiddenTabWidth; 475 int w = hiddenTabWidth;
472 int ih = 0; 476 int ih = 0;
473 if ( t->iconSet() != 0 ) { 477 if ( t->iconSet() != 0 ) {
474 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 478 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
475 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 479 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
476 } 480 }
477 int h = QMAX( fm.height(), ih ); 481 int h = QMAX( fm.height(), ih );
478 h = QMAX( h, QApplication::globalStrut().height() ); 482 h = QMAX( h, QApplication::globalStrut().height() );
479 483
480 h += vframe; 484 h += vframe;
481 w += hframe; 485 w += hframe;
482 486
483 t->setRect( QRect(x, 0, w, h) ); 487 t->setRect( QRect(x, 0, w, h) );
484 x += t->rect().width() - overlap; 488 x += t->rect().width() - overlap;
485 r = r.unite( t->rect() ); 489 r = r.unite( t->rect() );
486 } else { 490 } else {
487 int ih = 0; 491 int ih = 0;
488 if ( t->iconSet() != 0 ) { 492 if ( t->iconSet() != 0 ) {
489 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 493 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
490 } 494 }
@@ -603,351 +607,367 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
603 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) 607 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) )
604 p->setPen( colorGroup().buttonText() ); 608 p->setPen( colorGroup().buttonText() );
605 else 609 else
606 p->setPen( colorGroup().foreground() ); 610 p->setPen( colorGroup().foreground() );
607#else 611#else
608 p->setPen( colorGroup().foreground() ); 612 p->setPen( colorGroup().foreground() );
609#endif 613#endif
610 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); 614 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
611 } else { 615 } else {
612 p->setPen( palette().disabled().foreground() ); 616 p->setPen( palette().disabled().foreground() );
613 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); 617 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
614 } 618 }
615} 619}
616 620
617//--------------------------------------------------------------------------- 621//---------------------------------------------------------------------------
618 622
619Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) 623Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
620 : QMainWindow( parent, name, fl ) 624 : QMainWindow( parent, name, fl )
621{ 625{
622 setCaption( tr("Launcher") ); 626 setCaption( tr("Launcher") );
623 627
624 syncDialog = 0; 628 syncDialog = 0;
625 629
626 // we have a pretty good idea how big we'll be 630 // we have a pretty good idea how big we'll be
627 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); 631 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() );
628 632
629 tabs = 0; 633 tabs = 0;
630 rootFolder = 0; 634 rootFolder = 0;
631 docsFolder = 0; 635 docsFolder = 0;
632 636
633 int stamp = uidgen.generate(); // this is our timestamp to see which devices we know 637 int stamp = uidgen.generate(); // this is our timestamp to see which devices we know
634 //uidgen.store( stamp ); 638 //uidgen.store( stamp );
635 m_timeStamp = QString::number( stamp ); 639 m_timeStamp = QString::number( stamp );
636 640
637 tabs = new CategoryTabWidget( this ); 641 tabs = new CategoryTabWidget( this );
638 setCentralWidget( tabs ); 642 setCentralWidget( tabs );
639 643
640 connect( tabs, SIGNAL(selected(const QString&)), 644 connect( tabs, SIGNAL(selected(const QString&)),
641 this, SLOT(viewSelected(const QString&)) ); 645 this, SLOT(viewSelected(const QString&)) );
642 connect( tabs, SIGNAL(clicked(const AppLnk*)), 646 connect( tabs, SIGNAL(clicked(const AppLnk*)),
643 this, SLOT(select(const AppLnk*))); 647 this, SLOT(select(const AppLnk*)));
644 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 648 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
645 this, SLOT(properties(AppLnk*))); 649 this, SLOT(properties(AppLnk*)));
646 650
647#if !defined(QT_NO_COP) 651#if !defined(QT_NO_COP)
648 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 652 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
649 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), 653 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
650 this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); 654 this, SLOT(systemMessage( const QCString &, const QByteArray &)) );
651 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 655 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
652 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 656 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
653 this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); 657 this, SLOT(launcherMessage(const QCString&, const QByteArray&)) );
654#endif 658#endif
655 659
656 storage = new StorageInfo( this ); 660 storage = new StorageInfo( this );
657 connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); 661 connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) );
658 662
659 updateTabs(); 663 updateTabs();
660 664
661 preloadApps(); 665 preloadApps();
662 666
663 in_lnk_props = FALSE; 667 in_lnk_props = FALSE;
664 got_lnk_change = FALSE; 668 got_lnk_change = FALSE;
665} 669}
666 670
667Launcher::~Launcher() 671Launcher::~Launcher()
668{ 672{
669 delete rootFolder; 673 delete rootFolder;
670 delete docsFolder; 674 delete docsFolder;
671} 675}
672 676
673static bool isVisibleWindow(int wid) 677static bool isVisibleWindow(int wid)
674{ 678{
675#ifdef QWS 679#ifdef QWS
676 const QList<QWSWindow> &list = qwsServer->clientWindows(); 680 const QList<QWSWindow> &list = qwsServer->clientWindows();
677 QWSWindow* w; 681 QWSWindow* w;
678 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 682 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
679 if ( w->winId() == wid ) 683 if ( w->winId() == wid )
680 return !w->isFullyObscured(); 684 return !w->isFullyObscured();
681 } 685 }
682#endif 686#endif
683 return FALSE; 687 return FALSE;
684} 688}
685 689
686void Launcher::showMaximized() 690void Launcher::showMaximized()
687{ 691{
688 if ( isVisibleWindow( winId() ) ) 692 if ( isVisibleWindow( winId() ) )
689 doMaximize(); 693 doMaximize();
690 else 694 else
691 QTimer::singleShot( 20, this, SLOT(doMaximize()) ); 695 QTimer::singleShot( 20, this, SLOT(doMaximize()) );
692} 696}
693 697
694void Launcher::doMaximize() 698void Launcher::doMaximize()
695{ 699{
696 QMainWindow::showMaximized(); 700 QMainWindow::showMaximized();
697 tabs->setMaximumWidth( qApp->desktop()->width() ); 701 tabs->setMaximumWidth( qApp->desktop()->width() );
698} 702}
699 703
700void Launcher::updateMimeTypes() 704void Launcher::updateMimeTypes()
701{ 705{
702 MimeType::clear(); 706 MimeType::clear();
703 updateMimeTypes(rootFolder); 707 updateMimeTypes(rootFolder);
704} 708}
705 709
706void Launcher::updateMimeTypes(AppLnkSet* folder) 710void Launcher::updateMimeTypes(AppLnkSet* folder)
707{ 711{
708 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { 712 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) {
709 AppLnk *app = it.current(); 713 AppLnk *app = it.current();
710 if ( app->type() == "Folder" ) // No tr 714 if ( app->type() == "Folder" ) // No tr
711 updateMimeTypes((AppLnkSet *)app); 715 updateMimeTypes((AppLnkSet *)app);
712 else { 716 else {
713 MimeType::registerApp(*app); 717 MimeType::registerApp(*app);
714 } 718 }
715 } 719 }
716} 720}
717 721
718/** This is a HACK.... 722/** This is a HACK....
719 * Reason: scanning huge mediums, microdirvers for examples 723 * Reason: scanning huge mediums, microdirvers for examples
720 * consomes time. To avoid that we invented the MediumMountCheck 724 * consomes time. To avoid that we invented the MediumMountCheck
721 * 725 *
722 * a) the user globally disabled medium checking. We can ignore 726 * a) the user globally disabled medium checking. We can ignore
723 * all removable medium 727 * all removable medium
724 * b) the user enabled medium checking globally and we need to use this mimefilter 728 * b) the user enabled medium checking globally and we need to use this mimefilter
725 * c) the user enabled medium checking on a per medium bases 729 * c) the user enabled medium checking on a per medium bases
726 * c1) we already checked and its not ask again turns 730 * c1) we already checked and its not ask again turns
727 * c2) we need to ask and then apply the mimefilter 731 * c2) we need to ask and then apply the mimefilter
728 */ 732 */
729void Launcher::loadDocs() // ok here comes a hack belonging to Global:: 733void Launcher::loadDocs() // ok here comes a hack belonging to Global::
730{ 734{
735
736 OWait *owait = new OWait();
737 Global::statusMessage( tr( "Finding documents" ) );
738
739 owait->show();
740 qApp->processEvents();
741
731 delete docsFolder; 742 delete docsFolder;
732 docsFolder = new DocLnkSet; 743 docsFolder = new DocLnkSet;
733 744
734 DocLnkSet *tmp = 0; 745 DocLnkSet *tmp = 0;
735 QString home = QString(getenv("HOME")) + "/Documents"; 746 QString home = QString(getenv("HOME")) + "/Documents";
736 tmp = new DocLnkSet( home , QString::null); 747 tmp = new DocLnkSet( home , QString::null);
737 docsFolder->appendFrom( *tmp ); 748 docsFolder->appendFrom( *tmp );
738 delete tmp; 749 delete tmp;
739 750
740 // RAM documents 751 // RAM documents
741 StorageInfo storage; 752 StorageInfo storage;
742 const QList<FileSystem> &fileSystems = storage.fileSystems(); 753 const QList<FileSystem> &fileSystems = storage.fileSystems();
743 QListIterator<FileSystem> it ( fileSystems ); 754 QListIterator<FileSystem> it ( fileSystems );
744 755
745 for ( ; it.current(); ++it ) { 756 for ( ; it.current(); ++it ) {
746 if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { 757 if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) {
747 tmp = new DocLnkSet( (*it)->path(), QString::null ); 758 tmp = new DocLnkSet( (*it)->path(), QString::null );
748 docsFolder->appendFrom( *tmp ); 759 docsFolder->appendFrom( *tmp );
749 delete tmp; 760 delete tmp;
750 } 761 }
751 } 762 }
752 763
753 Config mediumCfg( "medium"); 764 Config mediumCfg( "medium");
754 mediumCfg.setGroup("main"); 765 mediumCfg.setGroup("main");
755 // a) -zecke we don't want to check 766 // a) -zecke we don't want to check
756 if(!mediumCfg.readBoolEntry("use", true ) ) 767 if(!mediumCfg.readBoolEntry("use", true ) )
757 return; 768 return;
758 769
759 // find out wich filesystems are new in this round 770 // find out wich filesystems are new in this round
760 // We will do this by having a timestamp inside each mountpoint 771 // We will do this by having a timestamp inside each mountpoint
761 // if the current timestamp doesn't match this is a new file system and 772 // if the current timestamp doesn't match this is a new file system and
762 // come up with our MediumMountGui :) let the hacking begin 773 // come up with our MediumMountGui :) let the hacking begin
763 int stamp = uidgen.generate(); 774 int stamp = uidgen.generate();
764 775
765 QString newStamp = QString::number( stamp ); // generates newtime Stamp 776 QString newStamp = QString::number( stamp ); // generates newtime Stamp
766 777
767 // b) 778 // b)
768 if( mediumCfg.readBoolEntry("global", true ) ){ 779 if( mediumCfg.readBoolEntry("global", true ) ){
769 QString mime = configToMime(&mediumCfg).join(";"); 780 QString mime = configToMime(&mediumCfg).join(";");
770 for( it.toFirst(); it.current(); ++it ){ 781 for( it.toFirst(); it.current(); ++it ){
771 if( (*it)->isRemovable() ){ 782 if( (*it)->isRemovable() ){
772 tmp = new DocLnkSet( (*it)->path(), mime ); 783 tmp = new DocLnkSet( (*it)->path(), mime );
773 docsFolder->appendFrom( *tmp ); 784 docsFolder->appendFrom( *tmp );
774 delete tmp; 785 delete tmp;
775 } 786 }
776 } // done 787 } // done
777 return; // save the else 788 return; // save the else
778 } 789 }
779 // c) zecke 790 // c) zecke
780 for ( it.toFirst(); it.current(); ++it ) { 791 for ( it.toFirst(); it.current(); ++it ) {
781 if ( (*it)->isRemovable() ) { // let's find out if we should search on it 792 if ( (*it)->isRemovable() ) { // let's find out if we should search on it
782 Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); 793 Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File);
783 cfg.setGroup("main"); 794 cfg.setGroup("main");
784 QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); 795 QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() );
785 /** This medium is uptodate 796 /** This medium is uptodate
786 */ 797 */
787 if( stamp == m_timeStamp ){ // ok we know this card 798 if( stamp == m_timeStamp ){ // ok we know this card
788 cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp 799 cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp
789 // we need to scan the list now. Hopefully the cache will be there 800 // we need to scan the list now. Hopefully the cache will be there
790 // read the mimetypes from the config and search for documents 801 // read the mimetypes from the config and search for documents
791 QStringList mimetypes = configToMime( &cfg); 802 QStringList mimetypes = configToMime( &cfg);
792 tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); 803 qApp->processEvents();
804 Global::statusMessage( tr( "Searching documents" ) );
805 tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") );
793 docsFolder->appendFrom( *tmp ); 806 docsFolder->appendFrom( *tmp );
794 delete tmp; 807 delete tmp;
795 808
796 }else{ // come up with the gui cause this a new card 809 }else{ // come up with the gui cause this a new card
797 MediumMountGui medium(&cfg, (*it)->path() ); 810 MediumMountGui medium(&cfg, (*it)->path() );
798 if( medium.check() ){ // we did not ask before or ask again is off 811 if( medium.check() ){ // we did not ask before or ask again is off
799 /** c2) */ 812 /** c2) */
800 if( medium.exec() ){ // he clicked yes so search it 813 if( medium.exec() ){ // he clicked yes so search it
801 // speicher 814 // speicher
802 //cfg.read(); // cause of a race we need to reread - fixed 815 //cfg.read(); // cause of a race we need to reread - fixed
803 cfg.setGroup("main"); 816 cfg.setGroup("main");
804 cfg.writeEntry("timestamp", newStamp ); 817 cfg.writeEntry("timestamp", newStamp );
805 cfg.write(); 818 cfg.write();
806 tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); 819
807 docsFolder->appendFrom( *tmp ); 820 qApp->processEvents();
821 tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) );
822 docsFolder->appendFrom( *tmp );
808 delete tmp; 823 delete tmp;
809 }// no else 824 }// no else
810 /** c1) */ 825 /** c1) */
811 }else{ // we checked 826 }else{ // we checked
812 // do something different see what we need to do 827 // do something different see what we need to do
813 // let's see if we should check the device 828 // let's see if we should check the device
814 cfg.setGroup("main" ); 829 cfg.setGroup("main" );
815 bool check = cfg.readBoolEntry("autocheck", true ); 830 bool check = cfg.readBoolEntry("autocheck", true );
816 if( check ){ // find the documents 831 if( check ){ // find the documents
817 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); 832
833 qApp->processEvents();
834 Global::statusMessage( tr( "Searching documents" ) );
835 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") );
818 docsFolder->appendFrom( *tmp ); 836 docsFolder->appendFrom( *tmp );
819 delete tmp; 837 delete tmp;
820 } 838 }
821 } 839 }
822 } 840 }
823 } 841 }
824 } 842 }
825 m_timeStamp = newStamp; 843 m_timeStamp = newStamp;
844 owait->hide();
845 delete owait;
826} 846}
827 847
828void Launcher::updateTabs() 848void Launcher::updateTabs()
829{ 849{
830 MimeType::updateApplications(); // ### reads all applnks twice 850 MimeType::updateApplications(); // ### reads all applnks twice
831 851
832 delete rootFolder; 852 delete rootFolder;
833 rootFolder = new AppLnkSet( MimeType::appsFolderName() ); 853 rootFolder = new AppLnkSet( MimeType::appsFolderName() );
834 854
835 loadDocs(); 855 loadDocs();
836 856
837 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); 857 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
838} 858}
839 859
840void Launcher::updateDocs() 860void Launcher::updateDocs()
841{ 861{
842 loadDocs(); 862 loadDocs();
843 tabs->updateDocs(docsFolder,storage->fileSystems()); 863 tabs->updateDocs(docsFolder,storage->fileSystems());
844} 864}
845 865
846void Launcher::viewSelected(const QString& s) 866void Launcher::viewSelected(const QString& s)
847{ 867{
848 setCaption( s + tr(" - Launcher") ); 868 setCaption( s + tr(" - Launcher") );
849} 869}
850 870
851void Launcher::nextView() 871void Launcher::nextView()
852{ 872{
853 tabs->nextTab(); 873 tabs->nextTab();
854} 874}
855 875
856void Launcher::showTab(const QString& id) 876void Launcher::showTab(const QString& id)
857{ 877{
858 tabs->showTab(id); 878 tabs->showTab(id);
859 raise(); 879 raise();
860} 880}
861 881
862void Launcher::select( const AppLnk *appLnk ) 882void Launcher::select( const AppLnk *appLnk )
863{ 883{
864 if ( appLnk->type() == "Folder" ) { // No tr 884 if ( appLnk->type() == "Folder" ) { // No tr
865 // Not supported: flat is simpler for the user 885 // Not supported: flat is simpler for the user
866 } else { 886 } else {
867 if ( appLnk->exec().isNull() ) { 887 if ( appLnk->exec().isNull() ) {
868 QMessageBox::information(this,tr("No application"), 888 QMessageBox::information(this,tr("No application"),
869 tr("<p>No application is defined for this document." 889 tr("<p>No application is defined for this document."
870 "<p>Type is %1.").arg(appLnk->type())); 890 "<p>Type is %1.").arg(appLnk->type()));
871 return; 891 return;
872 } 892 }
873 tabs->setBusy(TRUE); 893 tabs->setBusy(TRUE);
874 emit executing( appLnk ); 894 emit executing( appLnk );
875 appLnk->execute(); 895 appLnk->execute();
876 } 896 }
877} 897}
878 898
879void Launcher::externalSelected(const AppLnk *appLnk) 899void Launcher::externalSelected(const AppLnk *appLnk)
880{ 900{
881 tabs->setBusy(TRUE); 901 tabs->setBusy(TRUE);
882 emit executing( appLnk ); 902 emit executing( appLnk );
883} 903}
884 904
885void Launcher::properties( AppLnk *appLnk ) 905void Launcher::properties( AppLnk *appLnk )
886{ 906{
887 if ( appLnk->type() == "Folder" ) { // No tr 907 if ( appLnk->type() == "Folder" ) { // No tr
888 // Not supported: flat is simpler for the user 908 // Not supported: flat is simpler for the user
889 } else { 909 } else {
890 in_lnk_props = TRUE; 910 in_lnk_props = TRUE;
891 got_lnk_change = FALSE; 911 got_lnk_change = FALSE;
892 LnkProperties prop(appLnk); 912 LnkProperties prop(appLnk);
893 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 913 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
894 prop.showMaximized(); 914 prop.showMaximized();
895 prop.exec(); 915 prop.exec();
896 in_lnk_props = FALSE; 916 in_lnk_props = FALSE;
897 if ( got_lnk_change ) { 917 if ( got_lnk_change ) {
898 updateLink(lnk_change); 918 updateLink(lnk_change);
899 } 919 }
900 } 920 }
901} 921}
902 922
903void Launcher::updateLink(const QString& link) 923void Launcher::updateLink(const QString& link)
904{ 924{
905 bool notify_sm = false; 925 bool notify_sm = false;
906 926
907 if (link.isNull()) { 927 if (link.isNull()) {
908 updateTabs(); 928 updateTabs();
909 notify_sm = true; 929 notify_sm = true;
910 } 930 }
911 else if (link.isEmpty()) { 931 else if (link.isEmpty()) {
912 updateDocs(); 932 updateDocs();
913 } 933 }
914 else { 934 else {
915 tabs->updateLink(link); 935 tabs->updateLink(link);
916 notify_sm = true; 936 notify_sm = true;
917 } 937 }
918 938
919 if ( notify_sm ) 939 if ( notify_sm )
920 QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" ); 940 QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" );
921} 941}
922 942
923void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 943void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
924{ 944{
925 QDataStream stream( data, IO_ReadOnly ); 945 QDataStream stream( data, IO_ReadOnly );
926 if ( msg == "linkChanged(QString)" ) { 946 if ( msg == "linkChanged(QString)" ) {
927 QString link; 947 QString link;
928 stream >> link; 948 stream >> link;
929 if ( in_lnk_props ) { 949 if ( in_lnk_props ) {
930 got_lnk_change = TRUE; 950 got_lnk_change = TRUE;
931 lnk_change = link; 951 lnk_change = link;
932 } else { 952 } else {
933 updateLink(link); 953 updateLink(link);
934 } 954 }
935 } else if ( msg == "busy()" ) { 955 } else if ( msg == "busy()" ) {
936 emit busy(); 956 emit busy();
937 } else if ( msg == "notBusy(QString)" ) { 957 } else if ( msg == "notBusy(QString)" ) {
938 QString app; 958 QString app;
939 stream >> app; 959 stream >> app;
940 tabs->setBusy(FALSE); 960 tabs->setBusy(FALSE);
941 emit notBusy(app); 961 emit notBusy(app);
942 } else if ( msg == "mkdir(QString)" ) { 962 } else if ( msg == "mkdir(QString)" ) {
943 QString dir; 963 QString dir;
944 stream >> dir; 964 stream >> dir;
945 if ( !dir.isEmpty() ) 965 if ( !dir.isEmpty() )
946 mkdir( dir ); 966 mkdir( dir );
947 } else if ( msg == "rdiffGenSig(QString,QString)" ) { 967 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
948 QString baseFile, sigFile; 968 QString baseFile, sigFile;
949 stream >> baseFile >> sigFile; 969 stream >> baseFile >> sigFile;
950 QRsync::generateSignature( baseFile, sigFile ); 970 QRsync::generateSignature( baseFile, sigFile );
951 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { 971 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
952 QString baseFile, sigFile, deltaFile; 972 QString baseFile, sigFile, deltaFile;
953 stream >> baseFile >> sigFile >> deltaFile; 973 stream >> baseFile >> sigFile >> deltaFile;
@@ -979,257 +999,260 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
979 e << home; 999 e << home;
980 int locked = (int) Desktop::screenLocked(); 1000 int locked = (int) Desktop::screenLocked();
981 e << locked; 1001 e << locked;
982#endif 1002#endif
983 } else if ( msg == "autoStart(QString)" ) { 1003 } else if ( msg == "autoStart(QString)" ) {
984 QString appName; 1004 QString appName;
985 stream >> appName; 1005 stream >> appName;
986 Config cfg( "autostart" ); 1006 Config cfg( "autostart" );
987 cfg.setGroup( "AutoStart" ); 1007 cfg.setGroup( "AutoStart" );
988 if ( appName.compare("clear") == 0){ 1008 if ( appName.compare("clear") == 0){
989 cfg.writeEntry("Apps", ""); 1009 cfg.writeEntry("Apps", "");
990 } 1010 }
991 } else if ( msg == "autoStart(QString,QString)" ) { 1011 } else if ( msg == "autoStart(QString,QString)" ) {
992 QString modifier, appName; 1012 QString modifier, appName;
993 stream >> modifier >> appName; 1013 stream >> modifier >> appName;
994 Config cfg( "autostart" ); 1014 Config cfg( "autostart" );
995 cfg.setGroup( "AutoStart" ); 1015 cfg.setGroup( "AutoStart" );
996 if ( modifier.compare("add") == 0 ){ 1016 if ( modifier.compare("add") == 0 ){
997 // only add if appname is entered 1017 // only add if appname is entered
998 if (!appName.isEmpty()) { 1018 if (!appName.isEmpty()) {
999 cfg.writeEntry("Apps", appName); 1019 cfg.writeEntry("Apps", appName);
1000 } 1020 }
1001 } else if (modifier.compare("remove") == 0 ) { 1021 } else if (modifier.compare("remove") == 0 ) {
1002 // need to change for multiple entries 1022 // need to change for multiple entries
1003 // actually remove is right now simular to clear, but in future there 1023 // actually remove is right now simular to clear, but in future there
1004 // should be multiple apps in autostart possible. 1024 // should be multiple apps in autostart possible.
1005 QString checkName; 1025 QString checkName;
1006 checkName = cfg.readEntry("Apps", ""); 1026 checkName = cfg.readEntry("Apps", "");
1007 if (checkName == appName) { 1027 if (checkName == appName) {
1008 cfg.writeEntry("Apps", ""); 1028 cfg.writeEntry("Apps", "");
1009 } 1029 }
1010 } 1030 }
1011 // case the autostart feature should be delayed 1031 // case the autostart feature should be delayed
1012 } else if ( msg == "autoStart(QString,QString,QString)") { 1032 } else if ( msg == "autoStart(QString,QString,QString)") {
1013 QString modifier, appName, delay; 1033 QString modifier, appName, delay;
1014 stream >> modifier >> appName >> delay; 1034 stream >> modifier >> appName >> delay;
1015 Config cfg( "autostart" ); 1035 Config cfg( "autostart" );
1016 cfg.setGroup( "AutoStart" ); 1036 cfg.setGroup( "AutoStart" );
1017 if ( modifier.compare("add") == 0 ){ 1037 if ( modifier.compare("add") == 0 ){
1018 // only add it appname is entered 1038 // only add it appname is entered
1019 if (!appName.isEmpty()) { 1039 if (!appName.isEmpty()) {
1020 cfg.writeEntry("Apps", appName); 1040 cfg.writeEntry("Apps", appName);
1021 cfg.writeEntry("Delay", delay); 1041 cfg.writeEntry("Delay", delay);
1022 } 1042 }
1023 } else { 1043 } else {
1024 } 1044 }
1025 } 1045 }
1026 /* 1046 /*
1027 * QtopiaDesktop relies on the major number 1047 * QtopiaDesktop relies on the major number
1028 * to start with 1. We're at 0.9 1048 * to start with 1. We're at 0.9
1029 * so wee need to fake at least 1.4 to be able 1049 * so wee need to fake at least 1.4 to be able
1030 * to sync with QtopiaDesktop1.6 1050 * to sync with QtopiaDesktop1.6
1031 */ 1051 */
1032 else if ( msg == "sendVersionInfo()" ) { 1052 else if ( msg == "sendVersionInfo()" ) {
1033 QCopEnvelope e( "QPE/Desktop", "versionInfo(QString)" ); 1053 QCopEnvelope e( "QPE/Desktop", "versionInfo(QString)" );
1034 QString v2 = QString::fromLatin1("1.4"); 1054 QString v2 = QString::fromLatin1("1.4");
1035 e << v2; 1055 e << v2;
1036 //qDebug("version %s\n", line.latin1()); 1056 //qDebug("version %s\n", line.latin1());
1037 } else if ( msg == "sendCardInfo()" ) { 1057 } else if ( msg == "sendCardInfo()" ) {
1038#ifndef QT_NO_COP 1058#ifndef QT_NO_COP
1039 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); 1059 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
1040#endif 1060#endif
1041 const QList<FileSystem> &fs = storage->fileSystems(); 1061 const QList<FileSystem> &fs = storage->fileSystems();
1042 QListIterator<FileSystem> it ( fs ); 1062 QListIterator<FileSystem> it ( fs );
1043 QString s; 1063 QString s;
1044 QString homeDir = getenv("HOME"); 1064 QString homeDir = getenv("HOME");
1045 QString hardDiskHome, hardDiskHomePath; 1065 QString hardDiskHome, hardDiskHomePath;
1046 for ( ; it.current(); ++it ) { 1066 for ( ; it.current(); ++it ) {
1047 int k4 = (*it)->blockSize()/256; 1067 int k4 = (*it)->blockSize()/256;
1048 if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs") { 1068 if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs") {
1049 s += (*it)->name() + "=" + (*it)->path() + "/Documents " 1069 s += (*it)->name() + "=" + (*it)->path() + "/Documents "
1050 + QString::number( (*it)->availBlocks() * k4/4 ) 1070 + QString::number( (*it)->availBlocks() * k4/4 )
1051 + "K " + (*it)->options() + ";"; 1071 + "K " + (*it)->options() + ";";
1052 } else if ( (*it)->disk() == "/dev/mtdblock1" || 1072 } else if ( (*it)->disk() == "/dev/mtdblock1" ||
1053 (*it)->disk() == "/dev/mtdblock/1" ) { 1073 (*it)->disk() == "/dev/mtdblock/1" ) {
1054 s += (*it)->name() + "=" + homeDir + "/Documents " 1074 s += (*it)->name() + "=" + homeDir + "/Documents "
1055 + QString::number( (*it)->availBlocks() * k4/4 ) 1075 + QString::number( (*it)->availBlocks() * k4/4 )
1056 + "K " + (*it)->options() + ";"; 1076 + "K " + (*it)->options() + ";";
1057 } else if ( (*it)->name().contains( "Hard Disk") && 1077 } else if ( (*it)->name().contains( "Hard Disk") &&
1058 homeDir.contains( (*it)->path() ) && 1078 homeDir.contains( (*it)->path() ) &&
1059 (*it)->path().length() > hardDiskHomePath.length() ) { 1079 (*it)->path().length() > hardDiskHomePath.length() ) {
1060 hardDiskHomePath = (*it)->path(); 1080 hardDiskHomePath = (*it)->path();
1061 hardDiskHome = 1081 hardDiskHome =
1062 (*it)->name() + "=" + homeDir + "/Documents " 1082 (*it)->name() + "=" + homeDir + "/Documents "
1063 + QString::number( (*it)->availBlocks() * k4/4 ) 1083 + QString::number( (*it)->availBlocks() * k4/4 )
1064 + "K " + (*it)->options() + ";"; 1084 + "K " + (*it)->options() + ";";
1065 } 1085 }
1066 } 1086 }
1067 if ( !hardDiskHome.isEmpty() ) 1087 if ( !hardDiskHome.isEmpty() )
1068 s += hardDiskHome; 1088 s += hardDiskHome;
1069 1089
1070#ifndef QT_NO_COP 1090#ifndef QT_NO_COP
1071 e << s; 1091 e << s;
1072#endif 1092#endif
1073 } else if ( msg == "sendSyncDate(QString)" ) { 1093 } else if ( msg == "sendSyncDate(QString)" ) {
1074 QString app; 1094 QString app;
1075 stream >> app; 1095 stream >> app;
1076 Config cfg( "qpe" ); 1096 Config cfg( "qpe" );
1077 cfg.setGroup("SyncDate"); 1097 cfg.setGroup("SyncDate");
1078#ifndef QT_NO_COP 1098#ifndef QT_NO_COP
1079 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); 1099 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" );
1080 e << app << cfg.readEntry( app ); 1100 e << app << cfg.readEntry( app );
1081#endif 1101#endif
1082 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), 1102 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(),
1083 //cfg.readEntry( app ).latin1() ); 1103 //cfg.readEntry( app ).latin1() );
1084 } else if ( msg == "setSyncDate(QString,QString)" ) { 1104 } else if ( msg == "setSyncDate(QString,QString)" ) {
1085 QString app, date; 1105 QString app, date;
1086 stream >> app >> date; 1106 stream >> app >> date;
1087 Config cfg( "qpe" ); 1107 Config cfg( "qpe" );
1088 cfg.setGroup("SyncDate"); 1108 cfg.setGroup("SyncDate");
1089 cfg.writeEntry( app, date ); 1109 cfg.writeEntry( app, date );
1090 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); 1110 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1());
1091 } else if ( msg == "startSync(QString)" ) { 1111 } else if ( msg == "startSync(QString)" ) {
1092 QString what; 1112 QString what;
1093 stream >> what; 1113 stream >> what;
1094 delete syncDialog; syncDialog = 0; 1114 delete syncDialog; syncDialog = 0;
1095 syncDialog = new SyncDialog( this, "syncProgress", FALSE, 1115 syncDialog = new SyncDialog( this, "syncProgress", FALSE,
1096 WStyle_Tool | WStyle_Customize | 1116 WStyle_Tool | WStyle_Customize |
1097 Qt::WStyle_StaysOnTop ); 1117 Qt::WStyle_StaysOnTop );
1098 syncDialog->showMaximized(); 1118 syncDialog->showMaximized();
1099 syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); 1119 syncDialog->whatLabel->setText( "<b>" + what + "</b>" );
1100 connect( syncDialog->buttonCancel, SIGNAL( clicked() ), 1120 connect( syncDialog->buttonCancel, SIGNAL( clicked() ),
1101 SLOT( cancelSync() ) ); 1121 SLOT( cancelSync() ) );
1102 } else if ( msg == "stopSync()") { 1122 } else if ( msg == "stopSync()") {
1103 delete syncDialog; syncDialog = 0; 1123 delete syncDialog; syncDialog = 0;
1104 } else if ( msg == "getAllDocLinks()" ) { 1124 } else if ( msg == "getAllDocLinks()" ) {
1105 loadDocs(); 1125 loadDocs();
1106 1126
1107 QString contents; 1127 // directly show updated docs in document tab
1128 updateDocs();
1129
1130 QString contents;
1108 1131
1109 //Categories cats; 1132 //Categories cats;
1110 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { 1133 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) {
1111 DocLnk *doc = it.current(); 1134 DocLnk *doc = it.current();
1112 QFileInfo fi( doc->file() ); 1135 QFileInfo fi( doc->file() );
1113 if ( !fi.exists() ) 1136 if ( !fi.exists() )
1114 continue; 1137 continue;
1115 1138
1116 bool fake = !doc->linkFileKnown(); 1139 bool fake = !doc->linkFileKnown();
1117 if ( !fake ) { 1140 if ( !fake ) {
1118 QFile f( doc->linkFile() ); 1141 QFile f( doc->linkFile() );
1119 if ( f.open( IO_ReadOnly ) ) { 1142 if ( f.open( IO_ReadOnly ) ) {
1120 QTextStream ts( &f ); 1143 QTextStream ts( &f );
1121 ts.setEncoding( QTextStream::UnicodeUTF8 ); 1144 ts.setEncoding( QTextStream::UnicodeUTF8 );
1122 contents += ts.read(); 1145 contents += ts.read();
1123 f.close(); 1146 f.close();
1124 } else 1147 } else
1125 fake = TRUE; 1148 fake = TRUE;
1126 } 1149 }
1127 if (fake) { 1150 if (fake) {
1128 contents += "[Desktop Entry]\n"; 1151 contents += "[Desktop Entry]\n";
1129 contents += "Categories = " + // No tr 1152 contents += "Categories = " + // No tr
1130 // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr 1153 // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
1131 Qtopia::Record::idsToString( doc->categories() ) + "\n"; 1154 Qtopia::Record::idsToString( doc->categories() ) + "\n";
1132 contents += "Name = "+doc->name()+"\n"; // No tr 1155 contents += "Name = "+doc->name()+"\n"; // No tr
1133 contents += "Type = "+doc->type()+"\n"; // No tr 1156 contents += "Type = "+doc->type()+"\n"; // No tr
1134 } 1157 }
1135 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) 1158 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
1136 contents += QString("Size = %1\n").arg( fi.size() ); // No tr 1159 contents += QString("Size = %1\n").arg( fi.size() ); // No tr
1137 } 1160 }
1138 1161
1139 //qDebug( "sending length %d", contents.length() ); 1162 //qDebug( "sending length %d", contents.length() );
1140#ifndef QT_NO_COP 1163#ifndef QT_NO_COP
1141 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); 1164 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
1142 e << contents; 1165 e << contents;
1143#endif 1166#endif
1144 1167
1145 //qDebug( "================ \n\n%s\n\n===============", 1168 //qDebug( "================ \n\n%s\n\n===============",
1146 //contents.latin1() ); 1169 //contents.latin1() );
1147 1170
1148 delete docsFolder; 1171 delete docsFolder;
1149 docsFolder = 0; 1172 docsFolder = 0;
1150#ifdef QWS 1173#ifdef QWS
1151 } else if ( msg == "setMouseProto(QString)" ) { 1174 } else if ( msg == "setMouseProto(QString)" ) {
1152 QString mice; 1175 QString mice;
1153 stream >> mice; 1176 stream >> mice;
1154 setenv("QWS_MOUSE_PROTO",mice.latin1(),1); 1177 setenv("QWS_MOUSE_PROTO",mice.latin1(),1);
1155 qwsServer->openMouse(); 1178 qwsServer->openMouse();
1156 } else if ( msg == "setKeyboard(QString)" ) { 1179 } else if ( msg == "setKeyboard(QString)" ) {
1157 QString kb; 1180 QString kb;
1158 stream >> kb; 1181 stream >> kb;
1159 setenv("QWS_KEYBOARD",kb.latin1(),1); 1182 setenv("QWS_KEYBOARD",kb.latin1(),1);
1160 qwsServer->openKeyboard(); 1183 qwsServer->openKeyboard();
1161#endif 1184#endif
1162 } 1185 }
1163} 1186}
1164 1187
1165void Launcher::cancelSync() 1188void Launcher::cancelSync()
1166{ 1189{
1167#ifndef QT_NO_COP 1190#ifndef QT_NO_COP
1168 QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); 1191 QCopEnvelope e( "QPE/Desktop", "cancelSync()" );
1169#endif 1192#endif
1170} 1193}
1171 1194
1172void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) 1195void Launcher::launcherMessage( const QCString &msg, const QByteArray &data)
1173{ 1196{
1174 QDataStream stream( data, IO_ReadOnly ); 1197 QDataStream stream( data, IO_ReadOnly );
1175 if ( msg == "setTabView(QString,int)" ) { 1198 if ( msg == "setTabView(QString,int)" ) {
1176 QString id; 1199 QString id;
1177 stream >> id; 1200 stream >> id;
1178 int mode; 1201 int mode;
1179 stream >> mode; 1202 stream >> mode;
1180 if ( tabs->view(id) ) 1203 if ( tabs->view(id) )
1181 tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); 1204 tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode );
1182 } else if ( msg == "setTabBackground(QString,int,QString)" ) { 1205 } else if ( msg == "setTabBackground(QString,int,QString)" ) {
1183 QString id; 1206 QString id;
1184 stream >> id; 1207 stream >> id;
1185 int mode; 1208 int mode;
1186 stream >> mode; 1209 stream >> mode;
1187 QString pixmapOrColor; 1210 QString pixmapOrColor;
1188 stream >> pixmapOrColor; 1211 stream >> pixmapOrColor;
1189 if ( tabs->view(id) ) 1212 if ( tabs->view(id) )
1190 tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 1213 tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
1191 } else if ( msg == "setTextColor(QString,QString)" ) { 1214 } else if ( msg == "setTextColor(QString,QString)" ) {
1192 QString id; 1215 QString id;
1193 stream >> id; 1216 stream >> id;
1194 QString color; 1217 QString color;
1195 stream >> color; 1218 stream >> color;
1196 if ( tabs->view(id) ) 1219 if ( tabs->view(id) )
1197 tabs->view(id)->setTextColor( QColor(color) ); 1220 tabs->view(id)->setTextColor( QColor(color) );
1198 } else if ( msg == "setFont(QString,QString,int,int,int)" ) { 1221 } else if ( msg == "setFont(QString,QString,int,int,int)" ) {
1199 QString id; 1222 QString id;
1200 stream >> id; 1223 stream >> id;
1201 QString fam; 1224 QString fam;
1202 stream >> fam; 1225 stream >> fam;
1203 int size; 1226 int size;
1204 stream >> size; 1227 stream >> size;
1205 int weight; 1228 int weight;
1206 stream >> weight; 1229 stream >> weight;
1207 int italic; 1230 int italic;
1208 stream >> italic; 1231 stream >> italic;
1209 if ( tabs->view(id) ) 1232 if ( tabs->view(id) )
1210 if ( !fam. isEmpty ( )) 1233 if ( !fam. isEmpty ( ))
1211 tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); 1234 tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
1212 else 1235 else
1213 tabs->view(id)->unsetViewFont(); 1236 tabs->view(id)->unsetViewFont();
1214 qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); 1237 qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic );
1215 } 1238 }
1216 else if ( msg == "setBusyIndicatorType(QString)" ) { 1239 else if ( msg == "setBusyIndicatorType(QString)" ) {
1217 QString type; 1240 QString type;
1218 stream >> type; 1241 stream >> type;
1219 tabs->setBusyIndicatorType(type); 1242 tabs->setBusyIndicatorType(type);
1220 } 1243 }
1221 else if ( msg == "home()" ) { 1244 else if ( msg == "home()" ) {
1222 if ( isVisibleWindow( winId ( ))) 1245 if ( isVisibleWindow( winId ( )))
1223 nextView ( ); 1246 nextView ( );
1224 else 1247 else
1225 raise ( ); 1248 raise ( );
1226 1249
1227 } 1250 }
1228} 1251}
1229 1252
1230void Launcher::storageChanged() 1253void Launcher::storageChanged()
1231{ 1254{
1232 if ( in_lnk_props ) { 1255 if ( in_lnk_props ) {
1233 got_lnk_change = TRUE; 1256 got_lnk_change = TRUE;
1234 lnk_change = QString::null; 1257 lnk_change = QString::null;
1235 } else { 1258 } else {