summaryrefslogtreecommitdiff
path: root/core/launcher/launcher.cpp
authorllornkcor <llornkcor>2003-07-05 15:30:22 (UTC)
committer llornkcor <llornkcor>2003-07-05 15:30:22 (UTC)
commit2f6b0ede633948b44a5ed3ee1ec641395620f076 (patch) (unidiff)
tree1c3d86b2932fe0ae18ce50f72c680949b1b22ee8 /core/launcher/launcher.cpp
parent51cb7e4cd9a7ec7f1bf864884928c61b9f2db3b0 (diff)
downloadopie-2f6b0ede633948b44a5ed3ee1ec641395620f076.zip
opie-2f6b0ede633948b44a5ed3ee1ec641395620f076.tar.gz
opie-2f6b0ede633948b44a5ed3ee1ec641395620f076.tar.bz2
initial new doc tab using ofileselector
Diffstat (limited to 'core/launcher/launcher.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp1188
1 files changed, 612 insertions, 576 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index bcc2495..d9fc8e4 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -24,2 +24,4 @@
24 24
25//#include <opie/ofiledialog.h>
26#include <opie/ofileselector.h>
25#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
@@ -91,3 +93,3 @@ namespace {
91 if(tmpMime ) 93 if(tmpMime )
92 mimes.append("audio/*" ); 94 mimes.append("audio/*" );
93 95
@@ -95,3 +97,3 @@ namespace {
95 if(tmpMime ) 97 if(tmpMime )
96 mimes.append("image/*" ); 98 mimes.append("image/*" );
97 99
@@ -99,3 +101,3 @@ namespace {
99 if(tmpMime ) 101 if(tmpMime )
100 mimes.append("text/*"); 102 mimes.append("text/*");
101 103
@@ -103,3 +105,3 @@ namespace {
103 if(tmpMime ) 105 if(tmpMime )
104 mimes.append("video/*" ); 106 mimes.append("video/*" );
105 } 107 }
@@ -118,3 +120,3 @@ public:
118 CategoryTab( const QIconSet &icon, const QString &text=QString::null ) 120 CategoryTab( const QIconSet &icon, const QString &text=QString::null )
119 : QTab( icon, text ) 121 : QTab( icon, text )
120 { 122 {
@@ -138,5 +140,5 @@ void CategoryTabWidget::prevTab()
138 if ( categoryBar ) { 140 if ( categoryBar ) {
139 int n = categoryBar->count(); 141 int n = categoryBar->count();
140 int tab = categoryBar->currentTab(); 142 int tab = categoryBar->currentTab();
141 if ( tab >= 0 ) 143 if ( tab >= 0 )
142 categoryBar->setCurrentTab( (tab - 1 + n)%n ); 144 categoryBar->setCurrentTab( (tab - 1 + n)%n );
@@ -148,5 +150,5 @@ void CategoryTabWidget::nextTab()
148 if ( categoryBar ) { 150 if ( categoryBar ) {
149 int n = categoryBar->count(); 151 int n = categoryBar->count();
150 int tab = categoryBar->currentTab(); 152 int tab = categoryBar->currentTab();
151 categoryBar->setCurrentTab( (tab + 1)%n ); 153 categoryBar->setCurrentTab( (tab + 1)%n );
152 } 154 }
@@ -158,4 +160,4 @@ void CategoryTabWidget::showTab(const QString& id)
158 if ( categoryBar ) { 160 if ( categoryBar ) {
159 int idx = ids.findIndex( id ); 161 int idx = ids.findIndex( id );
160 categoryBar->setCurrentTab( idx ); 162 categoryBar->setCurrentTab( idx );
161 } 163 }
@@ -165,33 +167,33 @@ void CategoryTabWidget::addItem( const QString& linkfile )
165{ 167{
166 int i=0; 168 int i=0;
167 AppLnk *app = new AppLnk(linkfile); 169 AppLnk *app = new AppLnk(linkfile);
168 if ( !app->isValid() ) { 170 if ( !app->isValid() ) {
169 delete app; 171 delete app;
170 app=0; 172 app=0;
171 } 173 }
172 if ( !app || !app->file().isEmpty() ) { 174 if ( !app || !app->file().isEmpty() ) {
173 // A document 175 // A document
174 delete app; 176 delete app;
175 app = new DocLnk(linkfile); 177 app = new DocLnk(linkfile);
176 if ( app->fileKnown() ) { 178 if ( app->fileKnown() ) {
177 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); 179 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
178 } else { 180 } else {
179 ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); 181 ((LauncherView*)(stack->widget(ids.count()-1)))->sort();
180 delete app; 182 delete app;
181 } 183 }
182 return; 184 return;
183 } 185 }
184 // An application 186 // An application
185 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { 187 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) {
186 if ( !(*it).isEmpty() ) { 188 if ( !(*it).isEmpty() ) {
187 QRegExp tf(*it,FALSE,TRUE); 189 QRegExp tf(*it,FALSE,TRUE);
188 if ( tf.match(app->type()) >= 0 ) { 190 if ( tf.match(app->type()) >= 0 ) {
189 ((LauncherView*)stack->widget(i))->addItem(app); 191 ((LauncherView*)stack->widget(i))->addItem(app);
190 return; 192 return;
191 } 193 }
192 i++; 194 i++;
193 } 195 }
194 } 196 }
195 197
196 QCopEnvelope e("QPE/TaskBar","reloadApps()"); 198 QCopEnvelope e("QPE/TaskBar","reloadApps()");
197} 199}
@@ -199,5 +201,5 @@ void CategoryTabWidget::addItem( const QString& linkfile )
199void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, 201void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
200 AppLnkSet* docFolder, const QList<FileSystem> &fs) 202 AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/)
201{ 203{
202 QString current; 204 QString current;
203 if ( categoryBar ) { 205 if ( categoryBar ) {
@@ -224,6 +226,6 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
224 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 226 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
225 if ( !(*it).isEmpty() ) { 227 if ( !(*it).isEmpty() ) {
226 (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); 228 (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it));
227 setTabAppearance( *it, cfg ); 229 setTabAppearance( *it, cfg );
228 } 230 }
229 } 231 }
@@ -232,14 +234,14 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
232 while ( (l=it.current()) ) { 234 while ( (l=it.current()) ) {
233 if ( l->type() == "Separator" ) { // No tr 235 if ( l->type() == "Separator" ) { // No tr
234 rootFolder->remove(l); 236 rootFolder->remove(l);
235 delete l; 237 delete l;
236 } else { 238 } else {
237 int i=0; 239 int i=0;
238 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 240 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
239 if ( *it == l->type() ) 241 if ( *it == l->type() )
240 ((LauncherView*)stack->widget(i))->addItem(l,FALSE); 242 ((LauncherView*)stack->widget(i))->addItem(l,FALSE);
241 i++; 243 i++;
242 } 244 }
243 } 245 }
244 ++it; 246 ++it;
245 } 247 }
@@ -247,3 +249,3 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
247 for (int i=0; i<tabs; i++) 249 for (int i=0; i<tabs; i++)
248 ((LauncherView*)stack->widget(i))->sort(); 250 ((LauncherView*)stack->widget(i))->sort();
249 251
@@ -253,11 +255,21 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
253 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 255 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
254 docview = newView( "Documents", // No tr
255 pm, tr("Documents"));
256 docview->populate( docFolder, QString::null );
257 docFolder->detachChildren();
258 docview->setFileSystems(fs);
259 docview->setToolsEnabled(TRUE);
260 setTabAppearance( "Documents", cfg ); // No tr
261 256
262 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); 257 //ljpotter
258 CategoryTab *catTab ;
259 catTab = new CategoryTab( pm, "Documents" );
260
261 categoryBar->addTab( catTab );
262
263 fileSel = new DocumentTab( stack, 4, 0, "/","");
264 stack->addWidget( fileSel, tabs++ );
265
266 // fileSel->hide();
267
268 connect( fileSel, SIGNAL( fileSelected( const DocLnk & )),
269 this, SLOT(clickie(const DocLnk&)) );
270
271// connect( fileSel, SIGNAL( fileSelected( const QString & )),
272// this, SLOT(clickie(const QString&)) );
273
274 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) );
263 275
@@ -275,2 +287,3 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
275 287
288
276 QCopEnvelope e("QPE/TaskBar","reloadApps()"); 289 QCopEnvelope e("QPE/TaskBar","reloadApps()");
@@ -278,2 +291,12 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
278 291
292void CategoryTabWidget::clickie(const DocLnk &lnk) {
293 lnk.execute();
294 // fileSel->reparse();
295}
296
297void CategoryTabWidget::clickie(const QString &appStr) {
298// DocLnk lnk(appStr);
299// lnk.execute();
300}
301
279void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) 302void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
@@ -289,10 +312,10 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
289 if ( view == "List" ) // No tr 312 if ( view == "List" ) // No tr
290 v->setViewMode( LauncherView::List ); 313 v->setViewMode( LauncherView::List );
291 QString bgType = cfg.readEntry( "BackgroundType", "Image" ); 314 QString bgType = cfg.readEntry( "BackgroundType", "Image" );
292 if ( bgType == "Image" ) { // No tr 315 if ( bgType == "Image" ) { // No tr
293 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); 316 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" );
294 v->setBackgroundType( LauncherView::Image, pm ); 317 v->setBackgroundType( LauncherView::Image, pm );
295 } else if ( bgType == "SolidColor" ) { 318 } else if ( bgType == "SolidColor" ) {
296 QString c = cfg.readEntry( "BackgroundColor" ); 319 QString c = cfg.readEntry( "BackgroundColor" );
297 v->setBackgroundType( LauncherView::SolidColor, c ); 320 v->setBackgroundType( LauncherView::SolidColor, c );
298 } 321 }
@@ -300,8 +323,8 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
300 if ( textCol.isEmpty() ) 323 if ( textCol.isEmpty() )
301 v->setTextColor( QColor() ); 324 v->setTextColor( QColor() );
302 else 325 else
303 v->setTextColor( QColor(textCol) ); 326 v->setTextColor( QColor(textCol) );
304 QStringList font = cfg.readListEntry( "Font", ',' ); 327 QStringList font = cfg.readListEntry( "Font", ',' );
305 if ( font.count() == 4 ) 328 if ( font.count() == 4 )
306 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); 329 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) );
307 330
@@ -310,19 +333,16 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
310 if ( tabCol.isEmpty() ) 333 if ( tabCol.isEmpty() )
311 tab->bgColor = QColor(); 334 tab->bgColor = QColor();
312 else 335 else
313 tab->bgColor = QColor(tabCol); 336 tab->bgColor = QColor(tabCol);
314 QString tabTextCol = cfg.readEntry( "TabTextColor" ); 337 QString tabTextCol = cfg.readEntry( "TabTextColor" );
315 if ( tabTextCol.isEmpty() ) 338 if ( tabTextCol.isEmpty() )
316 tab->fgColor = QColor(); 339 tab->fgColor = QColor();
317 else 340 else
318 tab->fgColor = QColor(tabTextCol); 341 tab->fgColor = QColor(tabTextCol);
319} 342}
320 343
321void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) 344//void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/)
322{ 345//{
323 docview->populate( docFolder, QString::null ); 346 // docFolder->detachChildren();
324 docFolder->detachChildren(); 347//}
325 docview->setFileSystems(fs);
326 docview->updateTools();
327}
328 348
@@ -337,3 +357,3 @@ void CategoryTabWidget::tabProperties()
337 if ( rv >= 0 && rv != view->viewMode() ) { 357 if ( rv >= 0 && rv != view->viewMode() ) {
338 view->setViewMode( (LauncherView::ViewMode)rv ); 358 view->setViewMode( (LauncherView::ViewMode)rv );
339 } 359 }
@@ -345,3 +365,3 @@ QString CategoryTabWidget::getAllDocLinkInfo() const
345{ 365{
346 return docview->getAllDocLinkInfo(); 366 return "";
347} 367}
@@ -352,5 +372,5 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm,
352 connect( view, SIGNAL(clicked(const AppLnk*)), 372 connect( view, SIGNAL(clicked(const AppLnk*)),
353 this, SIGNAL(clicked(const AppLnk*))); 373 this, SIGNAL(clicked(const AppLnk*)));
354 connect( view, SIGNAL(rightPressed(AppLnk*)), 374 connect( view, SIGNAL(rightPressed(AppLnk*)),
355 this, SIGNAL(rightPressed(AppLnk*))); 375 this, SIGNAL(rightPressed(AppLnk*)));
356 ids.append(id); 376 ids.append(id);
@@ -363,11 +383,10 @@ void CategoryTabWidget::updateLink(const QString& linkfile)
363{ 383{
364 int i=0; 384 // LauncherView* view;
365 LauncherView* view; 385 qApp->processEvents();
366 qApp->processEvents(); 386// while ((view = (LauncherView*)stack->widget(i++))) {
367 while ((view = (LauncherView*)stack->widget(i++))) { 387// if ( view->removeLink(linkfile) )
368 if ( view->removeLink(linkfile) ) 388// break;
369 break; 389// }
370 } 390 // addItem(linkfile);
371 addItem(linkfile); 391 fileSel->reparse();
372 docview->updateTools();
373} 392}
@@ -387,6 +406,6 @@ void CategoryTabWidget::setBusy(bool on)
387 if ( on ) 406 if ( on )
388 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); 407 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE);
389 else 408 else
390 for (int i=0; i<tabs; i++) 409 for (int i=0; i<tabs-1; i++)
391 ((LauncherView*)stack->widget(i))->setBusy(FALSE); 410 ((LauncherView*)stack->widget(i))->setBusy(FALSE);
392} 411}
@@ -401,4 +420,4 @@ void CategoryTabWidget::setBusyIndicatorType ( const QString &type )
401{ 420{
402 for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) 421 for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it )
403 view ( *it )-> setBusyIndicatorType ( type ); 422 view ( *it )-> setBusyIndicatorType ( type );
404} 423}
@@ -421,3 +440,3 @@ void CategoryTabBar::layoutTabs()
421 if ( !count() ) 440 if ( !count() )
422 return; 441 return;
423 442
@@ -437,68 +456,68 @@ void CategoryTabBar::layoutTabs()
437 for ( int i = 0; i < count(); i++ ) { 456 for ( int i = 0; i < count(); i++ ) {
438 t = tab(i); 457 t = tab(i);
439 int iw = fm.width( t->text() ) + hframe - overlap; 458 int iw = fm.width( t->text() ) + hframe - overlap;
440 if ( i != middleTab ) { 459 if ( i != middleTab ) {
441 available -= hiddenTabWidth + hframe - overlap; 460 available -= hiddenTabWidth + hframe - overlap;
442 if ( t->iconSet() != 0 ) 461 if ( t->iconSet() != 0 )
443 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 462 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
444 } 463 }
445 if ( t->iconSet() != 0 ) 464 if ( t->iconSet() != 0 )
446 iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 465 iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
447 required += iw; 466 required += iw;
448 // As space gets tight, packed looks better than even. "10" must be at least 0. 467 // As space gets tight, packed looks better than even. "10" must be at least 0.
449 if ( iw >= eventabwidth-10 ) 468 if ( iw >= eventabwidth-10 )
450 mode = Pack; 469 mode = Pack;
451 } 470 }
452 if ( mode == Pack && required > width()-1 ) 471 if ( mode == Pack && required > width()-1 )
453 mode = HideBackText; 472 mode = HideBackText;
454 for ( int i = 0; i < count(); i++ ) { 473 for ( int i = 0; i < count(); i++ ) {
455 t = tab(i); 474 t = tab(i);
456 if ( mode != HideBackText ) { 475 if ( mode != HideBackText ) {
457 int w = fm.width( t->text() ); 476 int w = fm.width( t->text() );
458 int ih = 0; 477 int ih = 0;
459 if ( t->iconSet() != 0 ) { 478 if ( t->iconSet() != 0 ) {
460 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 479 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
461 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 480 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
462 } 481 }
463 int h = QMAX( fm.height(), ih ); 482 int h = QMAX( fm.height(), ih );
464 h = QMAX( h, QApplication::globalStrut().height() ); 483 h = QMAX( h, QApplication::globalStrut().height() );
465 484
466 h += vframe; 485 h += vframe;
467 w += hframe; 486 w += hframe;
468 487
469 QRect tr(x, 0, 488 QRect tr(x, 0,
470 mode == Even ? eventabwidth : w * (width()-1)/required, h); 489 mode == Even ? eventabwidth : w * (width()-1)/required, h);
471 t->setRect(tr); 490 t->setRect(tr);
472 x += tr.width() - overlap; 491 x += tr.width() - overlap;
473 r = r.unite(tr); 492 r = r.unite(tr);
474 } else if ( i != middleTab ) { 493 } else if ( i != middleTab ) {
475 int w = hiddenTabWidth; 494 int w = hiddenTabWidth;
476 int ih = 0; 495 int ih = 0;
477 if ( t->iconSet() != 0 ) { 496 if ( t->iconSet() != 0 ) {
478 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 497 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
479 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 498 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
480 } 499 }
481 int h = QMAX( fm.height(), ih ); 500 int h = QMAX( fm.height(), ih );
482 h = QMAX( h, QApplication::globalStrut().height() ); 501 h = QMAX( h, QApplication::globalStrut().height() );
483 502
484 h += vframe; 503 h += vframe;
485 w += hframe; 504 w += hframe;
486 505
487 t->setRect( QRect(x, 0, w, h) ); 506 t->setRect( QRect(x, 0, w, h) );
488 x += t->rect().width() - overlap; 507 x += t->rect().width() - overlap;
489 r = r.unite( t->rect() ); 508 r = r.unite( t->rect() );
490 } else { 509 } else {
491 int ih = 0; 510 int ih = 0;
492 if ( t->iconSet() != 0 ) { 511 if ( t->iconSet() != 0 ) {
493 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 512 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
494 } 513 }
495 int h = QMAX( fm.height(), ih ); 514 int h = QMAX( fm.height(), ih );
496 h = QMAX( h, QApplication::globalStrut().height() ); 515 h = QMAX( h, QApplication::globalStrut().height() );
497 516
498 h += vframe; 517 h += vframe;
499 518
500 t->setRect( QRect(x, 0, available, h) ); 519 t->setRect( QRect(x, 0, available, h) );
501 x += t->rect().width() - overlap; 520 x += t->rect().width() - overlap;
502 r = r.unite( t->rect() ); 521 r = r.unite( t->rect() );
503 } 522 }
504 } 523 }
@@ -526,9 +545,9 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
526 if ( ct->bgColor.isValid() ) { 545 if ( ct->bgColor.isValid() ) {
527 pal.setColor( QPalette::Active, QColorGroup::Background, ct->bgColor ); 546 pal.setColor( QPalette::Active, QColorGroup::Background, ct->bgColor );
528 pal.setColor( QPalette::Active, QColorGroup::Button, ct->bgColor ); 547 pal.setColor( QPalette::Active, QColorGroup::Button, ct->bgColor );
529 pal.setColor( QPalette::Inactive, QColorGroup::Background, ct->bgColor ); 548 pal.setColor( QPalette::Inactive, QColorGroup::Background, ct->bgColor );
530 pal.setColor( QPalette::Inactive, QColorGroup::Button, ct->bgColor ); 549 pal.setColor( QPalette::Inactive, QColorGroup::Button, ct->bgColor );
531 that->setUpdatesEnabled( FALSE ); 550 that->setUpdatesEnabled( FALSE );
532 that->setPalette( pal ); 551 that->setPalette( pal );
533 setPal = TRUE; 552 setPal = TRUE;
534 } 553 }
@@ -547,3 +566,3 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
547 if ( selected ) 566 if ( selected )
548 f.setBold( TRUE ); 567 f.setBold( TRUE );
549 p->setFont( f ); 568 p->setFont( f );
@@ -551,7 +570,7 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
551 if ( ct->fgColor.isValid() ) { 570 if ( ct->fgColor.isValid() ) {
552 pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor ); 571 pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor );
553 pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor ); 572 pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor );
554 that->setUpdatesEnabled( FALSE ); 573 that->setUpdatesEnabled( FALSE );
555 that->setPalette( pal ); 574 that->setPalette( pal );
556 setPal = TRUE; 575 setPal = TRUE;
557 } 576 }
@@ -560,4 +579,4 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
560 if ( t->iconSet() != 0 ) { 579 if ( t->iconSet() != 0 ) {
561 iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; 580 iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2;
562 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 581 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
563 } 582 }
@@ -566,12 +585,12 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
566 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, 585 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3,
567 r.top() + (r.height()-h)/2, w, h ), t, 586 r.top() + (r.height()-h)/2, w, h ), t,
568#if QT_VERSION >= 300 587#if QT_VERSION >= 300
569 t->identifier() == keyboardFocusTab() 588 t->identifier() == keyboardFocusTab()
570#else 589#else
571 t->identitifer() == keyboardFocusTab() 590 t->identitifer() == keyboardFocusTab()
572#endif 591#endif
573 ); 592 );
574 if ( setPal ) { 593 if ( setPal ) {
575 that->unsetPalette(); 594 that->unsetPalette();
576 that->setUpdatesEnabled( TRUE ); 595 that->setUpdatesEnabled( TRUE );
577 } 596 }
@@ -581,3 +600,3 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
581void CategoryTabBar::paintLabel( QPainter* p, const QRect&, 600void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
582 QTab* t, bool has_focus ) const 601 QTab* t, bool has_focus ) const
583{ 602{
@@ -588,11 +607,11 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
588 if ( t->iconSet() ) { 607 if ( t->iconSet() ) {
589 // the tab has an iconset, draw it in the right mode 608 // the tab has an iconset, draw it in the right mode
590 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; 609 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
591 if ( mode == QIconSet::Normal && has_focus ) 610 if ( mode == QIconSet::Normal && has_focus )
592 mode = QIconSet::Active; 611 mode = QIconSet::Active;
593 QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); 612 QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode );
594 int pixw = pixmap.width(); 613 int pixw = pixmap.width();
595 int pixh = pixmap.height(); 614 int pixh = pixmap.height();
596 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); 615 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap );
597 r.setLeft( r.left() + pixw + 5 ); 616 r.setLeft( r.left() + pixw + 5 );
598 } 617 }
@@ -602,3 +621,3 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
602 if ( r.width() < 20 ) 621 if ( r.width() < 20 )
603 return; 622 return;
604 623
@@ -606,13 +625,13 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
606#if defined(_WS_WIN32_) 625#if defined(_WS_WIN32_)
607 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) 626 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) )
608 p->setPen( colorGroup().buttonText() ); 627 p->setPen( colorGroup().buttonText() );
609 else 628 else
610 p->setPen( colorGroup().foreground() ); 629 p->setPen( colorGroup().foreground() );
611#else 630#else
612 p->setPen( colorGroup().foreground() ); 631 p->setPen( colorGroup().foreground() );
613#endif 632#endif
614 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); 633 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
615 } else { 634 } else {
616 p->setPen( palette().disabled().foreground() ); 635 p->setPen( palette().disabled().foreground() );
617 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); 636 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
618 } 637 }
@@ -644,7 +663,8 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
644 connect( tabs, SIGNAL(selected(const QString&)), 663 connect( tabs, SIGNAL(selected(const QString&)),
645 this, SLOT(viewSelected(const QString&)) ); 664 this, SLOT(viewSelected(const QString&)) );
646 connect( tabs, SIGNAL(clicked(const AppLnk*)), 665 connect( tabs, SIGNAL(clicked(const AppLnk*)),
647 this, SLOT(select(const AppLnk*))); 666 this, SLOT(select(const AppLnk*)));
648 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 667 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
649 this, SLOT(properties(AppLnk*))); 668 this, SLOT(properties(AppLnk*)));
669
650 670
@@ -682,4 +702,4 @@ static bool isVisibleWindow(int wid)
682 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 702 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
683 if ( w->winId() == wid ) 703 if ( w->winId() == wid )
684 return !w->isFullyObscured(); 704 return !w->isFullyObscured();
685 } 705 }
@@ -692,5 +712,5 @@ void Launcher::showMaximized()
692 if ( isVisibleWindow( winId() ) ) 712 if ( isVisibleWindow( winId() ) )
693 doMaximize(); 713 doMaximize();
694 else 714 else
695 QTimer::singleShot( 20, this, SLOT(doMaximize()) ); 715 QTimer::singleShot( 20, this, SLOT(doMaximize()) );
696} 716}
@@ -712,8 +732,8 @@ void Launcher::updateMimeTypes(AppLnkSet* folder)
712 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { 732 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) {
713 AppLnk *app = it.current(); 733 AppLnk *app = it.current();
714 if ( app->type() == "Folder" ) // No tr 734 if ( app->type() == "Folder" ) // No tr
715 updateMimeTypes((AppLnkSet *)app); 735 updateMimeTypes((AppLnkSet *)app);
716 else { 736 else {
717 MimeType::registerApp(*app); 737 MimeType::registerApp(*app);
718 } 738 }
719 } 739 }
@@ -734,113 +754,114 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
734{ 754{
735 755 OWait *owait = new OWait();
736 OWait *owait = new OWait(); 756 Global::statusMessage( tr( "Finding documents" ) );
737 Global::statusMessage( tr( "Finding documents" ) ); 757
738 758 owait->show();
739 owait->show(); 759 qApp->processEvents();
740 qApp->processEvents(); 760 if(docsFolder) delete docsFolder;
741 761 docsFolder = new DocLnkSet;
742 delete docsFolder; 762 DocLnkSet *tmp = 0;
743 docsFolder = new DocLnkSet; 763 QString home = QString(getenv("HOME")) + "/Documents";
744 764 tmp = new DocLnkSet( home , QString::null);
745 DocLnkSet *tmp = 0; 765 docsFolder->appendFrom( *tmp );
746 QString home = QString(getenv("HOME")) + "/Documents"; 766 delete tmp;
747 tmp = new DocLnkSet( home , QString::null); 767
748 docsFolder->appendFrom( *tmp ); 768 // RAM documents
749 delete tmp; 769 StorageInfo storage;
750 770 const QList<FileSystem> &fileSystems = storage.fileSystems();
751 // RAM documents 771 QListIterator<FileSystem> it ( fileSystems );
752 StorageInfo storage; 772
753 const QList<FileSystem> &fileSystems = storage.fileSystems(); 773 for ( ; it.current(); ++it ) {
754 QListIterator<FileSystem> it ( fileSystems ); 774 if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) {
755 775 tmp = new DocLnkSet( (*it)->path(), QString::null );
756 for ( ; it.current(); ++it ) { 776 docsFolder->appendFrom( *tmp );
757 if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { 777 delete tmp;
758 tmp = new DocLnkSet( (*it)->path(), QString::null ); 778 }
759 docsFolder->appendFrom( *tmp ); 779 }
760 delete tmp; 780
761 } 781 Config mediumCfg( "medium");
762 } 782 mediumCfg.setGroup("main");
763 783 // a) -zecke we don't want to check
764 Config mediumCfg( "medium"); 784 if(!mediumCfg.readBoolEntry("use", true ) ) {
765 mediumCfg.setGroup("main"); 785 owait->hide();
766 // a) -zecke we don't want to check 786 delete owait;
767 if(!mediumCfg.readBoolEntry("use", true ) )
768 return; 787 return;
788 }
789 // find out wich filesystems are new in this round
790 // We will do this by having a timestamp inside each mountpoint
791 // if the current timestamp doesn't match this is a new file system and
792 // come up with our MediumMountGui :) let the hacking begin
793 int stamp = uidgen.generate();
769 794
770 // find out wich filesystems are new in this round 795 QString newStamp = QString::number( stamp ); // generates newtime Stamp
771 // We will do this by having a timestamp inside each mountpoint
772 // if the current timestamp doesn't match this is a new file system and
773 // come up with our MediumMountGui :) let the hacking begin
774 int stamp = uidgen.generate();
775 796
776 QString newStamp = QString::number( stamp ); // generates newtime Stamp 797 // b)
777 798 if( mediumCfg.readBoolEntry("global", true ) ){
778 // b)
779 if( mediumCfg.readBoolEntry("global", true ) ){
780 QString mime = configToMime(&mediumCfg).join(";"); 799 QString mime = configToMime(&mediumCfg).join(";");
781 for( it.toFirst(); it.current(); ++it ){ 800 for( it.toFirst(); it.current(); ++it ){
782 if( (*it)->isRemovable() ){ 801 if( (*it)->isRemovable() ){
783 tmp = new DocLnkSet( (*it)->path(), mime ); 802 tmp = new DocLnkSet( (*it)->path(), mime );
784 docsFolder->appendFrom( *tmp ); 803 docsFolder->appendFrom( *tmp );
785 delete tmp; 804 delete tmp;
786 } 805 }
787 } // done 806 } // done
807 owait->hide();
808 delete owait;
788 return; // save the else 809 return; // save the else
789 } 810 }
790 // c) zecke 811 // c) zecke
791 for ( it.toFirst(); it.current(); ++it ) { 812 for ( it.toFirst(); it.current(); ++it ) {
792 if ( (*it)->isRemovable() ) { // let's find out if we should search on it 813 if ( (*it)->isRemovable() ) { // let's find out if we should search on it
793 Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); 814 Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File);
794 cfg.setGroup("main"); 815 cfg.setGroup("main");
795 QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); 816 QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() );
796 /** This medium is uptodate 817 /** This medium is uptodate
797 */ 818 */
798 if( stamp == m_timeStamp ){ // ok we know this card 819 if( stamp == m_timeStamp ){ // ok we know this card
799 cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp 820 cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp
800 // we need to scan the list now. Hopefully the cache will be there 821 // we need to scan the list now. Hopefully the cache will be there
801 // read the mimetypes from the config and search for documents 822 // read the mimetypes from the config and search for documents
802 QStringList mimetypes = configToMime( &cfg); 823 QStringList mimetypes = configToMime( &cfg);
803 //qApp->processEvents(); 824 //qApp->processEvents();
825 Global::statusMessage( tr( "Searching documents" ) );
826 tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") );
827 docsFolder->appendFrom( *tmp );
828 delete tmp;
829
830 } else { // come up with the gui cause this a new card
831 MediumMountGui medium(&cfg, (*it)->path() );
832 if( medium.check() ){ // we did not ask before or ask again is off
833 /** c2) */
834 if( medium.exec() ){ // he clicked yes so search it
835 // speicher
836 //cfg.read(); // cause of a race we need to reread - fixed
837 cfg.setGroup("main");
838 cfg.writeEntry("timestamp", newStamp );
839 cfg.write();
840
841 //qApp->processEvents();
842 tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) );
843 docsFolder->appendFrom( *tmp );
844 delete tmp;
845 }// no else
846 /** c1) */
847 } else { // we checked
848 // do something different see what we need to do
849 // let's see if we should check the device
850 cfg.setGroup("main" );
851 bool check = cfg.readBoolEntry("autocheck", true );
852 if( check ){ // find the documents
853
854 //qApp->processEvents();
804 Global::statusMessage( tr( "Searching documents" ) ); 855 Global::statusMessage( tr( "Searching documents" ) );
805 tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); 856 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") );
806 docsFolder->appendFrom( *tmp ); 857 docsFolder->appendFrom( *tmp );
807 delete tmp; 858 delete tmp;
808 859 }
809 }else{ // come up with the gui cause this a new card 860 }
810 MediumMountGui medium(&cfg, (*it)->path() ); 861 }
811 if( medium.check() ){ // we did not ask before or ask again is off 862 }
812 /** c2) */ 863 }
813 if( medium.exec() ){ // he clicked yes so search it 864 m_timeStamp = newStamp;
814 // speicher 865 owait->hide();
815 //cfg.read(); // cause of a race we need to reread - fixed 866 delete owait;
816 cfg.setGroup("main");
817 cfg.writeEntry("timestamp", newStamp );
818 cfg.write();
819
820 //qApp->processEvents();
821 tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) );
822 docsFolder->appendFrom( *tmp );
823 delete tmp;
824 }// no else
825 /** c1) */
826 }else{ // we checked
827 // do something different see what we need to do
828 // let's see if we should check the device
829 cfg.setGroup("main" );
830 bool check = cfg.readBoolEntry("autocheck", true );
831 if( check ){ // find the documents
832
833 //qApp->processEvents();
834 Global::statusMessage( tr( "Searching documents" ) );
835 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") );
836 docsFolder->appendFrom( *tmp );
837 delete tmp;
838 }
839 }
840 }
841 }
842 }
843 m_timeStamp = newStamp;
844 owait->hide();
845 delete owait;
846} 867}
@@ -850,3 +871,2 @@ void Launcher::updateTabs()
850 MimeType::updateApplications(); // ### reads all applnks twice 871 MimeType::updateApplications(); // ### reads all applnks twice
851
852 delete rootFolder; 872 delete rootFolder;
@@ -861,4 +881,4 @@ void Launcher::updateDocs()
861{ 881{
862 loadDocs(); 882 loadDocs();
863 tabs->updateDocs(docsFolder,storage->fileSystems()); 883 // tabs->updateDocs(docsFolder,storage->fileSystems());
864} 884}
@@ -884,13 +904,13 @@ void Launcher::select( const AppLnk *appLnk )
884 if ( appLnk->type() == "Folder" ) { // No tr 904 if ( appLnk->type() == "Folder" ) { // No tr
885 // Not supported: flat is simpler for the user 905 // Not supported: flat is simpler for the user
886 } else { 906 } else {
887 if ( appLnk->exec().isNull() ) { 907 if ( appLnk->exec().isNull() ) {
888 QMessageBox::information(this,tr("No application"), 908 QMessageBox::information(this,tr("No application"),
889 tr("<p>No application is defined for this document." 909 tr("<p>No application is defined for this document."
890 "<p>Type is %1.").arg(appLnk->type())); 910 "<p>Type is %1.").arg(appLnk->type()));
891 return; 911 return;
892 } 912 }
893 tabs->setBusy(TRUE); 913 tabs->setBusy(TRUE);
894 emit executing( appLnk ); 914 emit executing( appLnk );
895 appLnk->execute(); 915 appLnk->execute();
896 } 916 }
@@ -907,14 +927,14 @@ void Launcher::properties( AppLnk *appLnk )
907 if ( appLnk->type() == "Folder" ) { // No tr 927 if ( appLnk->type() == "Folder" ) { // No tr
908 // Not supported: flat is simpler for the user 928 // Not supported: flat is simpler for the user
909 } else { 929 } else {
910 in_lnk_props = TRUE; 930 in_lnk_props = TRUE;
911 got_lnk_change = FALSE; 931 got_lnk_change = FALSE;
912 LnkProperties prop(appLnk); 932 LnkProperties prop(appLnk);
913 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 933 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
914 prop.showMaximized(); 934 prop.showMaximized();
915 prop.exec(); 935 prop.exec();
916 in_lnk_props = FALSE; 936 in_lnk_props = FALSE;
917 if ( got_lnk_change ) { 937 if ( got_lnk_change ) {
918 updateLink(lnk_change); 938 updateLink(lnk_change);
919 } 939 }
920 } 940 }
@@ -927,11 +947,11 @@ void Launcher::updateLink(const QString& link)
927 if (link.isNull()) { 947 if (link.isNull()) {
928 updateTabs(); 948 updateTabs();
929 notify_sm = true; 949 notify_sm = true;
930 } 950 }
931 else if (link.isEmpty()) { 951 else if (link.isEmpty()) {
932 updateDocs(); 952 updateDocs();
933 } 953 }
934 else { 954 else {
935 tabs->updateLink(link); 955 tabs->updateLink(link);
936 notify_sm = true; 956 notify_sm = true;
937 } 957 }
@@ -939,3 +959,3 @@ void Launcher::updateLink(const QString& link)
939 if ( notify_sm ) 959 if ( notify_sm )
940 QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" ); 960 QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" );
941} 961}
@@ -944,59 +964,59 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
944{ 964{
945 QDataStream stream( data, IO_ReadOnly ); 965 QDataStream stream( data, IO_ReadOnly );
946 if ( msg == "linkChanged(QString)" ) { 966 if ( msg == "linkChanged(QString)" ) {
947 QString link; 967 QString link;
948 stream >> link; 968 stream >> link;
949 if ( in_lnk_props ) { 969 if ( in_lnk_props ) {
950 got_lnk_change = TRUE; 970 got_lnk_change = TRUE;
951 lnk_change = link; 971 lnk_change = link;
952 } else { 972 } else {
953 updateLink(link); 973 updateLink(link);
954 } 974 }
955 } else if ( msg == "busy()" ) { 975 } else if ( msg == "busy()" ) {
956 emit busy(); 976 emit busy();
957 } else if ( msg == "notBusy(QString)" ) { 977 } else if ( msg == "notBusy(QString)" ) {
958 QString app; 978 QString app;
959 stream >> app; 979 stream >> app;
960 tabs->setBusy(FALSE); 980 tabs->setBusy(FALSE);
961 emit notBusy(app); 981 emit notBusy(app);
962 } else if ( msg == "mkdir(QString)" ) { 982 } else if ( msg == "mkdir(QString)" ) {
963 QString dir; 983 QString dir;
964 stream >> dir; 984 stream >> dir;
965 if ( !dir.isEmpty() ) 985 if ( !dir.isEmpty() )
966 mkdir( dir ); 986 mkdir( dir );
967 } else if ( msg == "rdiffGenSig(QString,QString)" ) { 987 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
968 QString baseFile, sigFile; 988 QString baseFile, sigFile;
969 stream >> baseFile >> sigFile; 989 stream >> baseFile >> sigFile;
970 QRsync::generateSignature( baseFile, sigFile ); 990 QRsync::generateSignature( baseFile, sigFile );
971 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { 991 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
972 QString baseFile, sigFile, deltaFile; 992 QString baseFile, sigFile, deltaFile;
973 stream >> baseFile >> sigFile >> deltaFile; 993 stream >> baseFile >> sigFile >> deltaFile;
974 QRsync::generateDiff( baseFile, sigFile, deltaFile ); 994 QRsync::generateDiff( baseFile, sigFile, deltaFile );
975 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { 995 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
976 QString baseFile, deltaFile; 996 QString baseFile, deltaFile;
977 stream >> baseFile >> deltaFile; 997 stream >> baseFile >> deltaFile;
978 if ( !QFile::exists( baseFile ) ) { 998 if ( !QFile::exists( baseFile ) ) {
979 QFile f( baseFile ); 999 QFile f( baseFile );
980 f.open( IO_WriteOnly ); 1000 f.open( IO_WriteOnly );
981 f.close(); 1001 f.close();
982 } 1002 }
983 QRsync::applyDiff( baseFile, deltaFile ); 1003 QRsync::applyDiff( baseFile, deltaFile );
984#ifndef QT_NO_COP 1004#ifndef QT_NO_COP
985 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); 1005 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
986 e << baseFile; 1006 e << baseFile;
987#endif 1007#endif
988 } else if ( msg == "rdiffCleanup()" ) { 1008 } else if ( msg == "rdiffCleanup()" ) {
989 mkdir( "/tmp/rdiff" ); 1009 mkdir( "/tmp/rdiff" );
990 QDir dir; 1010 QDir dir;
991 dir.setPath( "/tmp/rdiff" ); 1011 dir.setPath( "/tmp/rdiff" );
992 QStringList entries = dir.entryList(); 1012 QStringList entries = dir.entryList();
993 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) 1013 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
994 dir.remove( *it ); 1014 dir.remove( *it );
995 } else if ( msg == "sendHandshakeInfo()" ) { 1015 } else if ( msg == "sendHandshakeInfo()" ) {
996 QString home = getenv( "HOME" ); 1016 QString home = getenv( "HOME" );
997#ifndef QT_NO_COP 1017#ifndef QT_NO_COP
998 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); 1018 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
999 e << home; 1019 e << home;
1000 int locked = (int) Desktop::screenLocked(); 1020 int locked = (int) Desktop::screenLocked();
1001 e << locked; 1021 e << locked;
1002#endif 1022#endif
@@ -1052,75 +1072,75 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
1052 else if ( msg == "sendVersionInfo()" ) { 1072 else if ( msg == "sendVersionInfo()" ) {
1053 QCopEnvelope e( "QPE/Desktop", "versionInfo(QString)" ); 1073 QCopEnvelope e( "QPE/Desktop", "versionInfo(QString)" );
1054 QString v2 = QString::fromLatin1("1.4"); 1074 QString v2 = QString::fromLatin1("1.4");
1055 e << v2; 1075 e << v2;
1056 //qDebug("version %s\n", line.latin1()); 1076 //qDebug("version %s\n", line.latin1());
1057 } else if ( msg == "sendCardInfo()" ) { 1077 } else if ( msg == "sendCardInfo()" ) {
1058#ifndef QT_NO_COP 1078#ifndef QT_NO_COP
1059 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); 1079 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
1060#endif 1080#endif
1061 const QList<FileSystem> &fs = storage->fileSystems(); 1081 const QList<FileSystem> &fs = storage->fileSystems();
1062 QListIterator<FileSystem> it ( fs ); 1082 QListIterator<FileSystem> it ( fs );
1063 QString s; 1083 QString s;
1064 QString homeDir = getenv("HOME"); 1084 QString homeDir = getenv("HOME");
1065 QString hardDiskHome, hardDiskHomePath; 1085 QString hardDiskHome, hardDiskHomePath;
1066 for ( ; it.current(); ++it ) { 1086 for ( ; it.current(); ++it ) {
1067 int k4 = (*it)->blockSize()/256; 1087 int k4 = (*it)->blockSize()/256;
1068 if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs") { 1088 if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs") {
1069 s += (*it)->name() + "=" + (*it)->path() + "/Documents " 1089 s += (*it)->name() + "=" + (*it)->path() + "/Documents "
1070 + QString::number( (*it)->availBlocks() * k4/4 ) 1090 + QString::number( (*it)->availBlocks() * k4/4 )
1071 + "K " + (*it)->options() + ";"; 1091 + "K " + (*it)->options() + ";";
1072 } else if ( (*it)->disk() == "/dev/mtdblock1" || 1092 } else if ( (*it)->disk() == "/dev/mtdblock1" ||
1073 (*it)->disk() == "/dev/mtdblock/1" ) { 1093 (*it)->disk() == "/dev/mtdblock/1" ) {
1074 s += (*it)->name() + "=" + homeDir + "/Documents " 1094 s += (*it)->name() + "=" + homeDir + "/Documents "
1075 + QString::number( (*it)->availBlocks() * k4/4 ) 1095 + QString::number( (*it)->availBlocks() * k4/4 )
1076 + "K " + (*it)->options() + ";"; 1096 + "K " + (*it)->options() + ";";
1077 } else if ( (*it)->name().contains( "Hard Disk") && 1097 } else if ( (*it)->name().contains( "Hard Disk") &&
1078 homeDir.contains( (*it)->path() ) && 1098 homeDir.contains( (*it)->path() ) &&
1079 (*it)->path().length() > hardDiskHomePath.length() ) { 1099 (*it)->path().length() > hardDiskHomePath.length() ) {
1080 hardDiskHomePath = (*it)->path(); 1100 hardDiskHomePath = (*it)->path();
1081 hardDiskHome = 1101 hardDiskHome =
1082 (*it)->name() + "=" + homeDir + "/Documents " 1102 (*it)->name() + "=" + homeDir + "/Documents "
1083 + QString::number( (*it)->availBlocks() * k4/4 ) 1103 + QString::number( (*it)->availBlocks() * k4/4 )
1084 + "K " + (*it)->options() + ";"; 1104 + "K " + (*it)->options() + ";";
1085 } 1105 }
1086 } 1106 }
1087 if ( !hardDiskHome.isEmpty() ) 1107 if ( !hardDiskHome.isEmpty() )
1088 s += hardDiskHome; 1108 s += hardDiskHome;
1089 1109
1090#ifndef QT_NO_COP 1110#ifndef QT_NO_COP
1091 e << s; 1111 e << s;
1092#endif 1112#endif
1093 } else if ( msg == "sendSyncDate(QString)" ) { 1113 } else if ( msg == "sendSyncDate(QString)" ) {
1094 QString app; 1114 QString app;
1095 stream >> app; 1115 stream >> app;
1096 Config cfg( "qpe" ); 1116 Config cfg( "qpe" );
1097 cfg.setGroup("SyncDate"); 1117 cfg.setGroup("SyncDate");
1098#ifndef QT_NO_COP 1118#ifndef QT_NO_COP
1099 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); 1119 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" );
1100 e << app << cfg.readEntry( app ); 1120 e << app << cfg.readEntry( app );
1101#endif 1121#endif
1102 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), 1122 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(),
1103 //cfg.readEntry( app ).latin1() ); 1123 //cfg.readEntry( app ).latin1() );
1104 } else if ( msg == "setSyncDate(QString,QString)" ) { 1124 } else if ( msg == "setSyncDate(QString,QString)" ) {
1105 QString app, date; 1125 QString app, date;
1106 stream >> app >> date; 1126 stream >> app >> date;
1107 Config cfg( "qpe" ); 1127 Config cfg( "qpe" );
1108 cfg.setGroup("SyncDate"); 1128 cfg.setGroup("SyncDate");
1109 cfg.writeEntry( app, date ); 1129 cfg.writeEntry( app, date );
1110 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); 1130 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1());
1111 } else if ( msg == "startSync(QString)" ) { 1131 } else if ( msg == "startSync(QString)" ) {
1112 QString what; 1132 QString what;
1113 stream >> what; 1133 stream >> what;
1114 delete syncDialog; syncDialog = 0; 1134 delete syncDialog; syncDialog = 0;
1115 syncDialog = new SyncDialog( this, "syncProgress", FALSE, 1135 syncDialog = new SyncDialog( this, "syncProgress", FALSE,
1116 WStyle_Tool | WStyle_Customize | 1136 WStyle_Tool | WStyle_Customize |
1117 Qt::WStyle_StaysOnTop ); 1137 Qt::WStyle_StaysOnTop );
1118 syncDialog->showMaximized(); 1138 syncDialog->showMaximized();
1119 syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); 1139 syncDialog->whatLabel->setText( "<b>" + what + "</b>" );
1120 connect( syncDialog->buttonCancel, SIGNAL( clicked() ), 1140 connect( syncDialog->buttonCancel, SIGNAL( clicked() ),
1121 SLOT( cancelSync() ) ); 1141 SLOT( cancelSync() ) );
1122 } else if ( msg == "stopSync()") { 1142 } else if ( msg == "stopSync()") {
1123 delete syncDialog; syncDialog = 0; 1143 delete syncDialog; syncDialog = 0;
1124 } else if ( msg == "getAllDocLinks()" ) { 1144 } else if ( msg == "getAllDocLinks()" ) {
1125 loadDocs(); 1145 loadDocs();
1126 1146
@@ -1131,54 +1151,54 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
1131 1151
1132 //Categories cats; 1152// Categories cats;
1133 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { 1153 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) {
1134 DocLnk *doc = it.current(); 1154 DocLnk *doc = it.current();
1135 QFileInfo fi( doc->file() ); 1155 QFileInfo fi( doc->file() );
1136 if ( !fi.exists() ) 1156 if ( !fi.exists() )
1137 continue; 1157 continue;
1138 1158
1139 bool fake = !doc->linkFileKnown(); 1159 bool fake = !doc->linkFileKnown();
1140 if ( !fake ) { 1160 if ( !fake ) {
1141 QFile f( doc->linkFile() ); 1161 QFile f( doc->linkFile() );
1142 if ( f.open( IO_ReadOnly ) ) { 1162 if ( f.open( IO_ReadOnly ) ) {
1143 QTextStream ts( &f ); 1163 QTextStream ts( &f );
1144 ts.setEncoding( QTextStream::UnicodeUTF8 ); 1164 ts.setEncoding( QTextStream::UnicodeUTF8 );
1145 contents += ts.read(); 1165 contents += ts.read();
1146 f.close(); 1166 f.close();
1147 } else 1167 } else
1148 fake = TRUE; 1168 fake = TRUE;
1149 } 1169 }
1150 if (fake) { 1170 if (fake) {
1151 contents += "[Desktop Entry]\n"; 1171 contents += "[Desktop Entry]\n";
1152 contents += "Categories = " + // No tr 1172 contents += "Categories = " + // No tr
1153 // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr 1173// cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
1154 Qtopia::Record::idsToString( doc->categories() ) + "\n"; 1174 Qtopia::Record::idsToString( doc->categories() ) + "\n";
1155 contents += "Name = "+doc->name()+"\n"; // No tr 1175 contents += "Name = "+doc->name()+"\n"; // No tr
1156 contents += "Type = "+doc->type()+"\n"; // No tr 1176 contents += "Type = "+doc->type()+"\n"; // No tr
1157 } 1177 }
1158 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) 1178 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
1159 contents += QString("Size = %1\n").arg( fi.size() ); // No tr 1179 contents += QString("Size = %1\n").arg( fi.size() ); // No tr
1160 } 1180 }
1161 1181
1162 //qDebug( "sending length %d", contents.length() ); 1182 //qDebug( "sending length %d", contents.length() );
1163#ifndef QT_NO_COP 1183#ifndef QT_NO_COP
1164 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); 1184 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
1165 e << contents; 1185 e << contents;
1166#endif 1186#endif
1167 1187
1168 //qDebug( "================ \n\n%s\n\n===============", 1188 //qDebug( "================ \n\n%s\n\n===============",
1169 //contents.latin1() ); 1189 //contents.latin1() );
1170 1190
1171 delete docsFolder; 1191 delete docsFolder;
1172 docsFolder = 0; 1192 docsFolder = 0;
1173#ifdef QWS 1193#ifdef QWS
1174 } else if ( msg == "setMouseProto(QString)" ) { 1194 } else if ( msg == "setMouseProto(QString)" ) {
1175 QString mice; 1195 QString mice;
1176 stream >> mice; 1196 stream >> mice;
1177 setenv("QWS_MOUSE_PROTO",mice.latin1(),1); 1197 setenv("QWS_MOUSE_PROTO",mice.latin1(),1);
1178 qwsServer->openMouse(); 1198 qwsServer->openMouse();
1179 } else if ( msg == "setKeyboard(QString)" ) { 1199 } else if ( msg == "setKeyboard(QString)" ) {
1180 QString kb; 1200 QString kb;
1181 stream >> kb; 1201 stream >> kb;
1182 setenv("QWS_KEYBOARD",kb.latin1(),1); 1202 setenv("QWS_KEYBOARD",kb.latin1(),1);
1183 qwsServer->openKeyboard(); 1203 qwsServer->openKeyboard();
1184#endif 1204#endif
@@ -1196,54 +1216,54 @@ void Launcher::launcherMessage( const QCString &msg, const QByteArray &data)
1196{ 1216{
1197 QDataStream stream( data, IO_ReadOnly ); 1217 QDataStream stream( data, IO_ReadOnly );
1198 if ( msg == "setTabView(QString,int)" ) { 1218 if ( msg == "setTabView(QString,int)" ) {
1199 QString id; 1219 QString id;
1200 stream >> id; 1220 stream >> id;
1201 int mode; 1221 int mode;
1202 stream >> mode; 1222 stream >> mode;
1203 if ( tabs->view(id) ) 1223 if ( tabs->view(id) )
1204 tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); 1224 tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode );
1205 } else if ( msg == "setTabBackground(QString,int,QString)" ) { 1225 } else if ( msg == "setTabBackground(QString,int,QString)" ) {
1206 QString id; 1226 QString id;
1207 stream >> id; 1227 stream >> id;
1208 int mode; 1228 int mode;
1209 stream >> mode; 1229 stream >> mode;
1210 QString pixmapOrColor; 1230 QString pixmapOrColor;
1211 stream >> pixmapOrColor; 1231 stream >> pixmapOrColor;
1212 if ( tabs->view(id) ) 1232 if ( tabs->view(id) )
1213 tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 1233 tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
1214 } else if ( msg == "setTextColor(QString,QString)" ) { 1234 } else if ( msg == "setTextColor(QString,QString)" ) {
1215 QString id; 1235 QString id;
1216 stream >> id; 1236 stream >> id;
1217 QString color; 1237 QString color;
1218 stream >> color; 1238 stream >> color;
1219 if ( tabs->view(id) ) 1239 if ( tabs->view(id) )
1220 tabs->view(id)->setTextColor( QColor(color) ); 1240 tabs->view(id)->setTextColor( QColor(color) );
1221 } else if ( msg == "setFont(QString,QString,int,int,int)" ) { 1241 } else if ( msg == "setFont(QString,QString,int,int,int)" ) {
1222 QString id; 1242 QString id;
1223 stream >> id; 1243 stream >> id;
1224 QString fam; 1244 QString fam;
1225 stream >> fam; 1245 stream >> fam;
1226 int size; 1246 int size;
1227 stream >> size; 1247 stream >> size;
1228 int weight; 1248 int weight;
1229 stream >> weight; 1249 stream >> weight;
1230 int italic; 1250 int italic;
1231 stream >> italic; 1251 stream >> italic;
1232 if ( tabs->view(id) ) 1252 if ( tabs->view(id) )
1233 if ( !fam. isEmpty ( )) 1253 if ( !fam. isEmpty ( ))
1234 tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); 1254 tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
1235 else 1255 else
1236 tabs->view(id)->unsetViewFont(); 1256 tabs->view(id)->unsetViewFont();
1237 qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); 1257 qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic );
1238 } 1258 }
1239 else if ( msg == "setBusyIndicatorType(QString)" ) { 1259 else if ( msg == "setBusyIndicatorType(QString)" ) {
1240 QString type; 1260 QString type;
1241 stream >> type; 1261 stream >> type;
1242 tabs->setBusyIndicatorType(type); 1262 tabs->setBusyIndicatorType(type);
1243 } 1263 }
1244 else if ( msg == "home()" ) { 1264 else if ( msg == "home()" ) {
1245 if ( isVisibleWindow( winId ( ))) 1265 if ( isVisibleWindow( winId ( )))
1246 nextView ( ); 1266 nextView ( );
1247 else 1267 else
1248 raise ( ); 1268 raise ( );
1249 1269
@@ -1255,6 +1275,6 @@ void Launcher::storageChanged()
1255 if ( in_lnk_props ) { 1275 if ( in_lnk_props ) {
1256 got_lnk_change = TRUE; 1276 got_lnk_change = TRUE;
1257 lnk_change = QString::null; 1277 lnk_change = QString::null;
1258 } else { 1278 } else {
1259 updateLink( QString::null ); 1279 updateLink( QString::null );
1260 } 1280 }
@@ -1267,3 +1287,3 @@ bool Launcher::mkdir(const QString &localPath)
1267 if (fullDir.exists()) 1287 if (fullDir.exists())
1268 return true; 1288 return true;
1269 1289
@@ -1279,4 +1299,4 @@ bool Launcher::mkdir(const QString &localPath)
1279 if (dirIndex == -1) { 1299 if (dirIndex == -1) {
1280 //qDebug("No seperators found in path %s", localPath.latin1()); 1300 //qDebug("No seperators found in path %s", localPath.latin1());
1281 checkedPath = QDir::currentDirPath(); 1301 checkedPath = QDir::currentDirPath();
1282 } 1302 }
@@ -1284,21 +1304,21 @@ bool Launcher::mkdir(const QString &localPath)
1284 while (checkedPath != localPath) { 1304 while (checkedPath != localPath) {
1285 // no more seperators found, use the local path 1305 // no more seperators found, use the local path
1286 if (dirIndex == -1) 1306 if (dirIndex == -1)
1287 checkedPath = localPath; 1307 checkedPath = localPath;
1288 else { 1308 else {
1289 // the next directory to check 1309 // the next directory to check
1290 checkedPath = localPath.left(dirIndex) + "/"; 1310 checkedPath = localPath.left(dirIndex) + "/";
1291 // advance the iterator; the next dir seperator 1311 // advance the iterator; the next dir seperator
1292 dirIndex = localPath.find(dirSeps, dirIndex+1); 1312 dirIndex = localPath.find(dirSeps, dirIndex+1);
1293 } 1313 }
1294 1314
1295 QDir checkDir(checkedPath); 1315 QDir checkDir(checkedPath);
1296 if (!checkDir.exists()) { 1316 if (!checkDir.exists()) {
1297 //qDebug("mkdir making dir %s", checkedPath.latin1()); 1317 //qDebug("mkdir making dir %s", checkedPath.latin1());
1298 1318
1299 if (!checkDir.mkdir(checkedPath)) { 1319 if (!checkDir.mkdir(checkedPath)) {
1300 qDebug("Unable to make directory %s", checkedPath.latin1()); 1320 qDebug("Unable to make directory %s", checkedPath.latin1());
1301 return FALSE; 1321 return FALSE;
1302 } 1322 }
1303 } 1323 }
1304 1324
@@ -1315,3 +1335,3 @@ void Launcher::preloadApps()
1315#ifndef QT_NO_COP 1335#ifndef QT_NO_COP
1316 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); 1336 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
1317#endif 1337#endif
@@ -1319 +1339,17 @@ void Launcher::preloadApps()
1319} 1339}
1340
1341DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName)
1342 : OFileSelector(parent,mode,selector,dirName,fileName)
1343{
1344 setYesCancelVisible(false);
1345 setToolbarVisible(true);
1346 setPermissionBarVisible(false);
1347 setLineEditVisible(false) ;
1348 //setChooserVisible( bool chooser );
1349
1350}
1351
1352DocumentTab::~DocumentTab() {
1353
1354}
1355