summaryrefslogtreecommitdiff
Unidiff
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
@@ -6,257 +6,257 @@
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);
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