summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp23
-rw-r--r--core/launcher/launcherview.h2
2 files changed, 17 insertions, 8 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 42704ba..72313e3 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -304,297 +304,304 @@ int LauncherIconView::compare(const AppLnk* a, const AppLnk* b)
304 304
305void LauncherIconView::setSortMethod( SortMethod m ) 305void LauncherIconView::setSortMethod( SortMethod m )
306{ 306{
307 if ( sortmeth != m ) { 307 if ( sortmeth != m ) {
308 sortmeth = m; 308 sortmeth = m;
309 sort(); 309 sort();
310 } 310 }
311} 311}
312 312
313void LauncherIconView::setCategoryFilter( int catfilter, bool resort ) 313void LauncherIconView::setCategoryFilter( int catfilter, bool resort )
314{ 314{
315 Categories cat; 315 Categories cat;
316 cat.load( categoryFileName() ); 316 cat.load( categoryFileName() );
317 QString str; 317 QString str;
318 if ( catfilter == -2 ) 318 if ( catfilter == -2 )
319 cf = 0; 319 cf = 0;
320 else 320 else
321 cf = catfilter; 321 cf = catfilter;
322 hideOrShowItems(resort); 322 hideOrShowItems(resort);
323} 323}
324 324
325void LauncherIconView::setTypeFilter(const QString& typefilter, bool resort) 325void LauncherIconView::setTypeFilter(const QString& typefilter, bool resort)
326{ 326{
327 tf = QRegExp(typefilter,FALSE,TRUE); 327 tf = QRegExp(typefilter,FALSE,TRUE);
328 hideOrShowItems(resort); 328 hideOrShowItems(resort);
329} 329}
330 330
331void LauncherIconView::setItemTextPos( ItemTextPos pos ) 331void LauncherIconView::setItemTextPos( ItemTextPos pos )
332{ 332{
333 calculateGrid( pos ); 333 calculateGrid( pos );
334 QIconView::setItemTextPos( pos ); 334 QIconView::setItemTextPos( pos );
335} 335}
336 336
337void LauncherIconView::drawBackground( QPainter *p, const QRect &r ) 337void LauncherIconView::drawBackground( QPainter *p, const QRect &r )
338{ 338{
339 if ( !bgPixmap.isNull() ) { 339 if ( !bgPixmap.isNull() ) {
340 p->drawTiledPixmap( r, bgPixmap, 340 p->drawTiledPixmap( r, bgPixmap,
341 QPoint( (r.x() + contentsX()) % bgPixmap.width(), 341 QPoint( (r.x() + contentsX()) % bgPixmap.width(),
342 (r.y() + contentsY()) % bgPixmap.height() ) ); 342 (r.y() + contentsY()) % bgPixmap.height() ) );
343 } else { 343 } else {
344 p->fillRect( r, bgColor ); 344 p->fillRect( r, bgColor );
345 } 345 }
346} 346}
347 347
348void LauncherIconView::addCatsAndMimes(AppLnk* app) 348void LauncherIconView::addCatsAndMimes(AppLnk* app)
349 { 349 {
350 // QStringList c = app->categories(); 350 // QStringList c = app->categories();
351 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { 351 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) {
352 // cats.replace(*cit,(void*)1); 352 // cats.replace(*cit,(void*)1);
353 // } 353 // }
354 QString maj=app->type(); 354 QString maj=app->type();
355 int sl=maj.find('/'); 355 int sl=maj.find('/');
356 if (sl>=0) { 356 if (sl>=0) {
357 QString k; 357 QString k;
358 k = maj.left(12) == "application/" ? maj : maj.left(sl); 358 k = maj.left(12) == "application/" ? maj : maj.left(sl);
359 mimes.replace(k,(void*)1); 359 mimes.replace(k,(void*)1);
360 } 360 }
361} 361}
362 362
363void LauncherIconView::setBusy(bool on) 363void LauncherIconView::setBusy(bool on)
364{ 364{
365#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 365#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
366 if ( busyPix.isNull() ) { 366 if ( busyPix.isNull() ) {
367 int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 367 int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
368 busyPix.convertFromImage( Resource::loadImage( "busy" ).smoothScale( size * 16, size ) ); 368 busyPix.convertFromImage( Resource::loadImage( "busy" ).smoothScale( size * 16, size ) );
369 } 369 }
370#endif 370#endif
371 371
372 if ( on ) { 372 if ( on ) {
373 busyTimer = startTimer( 100 ); 373 busyTimer = startTimer( 100 );
374 } else { 374 } else {
375 if ( busyTimer ) { 375 if ( busyTimer ) {
376 killTimer( busyTimer ); 376 killTimer( busyTimer );
377 busyTimer = 0; 377 busyTimer = 0;
378 } 378 }
379 } 379 }
380 380
381 LauncherItem *c = on ? (LauncherItem*)currentItem() : 0; 381 LauncherItem *c = on ? (LauncherItem*)currentItem() : 0;
382 382
383 if ( bsy != c ) { 383 if ( bsy != c ) {
384 LauncherItem *oldBusy = bsy; 384 LauncherItem *oldBusy = bsy;
385 bsy = c; 385 bsy = c;
386 if ( oldBusy ) { 386 if ( oldBusy ) {
387 oldBusy->resetIcon(); 387 oldBusy->resetIcon();
388 } 388 }
389 if ( bsy ) { 389 if ( bsy ) {
390 bsy->setBusyIndicatorType( busyType ) ; 390 bsy->setBusyIndicatorType( busyType ) ;
391 bsy->animateIcon(); 391 bsy->animateIcon();
392 } 392 }
393 } 393 }
394} 394}
395 395
396void LauncherIconView::clear() 396void LauncherIconView::clear()
397{ 397{
398 mimes.clear(); 398 mimes.clear();
399 cats.clear(); 399 cats.clear();
400 QIconView::clear(); 400 QIconView::clear();
401 hidden.clear(); 401 hidden.clear();
402} 402}
403 403
404QStringList LauncherIconView::mimeTypes() const 404QStringList LauncherIconView::mimeTypes() const
405{ 405{
406 QStringList r; 406 QStringList r;
407 QDictIterator<void> it(mimes); 407 QDictIterator<void> it(mimes);
408 while (it.current()) { 408 while (it.current()) {
409 r.append(it.currentKey()); 409 r.append(it.currentKey());
410 ++it; 410 ++it;
411 } 411 }
412 r.sort(); 412 r.sort();
413 return r; 413 return r;
414} 414}
415 415
416LauncherItem*LauncherIconView::findDocItem(const QString&fname) 416LauncherItem*LauncherIconView::findDocItem(const QString&fname)
417{ 417{
418 LauncherItem* item = (LauncherItem*)firstItem(); 418 LauncherItem* item = (LauncherItem*)firstItem();
419 while (item) { 419 while (item) {
420 if (item->appLnk()->file()==fname) { 420 if (item->appLnk()->file()==fname) {
421 break; 421 break;
422 } 422 }
423 item = (LauncherItem*)item->nextItem(); 423 item = (LauncherItem*)item->nextItem();
424 } 424 }
425 return item; 425 return item;
426} 426}
427 427
428void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width) 428void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width)
429{ 429{
430 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 430 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
431 if (s!=width) return; 431 if (s!=width) return;
432 LauncherItem*item = findDocItem(aFile); 432 LauncherItem*item = 0;
433 QMap<QString,LauncherItem*>::Iterator it;
434 if ( ( it = m_itemCache.find(aFile))!=m_itemCache.end()) {
435 item = it.data();
436 m_itemCache.remove(it);
437 } else {
438 item = findDocItem(aFile);
439 }
433 if (!item||!item->isEyeImage()) return; 440 if (!item||!item->isEyeImage()) return;
434 item->setEyePixmap(aPixmap); 441 item->setEyePixmap(aPixmap);
435} 442}
436 443
437void LauncherIconView::checkCallback() 444void LauncherIconView::checkCallback()
438{ 445{
439 if (m_EyeCallBack) { 446 if (!m_EyeCallBack) {
440 return; 447 m_EyeCallBack = new LauncherThumbReceiver();
448 connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
449 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
450 m_eyeTimer.changeInterval(600000);
441 } 451 }
442 m_EyeCallBack = new LauncherThumbReceiver();
443 connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
444 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
445} 452}
446 453
447void LauncherIconView::addCheckItem(AppLnk* app) 454void LauncherIconView::addCheckItem(AppLnk* app)
448{ 455{
449 LauncherItem*item = new LauncherItem( this, app, bigIcns ); 456 LauncherItem*item = new LauncherItem( this, app, bigIcns );
450 if (item->isEyeImage()) { 457 if (item->isEyeImage()) {
451 checkCallback(); 458 checkCallback();
452 } 459 }
453} 460}
454 461
455void LauncherIconView::requestEyePix(const LauncherItem*item) 462void LauncherIconView::requestEyePix(const LauncherItem*item)
456{ 463{
457 if (!item) return; 464 if (!item) return;
458 if (item->isEyeImage()) { 465 if (item->isEyeImage()) {
459 m_eyeTimer.changeInterval(600000);
460 checkCallback(); 466 checkCallback();
461 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 467 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
468 m_itemCache[item->appLnk()->file()]=(LauncherItem*)item;
462 m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); 469 m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s);
463 } 470 }
464} 471}
465 472
466void LauncherIconView::stopEyeTimer() 473void LauncherIconView::stopEyeTimer()
467{ 474{
468 odebug << "Launcherview: delete opie-eye handle" << oendl;
469 if (m_EyeCallBack) { 475 if (m_EyeCallBack) {
470 delete m_EyeCallBack; 476 delete m_EyeCallBack;
471 m_EyeCallBack=0; 477 m_EyeCallBack=0;
472 } 478 }
479 m_itemCache.clear();
473 m_eyeTimer.stop(); 480 m_eyeTimer.stop();
474} 481}
475 482
476void LauncherIconView::addItem(AppLnk* app, bool resort) 483void LauncherIconView::addItem(AppLnk* app, bool resort)
477{ 484{
478 addCatsAndMimes(app); 485 addCatsAndMimes(app);
479 if ( (tf.isEmpty() || tf.match(app->type()) >= 0) 486 if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
480 && (cf == 0 || app->categories().contains(cf) 487 && (cf == 0 || app->categories().contains(cf)
481 || cf == -1 && app->categories().count() == 0 ) ) { 488 || cf == -1 && app->categories().count() == 0 ) ) {
482 addCheckItem(app); 489 addCheckItem(app);
483 } else { 490 } else {
484 hidden.append(app); 491 hidden.append(app);
485 } 492 }
486 if ( resort ){ 493 if ( resort ){
487 sort(); 494 sort();
488 } 495 }
489} 496}
490 497
491void LauncherIconView::updateCategoriesAndMimeTypes() 498void LauncherIconView::updateCategoriesAndMimeTypes()
492{ 499{
493 mimes.clear(); 500 mimes.clear();
494 cats.clear(); 501 cats.clear();
495 LauncherItem* item = (LauncherItem*)firstItem(); 502 LauncherItem* item = (LauncherItem*)firstItem();
496 while (item) { 503 while (item) {
497 addCatsAndMimes(item->appLnk()); 504 addCatsAndMimes(item->appLnk());
498 item = (LauncherItem*)item->nextItem(); 505 item = (LauncherItem*)item->nextItem();
499 } 506 }
500 QListIterator<AppLnk> it(hidden); 507 QListIterator<AppLnk> it(hidden);
501 AppLnk* l; 508 AppLnk* l;
502 while ((l=it.current())) { 509 while ((l=it.current())) {
503 addCatsAndMimes(l); 510 addCatsAndMimes(l);
504 ++it; 511 ++it;
505 } 512 }
506} 513}
507 514
508void LauncherIconView::hideOrShowItems(bool resort) 515void LauncherIconView::hideOrShowItems(bool resort)
509{ 516{
510 viewport()->setUpdatesEnabled( FALSE ); 517 viewport()->setUpdatesEnabled( FALSE );
511 hidden.setAutoDelete(FALSE); 518 hidden.setAutoDelete(FALSE);
512 QList<AppLnk> links=hidden; 519 QList<AppLnk> links=hidden;
513 hidden.clear(); 520 hidden.clear();
514 hidden.setAutoDelete(TRUE); 521 hidden.setAutoDelete(TRUE);
515 LauncherItem* item = (LauncherItem*)firstItem(); 522 LauncherItem* item = (LauncherItem*)firstItem();
516 while (item) { 523 while (item) {
517 links.append(item->takeAppLnk()); 524 links.append(item->takeAppLnk());
518 item = (LauncherItem*)item->nextItem(); 525 item = (LauncherItem*)item->nextItem();
519 } 526 }
520 clear(); 527 clear();
521 QListIterator<AppLnk> it(links); 528 QListIterator<AppLnk> it(links);
522 AppLnk* l; 529 AppLnk* l;
523 while ((l=it.current())) { 530 while ((l=it.current())) {
524 addItem(l,FALSE); 531 addItem(l,FALSE);
525 ++it; 532 ++it;
526 } 533 }
527 if ( resort && !autoArrange() ) 534 if ( resort && !autoArrange() )
528 sort(); 535 sort();
529 viewport()->setUpdatesEnabled( TRUE ); 536 viewport()->setUpdatesEnabled( TRUE );
530} 537}
531 538
532bool LauncherIconView::removeLink(const QString& linkfile) 539bool LauncherIconView::removeLink(const QString& linkfile)
533{ 540{
534 LauncherItem* item = (LauncherItem*)firstItem(); 541 LauncherItem* item = (LauncherItem*)firstItem();
535 AppLnk* l; 542 AppLnk* l;
536 bool did = FALSE; 543 bool did = FALSE;
537 DocLnk dl(linkfile); 544 DocLnk dl(linkfile);
538 while (item) { 545 while (item) {
539 l = item->appLnk(); 546 l = item->appLnk();
540 LauncherItem *nextItem = (LauncherItem *)item->nextItem(); 547 LauncherItem *nextItem = (LauncherItem *)item->nextItem();
541 if ( l->linkFileKnown() && l->linkFile() == linkfile || l->fileKnown() && 548 if ( l->linkFileKnown() && l->linkFile() == linkfile || l->fileKnown() &&
542 ( l->file() == linkfile || dl.isValid() && dl.file() == l->file() ) ) { 549 ( l->file() == linkfile || dl.isValid() && dl.file() == l->file() ) ) {
543 delete item; 550 delete item;
544 did = TRUE; 551 did = TRUE;
545 } 552 }
546 item = nextItem; 553 item = nextItem;
547 } 554 }
548 QListIterator<AppLnk> it(hidden); 555 QListIterator<AppLnk> it(hidden);
549 while ((l=it.current())) { 556 while ((l=it.current())) {
550 ++it; 557 ++it;
551 if ( l->linkFileKnown() && l->linkFile() == linkfile 558 if ( l->linkFileKnown() && l->linkFile() == linkfile
552 || l->file() == linkfile 559 || l->file() == linkfile
553 || dl.isValid() && dl.file() == l->file() ) { 560 || dl.isValid() && dl.file() == l->file() ) {
554 hidden.removeRef(l); 561 hidden.removeRef(l);
555 did = TRUE; 562 did = TRUE;
556 } 563 }
557 } 564 }
558 return did; 565 return did;
559} 566}
560 567
561void LauncherIconView::timerEvent( QTimerEvent *te ) 568void LauncherIconView::timerEvent( QTimerEvent *te )
562{ 569{
563 if ( te->timerId() == busyTimer ) { 570 if ( te->timerId() == busyTimer ) {
564 if ( bsy ) 571 if ( bsy )
565 bsy->animateIcon(); 572 bsy->animateIcon();
566 } else { 573 } else {
567 QIconView::timerEvent( te ); 574 QIconView::timerEvent( te );
568 } 575 }
569} 576}
570 577
571void LauncherIconView::setBigIcons( bool bi ) 578void LauncherIconView::setBigIcons( bool bi )
572{ 579{
573 bigIcns = bi; 580 bigIcns = bi;
574#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 581#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
575 busyPix.resize(0,0); 582 busyPix.resize(0,0);
576#endif 583#endif
577} 584}
578 585
579QIconViewItem* LauncherIconView::busyItem() const 586QIconViewItem* LauncherIconView::busyItem() const
580{ 587{
581 return bsy; 588 return bsy;
582} 589}
583 590
584void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 591void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
585 592
586void LauncherIconView::calculateGrid( ItemTextPos pos ) 593void LauncherIconView::calculateGrid( ItemTextPos pos )
587{ 594{
588 int dw = QApplication::desktop()->width(); 595 int dw = QApplication::desktop()->width();
589 int viewerWidth = dw-style().scrollBarExtent().width(); 596 int viewerWidth = dw-style().scrollBarExtent().width();
590 if ( pos == Bottom ) { 597 if ( pos == Bottom ) {
591 int cols = 3; 598 int cols = 3;
592 if ( viewerWidth <= 200 ) 599 if ( viewerWidth <= 200 )
593 cols = 2; 600 cols = 2;
594 else if ( viewerWidth >= 400 ) 601 else if ( viewerWidth >= 400 )
595 cols = viewerWidth/96; 602 cols = viewerWidth/96;
596 setSpacing( 4 ); 603 setSpacing( 4 );
597 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 604 setGridX( (viewerWidth-(cols+1)*spacing())/cols );
598 setGridY( fontMetrics().height()*2+24 ); 605 setGridY( fontMetrics().height()*2+24 );
599 } else { 606 } else {
600 int cols = 2; 607 int cols = 2;
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
index ebb1362..94c367c 100644
--- a/core/launcher/launcherview.h
+++ b/core/launcher/launcherview.h
@@ -1,244 +1,246 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef LAUNCHERVIEW_H 20#ifndef LAUNCHERVIEW_H
21#define LAUNCHERVIEW_H 21#define LAUNCHERVIEW_H
22 22
23#include <qtopia/storage.h> 23#include <qtopia/storage.h>
24#include <qtopia/applnk.h> 24#include <qtopia/applnk.h>
25 25
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qiconview.h> 27#include <qiconview.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qmap.h>
29 30
30class CategorySelect; 31class CategorySelect;
31class LauncherIconView; 32class LauncherIconView;
32class LauncherItem; 33class LauncherItem;
33class QIconViewItem; 34class QIconViewItem;
34class QLabel; 35class QLabel;
35class QWidgetStack; 36class QWidgetStack;
36class MenuButton; 37class MenuButton;
37class QComboBox; 38class QComboBox;
38 39
39 40
40 41
41enum BusyIndicatorType { 42enum BusyIndicatorType {
42 BIT_Normal = 0, 43 BIT_Normal = 0,
43 BIT_Animated 44 BIT_Animated
44}; 45};
45 46
46class LauncherView : public QVBox 47class LauncherView : public QVBox
47{ 48{
48 Q_OBJECT 49 Q_OBJECT
49 50
50public: 51public:
51 LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 52 LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
52 ~LauncherView(); 53 ~LauncherView();
53 54
54 void hideIcons(); 55 void hideIcons();
55 56
56 bool removeLink(const QString& linkfile); 57 bool removeLink(const QString& linkfile);
57 void addItem(AppLnk* app, bool resort=TRUE); 58 void addItem(AppLnk* app, bool resort=TRUE);
58 void removeAllItems(); 59 void removeAllItems();
59 void setSortEnabled(bool); 60 void setSortEnabled(bool);
60 void setUpdatesEnabled(bool); 61 void setUpdatesEnabled(bool);
61 void sort(); 62 void sort();
62 63
63 void setToolsEnabled(bool); 64 void setToolsEnabled(bool);
64 void updateTools(); 65 void updateTools();
65 66
66 void setBusy(bool); 67 void setBusy(bool);
67 void setBusyIndicatorType( const QString& ); 68 void setBusyIndicatorType( const QString& );
68 69
69 enum ViewMode { Icon, List }; 70 enum ViewMode { Icon, List };
70 void setViewMode( ViewMode m ); 71 void setViewMode( ViewMode m );
71 ViewMode viewMode() const { return vmode; } 72 ViewMode viewMode() const { return vmode; }
72 73
73 enum BackgroundType { Ruled, SolidColor, Image }; 74 enum BackgroundType { Ruled, SolidColor, Image };
74 void setBackgroundType( BackgroundType t, const QString & ); 75 void setBackgroundType( BackgroundType t, const QString & );
75 BackgroundType backgroundType() const { return bgType; } 76 BackgroundType backgroundType() const { return bgType; }
76 77
77 void setTextColor( const QColor & ); 78 void setTextColor( const QColor & );
78 QColor textColor() const { return textCol; } 79 QColor textColor() const { return textCol; }
79 80
80 void setViewFont( const QFont & ); 81 void setViewFont( const QFont & );
81 void clearViewFont(); 82 void clearViewFont();
82 83
83 void relayout(void); 84 void relayout(void);
84 85
85signals: 86signals:
86 void clicked( const AppLnk * ); 87 void clicked( const AppLnk * );
87 void rightPressed( AppLnk * ); 88 void rightPressed( AppLnk * );
88 89
89protected slots: 90protected slots:
90 void selectionChanged(); 91 void selectionChanged();
91 void returnPressed( QIconViewItem *item ); 92 void returnPressed( QIconViewItem *item );
92 void itemClicked( int, QIconViewItem * ); 93 void itemClicked( int, QIconViewItem * );
93 void itemPressed( int, QIconViewItem * ); 94 void itemPressed( int, QIconViewItem * );
94 void sortBy(int); 95 void sortBy(int);
95 void showType(int); 96 void showType(int);
96 void showCategory( int ); 97 void showCategory( int );
97 void resizeEvent(QResizeEvent *); 98 void resizeEvent(QResizeEvent *);
98 void flushBgCache(); 99 void flushBgCache();
99 100
100protected: 101protected:
101 void paletteChange( const QPalette & ); 102 void paletteChange( const QPalette & );
102 103
103 void fontChanged(const QFont &); 104 void fontChanged(const QFont &);
104 105
105private: 106private:
106 static bool bsy; 107 static bool bsy;
107 QWidget* tools; 108 QWidget* tools;
108 LauncherIconView* icons; 109 LauncherIconView* icons;
109 QComboBox *typemb; 110 QComboBox *typemb;
110 QStringList typelist; 111 QStringList typelist;
111 CategorySelect *catmb; 112 CategorySelect *catmb;
112 ViewMode vmode; 113 ViewMode vmode;
113 BackgroundType bgType; 114 BackgroundType bgType;
114 QString bgName; 115 QString bgName;
115 QColor textCol; 116 QColor textCol;
116 117
117 QImage loadBackgroundImage(QString &fname); 118 QImage loadBackgroundImage(QString &fname);
118 119
119}; 120};
120 121
121/* from opie-eye */ 122/* from opie-eye */
122struct PixmapInfo { 123struct PixmapInfo {
123 PixmapInfo() : width( -1 ), height( -1 ) {} 124 PixmapInfo() : width( -1 ), height( -1 ) {}
124 bool operator==( const PixmapInfo& r ) { 125 bool operator==( const PixmapInfo& r ) {
125 if ( width != r.width ) return false; 126 if ( width != r.width ) return false;
126 if ( height != r.height ) return false; 127 if ( height != r.height ) return false;
127 if ( file != r.file ) return false; 128 if ( file != r.file ) return false;
128 return true; 129 return true;
129 } 130 }
130 int width, height; 131 int width, height;
131 QString file; 132 QString file;
132 QPixmap pixmap; 133 QPixmap pixmap;
133}; 134};
134 135
135class LauncherThumbReceiver:public QObject 136class LauncherThumbReceiver:public QObject
136{ 137{
137 Q_OBJECT 138 Q_OBJECT
138 typedef QValueList<PixmapInfo> PixmapInfos; 139 typedef QValueList<PixmapInfo> PixmapInfos;
139public: 140public:
140 LauncherThumbReceiver(); 141 LauncherThumbReceiver();
141 ~LauncherThumbReceiver(); 142 ~LauncherThumbReceiver();
142 void requestThumb(const QString&file,int width,int height); 143 void requestThumb(const QString&file,int width,int height);
143 144
144public slots: 145public slots:
145 void recieve( const QCString&, const QByteArray& ); 146 void recieve( const QCString&, const QByteArray& );
146protected slots: 147protected slots:
147 virtual void sendRequest(); 148 virtual void sendRequest();
148 149
149signals: 150signals:
150 void sig_Thumbnail(const QPixmap&,const QString&,int); 151 void sig_Thumbnail(const QPixmap&,const QString&,int);
151 152
152protected: 153protected:
153 PixmapInfos m_inThumbNail; 154 PixmapInfos m_inThumbNail;
154}; 155};
155 156
156class LauncherIconView : public QIconView { 157class LauncherIconView : public QIconView {
157 Q_OBJECT 158 Q_OBJECT
158public: 159public:
159 LauncherIconView( QWidget* parent, const char* name=0 ); 160 LauncherIconView( QWidget* parent, const char* name=0 );
160 ~LauncherIconView(); 161 ~LauncherIconView();
161 QIconViewItem* busyItem() const; 162 QIconViewItem* busyItem() const;
162 163
163#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 164#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
164 QPixmap busyPixmap() const { return busyPix; } 165 QPixmap busyPixmap() const { return busyPix; }
165#endif 166#endif
166 void setBigIcons( bool bi ); 167 void setBigIcons( bool bi );
167 void updateCategoriesAndMimeTypes(); 168 void updateCategoriesAndMimeTypes();
168 void setBusyIndicatorType ( BusyIndicatorType t ); 169 void setBusyIndicatorType ( BusyIndicatorType t );
169 void doAutoScroll() 170 void doAutoScroll()
170 { 171 {
171 // We don't want rubberbanding (yet) 172 // We don't want rubberbanding (yet)
172 } 173 }
173 174
174 void setBusy(bool on); 175 void setBusy(bool on);
175 bool inKeyEvent() const { return ike; } 176 bool inKeyEvent() const { return ike; }
176 177
177 void addItem(AppLnk* app, bool resort=TRUE); 178 void addItem(AppLnk* app, bool resort=TRUE);
178 bool removeLink(const QString& linkfile); 179 bool removeLink(const QString& linkfile);
179 180
180 QStringList mimeTypes() const; 181 QStringList mimeTypes() const;
181 QStringList categories() const; 182 QStringList categories() const;
182 void clear(); 183 void clear();
183 void addCatsAndMimes(AppLnk* app); 184 void addCatsAndMimes(AppLnk* app);
184 185
185 void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} 186 void setBackgroundOrigin( QWidget::BackgroundOrigin ) {}
186 187
187 void setBackgroundPixmap( const QPixmap &pm ) { 188 void setBackgroundPixmap( const QPixmap &pm ) {
188 bgPixmap = pm; 189 bgPixmap = pm;
189 } 190 }
190 191
191 void setBackgroundColor( const QColor &c ) { 192 void setBackgroundColor( const QColor &c ) {
192 bgColor = c; 193 bgColor = c;
193 } 194 }
194 195
195 void drawBackground( QPainter *p, const QRect &r ); 196 void drawBackground( QPainter *p, const QRect &r );
196 void setItemTextPos( ItemTextPos pos ); 197 void setItemTextPos( ItemTextPos pos );
197 void hideOrShowItems(bool resort); 198 void hideOrShowItems(bool resort);
198 199
199 void setTypeFilter(const QString& typefilter, bool resort); 200 void setTypeFilter(const QString& typefilter, bool resort);
200 void setCategoryFilter( int catfilter, bool resort ); 201 void setCategoryFilter( int catfilter, bool resort );
201 202
202 enum SortMethod { Name, Date, Type }; 203 enum SortMethod { Name, Date, Type };
203 204
204 void setSortMethod( SortMethod m ); 205 void setSortMethod( SortMethod m );
205 int compare(const AppLnk* a, const AppLnk* b); 206 int compare(const AppLnk* a, const AppLnk* b);
206 void requestEyePix(const LauncherItem*which); 207 void requestEyePix(const LauncherItem*which);
207 208
208protected: 209protected:
209 virtual void timerEvent( QTimerEvent *te ); 210 virtual void timerEvent( QTimerEvent *te );
210 void styleChange( QStyle &old ); 211 void styleChange( QStyle &old );
211 void calculateGrid( ItemTextPos pos ); 212 void calculateGrid( ItemTextPos pos );
212 void focusInEvent( QFocusEvent * ) {} 213 void focusInEvent( QFocusEvent * ) {}
213 void focusOutEvent( QFocusEvent * ) {} 214 void focusOutEvent( QFocusEvent * ) {}
214 LauncherItem*findDocItem(const QString&); 215 LauncherItem*findDocItem(const QString&);
215 void addCheckItem(AppLnk* app); 216 void addCheckItem(AppLnk* app);
216 void checkCallback(); 217 void checkCallback();
217 virtual void keyPressEvent(QKeyEvent* e); 218 virtual void keyPressEvent(QKeyEvent* e);
218 219
219protected slots: 220protected slots:
220 void setEyePixmap(const QPixmap&,const QString&,int width); 221 void setEyePixmap(const QPixmap&,const QString&,int width);
221 void stopEyeTimer(); 222 void stopEyeTimer();
222 223
223private: 224private:
224 QList<AppLnk> hidden; 225 QList<AppLnk> hidden;
225 QDict<void> mimes; 226 QDict<void> mimes;
226 QDict<void> cats; 227 QDict<void> cats;
227 SortMethod sortmeth; 228 SortMethod sortmeth;
228 QRegExp tf; 229 QRegExp tf;
229 int cf; 230 int cf;
230 LauncherItem* bsy; 231 LauncherItem* bsy;
231 int busyTimer; 232 int busyTimer;
232 bool ike; 233 bool ike;
233 bool bigIcns; 234 bool bigIcns;
234 QPixmap bgPixmap; 235 QPixmap bgPixmap;
235 QColor bgColor; 236 QColor bgColor;
236 LauncherThumbReceiver*m_EyeCallBack; 237 LauncherThumbReceiver*m_EyeCallBack;
237#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 238#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
238 QPixmap busyPix; 239 QPixmap busyPix;
239#endif 240#endif
240 BusyIndicatorType busyType; 241 BusyIndicatorType busyType;
241 QTimer m_eyeTimer; 242 QTimer m_eyeTimer;
243 QMap<QString,LauncherItem*> m_itemCache;
242}; 244};
243 245
244#endif // LAUNCHERVIEW_H 246#endif // LAUNCHERVIEW_H