summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp28
-rw-r--r--core/launcher/launcherview.h22
2 files changed, 33 insertions, 17 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 506c11e..42704ba 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -226,96 +226,97 @@ void LauncherItem::animateIcon()
226 } 226 }
227 for ( int r = 0; r < count; r++, rgb++ ) { 227 for ( int r = 0; r < count; r++, rgb++ ) {
228#if defined(BRIGHTEN_BUSY_ICON) 228#if defined(BRIGHTEN_BUSY_ICON)
229 QColor c(*rgb); 229 QColor c(*rgb);
230 int h, s, v; 230 int h, s, v;
231 c.hsv(&h,&s,&v); 231 c.hsv(&h,&s,&v);
232 c.setHsv(h,QMAX(s-24,0),QMIN(v+48,255)); 232 c.setHsv(h,QMAX(s-24,0),QMIN(v+48,255));
233 *rgb = qRgba(c.red(),c.green(),c.blue(),qAlpha(*rgb)); 233 *rgb = qRgba(c.red(),c.green(),c.blue(),qAlpha(*rgb));
234#elif defined(ALPHA_FADE_BUSY_ICON) 234#elif defined(ALPHA_FADE_BUSY_ICON)
235 *rgb = qRgba(qRed(*rgb),qGreen(*rgb),qBlue(*rgb),qAlpha(*rgb)/2); 235 *rgb = qRgba(qRed(*rgb),qGreen(*rgb),qBlue(*rgb),qAlpha(*rgb)/2);
236#endif 236#endif
237 } 237 }
238 src.convertFromImage( img ); 238 src.convertFromImage( img );
239 setPixmap( src ); 239 setPixmap( src );
240 } 240 }
241 241
242 iteration++; 242 iteration++;
243 243
244 // Paint animation overlay 244 // Paint animation overlay
245 QPainter p( liv->viewport() ); 245 QPainter p( liv->viewport() );
246 paintAnimatedIcon( &p ); 246 paintAnimatedIcon( &p );
247} 247}
248 248
249void LauncherItem::resetIcon() 249void LauncherItem::resetIcon()
250{ 250{
251 iteration = 0; 251 iteration = 0;
252 setPixmap((isEyeImage()?m_iPixmap:(isBigIcon ? app->bigPixmap() : app->pixmap()))); 252 setPixmap((isEyeImage()?m_iPixmap:(isBigIcon ? app->bigPixmap() : app->pixmap())));
253} 253}
254 254
255void LauncherItem::setEyePixmap(const QPixmap&aIcon) 255void LauncherItem::setEyePixmap(const QPixmap&aIcon)
256{ 256{
257 if (!isEyeImage()) return; 257 if (!isEyeImage()) return;
258 m_iPixmap = aIcon; 258 m_iPixmap = aIcon;
259 setPixmap(aIcon); 259 setPixmap(aIcon);
260 m_EyeImageSet = EYE_ICON; 260 m_EyeImageSet = EYE_ICON;
261} 261}
262 262
263//=========================================================================== 263//===========================================================================
264// Implemantation of LauncherIconview start 264// Implemantation of LauncherIconview start
265//=========================================================================== 265//===========================================================================
266LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) 266LauncherIconView::LauncherIconView( QWidget* parent, const char* name )
267 : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white) 267 : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white)
268{ 268{
269 m_EyeCallBack = 0; 269 m_EyeCallBack = 0;
270 sortmeth = Name; 270 sortmeth = Name;
271 hidden.setAutoDelete(TRUE); 271 hidden.setAutoDelete(TRUE);
272 ike = FALSE; 272 ike = FALSE;
273 calculateGrid( Bottom ); 273 calculateGrid( Bottom );
274 connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer()));
274} 275}
275 276
276LauncherIconView::~LauncherIconView() 277LauncherIconView::~LauncherIconView()
277{ 278{
278#if 0 // debuggery 279#if 0 // debuggery
279 QListIterator<AppLnk> it(hidden); 280 QListIterator<AppLnk> it(hidden);
280 AppLnk* l; 281 AppLnk* l;
281 while ((l=it.current())) { 282 while ((l=it.current())) {
282 ++it; 283 ++it;
283 //odebug << "" << l << ": hidden (should remove)" << oendl; 284 //odebug << "" << l << ": hidden (should remove)" << oendl;
284 } 285 }
285#endif 286#endif
286} 287}
287 288
288int LauncherIconView::compare(const AppLnk* a, const AppLnk* b) 289int LauncherIconView::compare(const AppLnk* a, const AppLnk* b)
289{ 290{
290 switch (sortmeth) { 291 switch (sortmeth) {
291 case Name: 292 case Name:
292 return a->name().lower().compare(b->name().lower()); 293 return a->name().lower().compare(b->name().lower());
293 case Date: { 294 case Date: {
294 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); 295 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file());
295 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); 296 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file());
296 return fa.lastModified().secsTo(fb.lastModified()); 297 return fa.lastModified().secsTo(fb.lastModified());
297 } 298 }
298 case Type: 299 case Type:
299 return a->type().compare(b->type()); 300 return a->type().compare(b->type());
300 } 301 }
301 return 0; 302 return 0;
302} 303}
303 304
304void LauncherIconView::setSortMethod( SortMethod m ) 305void LauncherIconView::setSortMethod( SortMethod m )
305{ 306{
306 if ( sortmeth != m ) { 307 if ( sortmeth != m ) {
307 sortmeth = m; 308 sortmeth = m;
308 sort(); 309 sort();
309 } 310 }
310} 311}
311 312
312void LauncherIconView::setCategoryFilter( int catfilter, bool resort ) 313void LauncherIconView::setCategoryFilter( int catfilter, bool resort )
313{ 314{
314 Categories cat; 315 Categories cat;
315 cat.load( categoryFileName() ); 316 cat.load( categoryFileName() );
316 QString str; 317 QString str;
317 if ( catfilter == -2 ) 318 if ( catfilter == -2 )
318 cf = 0; 319 cf = 0;
319 else 320 else
320 cf = catfilter; 321 cf = catfilter;
321 hideOrShowItems(resort); 322 hideOrShowItems(resort);
@@ -410,102 +411,113 @@ QStringList LauncherIconView::mimeTypes() const
410 } 411 }
411 r.sort(); 412 r.sort();
412 return r; 413 return r;
413} 414}
414 415
415LauncherItem*LauncherIconView::findDocItem(const QString&fname) 416LauncherItem*LauncherIconView::findDocItem(const QString&fname)
416{ 417{
417 LauncherItem* item = (LauncherItem*)firstItem(); 418 LauncherItem* item = (LauncherItem*)firstItem();
418 while (item) { 419 while (item) {
419 if (item->appLnk()->file()==fname) { 420 if (item->appLnk()->file()==fname) {
420 break; 421 break;
421 } 422 }
422 item = (LauncherItem*)item->nextItem(); 423 item = (LauncherItem*)item->nextItem();
423 } 424 }
424 return item; 425 return item;
425} 426}
426 427
427void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width) 428void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width)
428{ 429{
429 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 430 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
430 if (s!=width) return; 431 if (s!=width) return;
431 LauncherItem*item = findDocItem(aFile); 432 LauncherItem*item = findDocItem(aFile);
432 if (!item||!item->isEyeImage()) return; 433 if (!item||!item->isEyeImage()) return;
433 item->setEyePixmap(aPixmap); 434 item->setEyePixmap(aPixmap);
434} 435}
435 436
436void LauncherIconView::checkCallback() 437void LauncherIconView::checkCallback()
437{ 438{
438 if (m_EyeCallBack) { 439 if (m_EyeCallBack) {
439 return; 440 return;
440 } 441 }
441 m_EyeCallBack = new LauncherThumbReceiver(); 442 m_EyeCallBack = new LauncherThumbReceiver();
442 connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), 443 connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
443 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); 444 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
444} 445}
445 446
446void LauncherIconView::addCheckItem(AppLnk* app) 447void LauncherIconView::addCheckItem(AppLnk* app)
447{ 448{
448 LauncherItem*item = new LauncherItem( this, app, bigIcns ); 449 LauncherItem*item = new LauncherItem( this, app, bigIcns );
449 if (item->isEyeImage()) { 450 if (item->isEyeImage()) {
450 checkCallback(); 451 checkCallback();
451 } 452 }
452} 453}
453 454
454void LauncherIconView::requestEyePix(const LauncherItem*item) 455void LauncherIconView::requestEyePix(const LauncherItem*item)
455{ 456{
456 if (!item) return; 457 if (!item) return;
457 if (item->isEyeImage()) { 458 if (item->isEyeImage()) {
459 m_eyeTimer.changeInterval(600000);
458 checkCallback(); 460 checkCallback();
459 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 461 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
460 m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); 462 m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s);
461 } 463 }
462} 464}
463 465
466void LauncherIconView::stopEyeTimer()
467{
468 odebug << "Launcherview: delete opie-eye handle" << oendl;
469 if (m_EyeCallBack) {
470 delete m_EyeCallBack;
471 m_EyeCallBack=0;
472 }
473 m_eyeTimer.stop();
474}
475
464void LauncherIconView::addItem(AppLnk* app, bool resort) 476void LauncherIconView::addItem(AppLnk* app, bool resort)
465{ 477{
466 addCatsAndMimes(app); 478 addCatsAndMimes(app);
467 if ( (tf.isEmpty() || tf.match(app->type()) >= 0) 479 if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
468 && (cf == 0 || app->categories().contains(cf) 480 && (cf == 0 || app->categories().contains(cf)
469 || cf == -1 && app->categories().count() == 0 ) ) { 481 || cf == -1 && app->categories().count() == 0 ) ) {
470 addCheckItem(app); 482 addCheckItem(app);
471 } else { 483 } else {
472 hidden.append(app); 484 hidden.append(app);
473 } 485 }
474 if ( resort ){ 486 if ( resort ){
475 sort(); 487 sort();
476 } 488 }
477} 489}
478 490
479void LauncherIconView::updateCategoriesAndMimeTypes() 491void LauncherIconView::updateCategoriesAndMimeTypes()
480{ 492{
481 mimes.clear(); 493 mimes.clear();
482 cats.clear(); 494 cats.clear();
483 LauncherItem* item = (LauncherItem*)firstItem(); 495 LauncherItem* item = (LauncherItem*)firstItem();
484 while (item) { 496 while (item) {
485 addCatsAndMimes(item->appLnk()); 497 addCatsAndMimes(item->appLnk());
486 item = (LauncherItem*)item->nextItem(); 498 item = (LauncherItem*)item->nextItem();
487 } 499 }
488 QListIterator<AppLnk> it(hidden); 500 QListIterator<AppLnk> it(hidden);
489 AppLnk* l; 501 AppLnk* l;
490 while ((l=it.current())) { 502 while ((l=it.current())) {
491 addCatsAndMimes(l); 503 addCatsAndMimes(l);
492 ++it; 504 ++it;
493 } 505 }
494} 506}
495 507
496void LauncherIconView::hideOrShowItems(bool resort) 508void LauncherIconView::hideOrShowItems(bool resort)
497{ 509{
498 viewport()->setUpdatesEnabled( FALSE ); 510 viewport()->setUpdatesEnabled( FALSE );
499 hidden.setAutoDelete(FALSE); 511 hidden.setAutoDelete(FALSE);
500 QList<AppLnk> links=hidden; 512 QList<AppLnk> links=hidden;
501 hidden.clear(); 513 hidden.clear();
502 hidden.setAutoDelete(TRUE); 514 hidden.setAutoDelete(TRUE);
503 LauncherItem* item = (LauncherItem*)firstItem(); 515 LauncherItem* item = (LauncherItem*)firstItem();
504 while (item) { 516 while (item) {
505 links.append(item->takeAppLnk()); 517 links.append(item->takeAppLnk());
506 item = (LauncherItem*)item->nextItem(); 518 item = (LauncherItem*)item->nextItem();
507 } 519 }
508 clear(); 520 clear();
509 QListIterator<AppLnk> it(links); 521 QListIterator<AppLnk> it(links);
510 AppLnk* l; 522 AppLnk* l;
511 while ((l=it.current())) { 523 while ((l=it.current())) {
@@ -556,96 +568,111 @@ void LauncherIconView::timerEvent( QTimerEvent *te )
556 } 568 }
557} 569}
558 570
559void LauncherIconView::setBigIcons( bool bi ) 571void LauncherIconView::setBigIcons( bool bi )
560{ 572{
561 bigIcns = bi; 573 bigIcns = bi;
562#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 574#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
563 busyPix.resize(0,0); 575 busyPix.resize(0,0);
564#endif 576#endif
565} 577}
566 578
567QIconViewItem* LauncherIconView::busyItem() const 579QIconViewItem* LauncherIconView::busyItem() const
568{ 580{
569 return bsy; 581 return bsy;
570} 582}
571 583
572void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 584void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
573 585
574void LauncherIconView::calculateGrid( ItemTextPos pos ) 586void LauncherIconView::calculateGrid( ItemTextPos pos )
575{ 587{
576 int dw = QApplication::desktop()->width(); 588 int dw = QApplication::desktop()->width();
577 int viewerWidth = dw-style().scrollBarExtent().width(); 589 int viewerWidth = dw-style().scrollBarExtent().width();
578 if ( pos == Bottom ) { 590 if ( pos == Bottom ) {
579 int cols = 3; 591 int cols = 3;
580 if ( viewerWidth <= 200 ) 592 if ( viewerWidth <= 200 )
581 cols = 2; 593 cols = 2;
582 else if ( viewerWidth >= 400 ) 594 else if ( viewerWidth >= 400 )
583 cols = viewerWidth/96; 595 cols = viewerWidth/96;
584 setSpacing( 4 ); 596 setSpacing( 4 );
585 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 597 setGridX( (viewerWidth-(cols+1)*spacing())/cols );
586 setGridY( fontMetrics().height()*2+24 ); 598 setGridY( fontMetrics().height()*2+24 );
587 } else { 599 } else {
588 int cols = 2; 600 int cols = 2;
589 if ( viewerWidth < 150 ) 601 if ( viewerWidth < 150 )
590 cols = 1; 602 cols = 1;
591 else if ( viewerWidth >= 400 ) 603 else if ( viewerWidth >= 400 )
592 cols = viewerWidth/150; 604 cols = viewerWidth/150;
593 setSpacing( 2 ); 605 setSpacing( 2 );
594 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 606 setGridX( (viewerWidth-(cols+1)*spacing())/cols );
595 setGridY( fontMetrics().height()+2 ); 607 setGridY( fontMetrics().height()+2 );
596 } 608 }
597} 609}
598 610
599void LauncherIconView::styleChange( QStyle &old ) 611void LauncherIconView::styleChange( QStyle &old )
600{ 612{
601 QIconView::styleChange( old ); 613 QIconView::styleChange( old );
602 calculateGrid( itemTextPos() ); 614 calculateGrid( itemTextPos() );
603} 615}
616
617void LauncherIconView::keyPressEvent(QKeyEvent* e)
618{
619 ike = TRUE;
620 if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) {
621 if ( (e->state() & ShiftButton) )
622 emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() );
623 else
624 returnPressed(currentItem());
625 }
626
627 QIconView::keyPressEvent(e);
628 ike = FALSE;
629}
630
604//=========================================================================== 631//===========================================================================
605// Implemantation of LauncherIconview end 632// Implemantation of LauncherIconview end
606//=========================================================================== 633//===========================================================================
607 634
608 635
609//=========================================================================== 636//===========================================================================
610LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) 637LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl )
611 : QVBox( parent, name, fl ) 638 : QVBox( parent, name, fl )
612{ 639{
613 catmb = 0; 640 catmb = 0;
614 icons = new LauncherIconView( this ); 641 icons = new LauncherIconView( this );
615 setFocusProxy(icons); 642 setFocusProxy(icons);
616 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); 643 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold );
617 644
618 icons->setItemsMovable( FALSE ); 645 icons->setItemsMovable( FALSE );
619 icons->setAutoArrange( TRUE ); 646 icons->setAutoArrange( TRUE );
620 icons->setSorting( TRUE ); 647 icons->setSorting( TRUE );
621 icons->setFrameStyle( QFrame::NoFrame ); 648 icons->setFrameStyle( QFrame::NoFrame );
622 icons->setMargin( 0 ); 649 icons->setMargin( 0 );
623 icons->setSelectionMode( QIconView::NoSelection ); 650 icons->setSelectionMode( QIconView::NoSelection );
624 icons->setBackgroundMode( PaletteBase ); 651 icons->setBackgroundMode( PaletteBase );
625 icons->setResizeMode( QIconView::Fixed ); 652 icons->setResizeMode( QIconView::Fixed );
626 vmode = (ViewMode)-1; 653 vmode = (ViewMode)-1;
627 setViewMode( Icon ); 654 setViewMode( Icon );
628 655
629 connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)), 656 connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)),
630 SLOT(itemClicked(int,QIconViewItem*)) ); 657 SLOT(itemClicked(int,QIconViewItem*)) );
631 connect( icons, SIGNAL(selectionChanged()), 658 connect( icons, SIGNAL(selectionChanged()),
632 SLOT(selectionChanged()) ); 659 SLOT(selectionChanged()) );
633 connect( icons, SIGNAL(returnPressed(QIconViewItem*)), 660 connect( icons, SIGNAL(returnPressed(QIconViewItem*)),
634 SLOT(returnPressed(QIconViewItem*)) ); 661 SLOT(returnPressed(QIconViewItem*)) );
635 connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)), 662 connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)),
636 SLOT(itemPressed(int,QIconViewItem*)) ); 663 SLOT(itemPressed(int,QIconViewItem*)) );
637 664
638 tools = 0; 665 tools = 0;
639 setBackgroundType( Ruled, QString::null ); 666 setBackgroundType( Ruled, QString::null );
640} 667}
641 668
642LauncherView::~LauncherView() 669LauncherView::~LauncherView()
643{ 670{
644 if ( bgCache && bgCache->contains( bgName ) ) 671 if ( bgCache && bgCache->contains( bgName ) )
645 (*bgCache)[bgName]->ref--; 672 (*bgCache)[bgName]->ref--;
646} 673}
647 674
648 675
649bool LauncherView::bsy=FALSE; 676bool LauncherView::bsy=FALSE;
650 677
651void LauncherView::setBusy(bool on) 678void LauncherView::setBusy(bool on)
@@ -1078,71 +1105,70 @@ void LauncherView::flushBgCache()
1078 bgCache->remove( curr ); 1105 bgCache->remove( curr );
1079 } 1106 }
1080 } 1107 }
1081} 1108}
1082 1109
1083/* 1110/*
1084 * Launcherthumbnail handling for image files 1111 * Launcherthumbnail handling for image files
1085 */ 1112 */
1086 1113
1087/* special image handling - based on opie eye */ 1114/* special image handling - based on opie eye */
1088QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { 1115QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) {
1089 s >> inf.file >> inf.pixmap >> inf.width >> inf.height; 1116 s >> inf.file >> inf.pixmap >> inf.width >> inf.height;
1090 return s; 1117 return s;
1091} 1118}
1092 1119
1093QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { 1120QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) {
1094 return s << inf.file << inf.width << inf.height; 1121 return s << inf.file << inf.width << inf.height;
1095} 1122}
1096 1123
1097LauncherThumbReceiver::LauncherThumbReceiver() 1124LauncherThumbReceiver::LauncherThumbReceiver()
1098 :QObject() 1125 :QObject()
1099{ 1126{
1100 QCopChannel * chan = new QCopChannel( "QPE/opie-eye",this ); 1127 QCopChannel * chan = new QCopChannel( "QPE/opie-eye",this );
1101 connect(chan, SIGNAL(received(const QCString&,const QByteArray&)), 1128 connect(chan, SIGNAL(received(const QCString&,const QByteArray&)),
1102 this, SLOT(recieve(const QCString&,const QByteArray&)) ); 1129 this, SLOT(recieve(const QCString&,const QByteArray&)) );
1103 1130
1104 { 1131 {
1105 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 1132 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
1106 } 1133 }
1107} 1134}
1108 1135
1109LauncherThumbReceiver::~LauncherThumbReceiver() 1136LauncherThumbReceiver::~LauncherThumbReceiver()
1110{ 1137{
1111 { 1138 {
1112 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 1139 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
1113 } 1140 }
1114} 1141}
1115 1142
1116void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at ) 1143void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at )
1117{ 1144{
1118 PixmapInfos pixinfos; 1145 PixmapInfos pixinfos;
1119 QDataStream stream( at, IO_ReadOnly ); 1146 QDataStream stream( at, IO_ReadOnly );
1120 1147
1121 /* we are just interested in thumbmails */ 1148 /* we are just interested in thumbmails */
1122 if ( str == "pixmapsHandled(PixmapList)" ) 1149 if ( str == "pixmapsHandled(PixmapList)" )
1123 stream >> pixinfos; 1150 stream >> pixinfos;
1124 1151
1125 for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) { 1152 for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) {
1126 odebug << "Pixinfos: " << (*it).file << " - " << (*it).width << oendl;
1127 emit sig_Thumbnail((*it).pixmap,(*it).file,(*it).width); 1153 emit sig_Thumbnail((*it).pixmap,(*it).file,(*it).width);
1128 } 1154 }
1129} 1155}
1130 1156
1131void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height) 1157void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height)
1132{ 1158{
1133 PixmapInfo rItem; 1159 PixmapInfo rItem;
1134 rItem.file = file; 1160 rItem.file = file;
1135 rItem.width = width; 1161 rItem.width = width;
1136 rItem.height = height; 1162 rItem.height = height;
1137 m_inThumbNail.append(rItem); 1163 m_inThumbNail.append(rItem);
1138 QTimer::singleShot(0, this, SLOT(sendRequest())); 1164 QTimer::singleShot(0, this, SLOT(sendRequest()));
1139} 1165}
1140 1166
1141void LauncherThumbReceiver::sendRequest() 1167void LauncherThumbReceiver::sendRequest()
1142{ 1168{
1143 if (m_inThumbNail.count()>0) { 1169 if (m_inThumbNail.count()>0) {
1144 QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" ); 1170 QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" );
1145 env << m_inThumbNail; 1171 env << m_inThumbNail;
1146 m_inThumbNail.clear(); 1172 m_inThumbNail.clear();
1147 } 1173 }
1148} 1174}
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
index 0be9a1f..ebb1362 100644
--- a/core/launcher/launcherview.h
+++ b/core/launcher/launcherview.h
@@ -1,75 +1,76 @@
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 29
29class CategorySelect; 30class CategorySelect;
30class LauncherIconView; 31class LauncherIconView;
31class LauncherItem; 32class LauncherItem;
32class QIconViewItem; 33class QIconViewItem;
33class QLabel; 34class QLabel;
34class QWidgetStack; 35class QWidgetStack;
35class MenuButton; 36class MenuButton;
36class QComboBox; 37class QComboBox;
37 38
38 39
39 40
40enum BusyIndicatorType { 41enum BusyIndicatorType {
41 BIT_Normal = 0, 42 BIT_Normal = 0,
42 BIT_Animated 43 BIT_Animated
43}; 44};
44 45
45class LauncherView : public QVBox 46class LauncherView : public QVBox
46{ 47{
47 Q_OBJECT 48 Q_OBJECT
48 49
49public: 50public:
50 LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 51 LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
51 ~LauncherView(); 52 ~LauncherView();
52 53
53 void hideIcons(); 54 void hideIcons();
54 55
55 bool removeLink(const QString& linkfile); 56 bool removeLink(const QString& linkfile);
56 void addItem(AppLnk* app, bool resort=TRUE); 57 void addItem(AppLnk* app, bool resort=TRUE);
57 void removeAllItems(); 58 void removeAllItems();
58 void setSortEnabled(bool); 59 void setSortEnabled(bool);
59 void setUpdatesEnabled(bool); 60 void setUpdatesEnabled(bool);
60 void sort(); 61 void sort();
61 62
62 void setToolsEnabled(bool); 63 void setToolsEnabled(bool);
63 void updateTools(); 64 void updateTools();
64 65
65 void setBusy(bool); 66 void setBusy(bool);
66 void setBusyIndicatorType( const QString& ); 67 void setBusyIndicatorType( const QString& );
67 68
68 enum ViewMode { Icon, List }; 69 enum ViewMode { Icon, List };
69 void setViewMode( ViewMode m ); 70 void setViewMode( ViewMode m );
70 ViewMode viewMode() const { return vmode; } 71 ViewMode viewMode() const { return vmode; }
71 72
72 enum BackgroundType { Ruled, SolidColor, Image }; 73 enum BackgroundType { Ruled, SolidColor, Image };
73 void setBackgroundType( BackgroundType t, const QString & ); 74 void setBackgroundType( BackgroundType t, const QString & );
74 BackgroundType backgroundType() const { return bgType; } 75 BackgroundType backgroundType() const { return bgType; }
75 76
@@ -128,127 +129,116 @@ struct PixmapInfo {
128 } 129 }
129 int width, height; 130 int width, height;
130 QString file; 131 QString file;
131 QPixmap pixmap; 132 QPixmap pixmap;
132}; 133};
133 134
134class LauncherThumbReceiver:public QObject 135class LauncherThumbReceiver:public QObject
135{ 136{
136 Q_OBJECT 137 Q_OBJECT
137 typedef QValueList<PixmapInfo> PixmapInfos; 138 typedef QValueList<PixmapInfo> PixmapInfos;
138public: 139public:
139 LauncherThumbReceiver(); 140 LauncherThumbReceiver();
140 ~LauncherThumbReceiver(); 141 ~LauncherThumbReceiver();
141 void requestThumb(const QString&file,int width,int height); 142 void requestThumb(const QString&file,int width,int height);
142 143
143public slots: 144public slots:
144 void recieve( const QCString&, const QByteArray& ); 145 void recieve( const QCString&, const QByteArray& );
145protected slots: 146protected slots:
146 virtual void sendRequest(); 147 virtual void sendRequest();
147 148
148signals: 149signals:
149 void sig_Thumbnail(const QPixmap&,const QString&,int); 150 void sig_Thumbnail(const QPixmap&,const QString&,int);
150 151
151protected: 152protected:
152 PixmapInfos m_inThumbNail; 153 PixmapInfos m_inThumbNail;
153}; 154};
154 155
155class LauncherIconView : public QIconView { 156class LauncherIconView : public QIconView {
156 Q_OBJECT 157 Q_OBJECT
157public: 158public:
158 LauncherIconView( QWidget* parent, const char* name=0 ); 159 LauncherIconView( QWidget* parent, const char* name=0 );
159 ~LauncherIconView(); 160 ~LauncherIconView();
160 QIconViewItem* busyItem() const; 161 QIconViewItem* busyItem() const;
161 162
162#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 163#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
163 QPixmap busyPixmap() const { return busyPix; } 164 QPixmap busyPixmap() const { return busyPix; }
164#endif 165#endif
165 void setBigIcons( bool bi ); 166 void setBigIcons( bool bi );
166 void updateCategoriesAndMimeTypes(); 167 void updateCategoriesAndMimeTypes();
167 void setBusyIndicatorType ( BusyIndicatorType t ); 168 void setBusyIndicatorType ( BusyIndicatorType t );
168 void doAutoScroll() 169 void doAutoScroll()
169 { 170 {
170 // We don't want rubberbanding (yet) 171 // We don't want rubberbanding (yet)
171 } 172 }
172 173
173 void setBusy(bool on); 174 void setBusy(bool on);
174 bool inKeyEvent() const { return ike; } 175 bool inKeyEvent() const { return ike; }
175 176
176 void keyPressEvent(QKeyEvent* e)
177 {
178 ike = TRUE;
179 if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) {
180 if ( (e->state() & ShiftButton) )
181 emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() );
182 else
183 returnPressed(currentItem());
184 }
185
186 QIconView::keyPressEvent(e);
187 ike = FALSE;
188 }
189
190 void addItem(AppLnk* app, bool resort=TRUE); 177 void addItem(AppLnk* app, bool resort=TRUE);
191 bool removeLink(const QString& linkfile); 178 bool removeLink(const QString& linkfile);
192 179
193 QStringList mimeTypes() const; 180 QStringList mimeTypes() const;
194 QStringList categories() const; 181 QStringList categories() const;
195 void clear(); 182 void clear();
196 void addCatsAndMimes(AppLnk* app); 183 void addCatsAndMimes(AppLnk* app);
197 184
198 void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} 185 void setBackgroundOrigin( QWidget::BackgroundOrigin ) {}
199 186
200 void setBackgroundPixmap( const QPixmap &pm ) { 187 void setBackgroundPixmap( const QPixmap &pm ) {
201 bgPixmap = pm; 188 bgPixmap = pm;
202 } 189 }
203 190
204 void setBackgroundColor( const QColor &c ) { 191 void setBackgroundColor( const QColor &c ) {
205 bgColor = c; 192 bgColor = c;
206 } 193 }
207 194
208 void drawBackground( QPainter *p, const QRect &r ); 195 void drawBackground( QPainter *p, const QRect &r );
209 void setItemTextPos( ItemTextPos pos ); 196 void setItemTextPos( ItemTextPos pos );
210 void hideOrShowItems(bool resort); 197 void hideOrShowItems(bool resort);
211 198
212 void setTypeFilter(const QString& typefilter, bool resort); 199 void setTypeFilter(const QString& typefilter, bool resort);
213 void setCategoryFilter( int catfilter, bool resort ); 200 void setCategoryFilter( int catfilter, bool resort );
214 201
215 enum SortMethod { Name, Date, Type }; 202 enum SortMethod { Name, Date, Type };
216 203
217 void setSortMethod( SortMethod m ); 204 void setSortMethod( SortMethod m );
218 int compare(const AppLnk* a, const AppLnk* b); 205 int compare(const AppLnk* a, const AppLnk* b);
219 void requestEyePix(const LauncherItem*which); 206 void requestEyePix(const LauncherItem*which);
220 207
221protected: 208protected:
222 void timerEvent( QTimerEvent *te ); 209 virtual void timerEvent( QTimerEvent *te );
223 void styleChange( QStyle &old ); 210 void styleChange( QStyle &old );
224 void calculateGrid( ItemTextPos pos ); 211 void calculateGrid( ItemTextPos pos );
225 void focusInEvent( QFocusEvent * ) {} 212 void focusInEvent( QFocusEvent * ) {}
226 void focusOutEvent( QFocusEvent * ) {} 213 void focusOutEvent( QFocusEvent * ) {}
227 LauncherItem*findDocItem(const QString&); 214 LauncherItem*findDocItem(const QString&);
228 void addCheckItem(AppLnk* app); 215 void addCheckItem(AppLnk* app);
229 void checkCallback(); 216 void checkCallback();
217 virtual void keyPressEvent(QKeyEvent* e);
230 218
231protected slots: 219protected slots:
232 void setEyePixmap(const QPixmap&,const QString&,int width); 220 void setEyePixmap(const QPixmap&,const QString&,int width);
221 void stopEyeTimer();
233 222
234private: 223private:
235 QList<AppLnk> hidden; 224 QList<AppLnk> hidden;
236 QDict<void> mimes; 225 QDict<void> mimes;
237 QDict<void> cats; 226 QDict<void> cats;
238 SortMethod sortmeth; 227 SortMethod sortmeth;
239 QRegExp tf; 228 QRegExp tf;
240 int cf; 229 int cf;
241 LauncherItem* bsy; 230 LauncherItem* bsy;
242 int busyTimer; 231 int busyTimer;
243 bool ike; 232 bool ike;
244 bool bigIcns; 233 bool bigIcns;
245 QPixmap bgPixmap; 234 QPixmap bgPixmap;
246 QColor bgColor; 235 QColor bgColor;
247 LauncherThumbReceiver*m_EyeCallBack; 236 LauncherThumbReceiver*m_EyeCallBack;
248#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 237#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
249 QPixmap busyPix; 238 QPixmap busyPix;
250#endif 239#endif
251 BusyIndicatorType busyType; 240 BusyIndicatorType busyType;
241 QTimer m_eyeTimer;
252}; 242};
253 243
254#endif // LAUNCHERVIEW_H 244#endif // LAUNCHERVIEW_H