summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog3
-rw-r--r--core/launcher/launcherview.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b5d27c3..7228691 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,85 +1,88 @@
1 2004-??-??The Opie Team <opie@handhelds.org> 1 2004-??-??The Opie Team <opie@handhelds.org>
2 2
3 New Features 3 New Features
4 ------------ 4 ------------
5 * Fifteen gained configurable number of items (zecke) 5 * Fifteen gained configurable number of items (zecke)
6 * Fifteen can have custom background images (zecke) 6 * Fifteen can have custom background images (zecke)
7 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) 7 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl)
8 * Integrated the new security framework into libopie2 (zecke,clem) 8 * Integrated the new security framework into libopie2 (zecke,clem)
9 * Converted the launcher to use the new security framework (zecke) 9 * Converted the launcher to use the new security framework (zecke)
10 * Backup can now handle custom locations for backup and restore (ar) 10 * Backup can now handle custom locations for backup and restore (ar)
11 * Implemented right-on-hold feedback (wimpie,zecke)
12 * Lots of new features in opie-reader (tim,pohly)
11 13
12 Fixed Bugs 14 Fixed Bugs
13 -------- 15 --------
14 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) 16 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl)
15 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) 17 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers)
16 * #1370 - Pimconverter now reacts on cancel key (eilers) 18 * #1370 - Pimconverter now reacts on cancel key (eilers)
19 * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl)
17 20
18 2004-07-06The Opie Team <opie@handhelds.org> 21 2004-07-06The Opie Team <opie@handhelds.org>
19 22
20 * Tagged as Version 1.1.4 (devel) 23 * Tagged as Version 1.1.4 (devel)
21 24
22 New Features 25 New Features
23 ------------ 26 ------------
24 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) 27 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle)
25 * Added Conversion tool for pim-data (eilers) 28 * Added Conversion tool for pim-data (eilers)
26 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) 29 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers)
27 * Modified the PIM API for providing generic use of OPimRecords (eilers) 30 * Modified the PIM API for providing generic use of OPimRecords (eilers)
28 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) 31 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke)
29 32
30 Fixed Bugs 33 Fixed Bugs
31 -------- 34 --------
32 * #1068 - Country Drop Down Box Off Screen 35 * #1068 - Country Drop Down Box Off Screen
33 * #1291 - Opie tinykate does not open .desktop files (ar) 36 * #1291 - Opie tinykate does not open .desktop files (ar)
34 * #1291 - Opie sheet not saving correctly (ar) 37 * #1291 - Opie sheet not saving correctly (ar)
35 * #1294 - Opie does not know about British Summer Time 38 * #1294 - Opie does not know about British Summer Time
36 * #1314 - Drawpad initialization (mickeyl) 39 * #1314 - Drawpad initialization (mickeyl)
37 * #1317 - Packagemanager crashes on hold-down or install (chicken) 40 * #1317 - Packagemanager crashes on hold-down or install (chicken)
38 * #1321 - Batteryapplet graphic glitch (harlekin) 41 * #1321 - Batteryapplet graphic glitch (harlekin)
39 * #1324 - ZSafe not starting up (mickeyl) 42 * #1324 - ZSafe not starting up (mickeyl)
40 * #1328 - Personal Home Address fields is trimmed to 1char (eilers) 43 * #1328 - Personal Home Address fields is trimmed to 1char (eilers)
41 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) 44 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken)
42 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) 45 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl)
43 * #1348 - Datebook dependency on libopiedb2 (chicken) 46 * #1348 - Datebook dependency on libopiedb2 (chicken)
44 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) 47 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers)
45 48
46 2004-04-25The Opie Team <opie@handhelds.org> 49 2004-04-25The Opie Team <opie@handhelds.org>
47 50
48 * Released as Version 1.1.3 (devel) 51 * Released as Version 1.1.3 (devel)
49 * Introduced first implementation of SQL-Support using SQLite (eilers) 52 * Introduced first implementation of SQL-Support using SQLite (eilers)
50 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) 53 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp)
51 * Added a real system graffiti character set (brad) 54 * Added a real system graffiti character set (brad)
52 * Added Generic Keyconfig Widget (zecke) 55 * Added Generic Keyconfig Widget (zecke)
53 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) 56 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke)
54 * Added new Bible reader app - opie-dagger (drw) 57 * Added new Bible reader app - opie-dagger (drw)
55 * Added a new Image Viewer. Work is ongoing (zecke,alwin) 58 * Added a new Image Viewer. Work is ongoing (zecke,alwin)
56 * Added namespace usage in libopie2 and everywhere (zecke,alwin) 59 * Added namespace usage in libopie2 and everywhere (zecke,alwin)
57 * Enabled the possibility to pass command line arguments to applications (mickeyl) 60 * Enabled the possibility to pass command line arguments to applications (mickeyl)
58 * Added an about applet showing some credits and information about Opie (mickeyl) 61 * Added an about applet showing some credits and information about Opie (mickeyl)
59 * Added benchmarking functionality to sysinfo (mickeyl) 62 * Added benchmarking functionality to sysinfo (mickeyl)
60 * Added applet and configuration application for switching hardware keyboard layouts (alwin) 63 * Added applet and configuration application for switching hardware keyboard layouts (alwin)
61 * Ported applications from libopie1 to libopie2* (drw,ar,alwin) 64 * Ported applications from libopie1 to libopie2* (drw,ar,alwin)
62 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) 65 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe)
63 * Clean-up of package information in control files (drw) 66 * Clean-up of package information in control files (drw)
64 * Repaired mediummount which was broken since integrating the quicklauncher (alwin) 67 * Repaired mediummount which was broken since integrating the quicklauncher (alwin)
65 * Improved big-screen support (zecke,ar) 68 * Improved big-screen support (zecke,ar)
66 * Improved multikeyboard support, added keyboard layout switching applet (mouse) 69 * Improved multikeyboard support, added keyboard layout switching applet (mouse)
67 * Added a new mail client based on libetpan (harlekin,alwin,jgf) 70 * Added a new mail client based on libetpan (harlekin,alwin,jgf)
68 * Added new package manager - opie-packagemanager (drw) 71 * Added new package manager - opie-packagemanager (drw)
69 * Improved light-n-power for C7x0 (mickeyl) 72 * Improved light-n-power for C7x0 (mickeyl)
70 * Added automatic rotation support for C7x0 (treke) 73 * Added automatic rotation support for C7x0 (treke)
71 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) 74 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl)
72 * Added scanning the wireless network neighbourhood to networksettings (mickeyl) 75 * Added scanning the wireless network neighbourhood to networksettings (mickeyl)
73 76
74 2003-11-29The Opie Team <opie@handhelds.org> 77 2003-11-29The Opie Team <opie@handhelds.org>
75 78
76 * Released as Version 1.0.3 79 * Released as Version 1.0.3
77 * Improved i18n (various contributors) 80 * Improved i18n (various contributors)
78 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) 81 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin)
79 * Made the Documents Tab optional (mickeyl) 82 * Made the Documents Tab optional (mickeyl)
80 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) 83 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken)
81 84
82 2003-08-04The Opie Team <opie@handhelds.org> 85 2003-08-04The Opie Team <opie@handhelds.org>
83 86
84 * Released as Version 1.0.0 87 * Released as Version 1.0.0
85 * Including a PPP module for easy dial up (tille,harlekin,zecke) 88 * Including a PPP module for easy dial up (tille,harlekin,zecke)
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index e86f389..0d0f2cb 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -1,1061 +1,1059 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
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 20
21#include "launcherview.h" 21#include "launcherview.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odebug.h> 24#include <opie2/odebug.h>
25#include <qtopia/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
26#include <qtopia/private/categories.h> 26#include <qtopia/private/categories.h>
27#include <qtopia/categoryselect.h> 27#include <qtopia/categoryselect.h>
28#include <qtopia/mimetype.h> 28#include <qtopia/mimetype.h>
29#include <qtopia/resource.h> 29#include <qtopia/resource.h>
30using namespace Opie::Core; 30using namespace Opie::Core;
31 31
32/* QT */ 32/* QT */
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qfileinfo.h> 34#include <qfileinfo.h>
35#include <qiconview.h> 35#include <qiconview.h>
36#include <qobjectlist.h> 36#include <qobjectlist.h>
37 37
38 38
39// These define how the busy icon is animated and highlighted 39// These define how the busy icon is animated and highlighted
40#define BRIGHTEN_BUSY_ICON 40#define BRIGHTEN_BUSY_ICON
41//#define ALPHA_FADE_BUSY_ICON 41//#define ALPHA_FADE_BUSY_ICON
42//#define USE_ANIMATED_BUSY_ICON_OVERLAY 42//#define USE_ANIMATED_BUSY_ICON_OVERLAY
43#define BOUNCE_BUSY_ICON 43#define BOUNCE_BUSY_ICON
44 44
45 45
46class BgPixmap 46class BgPixmap
47{ 47{
48public: 48public:
49 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} 49 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {}
50 QPixmap pm; 50 QPixmap pm;
51 int ref; 51 int ref;
52}; 52};
53 53
54 54
55static QMap<QString,BgPixmap*> *bgCache = 0; 55static QMap<QString,BgPixmap*> *bgCache = 0;
56 56
57static void cleanup_cache() 57static void cleanup_cache()
58{ 58{
59 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); 59 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin();
60 while ( it != bgCache->end() ) { 60 while ( it != bgCache->end() ) {
61 QMap<QString,BgPixmap*>::Iterator curr = it; 61 QMap<QString,BgPixmap*>::Iterator curr = it;
62 ++it; 62 ++it;
63 delete (*curr); 63 delete (*curr);
64 bgCache->remove( curr ); 64 bgCache->remove( curr );
65 } 65 }
66 delete bgCache; 66 delete bgCache;
67 bgCache = 0; 67 bgCache = 0;
68} 68}
69 69
70 70
71class LauncherItem : public QIconViewItem 71class LauncherItem : public QIconViewItem
72{ 72{
73public: 73public:
74 LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE ); 74 LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE );
75 ~LauncherItem(); 75 ~LauncherItem();
76 76
77 AppLnk *appLnk() const { return app; } 77 AppLnk *appLnk() const { return app; }
78 AppLnk *takeAppLnk() { AppLnk* r=app; app=0; return r; } 78 AppLnk *takeAppLnk() { AppLnk* r=app; app=0; return r; }
79 79
80 void animateIcon(); 80 void animateIcon();
81 void resetIcon(); 81 void resetIcon();
82 82
83 virtual int compare ( QIconViewItem * i ) const; 83 virtual int compare ( QIconViewItem * i ) const;
84 void paintItem( QPainter *p, const QColorGroup &cg ); 84 void paintItem( QPainter *p, const QColorGroup &cg );
85 85
86 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 86 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
87protected: 87protected:
88 bool isBigIcon; 88 bool isBigIcon;
89 int iteration; 89 int iteration;
90 AppLnk* app; 90 AppLnk* app;
91private: 91private:
92 void paintAnimatedIcon( QPainter *p ); 92 void paintAnimatedIcon( QPainter *p );
93 BusyIndicatorType busyType; 93 BusyIndicatorType busyType;
94}; 94};
95 95
96 96
97class LauncherIconView : public QIconView { 97class LauncherIconView : public QIconView {
98public: 98public:
99 LauncherIconView( QWidget* parent, const char* name=0 ) : 99 LauncherIconView( QWidget* parent, const char* name=0 ) :
100 QIconView(parent,name), 100 QIconView(parent,name),
101 tf(""), 101 tf(""),
102 cf(0), 102 cf(0),
103 bsy(0), 103 bsy(0),
104 busyTimer(0), 104 busyTimer(0),
105 bigIcns(TRUE), 105 bigIcns(TRUE),
106 bgColor(white) 106 bgColor(white)
107 { 107 {
108 sortmeth = Name; 108 sortmeth = Name;
109 hidden.setAutoDelete(TRUE); 109 hidden.setAutoDelete(TRUE);
110 ike = FALSE; 110 ike = FALSE;
111 calculateGrid( Bottom ); 111 calculateGrid( Bottom );
112 } 112 }
113 113
114 ~LauncherIconView() 114 ~LauncherIconView()
115 { 115 {
116#if 0 // debuggery 116#if 0 // debuggery
117 QListIterator<AppLnk> it(hidden); 117 QListIterator<AppLnk> it(hidden);
118 AppLnk* l; 118 AppLnk* l;
119 while ((l=it.current())) { 119 while ((l=it.current())) {
120 ++it; 120 ++it;
121 //odebug << "" << l << ": hidden (should remove)" << oendl; 121 //odebug << "" << l << ": hidden (should remove)" << oendl;
122 } 122 }
123#endif 123#endif
124 } 124 }
125 125
126 QIconViewItem* busyItem() const { return bsy; } 126 QIconViewItem* busyItem() const { return bsy; }
127#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 127#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
128 QPixmap busyPixmap() const { return busyPix; } 128 QPixmap busyPixmap() const { return busyPix; }
129#endif 129#endif
130 void setBigIcons( bool bi ) { 130 void setBigIcons( bool bi ) {
131 bigIcns = bi; 131 bigIcns = bi;
132#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 132#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
133 busyPix.resize(0,0); 133 busyPix.resize(0,0);
134#endif 134#endif
135 } 135 }
136 136
137 void updateCategoriesAndMimeTypes(); 137 void updateCategoriesAndMimeTypes();
138 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 138 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
139 void doAutoScroll() 139 void doAutoScroll()
140 { 140 {
141 // We don't want rubberbanding (yet) 141 // We don't want rubberbanding (yet)
142 } 142 }
143 143
144 void setBusy(bool on) 144 void setBusy(bool on)
145 { 145 {
146#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 146#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
147 if ( busyPix.isNull() ) { 147 if ( busyPix.isNull() ) {
148 int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 148 int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
149 busyPix.convertFromImage( Resource::loadImage( "busy" ).smoothScale( size * 16, size ) ); 149 busyPix.convertFromImage( Resource::loadImage( "busy" ).smoothScale( size * 16, size ) );
150 } 150 }
151#endif 151#endif
152 152
153 if ( on ) { 153 if ( on ) {
154 busyTimer = startTimer( 100 ); 154 busyTimer = startTimer( 100 );
155 } else { 155 } else {
156 if ( busyTimer ) { 156 if ( busyTimer ) {
157 killTimer( busyTimer ); 157 killTimer( busyTimer );
158 busyTimer = 0; 158 busyTimer = 0;
159 } 159 }
160 } 160 }
161 161
162 LauncherItem *c = on ? (LauncherItem*)currentItem() : 0; 162 LauncherItem *c = on ? (LauncherItem*)currentItem() : 0;
163 163
164 if ( bsy != c ) { 164 if ( bsy != c ) {
165 LauncherItem *oldBusy = bsy; 165 LauncherItem *oldBusy = bsy;
166 bsy = c; 166 bsy = c;
167 if ( oldBusy ) { 167 if ( oldBusy ) {
168 oldBusy->resetIcon(); 168 oldBusy->resetIcon();
169 } 169 }
170 if ( bsy ) { 170 if ( bsy ) {
171 bsy->setBusyIndicatorType( busyType ) ; 171 bsy->setBusyIndicatorType( busyType ) ;
172 bsy->animateIcon(); 172 bsy->animateIcon();
173 } 173 }
174 } 174 }
175 } 175 }
176 176
177 bool inKeyEvent() const { return ike; } 177 bool inKeyEvent() const { return ike; }
178 void keyPressEvent(QKeyEvent* e) 178 void keyPressEvent(QKeyEvent* e)
179 { 179 {
180 ike = TRUE; 180 ike = TRUE;
181 if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { 181 if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) {
182 if ( (e->state() & ShiftButton) ) 182 if ( (e->state() & ShiftButton) )
183 emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); 183 emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() );
184 else 184 else
185 returnPressed(currentItem()); 185 returnPressed(currentItem());
186 } 186 }
187 187
188 QIconView::keyPressEvent(e); 188 QIconView::keyPressEvent(e);
189 ike = FALSE; 189 ike = FALSE;
190 } 190 }
191 191
192 void addItem(AppLnk* app, bool resort=TRUE); 192 void addItem(AppLnk* app, bool resort=TRUE);
193 bool removeLink(const QString& linkfile); 193 bool removeLink(const QString& linkfile);
194 194
195 QStringList mimeTypes() const; 195 QStringList mimeTypes() const;
196 QStringList categories() const; 196 QStringList categories() const;
197 197
198 void clear() 198 void clear()
199 { 199 {
200 mimes.clear(); 200 mimes.clear();
201 cats.clear(); 201 cats.clear();
202 QIconView::clear(); 202 QIconView::clear();
203 hidden.clear(); 203 hidden.clear();
204 } 204 }
205 205
206 void addCatsAndMimes(AppLnk* app) 206 void addCatsAndMimes(AppLnk* app)
207 { 207 {
208 // QStringList c = app->categories(); 208 // QStringList c = app->categories();
209 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { 209 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) {
210 // cats.replace(*cit,(void*)1); 210 // cats.replace(*cit,(void*)1);
211 // } 211 // }
212 QString maj=app->type(); 212 QString maj=app->type();
213 int sl=maj.find('/'); 213 int sl=maj.find('/');
214 if (sl>=0) { 214 if (sl>=0) {
215 QString k; 215 QString k;
216 k = maj.left(12) == "application/" ? maj : maj.left(sl); 216 k = maj.left(12) == "application/" ? maj : maj.left(sl);
217 mimes.replace(k,(void*)1); 217 mimes.replace(k,(void*)1);
218 } 218 }
219 } 219 }
220 220
221 void setBackgroundOrigin( QWidget::BackgroundOrigin ) { 221 void setBackgroundOrigin( QWidget::BackgroundOrigin ) {
222 } 222 }
223 223
224 void setBackgroundPixmap( const QPixmap &pm ) { 224 void setBackgroundPixmap( const QPixmap &pm ) {
225 bgPixmap = pm; 225 bgPixmap = pm;
226 } 226 }
227 227
228 void setBackgroundColor( const QColor &c ) { 228 void setBackgroundColor( const QColor &c ) {
229 bgColor = c; 229 bgColor = c;
230 } 230 }
231 231
232 void drawBackground( QPainter *p, const QRect &r ) 232 void drawBackground( QPainter *p, const QRect &r )
233 { 233 {
234 if ( !bgPixmap.isNull() ) { 234 if ( !bgPixmap.isNull() ) {
235 p->drawTiledPixmap( r, bgPixmap, 235 p->drawTiledPixmap( r, bgPixmap,
236 QPoint( (r.x() + contentsX()) % bgPixmap.width(), 236 QPoint( (r.x() + contentsX()) % bgPixmap.width(),
237 (r.y() + contentsY()) % bgPixmap.height() ) ); 237 (r.y() + contentsY()) % bgPixmap.height() ) );
238 } else { 238 } else {
239 p->fillRect( r, bgColor ); 239 p->fillRect( r, bgColor );
240 } 240 }
241 } 241 }
242 242
243 void setItemTextPos( ItemTextPos pos ) 243 void setItemTextPos( ItemTextPos pos )
244 { 244 {
245 calculateGrid( pos ); 245 calculateGrid( pos );
246 QIconView::setItemTextPos( pos ); 246 QIconView::setItemTextPos( pos );
247 } 247 }
248 248
249 void hideOrShowItems(bool resort); 249 void hideOrShowItems(bool resort);
250 250
251 void setTypeFilter(const QString& typefilter, bool resort) 251 void setTypeFilter(const QString& typefilter, bool resort)
252 { 252 {
253 tf = QRegExp(typefilter,FALSE,TRUE); 253 tf = QRegExp(typefilter,FALSE,TRUE);
254 hideOrShowItems(resort); 254 hideOrShowItems(resort);
255 } 255 }
256 256
257 void setCategoryFilter( int catfilter, bool resort ) 257 void setCategoryFilter( int catfilter, bool resort )
258 { 258 {
259 Categories cat; 259 Categories cat;
260 cat.load( categoryFileName() ); 260 cat.load( categoryFileName() );
261 QString str; 261 QString str;
262 if ( catfilter == -2 ) 262 if ( catfilter == -2 )
263 cf = 0; 263 cf = 0;
264 else 264 else
265 cf = catfilter; 265 cf = catfilter;
266 hideOrShowItems(resort); 266 hideOrShowItems(resort);
267 } 267 }
268 268
269 enum SortMethod { Name, Date, Type }; 269 enum SortMethod { Name, Date, Type };
270 270
271 void setSortMethod( SortMethod m ) 271 void setSortMethod( SortMethod m )
272 { 272 {
273 if ( sortmeth != m ) { 273 if ( sortmeth != m ) {
274 sortmeth = m; 274 sortmeth = m;
275 sort(); 275 sort();
276 } 276 }
277 } 277 }
278 278
279 int compare(const AppLnk* a, const AppLnk* b) 279 int compare(const AppLnk* a, const AppLnk* b)
280 { 280 {
281 switch (sortmeth) { 281 switch (sortmeth) {
282 case Name: 282 case Name:
283 return a->name().lower().compare(b->name().lower()); 283 return a->name().lower().compare(b->name().lower());
284 case Date: { 284 case Date: {
285 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); 285 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file());
286 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); 286 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file());
287 return fa.lastModified().secsTo(fb.lastModified()); 287 return fa.lastModified().secsTo(fb.lastModified());
288 } 288 }
289 case Type: 289 case Type:
290 return a->type().compare(b->type()); 290 return a->type().compare(b->type());
291 } 291 }
292 return 0; 292 return 0;
293 } 293 }
294 294
295protected: 295protected:
296 296
297 void timerEvent( QTimerEvent *te ) 297 void timerEvent( QTimerEvent *te )
298 { 298 {
299 if ( te->timerId() == busyTimer ) { 299 if ( te->timerId() == busyTimer ) {
300 if ( bsy ) 300 if ( bsy )
301 bsy->animateIcon(); 301 bsy->animateIcon();
302 } else { 302 } else {
303 QIconView::timerEvent( te ); 303 QIconView::timerEvent( te );
304 } 304 }
305 } 305 }
306 306
307 void styleChange( QStyle &old ) 307 void styleChange( QStyle &old )
308 { 308 {
309 QIconView::styleChange( old ); 309 QIconView::styleChange( old );
310 calculateGrid( itemTextPos() ); 310 calculateGrid( itemTextPos() );
311 } 311 }
312 312
313 void calculateGrid( ItemTextPos pos ) 313 void calculateGrid( ItemTextPos pos )
314 { 314 {
315 int dw = QApplication::desktop()->width(); 315 int dw = QApplication::desktop()->width();
316 int viewerWidth = dw-style().scrollBarExtent().width(); 316 int viewerWidth = dw-style().scrollBarExtent().width();
317 if ( pos == Bottom ) { 317 if ( pos == Bottom ) {
318 int cols = 3; 318 int cols = 3;
319 if ( viewerWidth <= 200 ) 319 if ( viewerWidth <= 200 )
320 cols = 2; 320 cols = 2;
321 else if ( viewerWidth >= 400 ) 321 else if ( viewerWidth >= 400 )
322 cols = viewerWidth/96; 322 cols = viewerWidth/96;
323 setSpacing( 4 ); 323 setSpacing( 4 );
324 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 324 setGridX( (viewerWidth-(cols+1)*spacing())/cols );
325 setGridY( fontMetrics().height()*2+24 ); 325 setGridY( fontMetrics().height()*2+24 );
326 } else { 326 } else {
327 int cols = 2; 327 int cols = 2;
328 if ( viewerWidth < 150 ) 328 if ( viewerWidth < 150 )
329 cols = 1; 329 cols = 1;
330 else if ( viewerWidth >= 400 ) 330 else if ( viewerWidth >= 400 )
331 cols = viewerWidth/150; 331 cols = viewerWidth/150;
332 setSpacing( 2 ); 332 setSpacing( 2 );
333 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 333 setGridX( (viewerWidth-(cols+1)*spacing())/cols );
334 setGridY( fontMetrics().height()+2 ); 334 setGridY( fontMetrics().height()+2 );
335 } 335 }
336 } 336 }
337 337
338 void focusInEvent( QFocusEvent * ) {} 338 void focusInEvent( QFocusEvent * ) {}
339 void focusOutEvent( QFocusEvent * ) {} 339 void focusOutEvent( QFocusEvent * ) {}
340 340
341private: 341private:
342 QList<AppLnk> hidden; 342 QList<AppLnk> hidden;
343 QDict<void> mimes; 343 QDict<void> mimes;
344 QDict<void> cats; 344 QDict<void> cats;
345 SortMethod sortmeth; 345 SortMethod sortmeth;
346 QRegExp tf; 346 QRegExp tf;
347 int cf; 347 int cf;
348 LauncherItem* bsy; 348 LauncherItem* bsy;
349 int busyTimer; 349 int busyTimer;
350 bool ike; 350 bool ike;
351 bool bigIcns; 351 bool bigIcns;
352 QPixmap bgPixmap; 352 QPixmap bgPixmap;
353 QColor bgColor; 353 QColor bgColor;
354#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 354#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
355 QPixmap busyPix; 355 QPixmap busyPix;
356#endif 356#endif
357 BusyIndicatorType busyType; 357 BusyIndicatorType busyType;
358}; 358};
359 359
360 360
361bool LauncherView::bsy=FALSE; 361bool LauncherView::bsy=FALSE;
362 362
363void LauncherView::setBusy(bool on) 363void LauncherView::setBusy(bool on)
364{ 364{
365 icons->setBusy(on); 365 icons->setBusy(on);
366} 366}
367 367
368void LauncherView::setBusyIndicatorType( const QString& type ) { 368void LauncherView::setBusyIndicatorType( const QString& type ) {
369 if ( type. lower ( ) == "animated" ) 369 if ( type. lower ( ) == "animated" )
370 icons->setBusyIndicatorType( BIT_Animated ) ; 370 icons->setBusyIndicatorType( BIT_Animated ) ;
371 else 371 else
372 icons->setBusyIndicatorType( BIT_Normal ) ; 372 icons->setBusyIndicatorType( BIT_Normal ) ;
373} 373}
374 374
375LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) 375LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon )
376 : QIconViewItem( parent, applnk->name(), 376 : QIconViewItem( parent, applnk->name(),
377 bigIcon ? applnk->bigPixmap() :applnk->pixmap() ), 377 bigIcon ? applnk->bigPixmap() :applnk->pixmap() ),
378 isBigIcon( bigIcon ), 378 isBigIcon( bigIcon ),
379 iteration(0), 379 iteration(0),
380 app(applnk) // Takes ownership 380 app(applnk) // Takes ownership
381{ 381{
382} 382}
383 383
384LauncherItem::~LauncherItem() 384LauncherItem::~LauncherItem()
385{ 385{
386 LauncherIconView* liv = (LauncherIconView*)iconView(); 386 LauncherIconView* liv = (LauncherIconView*)iconView();
387 if ( liv->busyItem() == this ) 387 if ( liv->busyItem() == this )
388 liv->setBusy(FALSE); 388 liv->setBusy(FALSE);
389 delete app; 389 delete app;
390} 390}
391 391
392int LauncherItem::compare ( QIconViewItem * i ) const 392int LauncherItem::compare ( QIconViewItem * i ) const
393{ 393{
394 LauncherIconView* view = (LauncherIconView*)iconView(); 394 LauncherIconView* view = (LauncherIconView*)iconView();
395 return view->compare(app,((LauncherItem *)i)->appLnk()); 395 return view->compare(app,((LauncherItem *)i)->appLnk());
396} 396}
397 397
398void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg ) 398void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg )
399{ 399{
400 LauncherIconView* liv = (LauncherIconView*)iconView(); 400 LauncherIconView* liv = (LauncherIconView*)iconView();
401 QBrush oldBrush( liv->itemTextBackground() ); 401 QBrush oldBrush( liv->itemTextBackground() );
402 QColorGroup mycg( cg ); 402 QColorGroup mycg( cg );
403 if ( liv->currentItem() == this ) { 403 if ( liv->currentItem() == this ) {
404 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) ); 404 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) );
405 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) ); 405 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) );
406 } 406 }
407 407
408 QIconViewItem::paintItem(p,mycg); 408 QIconViewItem::paintItem(p,mycg);
409 409
410 // Paint animation overlay 410 // Paint animation overlay
411 if ( liv->busyItem() == this ) 411 if ( liv->busyItem() == this )
412 paintAnimatedIcon(p); 412 paintAnimatedIcon(p);
413 413
414 if ( liv->currentItem() == this ) 414 if ( liv->currentItem() == this )
415 liv->setItemTextBackground( oldBrush ); 415 liv->setItemTextBackground( oldBrush );
416} 416}
417 417
418 418
419 419
420void LauncherItem::paintAnimatedIcon( QPainter *p ) 420void LauncherItem::paintAnimatedIcon( QPainter *p )
421{ 421{
422 LauncherIconView* liv = (LauncherIconView*)iconView(); 422 LauncherIconView* liv = (LauncherIconView*)iconView();
423 int pic = iteration % 16; 423 int pic = iteration % 16;
424 int w = pixmap()->width(), h = pixmap()->height(); 424 int w = pixmap()->width(), h = pixmap()->height();
425 QPixmap dblBuf( w, h + 4 ); 425 QPixmap dblBuf( w, h + 4 );
426 QPainter p2( &dblBuf ); 426 QPainter p2( &dblBuf );
427 int x1, y1; 427 int x1, y1;
428 if ( liv->itemTextPos() == QIconView::Bottom ) { 428 if ( liv->itemTextPos() == QIconView::Bottom ) {
429 x1 = x() + (width() - w) / 2 - liv->contentsX(); 429 x1 = x() + (width() - w) / 2 - liv->contentsX();
430 y1 = y() - liv->contentsY(); 430 y1 = y() - liv->contentsY();
431 } else { 431 } else {
432 x1 = x() - liv->contentsX(); 432 x1 = x() - liv->contentsX();
433 y1 = y() + (height() - h) / 2 - liv->contentsY(); 433 y1 = y() + (height() - h) / 2 - liv->contentsY();
434 } 434 }
435 y1 -= 2; 435 y1 -= 2;
436 p2.translate(-x1,-y1); 436 p2.translate(-x1,-y1);
437 liv->drawBackground( &p2, QRect(x1,y1,w,h+4) ); 437 liv->drawBackground( &p2, QRect(x1,y1,w,h+4) );
438 int bounceY = 2; 438 int bounceY = 2;
439#ifdef BOUNCE_BUSY_ICON 439#ifdef BOUNCE_BUSY_ICON
440 if ( busyType == BIT_Animated ) { 440 if ( busyType == BIT_Animated ) {
441 bounceY = 4 - ((iteration+2)%8); 441 bounceY = 4 - ((iteration+2)%8);
442 bounceY = bounceY < 0 ? -bounceY : bounceY; 442 bounceY = bounceY < 0 ? -bounceY : bounceY;
443 } 443 }
444#endif 444#endif
445 p2.drawPixmap( x1, y1 + bounceY, *pixmap() ); 445 p2.drawPixmap( x1, y1 + bounceY, *pixmap() );
446#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 446#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
447 p2.drawPixmap( x1, y1 + bounceY, liv->busyPixmap(), w * pic, 0, w, h ); 447 p2.drawPixmap( x1, y1 + bounceY, liv->busyPixmap(), w * pic, 0, w, h );
448#endif 448#endif
449 p->drawPixmap( x1, y1, dblBuf ); 449 p->drawPixmap( x1, y1, dblBuf );
450} 450}
451 451
452void LauncherItem::animateIcon() 452void LauncherItem::animateIcon()
453{ 453{
454 LauncherIconView* liv = (LauncherIconView*)iconView(); 454 LauncherIconView* liv = (LauncherIconView*)iconView();
455 455
456 if ( liv->busyItem() != this || !app ) 456 if ( liv->busyItem() != this || !app )
457 return; 457 return;
458 458
459 // Highlight the icon 459 // Highlight the icon
460 if ( iteration == 0 ) { 460 if ( iteration == 0 ) {
461 QPixmap src = isBigIcon ? app->bigPixmap() : app->pixmap(); 461 QPixmap src = isBigIcon ? app->bigPixmap() : app->pixmap();
462 QImage img = src.convertToImage(); 462 QImage img = src.convertToImage();
463 QRgb *rgb; 463 QRgb *rgb;
464 int count; 464 int count;
465 if ( img.depth() == 32 ) { 465 if ( img.depth() == 32 ) {
466 rgb = (QRgb*)img.bits(); 466 rgb = (QRgb*)img.bits();
467 count = img.bytesPerLine()/sizeof(QRgb)*img.height(); 467 count = img.bytesPerLine()/sizeof(QRgb)*img.height();
468 } else { 468 } else {
469 rgb = img.colorTable(); 469 rgb = img.colorTable();
470 count = img.numColors(); 470 count = img.numColors();
471 } 471 }
472 for ( int r = 0; r < count; r++, rgb++ ) { 472 for ( int r = 0; r < count; r++, rgb++ ) {
473#if defined(BRIGHTEN_BUSY_ICON) 473#if defined(BRIGHTEN_BUSY_ICON)
474 QColor c(*rgb); 474 QColor c(*rgb);
475 int h, s, v; 475 int h, s, v;
476 c.hsv(&h,&s,&v); 476 c.hsv(&h,&s,&v);
477 c.setHsv(h,QMAX(s-24,0),QMIN(v+48,255)); 477 c.setHsv(h,QMAX(s-24,0),QMIN(v+48,255));
478 *rgb = qRgba(c.red(),c.green(),c.blue(),qAlpha(*rgb)); 478 *rgb = qRgba(c.red(),c.green(),c.blue(),qAlpha(*rgb));
479#elif defined(ALPHA_FADE_BUSY_ICON) 479#elif defined(ALPHA_FADE_BUSY_ICON)
480 *rgb = qRgba(qRed(*rgb),qGreen(*rgb),qBlue(*rgb),qAlpha(*rgb)/2); 480 *rgb = qRgba(qRed(*rgb),qGreen(*rgb),qBlue(*rgb),qAlpha(*rgb)/2);
481#endif 481#endif
482 } 482 }
483 src.convertFromImage( img ); 483 src.convertFromImage( img );
484 setPixmap( src ); 484 setPixmap( src );
485 } 485 }
486 486
487 iteration++; 487 iteration++;
488 488
489 // Paint animation overlay 489 // Paint animation overlay
490 QPainter p( liv->viewport() ); 490 QPainter p( liv->viewport() );
491 paintAnimatedIcon( &p ); 491 paintAnimatedIcon( &p );
492} 492}
493 493
494void LauncherItem::resetIcon() 494void LauncherItem::resetIcon()
495{ 495{
496 iteration = 0; 496 iteration = 0;
497 setPixmap( isBigIcon ? app->bigPixmap() : app->pixmap() ); 497 setPixmap( isBigIcon ? app->bigPixmap() : app->pixmap() );
498} 498}
499 499
500//=========================================================================== 500//===========================================================================
501 501
502QStringList LauncherIconView::mimeTypes() const 502QStringList LauncherIconView::mimeTypes() const
503{ 503{
504 QStringList r; 504 QStringList r;
505 QDictIterator<void> it(mimes); 505 QDictIterator<void> it(mimes);
506 while (it.current()) { 506 while (it.current()) {
507 r.append(it.currentKey()); 507 r.append(it.currentKey());
508 ++it; 508 ++it;
509 } 509 }
510 r.sort(); 510 r.sort();
511 return r; 511 return r;
512} 512}
513 513
514void LauncherIconView::addItem(AppLnk* app, bool resort) 514void LauncherIconView::addItem(AppLnk* app, bool resort)
515{ 515{
516 addCatsAndMimes(app); 516 addCatsAndMimes(app);
517 517
518 if ( (tf.isEmpty() || tf.match(app->type()) >= 0) 518 if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
519 && (cf == 0 || app->categories().contains(cf) 519 && (cf == 0 || app->categories().contains(cf)
520 || cf == -1 && app->categories().count() == 0 ) ) 520 || cf == -1 && app->categories().count() == 0 ) )
521 (void) new LauncherItem( this, app, bigIcns ); 521 (void) new LauncherItem( this, app, bigIcns );
522 else 522 else
523 hidden.append(app); 523 hidden.append(app);
524 if ( resort ) 524 if ( resort )
525 sort(); 525 sort();
526} 526}
527 527
528void LauncherIconView::updateCategoriesAndMimeTypes() 528void LauncherIconView::updateCategoriesAndMimeTypes()
529{ 529{
530 mimes.clear(); 530 mimes.clear();
531 cats.clear(); 531 cats.clear();
532 LauncherItem* item = (LauncherItem*)firstItem(); 532 LauncherItem* item = (LauncherItem*)firstItem();
533 while (item) { 533 while (item) {
534 addCatsAndMimes(item->appLnk()); 534 addCatsAndMimes(item->appLnk());
535 item = (LauncherItem*)item->nextItem(); 535 item = (LauncherItem*)item->nextItem();
536 } 536 }
537 QListIterator<AppLnk> it(hidden); 537 QListIterator<AppLnk> it(hidden);
538 AppLnk* l; 538 AppLnk* l;
539 while ((l=it.current())) { 539 while ((l=it.current())) {
540 addCatsAndMimes(l); 540 addCatsAndMimes(l);
541 ++it; 541 ++it;
542 } 542 }
543} 543}
544 544
545void LauncherIconView::hideOrShowItems(bool resort) 545void LauncherIconView::hideOrShowItems(bool resort)
546{ 546{
547 viewport()->setUpdatesEnabled( FALSE ); 547 viewport()->setUpdatesEnabled( FALSE );
548 hidden.setAutoDelete(FALSE); 548 hidden.setAutoDelete(FALSE);
549 QList<AppLnk> links=hidden; 549 QList<AppLnk> links=hidden;
550 hidden.clear(); 550 hidden.clear();
551 hidden.setAutoDelete(TRUE); 551 hidden.setAutoDelete(TRUE);
552 LauncherItem* item = (LauncherItem*)firstItem(); 552 LauncherItem* item = (LauncherItem*)firstItem();
553 while (item) { 553 while (item) {
554 links.append(item->takeAppLnk()); 554 links.append(item->takeAppLnk());
555 item = (LauncherItem*)item->nextItem(); 555 item = (LauncherItem*)item->nextItem();
556 } 556 }
557 clear(); 557 clear();
558 QListIterator<AppLnk> it(links); 558 QListIterator<AppLnk> it(links);
559 AppLnk* l; 559 AppLnk* l;
560 while ((l=it.current())) { 560 while ((l=it.current())) {
561 addItem(l,FALSE); 561 addItem(l,FALSE);
562 ++it; 562 ++it;
563 } 563 }
564 if ( resort && !autoArrange() ) 564 if ( resort && !autoArrange() )
565 sort(); 565 sort();
566 viewport()->setUpdatesEnabled( TRUE ); 566 viewport()->setUpdatesEnabled( TRUE );
567} 567}
568 568
569bool LauncherIconView::removeLink(const QString& linkfile) 569bool LauncherIconView::removeLink(const QString& linkfile)
570{ 570{
571 LauncherItem* item = (LauncherItem*)firstItem(); 571 LauncherItem* item = (LauncherItem*)firstItem();
572 AppLnk* l; 572 AppLnk* l;
573 bool did = FALSE; 573 bool did = FALSE;
574 DocLnk dl(linkfile); 574 DocLnk dl(linkfile);
575 while (item) { 575 while (item) {
576 l = item->appLnk(); 576 l = item->appLnk();
577 LauncherItem *nextItem = (LauncherItem *)item->nextItem(); 577 LauncherItem *nextItem = (LauncherItem *)item->nextItem();
578 if ( l->linkFileKnown() && l->linkFile() == linkfile 578 if ( l->linkFileKnown() && l->linkFile() == linkfile
579 || l->fileKnown() && ( 579 || l->fileKnown() && (
580 l->file() == linkfile 580 l->file() == linkfile
581 || dl.isValid() && dl.file() == l->file() ) ) { 581 || dl.isValid() && dl.file() == l->file() ) ) {
582 delete item; 582 delete item;
583 did = TRUE; 583 did = TRUE;
584 } 584 }
585 item = nextItem; 585 item = nextItem;
586 } 586 }
587 QListIterator<AppLnk> it(hidden); 587 QListIterator<AppLnk> it(hidden);
588 while ((l=it.current())) { 588 while ((l=it.current())) {
589 ++it; 589 ++it;
590 if ( l->linkFileKnown() && l->linkFile() == linkfile 590 if ( l->linkFileKnown() && l->linkFile() == linkfile
591 || l->file() == linkfile 591 || l->file() == linkfile
592 || dl.isValid() && dl.file() == l->file() ) { 592 || dl.isValid() && dl.file() == l->file() ) {
593 hidden.removeRef(l); 593 hidden.removeRef(l);
594 did = TRUE; 594 did = TRUE;
595 } 595 }
596 } 596 }
597 return did; 597 return did;
598} 598}
599 599
600//=========================================================================== 600//===========================================================================
601 601
602LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) 602LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl )
603 : QVBox( parent, name, fl ) 603 : QVBox( parent, name, fl )
604{ 604{
605 catmb = 0; 605 catmb = 0;
606 icons = new LauncherIconView( this ); 606 icons = new LauncherIconView( this );
607 setFocusProxy(icons); 607 setFocusProxy(icons);
608 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); 608 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold );
609 609
610 icons->setItemsMovable( FALSE ); 610 icons->setItemsMovable( FALSE );
611 icons->setAutoArrange( TRUE ); 611 icons->setAutoArrange( TRUE );
612 icons->setSorting( TRUE ); 612 icons->setSorting( TRUE );
613 icons->setFrameStyle( QFrame::NoFrame ); 613 icons->setFrameStyle( QFrame::NoFrame );
614 icons->setMargin( 0 ); 614 icons->setMargin( 0 );
615 icons->setSelectionMode( QIconView::NoSelection ); 615 icons->setSelectionMode( QIconView::NoSelection );
616 icons->setBackgroundMode( PaletteBase ); 616 icons->setBackgroundMode( PaletteBase );
617 icons->setResizeMode( QIconView::Fixed ); 617 icons->setResizeMode( QIconView::Fixed );
618 vmode = (ViewMode)-1; 618 vmode = (ViewMode)-1;
619 setViewMode( Icon ); 619 setViewMode( Icon );
620 620
621 connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)), 621 connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)),
622 SLOT(itemClicked(int,QIconViewItem*)) ); 622 SLOT(itemClicked(int,QIconViewItem*)) );
623 connect( icons, SIGNAL(selectionChanged()), 623 connect( icons, SIGNAL(selectionChanged()),
624 SLOT(selectionChanged()) ); 624 SLOT(selectionChanged()) );
625 connect( icons, SIGNAL(returnPressed(QIconViewItem*)), 625 connect( icons, SIGNAL(returnPressed(QIconViewItem*)),
626 SLOT(returnPressed(QIconViewItem*)) ); 626 SLOT(returnPressed(QIconViewItem*)) );
627 connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)), 627 connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)),
628 SLOT(itemPressed(int,QIconViewItem*)) ); 628 SLOT(itemPressed(int,QIconViewItem*)) );
629 629
630 tools = 0; 630 tools = 0;
631 setBackgroundType( Ruled, QString::null ); 631 setBackgroundType( Ruled, QString::null );
632} 632}
633 633
634LauncherView::~LauncherView() 634LauncherView::~LauncherView()
635{ 635{
636 if ( bgCache && bgCache->contains( bgName ) ) 636 if ( bgCache && bgCache->contains( bgName ) )
637 (*bgCache)[bgName]->ref--; 637 (*bgCache)[bgName]->ref--;
638} 638}
639 639
640void LauncherView::hideIcons() 640void LauncherView::hideIcons()
641{ 641{
642 icons->hide(); 642 icons->hide();
643} 643}
644 644
645void LauncherView::setToolsEnabled(bool y) 645void LauncherView::setToolsEnabled(bool y)
646{ 646{
647 if ( !y != !tools ) { 647 if ( !y != !tools ) {
648 if ( y ) { 648 if ( y ) {
649 tools = new QHBox(this); 649 tools = new QHBox(this);
650 650
651 // Type filter 651 // Type filter
652 typemb = new QComboBox(tools); 652 typemb = new QComboBox(tools);
653 QSizePolicy p = typemb->sizePolicy(); 653 QSizePolicy p = typemb->sizePolicy();
654 p.setHorData(QSizePolicy::Expanding); 654 p.setHorData(QSizePolicy::Expanding);
655 typemb->setSizePolicy(p); 655 typemb->setSizePolicy(p);
656 656
657 // Category filter 657 // Category filter
658 updateTools(); 658 updateTools();
659 tools->show(); 659 tools->show();
660 660
661 // Always show vscrollbar
662 icons->setVScrollBarMode( QScrollView::AlwaysOn );
663 } else { 661 } else {
664 delete tools; 662 delete tools;
665 tools = 0; 663 tools = 0;
666 } 664 }
667 } 665 }
668} 666}
669 667
670void LauncherView::updateTools() 668void LauncherView::updateTools()
671{ 669{
672 disconnect( typemb, SIGNAL(activated(int)), 670 disconnect( typemb, SIGNAL(activated(int)),
673 this, SLOT(showType(int)) ); 671 this, SLOT(showType(int)) );
674 if ( catmb ) disconnect( catmb, SIGNAL(signalSelected(int)), 672 if ( catmb ) disconnect( catmb, SIGNAL(signalSelected(int)),
675 this, SLOT(showCategory(int)) ); 673 this, SLOT(showCategory(int)) );
676 674
677 // ### I want to remove this 675 // ### I want to remove this
678 icons->updateCategoriesAndMimeTypes(); 676 icons->updateCategoriesAndMimeTypes();
679 677
680 QString prev; 678 QString prev;
681 679
682 // Type filter 680 // Type filter
683 QStringList types; 681 QStringList types;
684 typelist = icons->mimeTypes(); 682 typelist = icons->mimeTypes();
685 for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) { 683 for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) {
686 QString t = *it; 684 QString t = *it;
687 if ( t.left(12) == "application/" ) { 685 if ( t.left(12) == "application/" ) {
688 MimeType mt(t); 686 MimeType mt(t);
689 const AppLnk* app = mt.application(); 687 const AppLnk* app = mt.application();
690 if ( app ) 688 if ( app )
691 t = app->name(); 689 t = app->name();
692 else 690 else
693 t = t.mid(12); 691 t = t.mid(12);
694 } else { 692 } else {
695 t[0] = t[0].upper(); 693 t[0] = t[0].upper();
696 } 694 }
697 types += t; 695 types += t;
698 } 696 }
699 types << tr("All types"); 697 types << tr("All types");
700 prev = typemb->currentText(); 698 prev = typemb->currentText();
701 typemb->clear(); 699 typemb->clear();
702 typemb->insertStringList(types); 700 typemb->insertStringList(types);
703 for (int i=0; i<typemb->count(); i++) { 701 for (int i=0; i<typemb->count(); i++) {
704 if ( typemb->text(i) == prev ) { 702 if ( typemb->text(i) == prev ) {
705 typemb->setCurrentItem(i); 703 typemb->setCurrentItem(i);
706 break; 704 break;
707 } 705 }
708 } 706 }
709 if ( prev.isNull() ) 707 if ( prev.isNull() )
710 typemb->setCurrentItem(typemb->count()-1); 708 typemb->setCurrentItem(typemb->count()-1);
711 709
712 int pcat = catmb ? catmb->currentCategory() : -2; 710 int pcat = catmb ? catmb->currentCategory() : -2;
713 if ( !catmb ) 711 if ( !catmb )
714 catmb = new CategorySelect(tools); 712 catmb = new CategorySelect(tools);
715 Categories cats( 0 ); 713 Categories cats( 0 );
716 cats.load( categoryFileName() ); 714 cats.load( categoryFileName() );
717 QArray<int> vl( 0 ); 715 QArray<int> vl( 0 );
718 catmb->setCategories( vl, "Document View", // No tr 716 catmb->setCategories( vl, "Document View", // No tr
719 tr("Document View") ); 717 tr("Document View") );
720 catmb->setRemoveCategoryEdit( TRUE ); 718 catmb->setRemoveCategoryEdit( TRUE );
721 catmb->setAllCategories( TRUE ); 719 catmb->setAllCategories( TRUE );
722 catmb->setCurrentCategory(pcat); 720 catmb->setCurrentCategory(pcat);
723 721
724 // if type has changed we need to redisplay 722 // if type has changed we need to redisplay
725 if ( typemb->currentText() != prev ) 723 if ( typemb->currentText() != prev )
726 showType( typemb->currentItem() ); 724 showType( typemb->currentItem() );
727 725
728 connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int))); 726 connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int)));
729 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); 727 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
730} 728}
731 729
732void LauncherView::sortBy(int s) 730void LauncherView::sortBy(int s)
733{ 731{
734 icons->setSortMethod((LauncherIconView::SortMethod)s); 732 icons->setSortMethod((LauncherIconView::SortMethod)s);
735} 733}
736 734
737void LauncherView::showType(int t) 735void LauncherView::showType(int t)
738{ 736{
739 if ( t >= (int)typelist.count() ) { 737 if ( t >= (int)typelist.count() ) {
740 icons->setTypeFilter("",TRUE); 738 icons->setTypeFilter("",TRUE);
741 } else { 739 } else {
742 QString ty = typelist[t]; 740 QString ty = typelist[t];
743 if ( !ty.contains('/') ) 741 if ( !ty.contains('/') )
744 ty += "/*"; 742 ty += "/*";
745 icons->setTypeFilter(ty,TRUE); 743 icons->setTypeFilter(ty,TRUE);
746 } 744 }
747} 745}
748 746
749void LauncherView::showCategory( int c ) 747void LauncherView::showCategory( int c )
750{ 748{
751 icons->setCategoryFilter( c, TRUE ); 749 icons->setCategoryFilter( c, TRUE );
752} 750}
753 751
754void LauncherView::setViewMode( ViewMode m ) 752void LauncherView::setViewMode( ViewMode m )
755{ 753{
756 if ( vmode != m ) { 754 if ( vmode != m ) {
757 bool bigIcons = m == Icon; 755 bool bigIcons = m == Icon;
758 icons->viewport()->setUpdatesEnabled( FALSE ); 756 icons->viewport()->setUpdatesEnabled( FALSE );
759 icons->setBigIcons( bigIcons ); 757 icons->setBigIcons( bigIcons );
760 switch ( m ) { 758 switch ( m ) {
761 case List: 759 case List:
762 icons->setItemTextPos( QIconView::Right ); 760 icons->setItemTextPos( QIconView::Right );
763 break; 761 break;
764 case Icon: 762 case Icon:
765 icons->setItemTextPos( QIconView::Bottom ); 763 icons->setItemTextPos( QIconView::Bottom );
766 break; 764 break;
767 } 765 }
768 icons->hideOrShowItems( FALSE ); 766 icons->hideOrShowItems( FALSE );
769 icons->viewport()->setUpdatesEnabled( TRUE ); 767 icons->viewport()->setUpdatesEnabled( TRUE );
770 vmode = m; 768 vmode = m;
771 } 769 }
772} 770}
773 771
774// 772//
775// User images may require scaling. 773// User images may require scaling.
776// 774//
777QImage LauncherView::loadBackgroundImage(QString &bgName) 775QImage LauncherView::loadBackgroundImage(QString &bgName)
778{ 776{
779 QImageIO imgio; 777 QImageIO imgio;
780 QSize ds = qApp->desktop()->size(); // should be launcher, not desktop 778 QSize ds = qApp->desktop()->size(); // should be launcher, not desktop
781 bool further_scaling = TRUE; 779 bool further_scaling = TRUE;
782 780
783 imgio.setFileName( bgName ); 781 imgio.setFileName( bgName );
784 imgio.setParameters("GetHeaderInformation"); 782 imgio.setParameters("GetHeaderInformation");
785 783
786 if (imgio.read() == FALSE) { 784 if (imgio.read() == FALSE) {
787 return imgio.image(); 785 return imgio.image();
788 } 786 }
789 787
790 if (imgio.image().width() < ds.width() && 788 if (imgio.image().width() < ds.width() &&
791 imgio.image().height() < ds.height()) { 789 imgio.image().height() < ds.height()) {
792 further_scaling = FALSE; 790 further_scaling = FALSE;
793 } 791 }
794 792
795 if (!imgio.image().bits()) { 793 if (!imgio.image().bits()) {
796 // 794 //
797 // Scale and load. Note we don't scale up. 795 // Scale and load. Note we don't scale up.
798 // 796 //
799 QString param( "Scale( %1, %2, ScaleMin )" ); // No tr 797 QString param( "Scale( %1, %2, ScaleMin )" ); // No tr
800 imgio.setParameters(further_scaling ? 798 imgio.setParameters(further_scaling ?
801 param.arg(ds.width()).arg(ds.height()).latin1() : 799 param.arg(ds.width()).arg(ds.height()).latin1() :
802 ""); 800 "");
803 imgio.read(); 801 imgio.read();
804 } else { 802 } else {
805 if (further_scaling) { 803 if (further_scaling) {
806 intt1 = imgio.image().width() * ds.height(); 804 intt1 = imgio.image().width() * ds.height();
807 int t2 = imgio.image().height() * ds.width(); 805 int t2 = imgio.image().height() * ds.width();
808 int dsth = ds.height(); 806 int dsth = ds.height();
809 int dstw = ds.width(); 807 int dstw = ds.width();
810 808
811 if (t1 > t2) { 809 if (t1 > t2) {
812 dsth = t2 / imgio.image().width(); 810 dsth = t2 / imgio.image().width();
813 } else { 811 } else {
814 dstw = t1 / imgio.image().height(); 812 dstw = t1 / imgio.image().height();
815 } 813 }
816 814
817 // 815 //
818 // Loader didn't scale for us. Do it manually. 816 // Loader didn't scale for us. Do it manually.
819 // 817 //
820 return imgio.image().smoothScale(dstw, dsth); 818 return imgio.image().smoothScale(dstw, dsth);
821 } 819 }
822 } 820 }
823 821
824 return imgio.image(); 822 return imgio.image();
825} 823}
826 824
827void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) 825void LauncherView::setBackgroundType( BackgroundType t, const QString &val )
828{ 826{
829 if ( !bgCache ) { 827 if ( !bgCache ) {
830 bgCache = new QMap<QString,BgPixmap*>; 828 bgCache = new QMap<QString,BgPixmap*>;
831 qAddPostRoutine( cleanup_cache ); 829 qAddPostRoutine( cleanup_cache );
832 } 830 }
833 831
834 if ( bgCache->contains( bgName ) ) 832 if ( bgCache->contains( bgName ) )
835 (*bgCache)[bgName]->ref--; 833 (*bgCache)[bgName]->ref--;
836 bgName = ""; 834 bgName = "";
837 835
838 QPixmap bg; 836 QPixmap bg;
839 837
840 switch ( t ) { 838 switch ( t ) {
841 case Ruled: { 839 case Ruled: {
842 bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr 840 bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr
843 if ( bgCache->contains( bgName ) ) { 841 if ( bgCache->contains( bgName ) ) {
844 (*bgCache)[bgName]->ref++; 842 (*bgCache)[bgName]->ref++;
845 bg = (*bgCache)[bgName]->pm; 843 bg = (*bgCache)[bgName]->pm;
846 } else { 844 } else {
847 bg.resize( width(), 9 ); 845 bg.resize( width(), 9 );
848 QPainter painter( &bg ); 846 QPainter painter( &bg );
849 for ( int i = 0; i < 3; i++ ) { 847 for ( int i = 0; i < 3; i++ ) {
850 painter.setPen( white ); 848 painter.setPen( white );
851 painter.drawLine( 0, i*3, width()-1, i*3 ); 849 painter.drawLine( 0, i*3, width()-1, i*3 );
852 painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); 850 painter.drawLine( 0, i*3+1, width()-1, i*3+1 );
853 painter.setPen( colorGroup().background().light(105) ); 851 painter.setPen( colorGroup().background().light(105) );
854 painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); 852 painter.drawLine( 0, i*3+2, width()-1, i*3+2 );
855 } 853 }
856 painter.end(); 854 painter.end();
857 bgCache->insert( bgName, new BgPixmap(bg) ); 855 bgCache->insert( bgName, new BgPixmap(bg) );
858 } 856 }
859 break; 857 break;
860 } 858 }
861 859
862 case Image: 860 case Image:
863 if (!val.isEmpty()) { 861 if (!val.isEmpty()) {
864 bgName = val; 862 bgName = val;
865 if ( bgCache->contains( bgName ) ) { 863 if ( bgCache->contains( bgName ) ) {
866 (*bgCache)[bgName]->ref++; 864 (*bgCache)[bgName]->ref++;
867 bg = (*bgCache)[bgName]->pm; 865 bg = (*bgCache)[bgName]->pm;
868 } else { 866 } else {
869 QString imgFile = bgName; 867 QString imgFile = bgName;
870 bool tile = FALSE; 868 bool tile = FALSE;
871 if ( imgFile[0]!='/' || !QFile::exists(imgFile) ) { 869 if ( imgFile[0]!='/' || !QFile::exists(imgFile) ) {
872 imgFile = Resource::findPixmap( imgFile ); 870 imgFile = Resource::findPixmap( imgFile );
873 tile = TRUE; 871 tile = TRUE;
874 } 872 }
875 QImage img = loadBackgroundImage(imgFile); 873 QImage img = loadBackgroundImage(imgFile);
876 874
877 875
878 if ( img.depth() == 1 ) 876 if ( img.depth() == 1 )
879 img = img.convertDepth(8); 877 img = img.convertDepth(8);
880 img.setAlphaBuffer(FALSE); 878 img.setAlphaBuffer(FALSE);
881 bg.convertFromImage(img); 879 bg.convertFromImage(img);
882 bgCache->insert( bgName, new BgPixmap(bg) ); 880 bgCache->insert( bgName, new BgPixmap(bg) );
883 } 881 }
884 } 882 }
885 break; 883 break;
886 884
887 case SolidColor: 885 case SolidColor:
888 default: 886 default:
889 break; 887 break;
890 } 888 }
891 889
892 const QObjectList *list = queryList( "QWidget", 0, FALSE ); 890 const QObjectList *list = queryList( "QWidget", 0, FALSE );
893 QObject *obj; 891 QObject *obj;
894 for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) { 892 for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) {
895 if ( obj->isWidgetType() ) { 893 if ( obj->isWidgetType() ) {
896 QWidget *w = (QWidget*)obj; 894 QWidget *w = (QWidget*)obj;
897 w->setBackgroundPixmap( bg ); 895 w->setBackgroundPixmap( bg );
898 if ( bgName.isEmpty() ) { 896 if ( bgName.isEmpty() ) {
899 // Solid Color 897 // Solid Color
900 if ( val.isEmpty() ) 898 if ( val.isEmpty() )
901 w->setBackgroundColor( colorGroup().base() ); 899 w->setBackgroundColor( colorGroup().base() );
902 else 900 else
903 w->setBackgroundColor( val ); 901 w->setBackgroundColor( val );
904 } else { 902 } else {
905 // Ruled or Image pixmap 903 // Ruled or Image pixmap
906 w->setBackgroundOrigin( ParentOrigin ); 904 w->setBackgroundOrigin( ParentOrigin );
907 } 905 }
908 } 906 }
909 } 907 }
910 delete list; 908 delete list;
911 909
912 bgType = t; 910 bgType = t;
913 icons->viewport()->update(); 911 icons->viewport()->update();
914 912
915 QTimer::singleShot( 1000, this, SLOT(flushBgCache()) ); 913 QTimer::singleShot( 1000, this, SLOT(flushBgCache()) );
916} 914}
917 915
918void LauncherView::setTextColor( const QColor &tc ) 916void LauncherView::setTextColor( const QColor &tc )
919{ 917{
920 textCol = tc; 918 textCol = tc;
921 QColorGroup cg = icons->colorGroup(); 919 QColorGroup cg = icons->colorGroup();
922 cg.setColor( QColorGroup::Text, tc ); 920 cg.setColor( QColorGroup::Text, tc );
923 icons->setPalette( QPalette(cg,cg,cg) ); 921 icons->setPalette( QPalette(cg,cg,cg) );
924 icons->viewport()->update(); 922 icons->viewport()->update();
925} 923}
926 924
927void LauncherView::setViewFont( const QFont &f ) 925void LauncherView::setViewFont( const QFont &f )
928{ 926{
929 icons->setFont( f ); 927 icons->setFont( f );
930 icons->hideOrShowItems( FALSE ); 928 icons->hideOrShowItems( FALSE );
931} 929}
932 930
933void LauncherView::clearViewFont() 931void LauncherView::clearViewFont()
934{ 932{
935 icons->unsetFont(); 933 icons->unsetFont();
936 icons->hideOrShowItems( FALSE ); 934 icons->hideOrShowItems( FALSE );
937} 935}
938 936
939void LauncherView::resizeEvent(QResizeEvent *e) 937void LauncherView::resizeEvent(QResizeEvent *e)
940{ 938{
941 //qDebug("LauncherView resize event"); 939 //qDebug("LauncherView resize event");
942 QVBox::resizeEvent( e ); 940 QVBox::resizeEvent( e );
943// commented out for launcherview and qt/e 2.3.8 problems, probably needs real fixing somewhere... 941// commented out for launcherview and qt/e 2.3.8 problems, probably needs real fixing somewhere...
944// if ( e->size().width() != e->oldSize().width() ) 942// if ( e->size().width() != e->oldSize().width() )
945 sort(); 943 sort();
946} 944}
947 945
948void LauncherView::selectionChanged() 946void LauncherView::selectionChanged()
949{ 947{
950 QIconViewItem* item = icons->currentItem(); 948 QIconViewItem* item = icons->currentItem();
951 if ( item && item->isSelected() ) { 949 if ( item && item->isSelected() ) {
952 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 950 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
953 if ( icons->inKeyEvent() ) // not for mouse press 951 if ( icons->inKeyEvent() ) // not for mouse press
954 emit clicked( appLnk ); 952 emit clicked( appLnk );
955 item->setSelected(FALSE); 953 item->setSelected(FALSE);
956 } 954 }
957} 955}
958 956
959void LauncherView::returnPressed( QIconViewItem *item ) 957void LauncherView::returnPressed( QIconViewItem *item )
960{ 958{
961 if ( item ) { 959 if ( item ) {
962 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 960 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
963 emit clicked( appLnk ); 961 emit clicked( appLnk );
964 } 962 }
965} 963}
966 964
967void LauncherView::itemClicked( int btn, QIconViewItem *item ) 965void LauncherView::itemClicked( int btn, QIconViewItem *item )
968{ 966{
969 if ( item ) { 967 if ( item ) {
970 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 968 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
971 if ( btn == LeftButton ) { 969 if ( btn == LeftButton ) {
972 // Make sure it's the item we execute that gets highlighted 970 // Make sure it's the item we execute that gets highlighted
973 icons->setCurrentItem( item ); 971 icons->setCurrentItem( item );
974 emit clicked( appLnk ); 972 emit clicked( appLnk );
975 } 973 }
976 item->setSelected(FALSE); 974 item->setSelected(FALSE);
977 } 975 }
978} 976}
979 977
980void LauncherView::itemPressed( int btn, QIconViewItem *item ) 978void LauncherView::itemPressed( int btn, QIconViewItem *item )
981{ 979{
982 if ( item ) { 980 if ( item ) {
983 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 981 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
984 if ( btn == RightButton ) 982 if ( btn == RightButton )
985 emit rightPressed( appLnk ); 983 emit rightPressed( appLnk );
986 else if ( btn == ShiftButton ) 984 else if ( btn == ShiftButton )
987 emit rightPressed( appLnk ); 985 emit rightPressed( appLnk );
988 item->setSelected(FALSE); 986 item->setSelected(FALSE);
989 } 987 }
990} 988}
991 989
992void LauncherView::removeAllItems() 990void LauncherView::removeAllItems()
993{ 991{
994 icons->clear(); 992 icons->clear();
995} 993}
996 994
997bool LauncherView::removeLink(const QString& linkfile) 995bool LauncherView::removeLink(const QString& linkfile)
998{ 996{
999 return icons->removeLink(linkfile); 997 return icons->removeLink(linkfile);
1000} 998}
1001 999
1002void LauncherView::setSortEnabled( bool v ) 1000void LauncherView::setSortEnabled( bool v )
1003{ 1001{
1004 icons->setSorting( v ); 1002 icons->setSorting( v );
1005 if ( v ) 1003 if ( v )
1006 sort(); 1004 sort();
1007} 1005}
1008 1006
1009void LauncherView::setUpdatesEnabled( bool u ) 1007void LauncherView::setUpdatesEnabled( bool u )
1010{ 1008{
1011 icons->setUpdatesEnabled( u ); 1009 icons->setUpdatesEnabled( u );
1012} 1010}
1013 1011
1014void LauncherView::sort() 1012void LauncherView::sort()
1015{ 1013{
1016 icons->sort(); 1014 icons->sort();
1017} 1015}
1018 1016
1019void LauncherView::addItem(AppLnk* app, bool resort) 1017void LauncherView::addItem(AppLnk* app, bool resort)
1020{ 1018{
1021 icons->addItem(app,resort); 1019 icons->addItem(app,resort);
1022} 1020}
1023 1021
1024void LauncherView::paletteChange( const QPalette &p ) 1022void LauncherView::paletteChange( const QPalette &p )
1025{ 1023{
1026 icons->unsetPalette(); 1024 icons->unsetPalette();
1027 QVBox::paletteChange( p ); 1025 QVBox::paletteChange( p );
1028 if ( bgType == Ruled ) 1026 if ( bgType == Ruled )
1029 setBackgroundType( Ruled, QString::null ); 1027 setBackgroundType( Ruled, QString::null );
1030 QColorGroup cg = icons->colorGroup(); 1028 QColorGroup cg = icons->colorGroup();
1031 cg.setColor( QColorGroup::Text, textCol ); 1029 cg.setColor( QColorGroup::Text, textCol );
1032 icons->setPalette( QPalette(cg,cg,cg) ); 1030 icons->setPalette( QPalette(cg,cg,cg) );
1033} 1031}
1034 1032
1035void LauncherView::fontChanged(const QFont&) 1033void LauncherView::fontChanged(const QFont&)
1036{ 1034{
1037 odebug << "LauncherView::fontChanged()" << oendl; 1035 odebug << "LauncherView::fontChanged()" << oendl;
1038 icons->hideOrShowItems( FALSE ); 1036 icons->hideOrShowItems( FALSE );
1039} 1037}
1040 1038
1041void LauncherView::relayout(void) 1039void LauncherView::relayout(void)
1042{ 1040{
1043 icons->hideOrShowItems(FALSE); 1041 icons->hideOrShowItems(FALSE);
1044} 1042}
1045 1043
1046void LauncherView::flushBgCache() 1044void LauncherView::flushBgCache()
1047{ 1045{
1048 if ( !bgCache ) 1046 if ( !bgCache )
1049 return; 1047 return;
1050 // remove unreferenced backgrounds. 1048 // remove unreferenced backgrounds.
1051 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); 1049 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin();
1052 while ( it != bgCache->end() ) { 1050 while ( it != bgCache->end() ) {
1053 QMap<QString,BgPixmap*>::Iterator curr = it; 1051 QMap<QString,BgPixmap*>::Iterator curr = it;
1054 ++it; 1052 ++it;
1055 if ( (*curr)->ref == 0 ) { 1053 if ( (*curr)->ref == 0 ) {
1056 delete (*curr); 1054 delete (*curr);
1057 bgCache->remove( curr ); 1055 bgCache->remove( curr );
1058 } 1056 }
1059 } 1057 }
1060} 1058}
1061 1059