summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp43
-rw-r--r--core/launcher/launcher.h4
-rw-r--r--core/launcher/launcherview.cpp109
-rw-r--r--core/launcher/launcherview.h7
4 files changed, 113 insertions, 50 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 5ec1cf8..ccc2114 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -74,13 +74,13 @@
74 74
75 75
76static bool isVisibleWindow( int ); 76static bool isVisibleWindow( int );
77//=========================================================================== 77//===========================================================================
78 78
79LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : 79LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
80 QVBox( parent ), docview( 0 ) 80 QVBox( parent ), docview( 0 ),docTabEnabled(true),m_DocumentTabId(0)
81{ 81{
82 docLoadingWidgetEnabled = false; 82 docLoadingWidgetEnabled = false;
83 docLoadingWidget = 0; 83 docLoadingWidget = 0;
84 docLoadingWidgetProgress = 0; 84 docLoadingWidgetProgress = 0;
85 launcher = parent; 85 launcher = parent;
86 categoryBar = new LauncherTabBar( this ); 86 categoryBar = new LauncherTabBar( this );
@@ -125,13 +125,13 @@ void LauncherTabWidget::createDocLoadingWidget()
125 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); 125 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) );
126 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); 126 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) );
127 waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); 127 waitPixmap->setAlignment( int( QLabel::AlignCenter ) );
128 128
129 Config cfg( "Launcher" ); 129 Config cfg( "Launcher" );
130 cfg.setGroup( "DocTab" ); 130 cfg.setGroup( "DocTab" );
131 bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); 131 docTabEnabled = cfg.readBoolEntry( "Enable", true );
132 132
133 QLabel *textLabel = new QLabel( docLoadingVBox ); 133 QLabel *textLabel = new QLabel( docLoadingVBox );
134 textLabel->setAlignment( int( QLabel::AlignCenter ) ); 134 textLabel->setAlignment( int( QLabel::AlignCenter ) );
135 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); 135 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox );
136 docLoadingWidgetProgress->setProgress( 0 ); 136 docLoadingWidgetProgress->setProgress( 0 );
137 docLoadingWidgetProgress->setCenterIndicator( TRUE ); 137 docLoadingWidgetProgress->setCenterIndicator( TRUE );
@@ -166,67 +166,70 @@ void LauncherTabWidget::initLayout()
166 categoryBar->showTab("Documents"); 166 categoryBar->showTab("Documents");
167} 167}
168 168
169void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) 169void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&)
170{ 170{
171 if ( message == "nextView()" ) 171 if ( message == "nextView()" )
172 categoryBar->nextTab(); 172 categoryBar->nextTab();
173} 173}
174 174
175void LauncherTabWidget::raiseTabWidget() 175void LauncherTabWidget::raiseTabWidget()
176{ 176{
177 if ( categoryBar->currentView() == docView() 177 if ( categoryBar->currentView() == docView()
178 && docLoadingWidgetEnabled ) { 178 && docLoadingWidgetEnabled ) {
179 stack->raiseWidget( docLoadingWidget ); 179 stack->raiseWidget( docLoadingWidget );
180 docLoadingWidget->updateGeometry(); 180 docLoadingWidget->updateGeometry();
181 } else { 181 } else {
182 stack->raiseWidget( categoryBar->currentView() ); 182 stack->raiseWidget( categoryBar->currentView() );
183 } 183 }
184} 184}
185 185
186void LauncherTabWidget::tabProperties() 186void LauncherTabWidget::tabProperties()
187{ 187{
188 LauncherView *view = categoryBar->currentView(); 188 LauncherView *view = categoryBar->currentView();
189 QPopupMenu *m = new QPopupMenu( this ); 189 QPopupMenu *m = new QPopupMenu( this );
190 m->insertItem( tr("Icon View"), LauncherView::Icon ); 190 m->insertItem( tr("Icon View"), LauncherView::Icon );
191 m->insertItem( tr("List View"), LauncherView::List ); 191 m->insertItem( tr("List View"), LauncherView::List );
192 m->setItemChecked( (int)view->viewMode(), TRUE ); 192 m->setItemChecked( (int)view->viewMode(), TRUE );
193 int rv = m->exec( QCursor::pos() ); 193 int rv = m->exec( QCursor::pos() );
194 if ( rv >= 0 && rv != view->viewMode() ) { 194 if ( rv >= 0 && rv != view->viewMode() ) {
195 view->setViewMode( (LauncherView::ViewMode)rv ); 195 view->setViewMode( (LauncherView::ViewMode)rv );
196 } 196 }
197 197
198 delete m; 198 delete m;
199} 199}
200 200
201void LauncherTabWidget::deleteView( const QString& id ) 201void LauncherTabWidget::deleteView( const QString& id )
202{ 202{
203 LauncherTab *t = categoryBar->launcherTab(id); 203 LauncherTab *t = categoryBar->launcherTab(id);
204 if ( t ) { 204 if ( t ) {
205 stack->removeWidget( t->view ); 205 stack->removeWidget( t->view );
206 delete t->view; 206 delete t->view;
207 categoryBar->removeTab( t ); 207 categoryBar->removeTab( t );
208 } 208 }
209} 209}
210 210
211LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 211LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
212{ 212{
213 LauncherView* view = new LauncherView( stack ); 213 LauncherView* view = new LauncherView( stack );
214 connect( view, SIGNAL(clicked(const AppLnk*)), 214 connect( view, SIGNAL(clicked(const AppLnk*)),
215 this, SIGNAL(clicked(const AppLnk*))); 215 this, SIGNAL(clicked(const AppLnk*)));
216 connect( view, SIGNAL(rightPressed(AppLnk*)), 216 connect( view, SIGNAL(rightPressed(AppLnk*)),
217 this, SIGNAL(rightPressed(AppLnk*))); 217 this, SIGNAL(rightPressed(AppLnk*)));
218 218
219
219 int n = categoryBar->count(); 220 int n = categoryBar->count();
221
220 stack->addWidget( view, n ); 222 stack->addWidget( view, n );
221 223
222 LauncherTab *tab = new LauncherTab( id, view, pm, label ); 224 LauncherTab *tab = new LauncherTab( id, view, pm, label );
223 categoryBar->insertTab( tab, n-1 ); 225 categoryBar->insertTab( tab, n-1 );
224 226 if ( id == "Documents" ) {
225 if ( id == "Documents" ) 227 docview = view;
226 docview = view; 228 m_DocumentTabId = n;
229 }
227 230
228 odebug << "inserting " << id << " at " << n-1 << "" << oendl; 231 odebug << "inserting " << id << " at " << n-1 << "" << oendl;
229 232
230 Config cfg("Launcher"); 233 Config cfg("Launcher");
231 setTabAppearance( tab, cfg ); 234 setTabAppearance( tab, cfg );
232 235
@@ -237,26 +240,26 @@ LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm,
237} 240}
238 241
239LauncherView *LauncherTabWidget::view( const QString &id ) 242LauncherView *LauncherTabWidget::view( const QString &id )
240{ 243{
241 LauncherTab *t = categoryBar->launcherTab(id); 244 LauncherTab *t = categoryBar->launcherTab(id);
242 if ( !t ) 245 if ( !t )
243 return 0; 246 return 0;
244 return t->view; 247 return t->view;
245} 248}
246 249
247LauncherView *LauncherTabWidget::docView() 250LauncherView *LauncherTabWidget::docView()
248{ 251{
249 return docview; 252 return docview;
250} 253}
251 254
252void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) 255void LauncherTabWidget::setLoadingWidgetEnabled( bool v )
253{ 256{
254 if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { 257 if ( v != docLoadingWidgetEnabled && docLoadingWidget ) {
255 docLoadingWidgetEnabled = v; 258 docLoadingWidgetEnabled = v;
256 raiseTabWidget(); 259 raiseTabWidget();
257 } 260 }
258} 261}
259 262
260void LauncherTabWidget::setLoadingProgress( int percent ) 263void LauncherTabWidget::setLoadingProgress( int percent )
261{ 264{
262 docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); 265 docLoadingWidgetProgress->setProgress( (percent / 4) * 4 );
@@ -601,13 +604,12 @@ void Launcher::properties( AppLnk *appLnk )
601 // Not supported: flat is simpler for the user 604 // Not supported: flat is simpler for the user
602 } else { 605 } else {
603/* ### libqtopia FIXME also moving docLnks... */ 606/* ### libqtopia FIXME also moving docLnks... */
604 LnkProperties prop(appLnk,0 ); 607 LnkProperties prop(appLnk,0 );
605 608
606 if (QPEApplication::execDialog( &prop )==QDialog::Accepted && tabs->currentView()==tabs->docView()) { 609 if (QPEApplication::execDialog( &prop )==QDialog::Accepted && tabs->currentView()==tabs->docView()) {
607 tabs->docView()->updateTools();
608 } 610 }
609 } 611 }
610} 612}
611 613
612void Launcher::storageChanged( const QList<FileSystem> & ) 614void Launcher::storageChanged( const QList<FileSystem> & )
613{ 615{
@@ -718,14 +720,19 @@ void Launcher::documentRemoved( const DocLnk& doc )
718{ 720{
719 tabs->docView()->removeLink( doc.linkFile() ); 721 tabs->docView()->removeLink( doc.linkFile() );
720} 722}
721 723
722void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) 724void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc )
723{ 725{
726#if 0
724 documentRemoved( oldDoc ); 727 documentRemoved( oldDoc );
725 documentAdded( newDoc ); 728 documentAdded( newDoc );
729// tabs->docView()->updateTools();
730#else
731 tabs->docView()->changeItem(oldDoc,new DocLnk(newDoc));
732#endif
726} 733}
727 734
728void Launcher::allDocumentsRemoved() 735void Launcher::allDocumentsRemoved()
729{ 736{
730 tabs->docView()->removeAllItems(); 737 tabs->docView()->removeAllItems();
731} 738}
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h
index 2eaf77c..db6ac54 100644
--- a/core/launcher/launcher.h
+++ b/core/launcher/launcher.h
@@ -87,12 +87,14 @@ private:
87 LauncherView *docview; 87 LauncherView *docview;
88 88
89 QWidgetStack *stack; 89 QWidgetStack *stack;
90 LauncherView *docLoadingWidget; 90 LauncherView *docLoadingWidget;
91 QProgressBar *docLoadingWidgetProgress; 91 QProgressBar *docLoadingWidgetProgress;
92 bool docLoadingWidgetEnabled; 92 bool docLoadingWidgetEnabled;
93 bool docTabEnabled;
94 int m_DocumentTabId;
93}; 95};
94 96
95class Launcher : public QMainWindow, public ServerInterface 97class Launcher : public QMainWindow, public ServerInterface
96{ 98{
97 Q_OBJECT 99 Q_OBJECT
98public: 100public:
@@ -132,13 +134,13 @@ public slots:
132 void makeVisible(); 134 void makeVisible();
133 135
134signals: 136signals:
135 void executing( const AppLnk * ); 137 void executing( const AppLnk * );
136 138
137private slots: 139private slots:
138 void systemMessage( const QCString &, const QByteArray &); 140 void systemMessage( const QCString &, const QByteArray &);
139 141
140protected: 142protected:
141 bool eventFilter( QObject *o, QEvent *ev ); 143 bool eventFilter( QObject *o, QEvent *ev );
142 144
143private: 145private:
144 void updateApps(); 146 void updateApps();
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index ff26133..c9efacb 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -41,12 +41,13 @@ using namespace Opie::Core;
41// These define how the busy icon is animated and highlighted 41// These define how the busy icon is animated and highlighted
42#define BRIGHTEN_BUSY_ICON 42#define BRIGHTEN_BUSY_ICON
43//#define ALPHA_FADE_BUSY_ICON 43//#define ALPHA_FADE_BUSY_ICON
44//#define USE_ANIMATED_BUSY_ICON_OVERLAY 44//#define USE_ANIMATED_BUSY_ICON_OVERLAY
45#define BOUNCE_BUSY_ICON 45#define BOUNCE_BUSY_ICON
46 46
47typedef QMap<QString,QPixmap>::Iterator pixiter;
47 48
48class BgPixmap 49class BgPixmap
49{ 50{
50public: 51public:
51 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} 52 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {}
52 QPixmap pm; 53 QPixmap pm;
@@ -102,31 +103,33 @@ protected:
102 AppLnk* app; 103 AppLnk* app;
103 104
104private: 105private:
105 void paintAnimatedIcon( QPainter *p ); 106 void paintAnimatedIcon( QPainter *p );
106 BusyIndicatorType busyType; 107 BusyIndicatorType busyType;
107 int psize; 108 int psize;
108 QPixmap m_iPixmap;
109 bool m_EyeImage; 109 bool m_EyeImage;
110 iconstate_t m_EyeImageSet; 110 iconstate_t m_EyeImageSet;
111}; 111};
112 112
113LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) 113LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon )
114 : QIconViewItem( parent, applnk->name(), 114 : QIconViewItem( parent, applnk->name(),
115 bigIcon ? applnk->bigPixmap() :applnk->pixmap() ), 115 bigIcon ? applnk->bigPixmap() :applnk->pixmap() ),
116 isBigIcon( bigIcon ), 116 isBigIcon( bigIcon ),
117 iteration(0), 117 iteration(0),
118 app(applnk), // Takes ownership 118 app(applnk), // Takes ownership
119 psize( (bigIcon ? applnk->bigPixmap().width() :applnk->pixmap().width() ) ), 119 psize( (bigIcon ? applnk->bigPixmap().width() :applnk->pixmap().width() ) ),
120 m_iPixmap(),
121 m_EyeImage(false), 120 m_EyeImage(false),
122 m_EyeImageSet(BASE_ICON) 121 m_EyeImageSet(BASE_ICON)
123{ 122{
124 if (applnk->type().lower().startsWith("image/") && applnk->exec().contains("opie-eye",false)) { 123 if (applnk->type().lower().startsWith("image/") && applnk->exec().contains("opie-eye",false)) {
125 m_EyeImage = true; 124 m_EyeImage = true;
126 m_iPixmap = (bigIcon ? applnk->bigPixmap():applnk->pixmap()); 125 QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(applnk->file());
126 if (it != LauncherIconView::sm_EyeCache->end()) {
127 m_EyeImageSet = EYE_ICON;
128 setPixmap(*it);
129 }
127 } 130 }
128} 131}
129 132
130LauncherItem::~LauncherItem() 133LauncherItem::~LauncherItem()
131{ 134{
132 LauncherIconView* liv = (LauncherIconView*)iconView(); 135 LauncherIconView* liv = (LauncherIconView*)iconView();
@@ -210,13 +213,19 @@ void LauncherItem::animateIcon()
210 213
211 if ( liv->busyItem() != this || !app ) 214 if ( liv->busyItem() != this || !app )
212 return; 215 return;
213 216
214 // Highlight the icon 217 // Highlight the icon
215 if ( iteration == 0 ) { 218 if ( iteration == 0 ) {
216 QPixmap src = (isEyeImage()?m_iPixmap:(isBigIcon ? app->bigPixmap() : app->pixmap())); 219 QPixmap src;
220 pixiter it;
221 if (isEyeImage() && (it=LauncherIconView::sm_EyeCache->find(appLnk()->file()))!=LauncherIconView::sm_EyeCache->end()) {
222 src = (*it);
223 } else {
224 src = ((isBigIcon ? app->bigPixmap() : app->pixmap()));
225 }
217 QImage img = src.convertToImage(); 226 QImage img = src.convertToImage();
218 QRgb *rgb; 227 QRgb *rgb;
219 int count; 228 int count;
220 if ( img.depth() == 32 ) { 229 if ( img.depth() == 32 ) {
221 rgb = (QRgb*)img.bits(); 230 rgb = (QRgb*)img.bits();
222 count = img.bytesPerLine()/sizeof(QRgb)*img.height(); 231 count = img.bytesPerLine()/sizeof(QRgb)*img.height();
@@ -246,30 +255,40 @@ void LauncherItem::animateIcon()
246 paintAnimatedIcon( &p ); 255 paintAnimatedIcon( &p );
247} 256}
248 257
249void LauncherItem::resetIcon() 258void LauncherItem::resetIcon()
250{ 259{
251 iteration = 0; 260 iteration = 0;
252 setPixmap((isEyeImage()?m_iPixmap:(isBigIcon ? app->bigPixmap() : app->pixmap()))); 261 if (isEyeImage()) {
262 QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(appLnk()->file());
263 if (it != LauncherIconView::sm_EyeCache->end()) {
264 setPixmap(*it);
265 return;
266 }
267 }
268 setPixmap(isBigIcon ? app->bigPixmap() : app->pixmap());
253} 269}
254 270
255void LauncherItem::setEyePixmap(const QPixmap&aIcon) 271void LauncherItem::setEyePixmap(const QPixmap&aIcon)
256{ 272{
257 if (!isEyeImage()) return; 273 if (!isEyeImage()) return;
258 m_iPixmap = aIcon;
259 setPixmap(aIcon); 274 setPixmap(aIcon);
260 m_EyeImageSet = EYE_ICON; 275 m_EyeImageSet = EYE_ICON;
261} 276}
262 277
263//=========================================================================== 278//===========================================================================
264// Implemantation of LauncherIconview start 279// Implemantation of LauncherIconview start
265//=========================================================================== 280//===========================================================================
281
282QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0;
283
266LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) 284LauncherIconView::LauncherIconView( QWidget* parent, const char* name )
267 : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white) 285 : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white)
268{ 286{
269 m_EyeCallBack = 0; 287 m_EyeCallBack = 0;
288 if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>();
270 sortmeth = Name; 289 sortmeth = Name;
271 hidden.setAutoDelete(TRUE); 290 hidden.setAutoDelete(TRUE);
272 ike = FALSE; 291 ike = FALSE;
273 calculateGrid( Bottom ); 292 calculateGrid( Bottom );
274 connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); 293 connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer()));
275} 294}
@@ -429,23 +448,24 @@ LauncherItem*LauncherIconView::findDocItem(const QString&fname)
429void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width) 448void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width)
430{ 449{
431 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 450 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
432 if (s!=width) return; 451 if (s!=width) return;
433 LauncherItem*item = findDocItem(aFile); 452 LauncherItem*item = findDocItem(aFile);
434 if (!item||!item->isEyeImage()) return; 453 if (!item||!item->isEyeImage()) return;
454 (*sm_EyeCache)[aFile]=aPixmap;
435 item->setEyePixmap(aPixmap); 455 item->setEyePixmap(aPixmap);
436} 456}
437 457
438void LauncherIconView::checkCallback() 458void LauncherIconView::checkCallback()
439{ 459{
440 if (!m_EyeCallBack) { 460 if (!m_EyeCallBack) {
441 m_EyeCallBack = new LauncherThumbReceiver(); 461 m_EyeCallBack = new LauncherThumbReceiver();
442 connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), 462 connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
443 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); 463 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
444 m_eyeTimer.changeInterval(600000);
445 } 464 }
465 m_eyeTimer.changeInterval(600000);
446} 466}
447 467
448void LauncherIconView::addCheckItem(AppLnk* app) 468void LauncherIconView::addCheckItem(AppLnk* app)
449{ 469{
450 LauncherItem*item = new LauncherItem( this, app, bigIcns ); 470 LauncherItem*item = new LauncherItem( this, app, bigIcns );
451 if (item->isEyeImage()) { 471 if (item->isEyeImage()) {
@@ -463,33 +483,20 @@ void LauncherIconView::requestEyePix(const LauncherItem*item)
463 } 483 }
464} 484}
465 485
466void LauncherIconView::stopEyeTimer() 486void LauncherIconView::stopEyeTimer()
467{ 487{
468 if (m_EyeCallBack) { 488 if (m_EyeCallBack) {
489 disconnect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
490 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
469 delete m_EyeCallBack; 491 delete m_EyeCallBack;
470 m_EyeCallBack=0; 492 m_EyeCallBack=0;
471 } 493 }
472 m_eyeTimer.stop(); 494 m_eyeTimer.stop();
473} 495}
474 496
475void LauncherIconView::addItem(AppLnk* app, bool resort)
476{
477 addCatsAndMimes(app);
478 if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
479 && (cf == 0 || app->categories().contains(cf)
480 || cf == -1 && app->categories().count() == 0 ) ) {
481 addCheckItem(app);
482 } else {
483 hidden.append(app);
484 }
485 if ( resort ){
486 sort();
487 }
488}
489
490void LauncherIconView::updateCategoriesAndMimeTypes() 497void LauncherIconView::updateCategoriesAndMimeTypes()
491{ 498{
492 mimes.clear(); 499 mimes.clear();
493 cats.clear(); 500 cats.clear();
494 LauncherItem* item = (LauncherItem*)firstItem(); 501 LauncherItem* item = (LauncherItem*)firstItem();
495 while (item) { 502 while (item) {
@@ -525,23 +532,24 @@ void LauncherIconView::hideOrShowItems(bool resort)
525 } 532 }
526 if ( resort && !autoArrange() ) 533 if ( resort && !autoArrange() )
527 sort(); 534 sort();
528 viewport()->setUpdatesEnabled( TRUE ); 535 viewport()->setUpdatesEnabled( TRUE );
529} 536}
530 537
531bool LauncherIconView::removeLink(const QString& linkfile) 538bool LauncherIconView::removeLink(const QString& linkfile,bool removeCache)
532{ 539{
533 LauncherItem* item = (LauncherItem*)firstItem(); 540 LauncherItem* item = (LauncherItem*)firstItem();
534 AppLnk* l; 541 AppLnk* l;
535 bool did = FALSE; 542 bool did = FALSE;
536 DocLnk dl(linkfile); 543 DocLnk dl(linkfile);
537 while (item) { 544 while (item) {
538 l = item->appLnk(); 545 l = item->appLnk();
539 LauncherItem *nextItem = (LauncherItem *)item->nextItem(); 546 LauncherItem *nextItem = (LauncherItem *)item->nextItem();
540 if ( l->linkFileKnown() && l->linkFile() == linkfile || l->fileKnown() && 547 if ( l->linkFileKnown() && l->linkFile() == linkfile || l->fileKnown() &&
541 ( l->file() == linkfile || dl.isValid() && dl.file() == l->file() ) ) { 548 ( l->file() == linkfile || dl.isValid() && dl.file() == l->file() ) ) {
549 if (removeCache) sm_EyeCache->remove(l->file());
542 delete item; 550 delete item;
543 did = TRUE; 551 did = TRUE;
544 } 552 }
545 item = nextItem; 553 item = nextItem;
546 } 554 }
547 QListIterator<AppLnk> it(hidden); 555 QListIterator<AppLnk> it(hidden);
@@ -554,24 +562,57 @@ bool LauncherIconView::removeLink(const QString& linkfile)
554 did = TRUE; 562 did = TRUE;
555 } 563 }
556 } 564 }
557 return did; 565 return did;
558} 566}
559 567
568void LauncherIconView::addItem(AppLnk* app, bool resort)
569{
570 addCatsAndMimes(app);
571 if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
572 && (cf == 0 || app->categories().contains(cf)
573 || cf == -1 && app->categories().count() == 0 ) ) {
574 addCheckItem(app);
575 } else {
576 hidden.append(app);
577 }
578 if ( resort ){
579 sort();
580 }
581}
582
583void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink)
584{
585 QString oldfile = old.file();
586 QString newfile = nlink->file();
587
588 if (newfile != oldfile) {
589 QMap<QString,QPixmap>::Iterator it = sm_EyeCache->find(oldfile);
590 if (it != sm_EyeCache->end()) {
591 (*sm_EyeCache)[newfile]=(*it);
592 }
593 removeLink(old.linkFile());
594 } else {
595 removeLink(old.linkFile(),false);
596 }
597 addItem(nlink,false);
598}
599
560void LauncherIconView::timerEvent( QTimerEvent *te ) 600void LauncherIconView::timerEvent( QTimerEvent *te )
561{ 601{
562 if ( te->timerId() == busyTimer ) { 602 if ( te->timerId() == busyTimer ) {
563 if ( bsy ) 603 if ( bsy )
564 bsy->animateIcon(); 604 bsy->animateIcon();
565 } else { 605 } else {
566 QIconView::timerEvent( te ); 606 QIconView::timerEvent( te );
567 } 607 }
568} 608}
569 609
570void LauncherIconView::setBigIcons( bool bi ) 610void LauncherIconView::setBigIcons( bool bi )
571{ 611{
612 sm_EyeCache->clear();
572 bigIcns = bi; 613 bigIcns = bi;
573#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 614#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
574 busyPix.resize(0,0); 615 busyPix.resize(0,0);
575#endif 616#endif
576} 617}
577 618
@@ -753,14 +794,17 @@ void LauncherView::updateTools()
753 } 794 }
754 if ( prev.isNull() ) { 795 if ( prev.isNull() ) {
755 typemb->setCurrentItem(typemb->count()-1); 796 typemb->setCurrentItem(typemb->count()-1);
756 } 797 }
757 798
758 int pcat = catmb ? catmb->currentCategory() : -2; 799 int pcat = catmb ? catmb->currentCategory() : -2;
759 if ( !catmb ) 800 if ( !catmb ) {
760 catmb = new CategorySelect(tools); 801 catmb = new CategorySelect(tools);
802 } else if (pcat!=-2) {
803
804 }
761 Categories cats( 0 ); 805 Categories cats( 0 );
762 cats.load( categoryFileName() ); 806 cats.load( categoryFileName() );
763 QArray<int> vl( 0 ); 807 QArray<int> vl( 0 );
764 catmb->setCategories( vl, "Document View", // No tr 808 catmb->setCategories( vl, "Document View", // No tr
765 tr("Document View") ); 809 tr("Document View") );
766 catmb->setRemoveCategoryEdit( TRUE ); 810 catmb->setRemoveCategoryEdit( TRUE );
@@ -1017,13 +1061,13 @@ void LauncherView::itemClicked( int btn, QIconViewItem *item )
1017 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 1061 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
1018 if ( btn == LeftButton ) { 1062 if ( btn == LeftButton ) {
1019 // Make sure it's the item we execute that gets highlighted 1063 // Make sure it's the item we execute that gets highlighted
1020 icons->setCurrentItem( item ); 1064 icons->setCurrentItem( item );
1021 emit clicked( appLnk ); 1065 emit clicked( appLnk );
1022 } 1066 }
1023 item->setSelected(FALSE); 1067 item->setSelected(FALSE);
1024 } 1068 }
1025} 1069}
1026 1070
1027void LauncherView::itemPressed( int btn, QIconViewItem *item ) 1071void LauncherView::itemPressed( int btn, QIconViewItem *item )
1028{ 1072{
1029 if ( item ) { 1073 if ( item ) {
@@ -1044,12 +1088,22 @@ void LauncherView::removeAllItems()
1044 1088
1045bool LauncherView::removeLink(const QString& linkfile) 1089bool LauncherView::removeLink(const QString& linkfile)
1046{ 1090{
1047 return icons->removeLink(linkfile); 1091 return icons->removeLink(linkfile);
1048} 1092}
1049 1093
1094void LauncherView::addItem(AppLnk* app, bool resort)
1095{
1096 icons->addItem(app,resort);
1097}
1098
1099void LauncherView::changeItem(const AppLnk&old,AppLnk*nlink)
1100{
1101 icons->changeItem(old,nlink);
1102}
1103
1050void LauncherView::setSortEnabled( bool v ) 1104void LauncherView::setSortEnabled( bool v )
1051{ 1105{
1052 icons->setSorting( v ); 1106 icons->setSorting( v );
1053 if ( v ) 1107 if ( v )
1054 sort(); 1108 sort();
1055} 1109}
@@ -1061,17 +1115,12 @@ void LauncherView::setUpdatesEnabled( bool u )
1061 1115
1062void LauncherView::sort() 1116void LauncherView::sort()
1063{ 1117{
1064 icons->sort(); 1118 icons->sort();
1065} 1119}
1066 1120
1067void LauncherView::addItem(AppLnk* app, bool resort)
1068{
1069 icons->addItem(app,resort);
1070}
1071
1072void LauncherView::paletteChange( const QPalette &p ) 1121void LauncherView::paletteChange( const QPalette &p )
1073{ 1122{
1074 icons->unsetPalette(); 1123 icons->unsetPalette();
1075 QVBox::paletteChange( p ); 1124 QVBox::paletteChange( p );
1076 if ( bgType == Ruled ) 1125 if ( bgType == Ruled )
1077 setBackgroundType( Ruled, QString::null ); 1126 setBackgroundType( Ruled, QString::null );
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
index 6d94539..05073ab 100644
--- a/core/launcher/launcherview.h
+++ b/core/launcher/launcherview.h
@@ -53,12 +53,14 @@ public:
53 ~LauncherView(); 53 ~LauncherView();
54 54
55 void hideIcons(); 55 void hideIcons();
56 56
57 bool removeLink(const QString& linkfile); 57 bool removeLink(const QString& linkfile);
58 void addItem(AppLnk* app, bool resort=TRUE); 58 void addItem(AppLnk* app, bool resort=TRUE);
59 void changeItem(const AppLnk&old,AppLnk*nlink);
60
59 void removeAllItems(); 61 void removeAllItems();
60 void setSortEnabled(bool); 62 void setSortEnabled(bool);
61 void setUpdatesEnabled(bool); 63 void setUpdatesEnabled(bool);
62 void sort(); 64 void sort();
63 65
64 void setToolsEnabled(bool); 66 void setToolsEnabled(bool);
@@ -173,13 +175,14 @@ public:
173 } 175 }
174 176
175 void setBusy(bool on); 177 void setBusy(bool on);
176 bool inKeyEvent() const { return ike; } 178 bool inKeyEvent() const { return ike; }
177 179
178 void addItem(AppLnk* app, bool resort=TRUE); 180 void addItem(AppLnk* app, bool resort=TRUE);
179 bool removeLink(const QString& linkfile); 181 bool removeLink(const QString& linkfile,bool removeCache = true);
182 void changeItem(const AppLnk&old,AppLnk*nlink);
180 183
181 QStringList mimeTypes() const; 184 QStringList mimeTypes() const;
182 QStringList categories() const; 185 QStringList categories() const;
183 void clear(); 186 void clear();
184 void addCatsAndMimes(AppLnk* app); 187 void addCatsAndMimes(AppLnk* app);
185 188
@@ -203,12 +206,14 @@ public:
203 enum SortMethod { Name, Date, Type }; 206 enum SortMethod { Name, Date, Type };
204 207
205 void setSortMethod( SortMethod m ); 208 void setSortMethod( SortMethod m );
206 int compare(const AppLnk* a, const AppLnk* b); 209 int compare(const AppLnk* a, const AppLnk* b);
207 void requestEyePix(const LauncherItem*which); 210 void requestEyePix(const LauncherItem*which);
208 211
212 static QMap<QString,QPixmap>* sm_EyeCache;
213
209protected: 214protected:
210 virtual void timerEvent( QTimerEvent *te ); 215 virtual void timerEvent( QTimerEvent *te );
211 void styleChange( QStyle &old ); 216 void styleChange( QStyle &old );
212 void calculateGrid( ItemTextPos pos ); 217 void calculateGrid( ItemTextPos pos );
213 void focusInEvent( QFocusEvent * ) {} 218 void focusInEvent( QFocusEvent * ) {}
214 void focusOutEvent( QFocusEvent * ) {} 219 void focusOutEvent( QFocusEvent * ) {}