From 1480f96170cb7cd7c262a14ad56ff08f384de10f Mon Sep 17 00:00:00 2001 From: alwin Date: Mon, 08 Nov 2004 20:26:03 +0000 Subject: timer for releasing a reference to opie-eye_slave if exists when unused for ten minutes. --- (limited to 'core/launcher') 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 @@ -271,6 +271,7 @@ LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) hidden.setAutoDelete(TRUE); ike = FALSE; calculateGrid( Bottom ); + connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); } LauncherIconView::~LauncherIconView() @@ -455,12 +456,23 @@ void LauncherIconView::requestEyePix(const LauncherItem*item) { if (!item) return; if (item->isEyeImage()) { + m_eyeTimer.changeInterval(600000); checkCallback(); int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); } } +void LauncherIconView::stopEyeTimer() +{ + odebug << "Launcherview: delete opie-eye handle" << oendl; + if (m_EyeCallBack) { + delete m_EyeCallBack; + m_EyeCallBack=0; + } + m_eyeTimer.stop(); +} + void LauncherIconView::addItem(AppLnk* app, bool resort) { addCatsAndMimes(app); @@ -601,6 +613,21 @@ void LauncherIconView::styleChange( QStyle &old ) QIconView::styleChange( old ); calculateGrid( itemTextPos() ); } + +void LauncherIconView::keyPressEvent(QKeyEvent* e) +{ + ike = TRUE; + if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { + if ( (e->state() & ShiftButton) ) + emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); + else + returnPressed(currentItem()); + } + + QIconView::keyPressEvent(e); + ike = FALSE; +} + //=========================================================================== // Implemantation of LauncherIconview end //=========================================================================== @@ -1123,7 +1150,6 @@ void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at ) stream >> pixinfos; for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) { - odebug << "Pixinfos: " << (*it).file << " - " << (*it).width << oendl; emit sig_Thumbnail((*it).pixmap,(*it).file,(*it).width); } } 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 @@ -25,6 +25,7 @@ #include #include +#include class CategorySelect; class LauncherIconView; @@ -173,20 +174,6 @@ public: void setBusy(bool on); bool inKeyEvent() const { return ike; } - void keyPressEvent(QKeyEvent* e) - { - ike = TRUE; - if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { - if ( (e->state() & ShiftButton) ) - emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); - else - returnPressed(currentItem()); - } - - QIconView::keyPressEvent(e); - ike = FALSE; - } - void addItem(AppLnk* app, bool resort=TRUE); bool removeLink(const QString& linkfile); @@ -219,7 +206,7 @@ public: void requestEyePix(const LauncherItem*which); protected: - void timerEvent( QTimerEvent *te ); + virtual void timerEvent( QTimerEvent *te ); void styleChange( QStyle &old ); void calculateGrid( ItemTextPos pos ); void focusInEvent( QFocusEvent * ) {} @@ -227,9 +214,11 @@ protected: LauncherItem*findDocItem(const QString&); void addCheckItem(AppLnk* app); void checkCallback(); + virtual void keyPressEvent(QKeyEvent* e); protected slots: void setEyePixmap(const QPixmap&,const QString&,int width); + void stopEyeTimer(); private: QList hidden; @@ -248,7 +237,8 @@ private: #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY QPixmap busyPix; #endif - BusyIndicatorType busyType; + BusyIndicatorType busyType; + QTimer m_eyeTimer; }; #endif // LAUNCHERVIEW_H -- cgit v0.9.0.2