author | sandman <sandman> | 2002-12-30 15:12:34 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-30 15:12:34 (UTC) |
commit | 66bfb25fe226a69f1ca2218b56fb3df74409de2f (patch) (unidiff) | |
tree | 2350a583f4b663f1c92cc442145ea342b133e3c0 | |
parent | a0eca1c0925a6893fa8f3ebfacd6363f906189df (diff) | |
download | opie-66bfb25fe226a69f1ca2218b56fb3df74409de2f.zip opie-66bfb25fe226a69f1ca2218b56fb3df74409de2f.tar.gz opie-66bfb25fe226a69f1ca2218b56fb3df74409de2f.tar.bz2 |
getting rid of some qDebugs to make the startup a bit more quiet
-rw-r--r-- | core/launcher/irserver.cpp | 6 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp index 2147d0a..625cb60 100644 --- a/core/launcher/irserver.cpp +++ b/core/launcher/irserver.cpp | |||
@@ -1,52 +1,52 @@ | |||
1 | #include "irserver.h" | 1 | #include "irserver.h" |
2 | 2 | ||
3 | #include <qpe/qlibrary.h> | 3 | #include <qpe/qlibrary.h> |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | 5 | ||
6 | #include <qtranslator.h> | 6 | #include <qtranslator.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | 8 | ||
9 | #include "obexinterface.h" | 9 | #include "obexinterface.h" |
10 | 10 | ||
11 | #include <qdir.h> | 11 | #include <qdir.h> |
12 | 12 | ||
13 | IrServer::IrServer( QObject *parent, const char *name ) | 13 | IrServer::IrServer( QObject *parent, const char *name ) |
14 | : QObject( parent, name ) | 14 | : QObject( parent, name ) |
15 | { | 15 | { |
16 | lib = 0; | 16 | lib = 0; |
17 | iface = 0; | 17 | iface = 0; |
18 | QString path = QPEApplication::qpeDir() + "/plugins/obex/"; | 18 | QString path = QPEApplication::qpeDir() + "/plugins/obex/"; |
19 | QDir dir( path, "lib*.so" ); | 19 | QDir dir( path, "lib*.so" ); |
20 | QStringList list = dir.entryList(); | 20 | QStringList list = dir.entryList(); |
21 | QStringList::Iterator it; | 21 | QStringList::Iterator it; |
22 | for ( it = list.begin(); it != list.end(); ++it ) { | 22 | for ( it = list.begin(); it != list.end(); ++it ) { |
23 | QLibrary *trylib = new QLibrary( path + *it ); | 23 | QLibrary *trylib = new QLibrary( path + *it ); |
24 | qDebug("trying lib %s", (path + (*it)).latin1() ); | 24 | //qDebug("trying lib %s", (path + (*it)).latin1() ); |
25 | if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 25 | if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
26 | lib = trylib; | 26 | lib = trylib; |
27 | qDebug("found obex lib" ); | 27 | //qDebug("found obex lib" ); |
28 | QString lang = getenv( "LANG" ); | 28 | QString lang = getenv( "LANG" ); |
29 | QTranslator * trans = new QTranslator(qApp); | 29 | QTranslator * trans = new QTranslator(qApp); |
30 | QString type = (*it).left( (*it).find(".") ); | 30 | QString type = (*it).left( (*it).find(".") ); |
31 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | 31 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; |
32 | qDebug("tr fpr obex: %s", tfn.latin1() ); | 32 | //qDebug("tr fpr obex: %s", tfn.latin1() ); |
33 | if ( trans->load( tfn )) | 33 | if ( trans->load( tfn )) |
34 | qApp->installTranslator( trans ); | 34 | qApp->installTranslator( trans ); |
35 | else | 35 | else |
36 | delete trans; | 36 | delete trans; |
37 | 37 | ||
38 | break; | 38 | break; |
39 | } else { | 39 | } else { |
40 | delete lib; | 40 | delete lib; |
41 | } | 41 | } |
42 | } | 42 | } |
43 | if ( !lib ) | 43 | if ( !lib ) |
44 | qDebug("could not load IR plugin" ); | 44 | qDebug("could not load IR plugin" ); |
45 | } | 45 | } |
46 | 46 | ||
47 | IrServer::~IrServer() | 47 | IrServer::~IrServer() |
48 | { | 48 | { |
49 | if ( iface ) | 49 | if ( iface ) |
50 | iface->release(); | 50 | iface->release(); |
51 | delete lib; | 51 | delete lib; |
52 | } | 52 | } |
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 95a1d4a..7117e0b 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -296,687 +296,686 @@ public: | |||
296 | case Type: | 296 | case Type: |
297 | return a->type().compare(b->type()); | 297 | return a->type().compare(b->type()); |
298 | } | 298 | } |
299 | return 0; | 299 | return 0; |
300 | } | 300 | } |
301 | 301 | ||
302 | QString getAllDocLinkInfo() const; | 302 | QString getAllDocLinkInfo() const; |
303 | 303 | ||
304 | protected: | 304 | protected: |
305 | 305 | ||
306 | void styleChange( QStyle &old ) | 306 | void styleChange( QStyle &old ) |
307 | { | 307 | { |
308 | QIconView::styleChange( old ); | 308 | QIconView::styleChange( old ); |
309 | calculateGrid( itemTextPos() ); | 309 | calculateGrid( itemTextPos() ); |
310 | } | 310 | } |
311 | 311 | ||
312 | void calculateGrid( ItemTextPos pos ) | 312 | void calculateGrid( ItemTextPos pos ) |
313 | { | 313 | { |
314 | int dw = QApplication::desktop()->width(); | 314 | int dw = QApplication::desktop()->width(); |
315 | int viewerWidth = dw-style().scrollBarExtent().width(); | 315 | int viewerWidth = dw-style().scrollBarExtent().width(); |
316 | if ( pos == Bottom ) { | 316 | if ( pos == Bottom ) { |
317 | int cols = 3; | 317 | int cols = 3; |
318 | if ( viewerWidth <= 200 ) | 318 | if ( viewerWidth <= 200 ) |
319 | cols = 2; | 319 | cols = 2; |
320 | else if ( viewerWidth >= 400 ) | 320 | else if ( viewerWidth >= 400 ) |
321 | cols = viewerWidth/96; | 321 | cols = viewerWidth/96; |
322 | setSpacing( 4 ); | 322 | setSpacing( 4 ); |
323 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); | 323 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); |
324 | setGridY( fontMetrics().height()*2+24 ); | 324 | setGridY( fontMetrics().height()*2+24 ); |
325 | } else { | 325 | } else { |
326 | int cols = 2; | 326 | int cols = 2; |
327 | if ( viewerWidth < 150 ) | 327 | if ( viewerWidth < 150 ) |
328 | cols = 1; | 328 | cols = 1; |
329 | else if ( viewerWidth >= 400 ) | 329 | else if ( viewerWidth >= 400 ) |
330 | cols = viewerWidth/150; | 330 | cols = viewerWidth/150; |
331 | setSpacing( 2 ); | 331 | setSpacing( 2 ); |
332 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); | 332 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); |
333 | setGridY( fontMetrics().height()+2 ); | 333 | setGridY( fontMetrics().height()+2 ); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | 336 | ||
337 | 337 | ||
338 | // flicker free redrawing of busy indicator | 338 | // flicker free redrawing of busy indicator |
339 | // code was taken from QScrollView::viewportPaintEvent | 339 | // code was taken from QScrollView::viewportPaintEvent |
340 | void viewportPaintEvent( QPaintEvent* pe ) | 340 | void viewportPaintEvent( QPaintEvent* pe ) |
341 | { | 341 | { |
342 | static QPixmap *pix = new QPixmap ( ); | 342 | static QPixmap *pix = new QPixmap ( ); |
343 | 343 | ||
344 | QWidget* vp = viewport(); | 344 | QWidget* vp = viewport(); |
345 | 345 | ||
346 | if ( vp-> size ( ) != pix-> size ( )) | 346 | if ( vp-> size ( ) != pix-> size ( )) |
347 | pix-> resize ( vp-> size ( )); | 347 | pix-> resize ( vp-> size ( )); |
348 | 348 | ||
349 | QPainter p(pix, vp); | 349 | QPainter p(pix, vp); |
350 | QRect r = pe->rect(); | 350 | QRect r = pe->rect(); |
351 | if ( clipper ( ) != vp ) { | 351 | if ( clipper ( ) != vp ) { |
352 | QRect rr( | 352 | QRect rr( |
353 | -vp->x(), -vp->y(), | 353 | -vp->x(), -vp->y(), |
354 | clipper()->width(), clipper()->height() | 354 | clipper()->width(), clipper()->height() |
355 | ); | 355 | ); |
356 | r &= rr; | 356 | r &= rr; |
357 | if ( r.isValid() ) { | 357 | if ( r.isValid() ) { |
358 | int ex = r.x() + vp->x() + contentsX(); | 358 | int ex = r.x() + vp->x() + contentsX(); |
359 | int ey = r.y() + vp->y() + contentsY(); | 359 | int ey = r.y() + vp->y() + contentsY(); |
360 | int ew = r.width(); | 360 | int ew = r.width(); |
361 | int eh = r.height(); | 361 | int eh = r.height(); |
362 | drawContentsOffset(&p, | 362 | drawContentsOffset(&p, |
363 | contentsX()+vp->x(), | 363 | contentsX()+vp->x(), |
364 | contentsY()+vp->y(), | 364 | contentsY()+vp->y(), |
365 | ex, ey, ew, eh); | 365 | ex, ey, ew, eh); |
366 | } | 366 | } |
367 | } else { | 367 | } else { |
368 | r &= clipper()->rect(); | 368 | r &= clipper()->rect(); |
369 | int ex = r.x() + contentsX(); | 369 | int ex = r.x() + contentsX(); |
370 | int ey = r.y() + contentsY(); | 370 | int ey = r.y() + contentsY(); |
371 | int ew = r.width(); | 371 | int ew = r.width(); |
372 | int eh = r.height(); | 372 | int eh = r.height(); |
373 | drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh); | 373 | drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh); |
374 | } | 374 | } |
375 | bitBlt ( vp, r.topLeft(), pix, r ); | 375 | bitBlt ( vp, r.topLeft(), pix, r ); |
376 | } | 376 | } |
377 | 377 | ||
378 | private: | 378 | private: |
379 | QList<AppLnk> hidden; | 379 | QList<AppLnk> hidden; |
380 | QDict<void> mimes; | 380 | QDict<void> mimes; |
381 | QDict<void> cats; | 381 | QDict<void> cats; |
382 | SortMethod sortmeth; | 382 | SortMethod sortmeth; |
383 | QRegExp tf; | 383 | QRegExp tf; |
384 | int cf; | 384 | int cf; |
385 | QIconViewItem* bsy; | 385 | QIconViewItem* bsy; |
386 | bool ike; | 386 | bool ike; |
387 | bool bigIcns; | 387 | bool bigIcns; |
388 | QPixmap bgPixmap; | 388 | QPixmap bgPixmap; |
389 | QPixmap bpm [6]; | 389 | QPixmap bpm [6]; |
390 | QColor bgColor; | 390 | QColor bgColor; |
391 | int busytimer; | 391 | int busytimer; |
392 | int busystate; | 392 | int busystate; |
393 | BusyIndicatorType busyType; | 393 | BusyIndicatorType busyType; |
394 | }; | 394 | }; |
395 | 395 | ||
396 | 396 | ||
397 | bool LauncherView::bsy=FALSE; | 397 | bool LauncherView::bsy=FALSE; |
398 | 398 | ||
399 | void LauncherView::setBusy(bool on) | 399 | void LauncherView::setBusy(bool on) |
400 | { | 400 | { |
401 | icons->setBusy(on); | 401 | icons->setBusy(on); |
402 | } | 402 | } |
403 | 403 | ||
404 | class LauncherItem : public QIconViewItem | 404 | class LauncherItem : public QIconViewItem |
405 | { | 405 | { |
406 | public: | 406 | public: |
407 | LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE ); | 407 | LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE ); |
408 | ~LauncherItem() | 408 | ~LauncherItem() |
409 | { | 409 | { |
410 | LauncherIconView* liv = (LauncherIconView*)iconView(); | 410 | LauncherIconView* liv = (LauncherIconView*)iconView(); |
411 | if ( liv->busyItem() == this ) | 411 | if ( liv->busyItem() == this ) |
412 | liv->setBusy(FALSE); | 412 | liv->setBusy(FALSE); |
413 | delete app; | 413 | delete app; |
414 | } | 414 | } |
415 | 415 | ||
416 | AppLnk* appLnk() const { return app; } | 416 | AppLnk* appLnk() const { return app; } |
417 | AppLnk* takeAppLnk() { AppLnk* r=app; app=0; return r; } | 417 | AppLnk* takeAppLnk() { AppLnk* r=app; app=0; return r; } |
418 | 418 | ||
419 | virtual int compare ( QIconViewItem * i ) const; | 419 | virtual int compare ( QIconViewItem * i ) const; |
420 | 420 | ||
421 | void paintItem( QPainter *p, const QColorGroup &cg ) | 421 | void paintItem( QPainter *p, const QColorGroup &cg ) |
422 | { | 422 | { |
423 | LauncherIconView* liv = (LauncherIconView*)iconView(); | 423 | LauncherIconView* liv = (LauncherIconView*)iconView(); |
424 | QBrush oldBrush( liv->itemTextBackground() ); | 424 | QBrush oldBrush( liv->itemTextBackground() ); |
425 | QColorGroup mycg( cg ); | 425 | QColorGroup mycg( cg ); |
426 | if ( liv->currentItem() == this ) { | 426 | if ( liv->currentItem() == this ) { |
427 | liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) ); | 427 | liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) ); |
428 | mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) ); | 428 | mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) ); |
429 | } | 429 | } |
430 | QIconViewItem::paintItem(p,mycg); | 430 | QIconViewItem::paintItem(p,mycg); |
431 | if ( liv->currentItem() == this ) | 431 | if ( liv->currentItem() == this ) |
432 | liv->setItemTextBackground( oldBrush ); | 432 | liv->setItemTextBackground( oldBrush ); |
433 | } | 433 | } |
434 | 434 | ||
435 | virtual QPixmap* pixmap () const | 435 | virtual QPixmap* pixmap () const |
436 | { | 436 | { |
437 | const LauncherIconView* liv = (LauncherIconView*)iconView(); | 437 | const LauncherIconView* liv = (LauncherIconView*)iconView(); |
438 | if ( (const LauncherItem *)liv->busyItem() == this ) | 438 | if ( (const LauncherItem *)liv->busyItem() == this ) |
439 | return liv->busyPixmap(); | 439 | return liv->busyPixmap(); |
440 | return QIconViewItem::pixmap(); | 440 | return QIconViewItem::pixmap(); |
441 | } | 441 | } |
442 | 442 | ||
443 | protected: | 443 | protected: |
444 | AppLnk* app; | 444 | AppLnk* app; |
445 | }; | 445 | }; |
446 | 446 | ||
447 | 447 | ||
448 | LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) | 448 | LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) |
449 | : QIconViewItem( parent, applnk->name(), | 449 | : QIconViewItem( parent, applnk->name(), |
450 | bigIcon ? applnk->bigPixmap() :applnk->pixmap() ), | 450 | bigIcon ? applnk->bigPixmap() :applnk->pixmap() ), |
451 | app(applnk) // Takes ownership | 451 | app(applnk) // Takes ownership |
452 | { | 452 | { |
453 | } | 453 | } |
454 | 454 | ||
455 | int LauncherItem::compare ( QIconViewItem * i ) const | 455 | int LauncherItem::compare ( QIconViewItem * i ) const |
456 | { | 456 | { |
457 | LauncherIconView* view = (LauncherIconView*)iconView(); | 457 | LauncherIconView* view = (LauncherIconView*)iconView(); |
458 | return view->compare(app,((LauncherItem *)i)->appLnk()); | 458 | return view->compare(app,((LauncherItem *)i)->appLnk()); |
459 | } | 459 | } |
460 | 460 | ||
461 | QStringList LauncherIconView::mimeTypes() const | 461 | QStringList LauncherIconView::mimeTypes() const |
462 | { | 462 | { |
463 | QStringList r; | 463 | QStringList r; |
464 | QDictIterator<void> it(mimes); | 464 | QDictIterator<void> it(mimes); |
465 | while (it.current()) { | 465 | while (it.current()) { |
466 | r.append(it.currentKey()); | 466 | r.append(it.currentKey()); |
467 | ++it; | 467 | ++it; |
468 | } | 468 | } |
469 | r.sort(); | 469 | r.sort(); |
470 | return r; | 470 | return r; |
471 | } | 471 | } |
472 | 472 | ||
473 | void LauncherIconView::addItem(AppLnk* app, bool resort) | 473 | void LauncherIconView::addItem(AppLnk* app, bool resort) |
474 | { | 474 | { |
475 | addCatsAndMimes(app); | 475 | addCatsAndMimes(app); |
476 | 476 | ||
477 | if ( (tf.isEmpty() || tf.match(app->type()) >= 0) | 477 | if ( (tf.isEmpty() || tf.match(app->type()) >= 0) |
478 | && (cf == 0 || app->categories().contains(cf) | 478 | && (cf == 0 || app->categories().contains(cf) |
479 | || cf == -1 && app->categories().count() == 0 ) ) | 479 | || cf == -1 && app->categories().count() == 0 ) ) |
480 | (void) new LauncherItem( this, app, bigIcns ); | 480 | (void) new LauncherItem( this, app, bigIcns ); |
481 | else | 481 | else |
482 | hidden.append(app); | 482 | hidden.append(app); |
483 | if ( resort ) | 483 | if ( resort ) |
484 | sort(); | 484 | sort(); |
485 | } | 485 | } |
486 | 486 | ||
487 | void LauncherIconView::updateCategoriesAndMimeTypes() | 487 | void LauncherIconView::updateCategoriesAndMimeTypes() |
488 | { | 488 | { |
489 | mimes.clear(); | 489 | mimes.clear(); |
490 | cats.clear(); | 490 | cats.clear(); |
491 | LauncherItem* item = (LauncherItem*)firstItem(); | 491 | LauncherItem* item = (LauncherItem*)firstItem(); |
492 | while (item) { | 492 | while (item) { |
493 | addCatsAndMimes(item->appLnk()); | 493 | addCatsAndMimes(item->appLnk()); |
494 | item = (LauncherItem*)item->nextItem(); | 494 | item = (LauncherItem*)item->nextItem(); |
495 | } | 495 | } |
496 | QListIterator<AppLnk> it(hidden); | 496 | QListIterator<AppLnk> it(hidden); |
497 | AppLnk* l; | 497 | AppLnk* l; |
498 | while ((l=it.current())) { | 498 | while ((l=it.current())) { |
499 | addCatsAndMimes(l); | 499 | addCatsAndMimes(l); |
500 | ++it; | 500 | ++it; |
501 | } | 501 | } |
502 | } | 502 | } |
503 | 503 | ||
504 | void LauncherIconView::hideOrShowItems(bool resort) | 504 | void LauncherIconView::hideOrShowItems(bool resort) |
505 | { | 505 | { |
506 | hidden.setAutoDelete(FALSE); | 506 | hidden.setAutoDelete(FALSE); |
507 | QList<AppLnk> links=hidden; | 507 | QList<AppLnk> links=hidden; |
508 | hidden.clear(); | 508 | hidden.clear(); |
509 | hidden.setAutoDelete(TRUE); | 509 | hidden.setAutoDelete(TRUE); |
510 | LauncherItem* item = (LauncherItem*)firstItem(); | 510 | LauncherItem* item = (LauncherItem*)firstItem(); |
511 | while (item) { | 511 | while (item) { |
512 | links.append(item->takeAppLnk()); | 512 | links.append(item->takeAppLnk()); |
513 | item = (LauncherItem*)item->nextItem(); | 513 | item = (LauncherItem*)item->nextItem(); |
514 | } | 514 | } |
515 | viewport()->setUpdatesEnabled( FALSE ); | 515 | viewport()->setUpdatesEnabled( FALSE ); |
516 | clear(); | 516 | clear(); |
517 | QListIterator<AppLnk> it(links); | 517 | QListIterator<AppLnk> it(links); |
518 | AppLnk* l; | 518 | AppLnk* l; |
519 | while ((l=it.current())) { | 519 | while ((l=it.current())) { |
520 | addItem(l,FALSE); | 520 | addItem(l,FALSE); |
521 | ++it; | 521 | ++it; |
522 | } | 522 | } |
523 | viewport()->setUpdatesEnabled( TRUE ); | 523 | viewport()->setUpdatesEnabled( TRUE ); |
524 | if ( resort && !autoArrange() ) | 524 | if ( resort && !autoArrange() ) |
525 | sort(); | 525 | sort(); |
526 | } | 526 | } |
527 | 527 | ||
528 | bool LauncherIconView::removeLink(const QString& linkfile) | 528 | bool LauncherIconView::removeLink(const QString& linkfile) |
529 | { | 529 | { |
530 | LauncherItem* item = (LauncherItem*)firstItem(); | 530 | LauncherItem* item = (LauncherItem*)firstItem(); |
531 | AppLnk* l; | 531 | AppLnk* l; |
532 | bool did = FALSE; | 532 | bool did = FALSE; |
533 | DocLnk dl(linkfile); | 533 | DocLnk dl(linkfile); |
534 | while (item) { | 534 | while (item) { |
535 | l = item->appLnk(); | 535 | l = item->appLnk(); |
536 | if ( ( l->linkFileKnown() && ( l->linkFile() == linkfile )) | 536 | if ( ( l->linkFileKnown() && ( l->linkFile() == linkfile )) |
537 | || ( l->fileKnown() && ( l->file() == linkfile )) | 537 | || ( l->fileKnown() && ( l->file() == linkfile )) |
538 | || ( dl.fileKnown() && l->fileKnown() && ( dl.file() == l->file() )) ) { | 538 | || ( dl.fileKnown() && l->fileKnown() && ( dl.file() == l->file() )) ) { |
539 | delete item; | 539 | delete item; |
540 | did = TRUE; | 540 | did = TRUE; |
541 | } | 541 | } |
542 | item = (LauncherItem*)item->nextItem(); | 542 | item = (LauncherItem*)item->nextItem(); |
543 | } | 543 | } |
544 | QListIterator<AppLnk> it(hidden); | 544 | QListIterator<AppLnk> it(hidden); |
545 | while ((l=it.current())) { | 545 | while ((l=it.current())) { |
546 | ++it; | 546 | ++it; |
547 | if ( ( l->linkFileKnown() && ( l->linkFile() == linkfile )) | 547 | if ( ( l->linkFileKnown() && ( l->linkFile() == linkfile )) |
548 | || ( l->file() == linkfile ) | 548 | || ( l->file() == linkfile ) |
549 | || ( dl.fileKnown() && ( dl.file() == l->file() )) ) { | 549 | || ( dl.fileKnown() && ( dl.file() == l->file() )) ) { |
550 | hidden.removeRef(l); | 550 | hidden.removeRef(l); |
551 | did = TRUE; | 551 | did = TRUE; |
552 | } | 552 | } |
553 | } | 553 | } |
554 | return did; | 554 | return did; |
555 | } | 555 | } |
556 | 556 | ||
557 | static QString docLinkInfo(const Categories& cats, DocLnk* doc) | 557 | static QString docLinkInfo(const Categories& cats, DocLnk* doc) |
558 | { | 558 | { |
559 | QString contents; | 559 | QString contents; |
560 | 560 | ||
561 | QFileInfo fi( doc->file() ); | 561 | QFileInfo fi( doc->file() ); |
562 | if ( !fi.exists() ) | 562 | if ( !fi.exists() ) |
563 | return contents; | 563 | return contents; |
564 | 564 | ||
565 | if ( doc->linkFileKnown() ) { | 565 | if ( doc->linkFileKnown() ) { |
566 | QString lfn = doc->linkFile(); | 566 | QString lfn = doc->linkFile(); |
567 | QFile f( lfn ); | 567 | QFile f( lfn ); |
568 | if ( f.open( IO_ReadOnly ) ) { | 568 | if ( f.open( IO_ReadOnly ) ) { |
569 | QTextStream ts( &f ); | 569 | QTextStream ts( &f ); |
570 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 570 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
571 | contents += ts.read(); | 571 | contents += ts.read(); |
572 | f.close(); | 572 | f.close(); |
573 | goto calcsize; | 573 | goto calcsize; |
574 | } | 574 | } |
575 | } | 575 | } |
576 | 576 | ||
577 | contents += "[Desktop Entry]\n"; | 577 | contents += "[Desktop Entry]\n"; |
578 | contents += "Categories = " // No tr | 578 | contents += "Categories = " // No tr |
579 | + cats.labels("Document View", doc->categories()).join(";") + "\n"; // No tr | 579 | + cats.labels("Document View", doc->categories()).join(";") + "\n"; // No tr |
580 | contents += "File = "+doc->file()+"\n"; // No tr | 580 | contents += "File = "+doc->file()+"\n"; // No tr |
581 | contents += "Name = "+doc->name()+"\n"; // No tr | 581 | contents += "Name = "+doc->name()+"\n"; // No tr |
582 | contents += "Type = "+doc->type()+"\n"; // No tr | 582 | contents += "Type = "+doc->type()+"\n"; // No tr |
583 | 583 | ||
584 | calcsize: | 584 | calcsize: |
585 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr | 585 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr |
586 | return contents; | 586 | return contents; |
587 | } | 587 | } |
588 | 588 | ||
589 | QString LauncherIconView::getAllDocLinkInfo() const | 589 | QString LauncherIconView::getAllDocLinkInfo() const |
590 | { | 590 | { |
591 | QString contents; | 591 | QString contents; |
592 | LauncherItem* item = (LauncherItem*)firstItem(); | 592 | LauncherItem* item = (LauncherItem*)firstItem(); |
593 | Categories cats; | 593 | Categories cats; |
594 | while (item) { | 594 | while (item) { |
595 | DocLnk* doc = (DocLnk*)item->appLnk(); | 595 | DocLnk* doc = (DocLnk*)item->appLnk(); |
596 | contents += docLinkInfo(cats,doc); | 596 | contents += docLinkInfo(cats,doc); |
597 | item = (LauncherItem*)item->nextItem(); | 597 | item = (LauncherItem*)item->nextItem(); |
598 | } | 598 | } |
599 | QListIterator<AppLnk> it(hidden); | 599 | QListIterator<AppLnk> it(hidden); |
600 | DocLnk* doc; | 600 | DocLnk* doc; |
601 | while ((doc=(DocLnk*)it.current())) { | 601 | while ((doc=(DocLnk*)it.current())) { |
602 | contents += docLinkInfo(cats,doc); | 602 | contents += docLinkInfo(cats,doc); |
603 | ++it; | 603 | ++it; |
604 | } | 604 | } |
605 | return contents; | 605 | return contents; |
606 | } | 606 | } |
607 | 607 | ||
608 | //=========================================================================== | 608 | //=========================================================================== |
609 | 609 | ||
610 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) | 610 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) |
611 | : QVBox( parent, name, fl ) | 611 | : QVBox( parent, name, fl ) |
612 | { | 612 | { |
613 | icons = new LauncherIconView( this ); | 613 | icons = new LauncherIconView( this ); |
614 | setFocusProxy(icons); | 614 | setFocusProxy(icons); |
615 | QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); | 615 | QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); |
616 | 616 | ||
617 | icons->setItemsMovable( FALSE ); | 617 | icons->setItemsMovable( FALSE ); |
618 | icons->setAutoArrange( TRUE ); | 618 | icons->setAutoArrange( TRUE ); |
619 | icons->setSorting( TRUE ); | 619 | icons->setSorting( TRUE ); |
620 | icons->setFrameStyle( QFrame::NoFrame ); | 620 | icons->setFrameStyle( QFrame::NoFrame ); |
621 | icons->setMargin( 0 ); | 621 | icons->setMargin( 0 ); |
622 | icons->setSelectionMode( QIconView::NoSelection ); | 622 | icons->setSelectionMode( QIconView::NoSelection ); |
623 | icons->setBackgroundMode( PaletteBase ); | 623 | icons->setBackgroundMode( PaletteBase ); |
624 | icons->setResizeMode( QIconView::Fixed ); | 624 | icons->setResizeMode( QIconView::Fixed ); |
625 | vmode = (ViewMode)-1; | 625 | vmode = (ViewMode)-1; |
626 | setViewMode( Icon ); | 626 | setViewMode( Icon ); |
627 | 627 | ||
628 | connect( icons, SIGNAL(mouseButtonClicked(int, QIconViewItem *, const QPoint&)), | 628 | connect( icons, SIGNAL(mouseButtonClicked(int, QIconViewItem *, const QPoint&)), |
629 | SLOT(itemClicked(int, QIconViewItem *)) ); | 629 | SLOT(itemClicked(int, QIconViewItem *)) ); |
630 | connect( icons, SIGNAL(selectionChanged()), | 630 | connect( icons, SIGNAL(selectionChanged()), |
631 | SLOT(selectionChanged()) ); | 631 | SLOT(selectionChanged()) ); |
632 | connect( icons, SIGNAL(returnPressed(QIconViewItem *)), | 632 | connect( icons, SIGNAL(returnPressed(QIconViewItem *)), |
633 | SLOT(returnPressed(QIconViewItem *)) ); | 633 | SLOT(returnPressed(QIconViewItem *)) ); |
634 | connect( icons, SIGNAL(mouseButtonPressed(int, QIconViewItem *, const QPoint&)), | 634 | connect( icons, SIGNAL(mouseButtonPressed(int, QIconViewItem *, const QPoint&)), |
635 | SLOT(itemPressed(int, QIconViewItem *)) ); | 635 | SLOT(itemPressed(int, QIconViewItem *)) ); |
636 | 636 | ||
637 | tools = 0; | 637 | tools = 0; |
638 | setBackgroundType( Ruled, QString::null ); | 638 | setBackgroundType( Ruled, QString::null ); |
639 | } | 639 | } |
640 | 640 | ||
641 | LauncherView::~LauncherView() | 641 | LauncherView::~LauncherView() |
642 | { | 642 | { |
643 | } | 643 | } |
644 | 644 | ||
645 | void LauncherView::setToolsEnabled(bool y) | 645 | void LauncherView::setToolsEnabled(bool y) |
646 | { | 646 | { |
647 | if ( !y != !tools ) { | 647 | if ( !y != !tools ) { |
648 | if ( y ) { | 648 | if ( y ) { |
649 | tools = new QHBox(this); | 649 | tools = new QHBox(this); |
650 | 650 | ||
651 | // Type filter | 651 | // Type filter |
652 | typemb = new QComboBox(tools); | 652 | typemb = new QComboBox(tools); |
653 | 653 | ||
654 | // Category filter | 654 | // Category filter |
655 | catmb = new CategorySelect(tools); | 655 | catmb = new CategorySelect(tools); |
656 | 656 | ||
657 | updateTools(); | 657 | updateTools(); |
658 | tools->show(); | 658 | tools->show(); |
659 | } else { | 659 | } else { |
660 | delete tools; | 660 | delete tools; |
661 | tools = 0; | 661 | tools = 0; |
662 | } | 662 | } |
663 | } | 663 | } |
664 | } | 664 | } |
665 | 665 | ||
666 | void LauncherView::updateTools() | 666 | void LauncherView::updateTools() |
667 | { | 667 | { |
668 | disconnect( typemb, SIGNAL(activated(int)), | 668 | disconnect( typemb, SIGNAL(activated(int)), |
669 | this, SLOT(showType(int)) ); | 669 | this, SLOT(showType(int)) ); |
670 | disconnect( catmb, SIGNAL(signalSelected(int)), | 670 | disconnect( catmb, SIGNAL(signalSelected(int)), |
671 | this, SLOT(showCategory(int)) ); | 671 | this, SLOT(showCategory(int)) ); |
672 | 672 | ||
673 | icons->updateCategoriesAndMimeTypes(); | 673 | icons->updateCategoriesAndMimeTypes(); |
674 | 674 | ||
675 | QString prev; | 675 | QString prev; |
676 | 676 | ||
677 | // Type filter | 677 | // Type filter |
678 | QStringList types; | 678 | QStringList types; |
679 | typelist = icons->mimeTypes(); | 679 | typelist = icons->mimeTypes(); |
680 | for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) { | 680 | for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) { |
681 | QString t = *it; | 681 | QString t = *it; |
682 | if ( t.left(12) == "application/" ) { | 682 | if ( t.left(12) == "application/" ) { |
683 | MimeType mt(t); | 683 | MimeType mt(t); |
684 | const AppLnk* app = mt.application(); | 684 | const AppLnk* app = mt.application(); |
685 | if ( app ) | 685 | if ( app ) |
686 | t = app->name(); | 686 | t = app->name(); |
687 | else | 687 | else |
688 | t = t.mid(12); | 688 | t = t.mid(12); |
689 | } else { | 689 | } else { |
690 | t[0] = t[0].upper(); | 690 | t[0] = t[0].upper(); |
691 | } | 691 | } |
692 | types += tr("%1 files").arg(t); | 692 | types += tr("%1 files").arg(t); |
693 | } | 693 | } |
694 | types << tr("All types of file"); | 694 | types << tr("All types of file"); |
695 | prev = typemb->currentText(); | 695 | prev = typemb->currentText(); |
696 | typemb->clear(); | 696 | typemb->clear(); |
697 | typemb->insertStringList(types); | 697 | typemb->insertStringList(types); |
698 | for (int i=0; i<typemb->count(); i++) { | 698 | for (int i=0; i<typemb->count(); i++) { |
699 | if ( typemb->text(i) == prev ) { | 699 | if ( typemb->text(i) == prev ) { |
700 | typemb->setCurrentItem(i); | 700 | typemb->setCurrentItem(i); |
701 | break; | 701 | break; |
702 | } | 702 | } |
703 | } | 703 | } |
704 | if ( prev.isNull() ) | 704 | if ( prev.isNull() ) |
705 | typemb->setCurrentItem(typemb->count()-1); | 705 | typemb->setCurrentItem(typemb->count()-1); |
706 | 706 | ||
707 | Categories cats( 0 ); | 707 | Categories cats( 0 ); |
708 | cats.load( categoryFileName() ); | 708 | cats.load( categoryFileName() ); |
709 | QArray<int> vl( 0 ); | 709 | QArray<int> vl( 0 ); |
710 | catmb->setCategories( vl, "Document View", // No tr | 710 | catmb->setCategories( vl, "Document View", // No tr |
711 | tr("Document View") ); | 711 | tr("Document View") ); |
712 | catmb->setRemoveCategoryEdit( TRUE ); | 712 | catmb->setRemoveCategoryEdit( TRUE ); |
713 | catmb->setAllCategories( TRUE ); | 713 | catmb->setAllCategories( TRUE ); |
714 | 714 | ||
715 | connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int))); | 715 | connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int))); |
716 | connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); | 716 | connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); |
717 | } | 717 | } |
718 | 718 | ||
719 | void LauncherView::sortBy(int s) | 719 | void LauncherView::sortBy(int s) |
720 | { | 720 | { |
721 | icons->setSortMethod((LauncherIconView::SortMethod)s); | 721 | icons->setSortMethod((LauncherIconView::SortMethod)s); |
722 | } | 722 | } |
723 | 723 | ||
724 | void LauncherView::showType(int t) | 724 | void LauncherView::showType(int t) |
725 | { | 725 | { |
726 | if ( t >= (int)typelist.count() ) { | 726 | if ( t >= (int)typelist.count() ) { |
727 | icons->setTypeFilter("",TRUE); | 727 | icons->setTypeFilter("",TRUE); |
728 | } else { | 728 | } else { |
729 | QString ty = typelist[t]; | 729 | QString ty = typelist[t]; |
730 | if ( !ty.contains('/') ) | 730 | if ( !ty.contains('/') ) |
731 | ty += "/*"; | 731 | ty += "/*"; |
732 | icons->setTypeFilter(ty,TRUE); | 732 | icons->setTypeFilter(ty,TRUE); |
733 | } | 733 | } |
734 | } | 734 | } |
735 | 735 | ||
736 | void LauncherView::showCategory( int c ) | 736 | void LauncherView::showCategory( int c ) |
737 | { | 737 | { |
738 | icons->setCategoryFilter( c, TRUE ); | 738 | icons->setCategoryFilter( c, TRUE ); |
739 | } | 739 | } |
740 | 740 | ||
741 | void LauncherView::setViewMode( ViewMode m ) | 741 | void LauncherView::setViewMode( ViewMode m ) |
742 | { | 742 | { |
743 | if ( vmode != m ) { | 743 | if ( vmode != m ) { |
744 | bool bigIcons = m == Icon; | 744 | bool bigIcons = m == Icon; |
745 | icons->viewport()->setUpdatesEnabled( FALSE ); | 745 | icons->viewport()->setUpdatesEnabled( FALSE ); |
746 | icons->setBigIcons( bigIcons ); | 746 | icons->setBigIcons( bigIcons ); |
747 | switch ( m ) { | 747 | switch ( m ) { |
748 | case List: | 748 | case List: |
749 | icons->setItemTextPos( QIconView::Right ); | 749 | icons->setItemTextPos( QIconView::Right ); |
750 | break; | 750 | break; |
751 | case Icon: | 751 | case Icon: |
752 | icons->setItemTextPos( QIconView::Bottom ); | 752 | icons->setItemTextPos( QIconView::Bottom ); |
753 | break; | 753 | break; |
754 | } | 754 | } |
755 | icons->hideOrShowItems( FALSE ); | 755 | icons->hideOrShowItems( FALSE ); |
756 | icons->viewport()->setUpdatesEnabled( TRUE ); | 756 | icons->viewport()->setUpdatesEnabled( TRUE ); |
757 | vmode = m; | 757 | vmode = m; |
758 | } | 758 | } |
759 | } | 759 | } |
760 | 760 | ||
761 | void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) | 761 | void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) |
762 | { | 762 | { |
763 | if ( !bgCache ) | 763 | if ( !bgCache ) |
764 | bgCache = new QMap<QString,BgPixmap*>; | 764 | bgCache = new QMap<QString,BgPixmap*>; |
765 | if ( bgCache->contains( bgName ) ) | 765 | if ( bgCache->contains( bgName ) ) |
766 | (*bgCache)[bgName]->ref--; | 766 | (*bgCache)[bgName]->ref--; |
767 | 767 | ||
768 | switch ( t ) { | 768 | switch ( t ) { |
769 | case Ruled: { | 769 | case Ruled: { |
770 | bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr | 770 | bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr |
771 | QPixmap bg; | 771 | QPixmap bg; |
772 | if ( bgCache->contains( bgName ) ) { | 772 | if ( bgCache->contains( bgName ) ) { |
773 | (*bgCache)[bgName]->ref++; | 773 | (*bgCache)[bgName]->ref++; |
774 | bg = (*bgCache)[bgName]->pm; | 774 | bg = (*bgCache)[bgName]->pm; |
775 | } else { | 775 | } else { |
776 | bg.resize( width(), 9 ); | 776 | bg.resize( width(), 9 ); |
777 | QPainter painter( &bg ); | 777 | QPainter painter( &bg ); |
778 | for ( int i = 0; i < 3; i++ ) { | 778 | for ( int i = 0; i < 3; i++ ) { |
779 | painter.setPen( white ); | 779 | painter.setPen( white ); |
780 | painter.drawLine( 0, i*3, width()-1, i*3 ); | 780 | painter.drawLine( 0, i*3, width()-1, i*3 ); |
781 | painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); | 781 | painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); |
782 | painter.setPen( colorGroup().background().light(105) ); | 782 | painter.setPen( colorGroup().background().light(105) ); |
783 | painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); | 783 | painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); |
784 | } | 784 | } |
785 | painter.end(); | 785 | painter.end(); |
786 | bgCache->insert( bgName, new BgPixmap(bg) ); | 786 | bgCache->insert( bgName, new BgPixmap(bg) ); |
787 | } | 787 | } |
788 | icons->setBackgroundPixmap( bg ); | 788 | icons->setBackgroundPixmap( bg ); |
789 | break; | 789 | break; |
790 | } | 790 | } |
791 | 791 | ||
792 | case SolidColor: | 792 | case SolidColor: |
793 | icons->setBackgroundPixmap( QPixmap() ); | 793 | icons->setBackgroundPixmap( QPixmap() ); |
794 | if ( val.isEmpty() ) { | 794 | if ( val.isEmpty() ) { |
795 | icons->setBackgroundColor( colorGroup().base() ); | 795 | icons->setBackgroundColor( colorGroup().base() ); |
796 | } else { | 796 | } else { |
797 | icons->setBackgroundColor( val ); | 797 | icons->setBackgroundColor( val ); |
798 | } | 798 | } |
799 | bgName = ""; | 799 | bgName = ""; |
800 | break; | 800 | break; |
801 | 801 | ||
802 | case Image: | 802 | case Image: |
803 | bgName = val; | 803 | bgName = val; |
804 | if ( bgCache->contains( bgName ) ) { | 804 | if ( bgCache->contains( bgName ) ) { |
805 | (*bgCache)[bgName]->ref++; | 805 | (*bgCache)[bgName]->ref++; |
806 | icons->setBackgroundPixmap( (*bgCache)[bgName]->pm ); | 806 | icons->setBackgroundPixmap( (*bgCache)[bgName]->pm ); |
807 | } else { | 807 | } else { |
808 | qDebug( "Loading image: %s", val.latin1() ); | ||
809 | QPixmap bg( Resource::loadPixmap( val ) ); | 808 | QPixmap bg( Resource::loadPixmap( val ) ); |
810 | if ( bg.isNull() ) { | 809 | if ( bg.isNull() ) { |
811 | QImageIO imgio; | 810 | QImageIO imgio; |
812 | imgio.setFileName( bgName ); | 811 | imgio.setFileName( bgName ); |
813 | QSize ds = qApp->desktop()->size(); | 812 | QSize ds = qApp->desktop()->size(); |
814 | QString param( "Scale( %1, %2, ScaleMin )" ); // No tr | 813 | QString param( "Scale( %1, %2, ScaleMin )" ); // No tr |
815 | imgio.setParameters( param.arg(ds.width()).arg(ds.height()).latin1() ); | 814 | imgio.setParameters( param.arg(ds.width()).arg(ds.height()).latin1() ); |
816 | imgio.read(); | 815 | imgio.read(); |
817 | bg = imgio.image(); | 816 | bg = imgio.image(); |
818 | } | 817 | } |
819 | bgCache->insert( bgName, new BgPixmap(bg) ); | 818 | bgCache->insert( bgName, new BgPixmap(bg) ); |
820 | icons->setBackgroundPixmap( bg ); | 819 | icons->setBackgroundPixmap( bg ); |
821 | } | 820 | } |
822 | break; | 821 | break; |
823 | } | 822 | } |
824 | 823 | ||
825 | // remove unreferenced backgrounds. | 824 | // remove unreferenced backgrounds. |
826 | QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); | 825 | QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); |
827 | while ( it != bgCache->end() ) { | 826 | while ( it != bgCache->end() ) { |
828 | QMap<QString,BgPixmap*>::Iterator curr = it; | 827 | QMap<QString,BgPixmap*>::Iterator curr = it; |
829 | ++it; | 828 | ++it; |
830 | if ( (*curr)->ref == 0 ) { | 829 | if ( (*curr)->ref == 0 ) { |
831 | delete (*curr); | 830 | delete (*curr); |
832 | bgCache->remove( curr ); | 831 | bgCache->remove( curr ); |
833 | } | 832 | } |
834 | } | 833 | } |
835 | 834 | ||
836 | bgType = t; | 835 | bgType = t; |
837 | icons->viewport()->update(); | 836 | icons->viewport()->update(); |
838 | } | 837 | } |
839 | 838 | ||
840 | void LauncherView::setTextColor( const QColor &tc ) | 839 | void LauncherView::setTextColor( const QColor &tc ) |
841 | { | 840 | { |
842 | textCol = tc; | 841 | textCol = tc; |
843 | QColorGroup cg = icons->colorGroup(); | 842 | QColorGroup cg = icons->colorGroup(); |
844 | cg.setColor( QColorGroup::Text, tc ); | 843 | cg.setColor( QColorGroup::Text, tc ); |
845 | icons->setPalette( QPalette(cg,cg,cg) ); | 844 | icons->setPalette( QPalette(cg,cg,cg) ); |
846 | icons->viewport()->update(); | 845 | icons->viewport()->update(); |
847 | } | 846 | } |
848 | 847 | ||
849 | void LauncherView::setViewFont( const QFont &f ) | 848 | void LauncherView::setViewFont( const QFont &f ) |
850 | { | 849 | { |
851 | icons->setFont( f ); | 850 | icons->setFont( f ); |
852 | } | 851 | } |
853 | 852 | ||
854 | void LauncherView::unsetViewFont( ) | 853 | void LauncherView::unsetViewFont( ) |
855 | { | 854 | { |
856 | icons->unsetFont( ); | 855 | icons->unsetFont( ); |
857 | } | 856 | } |
858 | 857 | ||
859 | void LauncherView::resizeEvent(QResizeEvent *e) | 858 | void LauncherView::resizeEvent(QResizeEvent *e) |
860 | { | 859 | { |
861 | QVBox::resizeEvent( e ); | 860 | QVBox::resizeEvent( e ); |
862 | if ( e->size().width() != e->oldSize().width() ) | 861 | if ( e->size().width() != e->oldSize().width() ) |
863 | sort(); | 862 | sort(); |
864 | } | 863 | } |
865 | 864 | ||
866 | void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) | 865 | void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) |
867 | { | 866 | { |
868 | icons->clear(); | 867 | icons->clear(); |
869 | internalPopulate( folder, typefilter ); | 868 | internalPopulate( folder, typefilter ); |
870 | } | 869 | } |
871 | 870 | ||
872 | QString LauncherView::getAllDocLinkInfo() const | 871 | QString LauncherView::getAllDocLinkInfo() const |
873 | { | 872 | { |
874 | return icons->getAllDocLinkInfo(); | 873 | return icons->getAllDocLinkInfo(); |
875 | } | 874 | } |
876 | 875 | ||
877 | void LauncherView::selectionChanged() | 876 | void LauncherView::selectionChanged() |
878 | { | 877 | { |
879 | QIconViewItem* item = icons->currentItem(); | 878 | QIconViewItem* item = icons->currentItem(); |
880 | if ( item && item->isSelected() ) { | 879 | if ( item && item->isSelected() ) { |
881 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 880 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
882 | if ( icons->inKeyEvent() ) // not for mouse press | 881 | if ( icons->inKeyEvent() ) // not for mouse press |
883 | emit clicked( appLnk ); | 882 | emit clicked( appLnk ); |
884 | item->setSelected(FALSE); | 883 | item->setSelected(FALSE); |
885 | } | 884 | } |
886 | } | 885 | } |
887 | 886 | ||
888 | void LauncherView::returnPressed( QIconViewItem *item ) | 887 | void LauncherView::returnPressed( QIconViewItem *item ) |
889 | { | 888 | { |
890 | if ( item ) { | 889 | if ( item ) { |
891 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 890 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
892 | emit clicked( appLnk ); | 891 | emit clicked( appLnk ); |
893 | } | 892 | } |
894 | } | 893 | } |
895 | 894 | ||
896 | void LauncherView::itemClicked( int btn, QIconViewItem *item ) | 895 | void LauncherView::itemClicked( int btn, QIconViewItem *item ) |
897 | { | 896 | { |
898 | if ( item ) { | 897 | if ( item ) { |
899 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 898 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
900 | if ( btn == LeftButton ) { | 899 | if ( btn == LeftButton ) { |
901 | // Make sure it's the item we execute that gets highlighted | 900 | // Make sure it's the item we execute that gets highlighted |
902 | icons->setCurrentItem( item ); | 901 | icons->setCurrentItem( item ); |
903 | emit clicked( appLnk ); | 902 | emit clicked( appLnk ); |
904 | } | 903 | } |
905 | item->setSelected(FALSE); | 904 | item->setSelected(FALSE); |
906 | } | 905 | } |
907 | } | 906 | } |
908 | 907 | ||
909 | void LauncherView::itemPressed( int btn, QIconViewItem *item ) | 908 | void LauncherView::itemPressed( int btn, QIconViewItem *item ) |
910 | { | 909 | { |
911 | if ( item ) { | 910 | if ( item ) { |
912 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 911 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
913 | if ( btn == RightButton ) | 912 | if ( btn == RightButton ) |
914 | emit rightPressed( appLnk ); | 913 | emit rightPressed( appLnk ); |
915 | /* | 914 | /* |
916 | else if ( btn == LeftButton ) | 915 | else if ( btn == LeftButton ) |
917 | emit clicked( appLnk ); | 916 | emit clicked( appLnk ); |
918 | */ | 917 | */ |
919 | item->setSelected(FALSE); | 918 | item->setSelected(FALSE); |
920 | } | 919 | } |
921 | } | 920 | } |
922 | 921 | ||
923 | void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter ) | 922 | void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter ) |
924 | { | 923 | { |
925 | QListIterator<AppLnk> it( folder->children() ); | 924 | QListIterator<AppLnk> it( folder->children() ); |
926 | icons->setTypeFilter(typefilter,FALSE); | 925 | icons->setTypeFilter(typefilter,FALSE); |
927 | 926 | ||
928 | while ( it.current() ) { | 927 | while ( it.current() ) { |
929 | // show only the icons for existing files | 928 | // show only the icons for existing files |
930 | if (QFile(it.current()->file()).exists() || ( it.current()->file().left(4) == "http" )) { | 929 | if (QFile(it.current()->file()).exists() || ( it.current()->file().left(4) == "http" )) { |
931 | icons->addItem(*it,FALSE); | 930 | icons->addItem(*it,FALSE); |
932 | } | 931 | } |
933 | else { | 932 | else { |
934 | //maybe insert some .desktop file deletion code later | 933 | //maybe insert some .desktop file deletion code later |
935 | //maybe dir specific | 934 | //maybe dir specific |
936 | } | 935 | } |
937 | ++it; | 936 | ++it; |
938 | } | 937 | } |
939 | 938 | ||
940 | icons->sort(); | 939 | icons->sort(); |
941 | } | 940 | } |
942 | 941 | ||
943 | bool LauncherView::removeLink(const QString& linkfile) | 942 | bool LauncherView::removeLink(const QString& linkfile) |
944 | { | 943 | { |
945 | return icons->removeLink(linkfile); | 944 | return icons->removeLink(linkfile); |
946 | } | 945 | } |
947 | 946 | ||
948 | void LauncherView::sort() | 947 | void LauncherView::sort() |
949 | { | 948 | { |
950 | icons->sort(); | 949 | icons->sort(); |
951 | } | 950 | } |
952 | 951 | ||
953 | void LauncherView::addItem(AppLnk* app, bool resort) | 952 | void LauncherView::addItem(AppLnk* app, bool resort) |
954 | { | 953 | { |
955 | icons->addItem(app,resort); | 954 | icons->addItem(app,resort); |
956 | } | 955 | } |
957 | 956 | ||
958 | void LauncherView::setFileSystems(const QList<FileSystem> &) | 957 | void LauncherView::setFileSystems(const QList<FileSystem> &) |
959 | { | 958 | { |
960 | // ### does nothing now... | 959 | // ### does nothing now... |
961 | } | 960 | } |
962 | 961 | ||
963 | void LauncherView::paletteChange( const QPalette &p ) | 962 | void LauncherView::paletteChange( const QPalette &p ) |
964 | { | 963 | { |
965 | icons->unsetPalette(); | 964 | icons->unsetPalette(); |
966 | QVBox::paletteChange( p ); | 965 | QVBox::paletteChange( p ); |
967 | if ( bgType == Ruled ) | 966 | if ( bgType == Ruled ) |
968 | setBackgroundType( Ruled, QString::null ); | 967 | setBackgroundType( Ruled, QString::null ); |
969 | QColorGroup cg = icons->colorGroup(); | 968 | QColorGroup cg = icons->colorGroup(); |
970 | cg.setColor( QColorGroup::Text, textCol ); | 969 | cg.setColor( QColorGroup::Text, textCol ); |
971 | icons->setPalette( QPalette(cg,cg,cg) ); | 970 | icons->setPalette( QPalette(cg,cg,cg) ); |
972 | } | 971 | } |
973 | 972 | ||
974 | 973 | ||
975 | void LauncherView::setBusyIndicatorType ( const QString &type ) | 974 | void LauncherView::setBusyIndicatorType ( const QString &type ) |
976 | { | 975 | { |
977 | if ( type. lower ( ) == "blink" ) | 976 | if ( type. lower ( ) == "blink" ) |
978 | icons-> setBusyIndicatorType ( BIT_Blinking ); | 977 | icons-> setBusyIndicatorType ( BIT_Blinking ); |
979 | else | 978 | else |
980 | icons-> setBusyIndicatorType ( BIT_Normal ); | 979 | icons-> setBusyIndicatorType ( BIT_Normal ); |
981 | } | 980 | } |
982 | 981 | ||