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
@@ -262,24 +262,25 @@ void LauncherItem::setEyePixmap(const QPixmap&aIcon)
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
@@ -446,30 +447,41 @@ void LauncherIconView::checkCallback()
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();
@@ -592,24 +604,39 @@ void LauncherIconView::calculateGrid( ItemTextPos pos )
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);
@@ -1114,25 +1141,24 @@ LauncherThumbReceiver::~LauncherThumbReceiver()
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()));
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
@@ -16,24 +16,25 @@
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
@@ -164,38 +165,24 @@ public:
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;
@@ -210,45 +197,48 @@ public:
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