-rw-r--r-- | core/launcher/launcherview.cpp | 23 | ||||
-rw-r--r-- | core/launcher/launcherview.h | 2 |
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 | |||
@@ -408,89 +408,96 @@ QStringList LauncherIconView::mimeTypes() const | |||
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 | ||
416 | LauncherItem*LauncherIconView::findDocItem(const QString&fname) | 416 | LauncherItem*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 | ||
428 | void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width) | 428 | void 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 | ||
437 | void LauncherIconView::checkCallback() | 444 | void 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 | ||
447 | void LauncherIconView::addCheckItem(AppLnk* app) | 454 | void 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 | ||
455 | void LauncherIconView::requestEyePix(const LauncherItem*item) | 462 | void 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 | ||
466 | void LauncherIconView::stopEyeTimer() | 473 | void 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 | ||
476 | void LauncherIconView::addItem(AppLnk* app, bool resort) | 483 | void 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 | ||
491 | void LauncherIconView::updateCategoriesAndMimeTypes() | 498 | void 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) { |
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 | |||
@@ -5,48 +5,49 @@ | |||
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 | ||
30 | class CategorySelect; | 31 | class CategorySelect; |
31 | class LauncherIconView; | 32 | class LauncherIconView; |
32 | class LauncherItem; | 33 | class LauncherItem; |
33 | class QIconViewItem; | 34 | class QIconViewItem; |
34 | class QLabel; | 35 | class QLabel; |
35 | class QWidgetStack; | 36 | class QWidgetStack; |
36 | class MenuButton; | 37 | class MenuButton; |
37 | class QComboBox; | 38 | class QComboBox; |
38 | 39 | ||
39 | 40 | ||
40 | 41 | ||
41 | enum BusyIndicatorType { | 42 | enum BusyIndicatorType { |
42 | BIT_Normal = 0, | 43 | BIT_Normal = 0, |
43 | BIT_Animated | 44 | BIT_Animated |
44 | }; | 45 | }; |
45 | 46 | ||
46 | class LauncherView : public QVBox | 47 | class LauncherView : public QVBox |
47 | { | 48 | { |
48 | Q_OBJECT | 49 | Q_OBJECT |
49 | 50 | ||
50 | public: | 51 | public: |
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(); |
@@ -218,27 +219,28 @@ protected: | |||
218 | 219 | ||
219 | protected slots: | 220 | protected 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 | ||
223 | private: | 224 | private: |
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 |