summaryrefslogtreecommitdiff
authorkergoth <kergoth>2002-03-18 23:13:24 (UTC)
committer kergoth <kergoth>2002-03-18 23:13:24 (UTC)
commit35d040816fd59e247efbe9727ecd810bcba7c2b9 (patch) (unidiff)
treebd8af7644f6ff0bfa4c1a14b3e66306ad06b9e46
parent2a6b7129c74b7769c6a61a2dcdebce69e8756f62 (diff)
downloadopie-35d040816fd59e247efbe9727ecd810bcba7c2b9.zip
opie-35d040816fd59e247efbe9727ecd810bcba7c2b9.tar.gz
opie-35d040816fd59e247efbe9727ecd810bcba7c2b9.tar.bz2
Fixing package conflicts.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--apps/Applications/opiemail.desktop2
-rw-r--r--core/launcher/launcherview.cpp2
-rw-r--r--pics/launcher/opie-background.png (renamed from pics/qpe-background.png)bin26866 -> 26866 bytes
-rw-r--r--pics/opiemail/opiemail.png (renamed from pics/opiemail.png)bin2136 -> 2136 bytes
-rw-r--r--pics/textedit/s_hidden.png (renamed from pics/s_hidden.png)bin356 -> 356 bytes
5 files changed, 2 insertions, 2 deletions
diff --git a/apps/Applications/opiemail.desktop b/apps/Applications/opiemail.desktop
index b123edf..c3cd6f1 100644
--- a/apps/Applications/opiemail.desktop
+++ b/apps/Applications/opiemail.desktop
@@ -1,6 +1,6 @@
1[Desktop Entry] 1[Desktop Entry]
2Comment=An EMail Client 2Comment=An EMail Client
3Exec=opiemail 3Exec=opiemail
4Icon=opiemail 4Icon=opiemail/opiemail
5Type=Application 5Type=Application
6Name=EMail 6Name=EMail
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 538ad79..cd336d2 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -1,621 +1,621 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of 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#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qpe/applnk.h> 24#include <qpe/applnk.h>
25#include <qpe/qpedebug.h> 25#include <qpe/qpedebug.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/categories.h> 27#include <qpe/categories.h>
28#include <qpe/categoryselect.h> 28#include <qpe/categoryselect.h>
29#include <qpe/menubutton.h> 29#include <qpe/menubutton.h>
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qpe/qpetoolbar.h> 31#include <qpe/qpetoolbar.h>
32 32
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qdict.h> 34#include <qdict.h>
35#include <qfile.h> 35#include <qfile.h>
36#include <qfileinfo.h> 36#include <qfileinfo.h>
37#include <qhbox.h> 37#include <qhbox.h>
38#include <qiconview.h> 38#include <qiconview.h>
39#include <qpainter.h> 39#include <qpainter.h>
40#include <qregexp.h> 40#include <qregexp.h>
41#include <qtoolbutton.h> 41#include <qtoolbutton.h>
42 42
43class LauncherIconView : public QIconView { 43class LauncherIconView : public QIconView {
44public: 44public:
45 LauncherIconView( QWidget* parent, const char* name=0 ) : 45 LauncherIconView( QWidget* parent, const char* name=0 ) :
46 QIconView(parent,name), 46 QIconView(parent,name),
47 tf(""), 47 tf(""),
48 cf(0), 48 cf(0),
49 bsy(0) 49 bsy(0)
50 { 50 {
51 sortmeth = Name; 51 sortmeth = Name;
52 hidden.setAutoDelete(TRUE); 52 hidden.setAutoDelete(TRUE);
53 ike = FALSE; 53 ike = FALSE;
54 } 54 }
55 55
56 ~LauncherIconView() 56 ~LauncherIconView()
57 { 57 {
58#if 0 // debuggery 58#if 0 // debuggery
59 QListIterator<AppLnk> it(hidden); 59 QListIterator<AppLnk> it(hidden);
60 AppLnk* l; 60 AppLnk* l;
61 while ((l=it.current())) { 61 while ((l=it.current())) {
62 ++it; 62 ++it;
63 //qDebug("%p: hidden (should remove)",l); 63 //qDebug("%p: hidden (should remove)",l);
64 } 64 }
65#endif 65#endif
66 } 66 }
67 67
68 QIconViewItem* busyItem() const { return bsy; } 68 QIconViewItem* busyItem() const { return bsy; }
69 69
70 void updateCategoriesAndMimeTypes(); 70 void updateCategoriesAndMimeTypes();
71 71
72 void doAutoScroll() 72 void doAutoScroll()
73 { 73 {
74 // We don't want rubberbanding (yet) 74 // We don't want rubberbanding (yet)
75 } 75 }
76 76
77 void setBusy(bool on) 77 void setBusy(bool on)
78 { 78 {
79 QIconViewItem *c = on ? currentItem() : 0; 79 QIconViewItem *c = on ? currentItem() : 0;
80 if ( bsy != c ) { 80 if ( bsy != c ) {
81 QIconViewItem* o = bsy; 81 QIconViewItem* o = bsy;
82 bsy = c; 82 bsy = c;
83 if ( o ) o->repaint(); 83 if ( o ) o->repaint();
84 if ( c ) c->repaint(); 84 if ( c ) c->repaint();
85 } 85 }
86 } 86 }
87 87
88 bool inKeyEvent() const { return ike; } 88 bool inKeyEvent() const { return ike; }
89 void keyPressEvent(QKeyEvent* e) 89 void keyPressEvent(QKeyEvent* e)
90 { 90 {
91 ike = TRUE; 91 ike = TRUE;
92 if ( e->key() == Key_F33 ) { 92 if ( e->key() == Key_F33 ) {
93 // "OK" button 93 // "OK" button
94 returnPressed(currentItem()); 94 returnPressed(currentItem());
95 } 95 }
96 QIconView::keyPressEvent(e); 96 QIconView::keyPressEvent(e);
97 ike = FALSE; 97 ike = FALSE;
98 } 98 }
99 99
100 void addItem(AppLnk* app, bool resort=TRUE); 100 void addItem(AppLnk* app, bool resort=TRUE);
101 bool removeLink(const QString& linkfile); 101 bool removeLink(const QString& linkfile);
102 102
103 QStringList mimeTypes() const; 103 QStringList mimeTypes() const;
104 QStringList categories() const; 104 QStringList categories() const;
105 105
106 void clear() 106 void clear()
107 { 107 {
108 mimes.clear(); 108 mimes.clear();
109 cats.clear(); 109 cats.clear();
110 QIconView::clear(); 110 QIconView::clear();
111 hidden.clear(); 111 hidden.clear();
112 } 112 }
113 113
114 void addCatsAndMimes(AppLnk* app) 114 void addCatsAndMimes(AppLnk* app)
115 { 115 {
116 // QStringList c = app->categories(); 116 // QStringList c = app->categories();
117 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { 117 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) {
118 // cats.replace(*cit,(void*)1); 118 // cats.replace(*cit,(void*)1);
119 // } 119 // }
120 QString maj=app->type(); 120 QString maj=app->type();
121 int sl=maj.find('/'); 121 int sl=maj.find('/');
122 if (sl>=0) { 122 if (sl>=0) {
123 QString k = maj.left(sl); 123 QString k = maj.left(sl);
124 mimes.replace(k,(void*)1); 124 mimes.replace(k,(void*)1);
125 } 125 }
126 } 126 }
127 127
128 void drawBackground( QPainter *p, const QRect &r ) 128 void drawBackground( QPainter *p, const QRect &r )
129 { 129 {
130 Config config("qpe"); 130 Config config("qpe");
131 config.setGroup("Appearance"); 131 config.setGroup("Appearance");
132 QString backgroundImage = config.readEntry("BackgroundImage"); 132 QString backgroundImage = config.readEntry("BackgroundImage");
133 133
134 if (backgroundImage.isNull()) backgroundImage="qpe-background"; 134 if (backgroundImage.isNull()) backgroundImage="opie-background";
135 int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0; 135 int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0;
136 //int backgroundMode = 2; 136 //int backgroundMode = 2;
137 137
138 if ( backgroundMode == 1 ) { 138 if ( backgroundMode == 1 ) {
139 139
140 // Double buffer the background 140 // Double buffer the background
141 static QPixmap *bg = NULL; 141 static QPixmap *bg = NULL;
142 static QColor bgColor; 142 static QColor bgColor;
143 143
144 if ( (bg == NULL) || (bgColor != colorGroup().button()) ) { 144 if ( (bg == NULL) || (bgColor != colorGroup().button()) ) {
145 // Create a new background double buffer 145 // Create a new background double buffer
146 if (bg == NULL) 146 if (bg == NULL)
147 bg = new QPixmap( width(), height() ); 147 bg = new QPixmap( width(), height() );
148 bgColor = colorGroup().button(); 148 bgColor = colorGroup().button();
149 QPainter painter( bg ); 149 QPainter painter( bg );
150 150
151 painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110)); 151 painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110));
152 // Overlay the Qtopia logo in the center 152 // Overlay the Qtopia logo in the center
153 QImage logo; 153 QImage logo;
154 if (QFile::exists(backgroundImage)) { 154 if (QFile::exists(backgroundImage)) {
155 logo = QImage(backgroundImage); 155 logo = QImage(backgroundImage);
156 } else { 156 } else {
157 logo = Resource::loadImage(backgroundImage ); 157 logo = Resource::loadImage(backgroundImage );
158 } 158 }
159 if ( !logo.isNull() ) 159 if ( !logo.isNull() )
160 painter.drawImage( (width() - logo.width()) / 2, 160 painter.drawImage( (width() - logo.width()) / 2,
161 (height() - logo.height()) / 2, logo ); 161 (height() - logo.height()) / 2, logo );
162 } 162 }
163 163
164 // Draw the double buffer to the widget (it is tiled for when the icon view is large) 164 // Draw the double buffer to the widget (it is tiled for when the icon view is large)
165 p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(), 165 p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(),
166 (r.y() + contentsY()) % bg->height() ) ); 166 (r.y() + contentsY()) % bg->height() ) );
167 } else if ( backgroundMode == 2 ) { 167 } else if ( backgroundMode == 2 ) {
168 static QPixmap *bg = 0; 168 static QPixmap *bg = 0;
169 static QColor bgColor; 169 static QColor bgColor;
170 if ( !bg || (bgColor != colorGroup().background()) ) { 170 if ( !bg || (bgColor != colorGroup().background()) ) {
171 bgColor = colorGroup().background(); 171 bgColor = colorGroup().background();
172 bg = new QPixmap( width(), 9 ); 172 bg = new QPixmap( width(), 9 );
173 QPainter painter( bg ); 173 QPainter painter( bg );
174 for ( int i = 0; i < 3; i++ ) { 174 for ( int i = 0; i < 3; i++ ) {
175 painter.setPen( colorGroup().background().light(130) ); 175 painter.setPen( colorGroup().background().light(130) );
176 painter.drawLine( 0, i*3, width()-1, i*3 ); 176 painter.drawLine( 0, i*3, width()-1, i*3 );
177 painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); 177 painter.drawLine( 0, i*3+1, width()-1, i*3+1 );
178 painter.setPen( colorGroup().background().light(105) ); 178 painter.setPen( colorGroup().background().light(105) );
179 painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); 179 painter.drawLine( 0, i*3+2, width()-1, i*3+2 );
180 } 180 }
181 } 181 }
182 p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(), 182 p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(),
183 (r.y() + contentsY()) % bg->height() ) ); 183 (r.y() + contentsY()) % bg->height() ) );
184 } else { 184 } else {
185 p->fillRect( r, QBrush( colorGroup().background().light(110) ) ); 185 p->fillRect( r, QBrush( colorGroup().background().light(110) ) );
186 } 186 }
187 } 187 }
188 188
189 void hideOrShowItems(bool resort); 189 void hideOrShowItems(bool resort);
190 190
191 void setTypeFilter(const QString& typefilter, bool resort) 191 void setTypeFilter(const QString& typefilter, bool resort)
192 { 192 {
193 tf = QRegExp(typefilter,FALSE,TRUE); 193 tf = QRegExp(typefilter,FALSE,TRUE);
194 hideOrShowItems(resort); 194 hideOrShowItems(resort);
195 } 195 }
196 196
197 void setCategoryFilter( int catfilter, bool resort ) 197 void setCategoryFilter( int catfilter, bool resort )
198 { 198 {
199 Categories cat; 199 Categories cat;
200 cat.load( categoryFileName() ); 200 cat.load( categoryFileName() );
201 QString str; 201 QString str;
202 if ( catfilter == -2 ) 202 if ( catfilter == -2 )
203 cf = 0; 203 cf = 0;
204 else 204 else
205 cf = catfilter; 205 cf = catfilter;
206 hideOrShowItems(resort); 206 hideOrShowItems(resort);
207 } 207 }
208 208
209 enum SortMethod { Name, Date, Type }; 209 enum SortMethod { Name, Date, Type };
210 210
211 void setSortMethod( SortMethod m ) 211 void setSortMethod( SortMethod m )
212 { 212 {
213 if ( sortmeth != m ) { 213 if ( sortmeth != m ) {
214 sortmeth = m; 214 sortmeth = m;
215 sort(); 215 sort();
216 } 216 }
217 } 217 }
218 218
219 int compare(const AppLnk* a, const AppLnk* b) 219 int compare(const AppLnk* a, const AppLnk* b)
220 { 220 {
221 switch (sortmeth) { 221 switch (sortmeth) {
222 case Name: 222 case Name:
223 return a->name().compare(b->name()); 223 return a->name().compare(b->name());
224 case Date: { 224 case Date: {
225 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); 225 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file());
226 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); 226 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file());
227 return fa.lastModified().secsTo(fb.lastModified()); 227 return fa.lastModified().secsTo(fb.lastModified());
228 } 228 }
229 case Type: 229 case Type:
230 return a->type().compare(b->type()); 230 return a->type().compare(b->type());
231 } 231 }
232 return 0; 232 return 0;
233 } 233 }
234 234
235protected: 235protected:
236 236
237 void styleChange( QStyle &old ) 237 void styleChange( QStyle &old )
238 { 238 {
239 QIconView::styleChange( old ); 239 QIconView::styleChange( old );
240 //### duplicated code from LauncherView constructor 240 //### duplicated code from LauncherView constructor
241 int dw = QApplication::desktop()->width(); 241 int dw = QApplication::desktop()->width();
242 setGridX( (dw-13-style().scrollBarExtent().width())/3 ); // tweaked for 8pt+dw=176 and 10pt+dw=240 242 setGridX( (dw-13-style().scrollBarExtent().width())/3 ); // tweaked for 8pt+dw=176 and 10pt+dw=240
243 } 243 }
244 244
245private: 245private:
246 QList<AppLnk> hidden; 246 QList<AppLnk> hidden;
247 QDict<void> mimes; 247 QDict<void> mimes;
248 QDict<void> cats; 248 QDict<void> cats;
249 SortMethod sortmeth; 249 SortMethod sortmeth;
250 QRegExp tf; 250 QRegExp tf;
251 int cf; 251 int cf;
252 QIconViewItem* bsy; 252 QIconViewItem* bsy;
253 bool ike; 253 bool ike;
254 254
255}; 255};
256 256
257 257
258bool LauncherView::bsy=FALSE; 258bool LauncherView::bsy=FALSE;
259 259
260void LauncherView::setBusy(bool on) 260void LauncherView::setBusy(bool on)
261{ 261{
262 icons->setBusy(on); 262 icons->setBusy(on);
263} 263}
264 264
265class LauncherItem : public QIconViewItem 265class LauncherItem : public QIconViewItem
266{ 266{
267public: 267public:
268 LauncherItem( QIconView *parent, AppLnk* applnk ); 268 LauncherItem( QIconView *parent, AppLnk* applnk );
269 ~LauncherItem() 269 ~LauncherItem()
270 { 270 {
271 LauncherIconView* liv = (LauncherIconView*)iconView(); 271 LauncherIconView* liv = (LauncherIconView*)iconView();
272 if ( liv->busyItem() == this ) 272 if ( liv->busyItem() == this )
273 liv->setBusy(FALSE); 273 liv->setBusy(FALSE);
274 delete app; 274 delete app;
275 } 275 }
276 276
277 AppLnk* appLnk() const { return app; } 277 AppLnk* appLnk() const { return app; }
278 AppLnk* takeAppLnk() { AppLnk* r=app; app=0; return r; } 278 AppLnk* takeAppLnk() { AppLnk* r=app; app=0; return r; }
279 279
280 virtual int compare ( QIconViewItem * i ) const; 280 virtual int compare ( QIconViewItem * i ) const;
281 281
282 void paintItem( QPainter *p, const QColorGroup &cg ) 282 void paintItem( QPainter *p, const QColorGroup &cg )
283 { 283 {
284 LauncherIconView* liv = (LauncherIconView*)iconView(); 284 LauncherIconView* liv = (LauncherIconView*)iconView();
285 QBrush oldBrush( liv->itemTextBackground() ); 285 QBrush oldBrush( liv->itemTextBackground() );
286 QColorGroup mycg( cg ); 286 QColorGroup mycg( cg );
287 if ( liv->currentItem() == this ) { 287 if ( liv->currentItem() == this ) {
288 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) ); 288 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) );
289 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) ); 289 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) );
290 } 290 }
291 QIconViewItem::paintItem(p,mycg); 291 QIconViewItem::paintItem(p,mycg);
292 if ( liv->currentItem() == this ) 292 if ( liv->currentItem() == this )
293 liv->setItemTextBackground( oldBrush ); 293 liv->setItemTextBackground( oldBrush );
294 if ( liv->busyItem() == this ) { 294 if ( liv->busyItem() == this ) {
295 static QPixmap* busypm=0; 295 static QPixmap* busypm=0;
296 if ( !busypm ) 296 if ( !busypm )
297 busypm = new QPixmap(Resource::loadPixmap("launching")); 297 busypm = new QPixmap(Resource::loadPixmap("launching"));
298 p->drawPixmap(x()+(width()-busypm->width())/2, y(),*busypm); 298 p->drawPixmap(x()+(width()-busypm->width())/2, y(),*busypm);
299 } 299 }
300 } 300 }
301 301
302protected: 302protected:
303 AppLnk* app; 303 AppLnk* app;
304}; 304};
305 305
306 306
307LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk ) 307LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk )
308 : QIconViewItem( parent, applnk->name(), applnk->bigPixmap() ), 308 : QIconViewItem( parent, applnk->name(), applnk->bigPixmap() ),
309 app(applnk) // Takes ownership 309 app(applnk) // Takes ownership
310{ 310{
311} 311}
312 312
313int LauncherItem::compare ( QIconViewItem * i ) const 313int LauncherItem::compare ( QIconViewItem * i ) const
314{ 314{
315 LauncherIconView* view = (LauncherIconView*)iconView(); 315 LauncherIconView* view = (LauncherIconView*)iconView();
316 return view->compare(app,((LauncherItem *)i)->appLnk()); 316 return view->compare(app,((LauncherItem *)i)->appLnk());
317} 317}
318 318
319QStringList LauncherIconView::mimeTypes() const 319QStringList LauncherIconView::mimeTypes() const
320{ 320{
321 QStringList r; 321 QStringList r;
322 QDictIterator<void> it(mimes); 322 QDictIterator<void> it(mimes);
323 while (it.current()) { 323 while (it.current()) {
324 r.append(it.currentKey()); 324 r.append(it.currentKey());
325 ++it; 325 ++it;
326 } 326 }
327 r.sort(); 327 r.sort();
328 return r; 328 return r;
329} 329}
330 330
331void LauncherIconView::addItem(AppLnk* app, bool resort) 331void LauncherIconView::addItem(AppLnk* app, bool resort)
332{ 332{
333 addCatsAndMimes(app); 333 addCatsAndMimes(app);
334 334
335 if ( (tf.isEmpty() || tf.match(app->type()) >= 0) 335 if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
336 && (cf == 0 || app->categories().contains(cf) 336 && (cf == 0 || app->categories().contains(cf)
337 || cf == -1 && app->categories().count() == 0 ) ) 337 || cf == -1 && app->categories().count() == 0 ) )
338 (void) new LauncherItem( this, app ); 338 (void) new LauncherItem( this, app );
339 else 339 else
340 hidden.append(app); 340 hidden.append(app);
341 if ( resort ) 341 if ( resort )
342 sort(); 342 sort();
343} 343}
344 344
345void LauncherIconView::updateCategoriesAndMimeTypes() 345void LauncherIconView::updateCategoriesAndMimeTypes()
346{ 346{
347 mimes.clear(); 347 mimes.clear();
348 cats.clear(); 348 cats.clear();
349 LauncherItem* item = (LauncherItem*)firstItem(); 349 LauncherItem* item = (LauncherItem*)firstItem();
350 while (item) { 350 while (item) {
351 addCatsAndMimes(item->appLnk()); 351 addCatsAndMimes(item->appLnk());
352 item = (LauncherItem*)item->nextItem(); 352 item = (LauncherItem*)item->nextItem();
353 } 353 }
354 QListIterator<AppLnk> it(hidden); 354 QListIterator<AppLnk> it(hidden);
355 AppLnk* l; 355 AppLnk* l;
356 while ((l=it.current())) { 356 while ((l=it.current())) {
357 addCatsAndMimes(l); 357 addCatsAndMimes(l);
358 ++it; 358 ++it;
359 } 359 }
360} 360}
361 361
362void LauncherIconView::hideOrShowItems(bool resort) 362void LauncherIconView::hideOrShowItems(bool resort)
363{ 363{
364 hidden.setAutoDelete(FALSE); 364 hidden.setAutoDelete(FALSE);
365 QList<AppLnk> links=hidden; 365 QList<AppLnk> links=hidden;
366 hidden.clear(); 366 hidden.clear();
367 hidden.setAutoDelete(TRUE); 367 hidden.setAutoDelete(TRUE);
368 LauncherItem* item = (LauncherItem*)firstItem(); 368 LauncherItem* item = (LauncherItem*)firstItem();
369 while (item) { 369 while (item) {
370 links.append(item->takeAppLnk()); 370 links.append(item->takeAppLnk());
371 item = (LauncherItem*)item->nextItem(); 371 item = (LauncherItem*)item->nextItem();
372 } 372 }
373 bool oldAutoArrange = autoArrange(); 373 bool oldAutoArrange = autoArrange();
374 setAutoArrange( FALSE ); 374 setAutoArrange( FALSE );
375 clear(); 375 clear();
376 QListIterator<AppLnk> it(links); 376 QListIterator<AppLnk> it(links);
377 AppLnk* l; 377 AppLnk* l;
378 while ((l=it.current())) { 378 while ((l=it.current())) {
379 addItem(l,FALSE); 379 addItem(l,FALSE);
380 ++it; 380 ++it;
381 } 381 }
382 if ( resort ) 382 if ( resort )
383 sort(); 383 sort();
384 setAutoArrange( oldAutoArrange ); 384 setAutoArrange( oldAutoArrange );
385} 385}
386 386
387bool LauncherIconView::removeLink(const QString& linkfile) 387bool LauncherIconView::removeLink(const QString& linkfile)
388{ 388{
389 LauncherItem* item = (LauncherItem*)firstItem(); 389 LauncherItem* item = (LauncherItem*)firstItem();
390 AppLnk* l; 390 AppLnk* l;
391 bool did = FALSE; 391 bool did = FALSE;
392 DocLnk dl(linkfile); 392 DocLnk dl(linkfile);
393 while (item) { 393 while (item) {
394 l = item->appLnk(); 394 l = item->appLnk();
395 if ( l->linkFileKnown() && l->linkFile() == linkfile/* || l->file() == linkfile || dl.isValid() && dl.file() == l->file()*/ ) { 395 if ( l->linkFileKnown() && l->linkFile() == linkfile/* || l->file() == linkfile || dl.isValid() && dl.file() == l->file()*/ ) {
396 delete item; 396 delete item;
397 did = TRUE; 397 did = TRUE;
398 } 398 }
399 item = (LauncherItem*)item->nextItem(); 399 item = (LauncherItem*)item->nextItem();
400 } 400 }
401 QListIterator<AppLnk> it(hidden); 401 QListIterator<AppLnk> it(hidden);
402 while ((l=it.current())) { 402 while ((l=it.current())) {
403 ++it; 403 ++it;
404 if ( l->linkFileKnown() && l->linkFile() == linkfile/* || l->file() == linkfile || dl.isValid() && dl.file() == l->file()*/ ) { 404 if ( l->linkFileKnown() && l->linkFile() == linkfile/* || l->file() == linkfile || dl.isValid() && dl.file() == l->file()*/ ) {
405 hidden.removeRef(l); 405 hidden.removeRef(l);
406 did = TRUE; 406 did = TRUE;
407 } 407 }
408 } 408 }
409 return did; 409 return did;
410} 410}
411 411
412LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) 412LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl )
413 : QVBox( parent, name, fl ) 413 : QVBox( parent, name, fl )
414{ 414{
415 icons = new LauncherIconView( this ); 415 icons = new LauncherIconView( this );
416 setFocusProxy(icons); 416 setFocusProxy(icons);
417 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); 417 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold );
418 418
419 int dw = QApplication::desktop()->width(); 419 int dw = QApplication::desktop()->width();
420 icons->setItemsMovable( FALSE ); 420 icons->setItemsMovable( FALSE );
421 icons->setAutoArrange( TRUE ); 421 icons->setAutoArrange( TRUE );
422 icons->setSorting( TRUE ); 422 icons->setSorting( TRUE );
423 icons->setGridX( (dw-13-style().scrollBarExtent().width())/3 ); // tweaked for 8pt+dw=176 and 10pt+dw=240 423 icons->setGridX( (dw-13-style().scrollBarExtent().width())/3 ); // tweaked for 8pt+dw=176 and 10pt+dw=240
424 icons->setGridY( fontMetrics().height()*2+24 ); 424 icons->setGridY( fontMetrics().height()*2+24 );
425 icons->setFrameStyle( QFrame::NoFrame ); 425 icons->setFrameStyle( QFrame::NoFrame );
426 icons->setSpacing( 4 ); 426 icons->setSpacing( 4 );
427 icons->setMargin( 0 ); 427 icons->setMargin( 0 );
428 icons->setSelectionMode( QIconView::Multi ); 428 icons->setSelectionMode( QIconView::Multi );
429 icons->setBackgroundMode( PaletteBase ); 429 icons->setBackgroundMode( PaletteBase );
430 430
431 connect( icons, SIGNAL(mouseButtonClicked(int, QIconViewItem *, const QPoint&)), 431 connect( icons, SIGNAL(mouseButtonClicked(int, QIconViewItem *, const QPoint&)),
432 SLOT(itemClicked(int, QIconViewItem *)) ); 432 SLOT(itemClicked(int, QIconViewItem *)) );
433 connect( icons, SIGNAL(selectionChanged()), 433 connect( icons, SIGNAL(selectionChanged()),
434 SLOT(selectionChanged()) ); 434 SLOT(selectionChanged()) );
435 connect( icons, SIGNAL(returnPressed(QIconViewItem *)), 435 connect( icons, SIGNAL(returnPressed(QIconViewItem *)),
436 SLOT(returnPressed(QIconViewItem *)) ); 436 SLOT(returnPressed(QIconViewItem *)) );
437 connect( icons, SIGNAL(mouseButtonPressed(int, QIconViewItem *, const QPoint&)), 437 connect( icons, SIGNAL(mouseButtonPressed(int, QIconViewItem *, const QPoint&)),
438 SLOT(itemPressed(int, QIconViewItem *)) ); 438 SLOT(itemPressed(int, QIconViewItem *)) );
439 439
440 tools = 0; 440 tools = 0;
441} 441}
442 442
443LauncherView::~LauncherView() 443LauncherView::~LauncherView()
444{ 444{
445} 445}
446 446
447void LauncherView::setToolsEnabled(bool y) 447void LauncherView::setToolsEnabled(bool y)
448{ 448{
449 if ( !y != !tools ) { 449 if ( !y != !tools ) {
450 if ( y ) { 450 if ( y ) {
451 tools = new QHBox(this); 451 tools = new QHBox(this);
452 452
453 // Type filter 453 // Type filter
454 typemb = new MenuButton(tools); 454 typemb = new MenuButton(tools);
455 typemb->setLabel(tr("Type: %1")); 455 typemb->setLabel(tr("Type: %1"));
456 typemb->setFixedHeight ( 20 ); 456 typemb->setFixedHeight ( 20 );
457 457
458 // Category filter 458 // Category filter
459 catmb = new CategorySelect(tools); 459 catmb = new CategorySelect(tools);
460 catmb->setFixedHeight ( 20 ); 460 catmb->setFixedHeight ( 20 );
461 461
462 updateTools(); 462 updateTools();
463 tools->show(); 463 tools->show();
464 } else { 464 } else {
465 delete tools; 465 delete tools;
466 tools = 0; 466 tools = 0;
467 } 467 }
468 } 468 }
469} 469}
470 470
471void LauncherView::updateTools() 471void LauncherView::updateTools()
472{ 472{
473 disconnect( typemb, SIGNAL(selected(const QString&)), 473 disconnect( typemb, SIGNAL(selected(const QString&)),
474 this, SLOT(showType(const QString&)) ); 474 this, SLOT(showType(const QString&)) );
475 disconnect( catmb, SIGNAL(signalSelected(int)), 475 disconnect( catmb, SIGNAL(signalSelected(int)),
476 this, SLOT(showCategory(int)) ); 476 this, SLOT(showCategory(int)) );
477 477
478 icons->updateCategoriesAndMimeTypes(); 478 icons->updateCategoriesAndMimeTypes();
479 479
480 QString prev; 480 QString prev;
481 481
482 // Type filter 482 // Type filter
483 QStringList types; 483 QStringList types;
484 types << tr("All"); 484 types << tr("All");
485 types << "--"; 485 types << "--";
486 types += icons->mimeTypes(); 486 types += icons->mimeTypes();
487 prev = typemb->currentText(); 487 prev = typemb->currentText();
488 typemb->clear(); 488 typemb->clear();
489 typemb->insertItems(types); 489 typemb->insertItems(types);
490 typemb->select(prev); 490 typemb->select(prev);
491 491
492 Categories cats( 0 ); 492 Categories cats( 0 );
493 cats.load( categoryFileName() ); 493 cats.load( categoryFileName() );
494 QArray<int> vl( 0 ); 494 QArray<int> vl( 0 );
495 catmb->setCategories( vl, "Document View", tr("Document View") ); 495 catmb->setCategories( vl, "Document View", tr("Document View") );
496 catmb->setRemoveCategoryEdit( TRUE ); 496 catmb->setRemoveCategoryEdit( TRUE );
497 catmb->setAllCategories( TRUE ); 497 catmb->setAllCategories( TRUE );
498 498
499 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); 499 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&)));
500 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); 500 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
501} 501}
502 502
503void LauncherView::sortBy(int s) 503void LauncherView::sortBy(int s)
504{ 504{
505 icons->setSortMethod((LauncherIconView::SortMethod)s); 505 icons->setSortMethod((LauncherIconView::SortMethod)s);
506} 506}
507 507
508void LauncherView::showType(const QString& t) 508void LauncherView::showType(const QString& t)
509{ 509{
510 if ( t == tr("All") ) { 510 if ( t == tr("All") ) {
511 icons->setTypeFilter("",TRUE); 511 icons->setTypeFilter("",TRUE);
512 } else { 512 } else {
513 icons->setTypeFilter(t+"/*",TRUE); 513 icons->setTypeFilter(t+"/*",TRUE);
514 } 514 }
515} 515}
516 516
517void LauncherView::showCategory( int c ) 517void LauncherView::showCategory( int c )
518{ 518{
519 icons->setCategoryFilter( c, TRUE ); 519 icons->setCategoryFilter( c, TRUE );
520} 520}
521 521
522void LauncherView::resizeEvent(QResizeEvent *e) 522void LauncherView::resizeEvent(QResizeEvent *e)
523{ 523{
524 QVBox::resizeEvent( e ); 524 QVBox::resizeEvent( e );
525 if ( e->size().width() != e->oldSize().width() ) 525 if ( e->size().width() != e->oldSize().width() )
526 sort(); 526 sort();
527} 527}
528 528
529void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) 529void LauncherView::populate( AppLnkSet *folder, const QString& typefilter )
530{ 530{
531 icons->clear(); 531 icons->clear();
532 internalPopulate( folder, typefilter ); 532 internalPopulate( folder, typefilter );
533} 533}
534 534
535void LauncherView::selectionChanged() 535void LauncherView::selectionChanged()
536{ 536{
537 QIconViewItem* item = icons->currentItem(); 537 QIconViewItem* item = icons->currentItem();
538 if ( item && item->isSelected() ) { 538 if ( item && item->isSelected() ) {
539 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 539 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
540 if ( icons->inKeyEvent() ) // not for mouse press 540 if ( icons->inKeyEvent() ) // not for mouse press
541 emit clicked( appLnk ); 541 emit clicked( appLnk );
542 item->setSelected(FALSE); 542 item->setSelected(FALSE);
543 } 543 }
544} 544}
545 545
546void LauncherView::returnPressed( QIconViewItem *item ) 546void LauncherView::returnPressed( QIconViewItem *item )
547{ 547{
548 if ( item ) { 548 if ( item ) {
549 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 549 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
550 emit clicked( appLnk ); 550 emit clicked( appLnk );
551 } 551 }
552} 552}
553 553
554void LauncherView::itemClicked( int btn, QIconViewItem *item ) 554void LauncherView::itemClicked( int btn, QIconViewItem *item )
555{ 555{
556 if ( item ) { 556 if ( item ) {
557 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 557 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
558 if ( btn == LeftButton ) { 558 if ( btn == LeftButton ) {
559 // Make sure it's the item we execute that gets highlighted 559 // Make sure it's the item we execute that gets highlighted
560 icons->setCurrentItem( item ); 560 icons->setCurrentItem( item );
561 emit clicked( appLnk ); 561 emit clicked( appLnk );
562 } 562 }
563 item->setSelected(FALSE); 563 item->setSelected(FALSE);
564 } 564 }
565} 565}
566 566
567void LauncherView::itemPressed( int btn, QIconViewItem *item ) 567void LauncherView::itemPressed( int btn, QIconViewItem *item )
568{ 568{
569 if ( item ) { 569 if ( item ) {
570 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 570 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
571 if ( btn == RightButton ) 571 if ( btn == RightButton )
572 emit rightPressed( appLnk ); 572 emit rightPressed( appLnk );
573/* 573/*
574 else if ( btn == LeftButton ) 574 else if ( btn == LeftButton )
575 emit clicked( appLnk ); 575 emit clicked( appLnk );
576*/ 576*/
577 item->setSelected(FALSE); 577 item->setSelected(FALSE);
578 } 578 }
579} 579}
580 580
581void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter ) 581void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter )
582{ 582{
583 QListIterator<AppLnk> it( folder->children() ); 583 QListIterator<AppLnk> it( folder->children() );
584 icons->setTypeFilter(typefilter,FALSE); 584 icons->setTypeFilter(typefilter,FALSE);
585 585
586 while ( it.current() ) { 586 while ( it.current() ) {
587 // show only the icons for existing files 587 // show only the icons for existing files
588 if (!QFile(it.current()->file()).exists() ) 588 if (!QFile(it.current()->file()).exists() )
589 { 589 {
590 //maybe insert some .desktop file deletion code later 590 //maybe insert some .desktop file deletion code later
591 //maybe dir specific 591 //maybe dir specific
592 } 592 }
593 else 593 else
594 { 594 {
595 icons->addItem(*it,FALSE); 595 icons->addItem(*it,FALSE);
596 } 596 }
597 ++it; 597 ++it;
598 } 598 }
599 599
600 icons->sort(); 600 icons->sort();
601} 601}
602 602
603bool LauncherView::removeLink(const QString& linkfile) 603bool LauncherView::removeLink(const QString& linkfile)
604{ 604{
605 return icons->removeLink(linkfile); 605 return icons->removeLink(linkfile);
606} 606}
607 607
608void LauncherView::sort() 608void LauncherView::sort()
609{ 609{
610 icons->sort(); 610 icons->sort();
611} 611}
612 612
613void LauncherView::addItem(AppLnk* app, bool resort) 613void LauncherView::addItem(AppLnk* app, bool resort)
614{ 614{
615 icons->addItem(app,resort); 615 icons->addItem(app,resort);
616} 616}
617 617
618void LauncherView::setFileSystems(const QList<FileSystem> &) 618void LauncherView::setFileSystems(const QList<FileSystem> &)
619{ 619{
620 // ### does nothing now... 620 // ### does nothing now...
621} 621}
diff --git a/pics/qpe-background.png b/pics/launcher/opie-background.png
index 06461bf..06461bf 100644
--- a/pics/qpe-background.png
+++ b/pics/launcher/opie-background.png
Binary files differ
diff --git a/pics/opiemail.png b/pics/opiemail/opiemail.png
index 0095184..0095184 100644
--- a/pics/opiemail.png
+++ b/pics/opiemail/opiemail.png
Binary files differ
diff --git a/pics/s_hidden.png b/pics/textedit/s_hidden.png
index a9f3c54..a9f3c54 100644
--- a/pics/s_hidden.png
+++ b/pics/textedit/s_hidden.png
Binary files differ