summaryrefslogtreecommitdiff
authoralwin <alwin>2004-11-08 20:26:03 (UTC)
committer alwin <alwin>2004-11-08 20:26:03 (UTC)
commit1480f96170cb7cd7c262a14ad56ff08f384de10f (patch) (side-by-side diff)
treeef83e5ce722809c0e84fd88ff885132098a67bf4
parentcce0a7a0d315993645870e88591b4afd647480a7 (diff)
downloadopie-1480f96170cb7cd7c262a14ad56ff08f384de10f.zip
opie-1480f96170cb7cd7c262a14ad56ff08f384de10f.tar.gz
opie-1480f96170cb7cd7c262a14ad56ff08f384de10f.tar.bz2
timer for releasing a reference to opie-eye_slave if exists when unused for ten
minutes.
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
@@ -270,8 +270,9 @@ LauncherIconView::LauncherIconView( QWidget* parent, const char* name )
sortmeth = Name;
hidden.setAutoDelete(TRUE);
ike = FALSE;
calculateGrid( Bottom );
+ connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer()));
}
LauncherIconView::~LauncherIconView()
{
@@ -454,14 +455,25 @@ void LauncherIconView::addCheckItem(AppLnk* app)
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);
if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
@@ -600,8 +612,23 @@ 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
//===========================================================================
@@ -1122,9 +1149,8 @@ void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at )
if ( str == "pixmapsHandled(PixmapList)" )
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
@@ -24,8 +24,9 @@
#include <qtopia/applnk.h>
#include <qvbox.h>
#include <qiconview.h>
+#include <qtimer.h>
class CategorySelect;
class LauncherIconView;
class LauncherItem;
@@ -172,22 +173,8 @@ 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);
QStringList mimeTypes() const;
@@ -218,19 +205,21 @@ public:
int compare(const AppLnk* a, const AppLnk* b);
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 * ) {}
void focusOutEvent( QFocusEvent * ) {}
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<AppLnk> hidden;
QDict<void> mimes;
@@ -247,8 +236,9 @@ private:
LauncherThumbReceiver*m_EyeCallBack;
#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
QPixmap busyPix;
#endif
- BusyIndicatorType busyType;
+ BusyIndicatorType busyType;
+ QTimer m_eyeTimer;
};
#endif // LAUNCHERVIEW_H