summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index d9fc8e4..5f050aa 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -48,264 +48,264 @@
48#include <qpushbutton.h> 48#include <qpushbutton.h>
49#include <qtabbar.h> 49#include <qtabbar.h>
50#include <qwidgetstack.h> 50#include <qwidgetstack.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qmessagebox.h> 53#include <qmessagebox.h>
54#include <qframe.h> 54#include <qframe.h>
55#include <qpainter.h> 55#include <qpainter.h>
56#include <qlabel.h> 56#include <qlabel.h>
57#include <qtextstream.h> 57#include <qtextstream.h>
58#include <qpopupmenu.h> 58#include <qpopupmenu.h>
59 59
60#include <opie/owait.h> 60#include <opie/owait.h>
61 61
62 62
63#include "launcherview.h" 63#include "launcherview.h"
64#include "launcher.h" 64#include "launcher.h"
65#include "syncdialog.h" 65#include "syncdialog.h"
66#include "desktop.h" 66#include "desktop.h"
67#include <qpe/lnkproperties.h> 67#include <qpe/lnkproperties.h>
68//#include "mrulist.h" 68//#include "mrulist.h"
69#include "qrsync.h" 69#include "qrsync.h"
70#include <stdlib.h> 70#include <stdlib.h>
71#include <unistd.h> 71#include <unistd.h>
72 72
73#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 73#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
74#include <stdio.h> 74#include <stdio.h>
75#include <sys/vfs.h> 75#include <sys/vfs.h>
76#include <mntent.h> 76#include <mntent.h>
77#endif 77#endif
78 78
79#include <qpe/storage.h> 79#include <qpe/storage.h>
80#include "mediummountgui.h" 80#include "mediummountgui.h"
81 81
82namespace { 82namespace {
83 QStringList configToMime( Config *cfg ){ 83 QStringList configToMime( Config *cfg ){
84 QStringList mimes; 84 QStringList mimes;
85 bool tmpMime = true; 85 bool tmpMime = true;
86 cfg->setGroup("mimetypes" ); 86 cfg->setGroup("mimetypes" );
87 tmpMime = cfg->readBoolEntry("all" ,true); 87 tmpMime = cfg->readBoolEntry("all" ,true);
88 if( tmpMime ){ 88 if( tmpMime ){
89 mimes << QString::null; 89 mimes << QString::null;
90 return mimes; 90 return mimes;
91 }else{ 91 }else{
92 tmpMime = cfg->readBoolEntry("audio", true ); 92 tmpMime = cfg->readBoolEntry("audio", true );
93 if(tmpMime ) 93 if(tmpMime )
94 mimes.append("audio/*" ); 94 mimes.append("audio/*" );
95 95
96 tmpMime = cfg->readBoolEntry("image", true ); 96 tmpMime = cfg->readBoolEntry("image", true );
97 if(tmpMime ) 97 if(tmpMime )
98 mimes.append("image/*" ); 98 mimes.append("image/*" );
99 99
100 tmpMime = cfg->readBoolEntry("text", true ); 100 tmpMime = cfg->readBoolEntry("text", true );
101 if(tmpMime ) 101 if(tmpMime )
102 mimes.append("text/*"); 102 mimes.append("text/*");
103 103
104 tmpMime = cfg->readBoolEntry("video", true ); 104 tmpMime = cfg->readBoolEntry("video", true );
105 if(tmpMime ) 105 if(tmpMime )
106 mimes.append("video/*" ); 106 mimes.append("video/*" );
107 } 107 }
108 return mimes; 108 return mimes;
109 } 109 }
110 110
111} 111}
112 112
113 113
114 114
115//#define SHOW_ALL 115//#define SHOW_ALL
116 116
117class CategoryTab : public QTab 117class CategoryTab : public QTab
118{ 118{
119public: 119public:
120 CategoryTab( const QIconSet &icon, const QString &text=QString::null ) 120 CategoryTab( const QIconSet &icon, const QString &text=QString::null )
121 : QTab( icon, text ) 121 : QTab( icon, text )
122 { 122 {
123 } 123 }
124 124
125 QColor bgColor; 125 QColor bgColor;
126 QColor fgColor; 126 QColor fgColor;
127}; 127};
128 128
129//=========================================================================== 129//===========================================================================
130 130
131CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : 131CategoryTabWidget::CategoryTabWidget( QWidget* parent ) :
132 QVBox( parent ) 132 QVBox( parent )
133{ 133{
134 categoryBar = 0; 134 categoryBar = 0;
135 stack = 0; 135 stack = 0;
136} 136}
137 137
138void CategoryTabWidget::prevTab() 138void CategoryTabWidget::prevTab()
139{ 139{
140 if ( categoryBar ) { 140 if ( categoryBar ) {
141 int n = categoryBar->count(); 141 int n = categoryBar->count();
142 int tab = categoryBar->currentTab(); 142 int tab = categoryBar->currentTab();
143 if ( tab >= 0 ) 143 if ( tab >= 0 )
144 categoryBar->setCurrentTab( (tab - 1 + n)%n ); 144 categoryBar->setCurrentTab( (tab - 1 + n)%n );
145 } 145 }
146} 146}
147 147
148void CategoryTabWidget::nextTab() 148void CategoryTabWidget::nextTab()
149{ 149{
150 if ( categoryBar ) { 150 if ( categoryBar ) {
151 int n = categoryBar->count(); 151 int n = categoryBar->count();
152 int tab = categoryBar->currentTab(); 152 int tab = categoryBar->currentTab();
153 categoryBar->setCurrentTab( (tab + 1)%n ); 153 categoryBar->setCurrentTab( (tab + 1)%n );
154 } 154 }
155} 155}
156 156
157 157
158void CategoryTabWidget::showTab(const QString& id) 158void CategoryTabWidget::showTab(const QString& id)
159{ 159{
160 if ( categoryBar ) { 160 if ( categoryBar ) {
161 int idx = ids.findIndex( id ); 161 int idx = ids.findIndex( id );
162 categoryBar->setCurrentTab( idx ); 162 categoryBar->setCurrentTab( idx );
163 } 163 }
164} 164}
165 165
166void CategoryTabWidget::addItem( const QString& linkfile ) 166void CategoryTabWidget::addItem( const QString& linkfile )
167{ 167{
168 int i=0; 168 int i=0;
169 AppLnk *app = new AppLnk(linkfile); 169 AppLnk *app = new AppLnk(linkfile);
170 if ( !app->isValid() ) { 170 if ( !app->isValid() ) {
171 delete app; 171 delete app;
172 app=0; 172 app=0;
173 } 173 }
174 if ( !app || !app->file().isEmpty() ) { 174 if ( !app || !app->file().isEmpty() ) {
175 // A document 175 // A document
176 delete app; 176// delete app;
177 app = new DocLnk(linkfile); 177// app = new DocLnk(linkfile);
178 if ( app->fileKnown() ) { 178// if ( app->fileKnown() ) {
179 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); 179// ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
180 } else { 180// } else {
181 ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); 181// ((LauncherView*)(stack->widget(ids.count()-1)))->sort();
182 delete app; 182// delete app;
183 } 183// }
184 return; 184 return;
185 } 185 }
186 // An application 186 // An application
187 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { 187 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) {
188 if ( !(*it).isEmpty() ) { 188 if ( !(*it).isEmpty() ) {
189 QRegExp tf(*it,FALSE,TRUE); 189 QRegExp tf(*it,FALSE,TRUE);
190 if ( tf.match(app->type()) >= 0 ) { 190 if ( tf.match(app->type()) >= 0 ) {
191 ((LauncherView*)stack->widget(i))->addItem(app); 191 ((LauncherView*)stack->widget(i))->addItem(app);
192 return; 192 return;
193 } 193 }
194 i++; 194 i++;
195 } 195 }
196 } 196 }
197 197
198 QCopEnvelope e("QPE/TaskBar","reloadApps()"); 198 QCopEnvelope e("QPE/TaskBar","reloadApps()");
199} 199}
200 200
201void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, 201void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
202 AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) 202 AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/)
203{ 203{
204 QString current; 204 QString current;
205 if ( categoryBar ) { 205 if ( categoryBar ) {
206 int c = categoryBar->currentTab(); 206 int c = categoryBar->currentTab();
207 if ( c >= 0 ) current = ids[c]; 207 if ( c >= 0 ) current = ids[c];
208 } 208 }
209 209
210 delete categoryBar; 210 delete categoryBar;
211 categoryBar = new CategoryTabBar( this ); 211 categoryBar = new CategoryTabBar( this );
212 QPalette pal = categoryBar->palette(); 212 QPalette pal = categoryBar->palette();
213 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 213 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
214 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 214 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
215 categoryBar->setPalette( pal ); 215 categoryBar->setPalette( pal );
216 216
217 delete stack; 217 delete stack;
218 stack = new QWidgetStack(this); 218 stack = new QWidgetStack(this);
219 tabs=0; 219 tabs=0;
220 220
221 ids.clear(); 221 ids.clear();
222 222
223 Config cfg("Launcher"); 223 Config cfg("Launcher");
224 224
225 QStringList types = rootFolder->types(); 225 QStringList types = rootFolder->types();
226 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 226 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
227 if ( !(*it).isEmpty() ) { 227 if ( !(*it).isEmpty() ) {
228 (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); 228 (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it));
229 setTabAppearance( *it, cfg ); 229 setTabAppearance( *it, cfg );
230 } 230 }
231 } 231 }
232 QListIterator<AppLnk> it( rootFolder->children() ); 232 QListIterator<AppLnk> it( rootFolder->children() );
233 AppLnk* l; 233 AppLnk* l;
234 while ( (l=it.current()) ) { 234 while ( (l=it.current()) ) {
235 if ( l->type() == "Separator" ) { // No tr 235 if ( l->type() == "Separator" ) { // No tr
236 rootFolder->remove(l); 236 rootFolder->remove(l);
237 delete l; 237 delete l;
238 } else { 238 } else {
239 int i=0; 239 int i=0;
240 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 240 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
241 if ( *it == l->type() ) 241 if ( *it == l->type() )
242 ((LauncherView*)stack->widget(i))->addItem(l,FALSE); 242 ((LauncherView*)stack->widget(i))->addItem(l,FALSE);
243 i++; 243 i++;
244 } 244 }
245 } 245 }
246 ++it; 246 ++it;
247 } 247 }
248 rootFolder->detachChildren(); 248 rootFolder->detachChildren();
249 for (int i=0; i<tabs; i++) 249 for (int i=0; i<tabs; i++)
250 ((LauncherView*)stack->widget(i))->sort(); 250 ((LauncherView*)stack->widget(i))->sort();
251 251
252 // all documents 252 // all documents
253 QImage img( Resource::loadImage( "DocsIcon" ) ); 253 QImage img( Resource::loadImage( "DocsIcon" ) );
254 QPixmap pm; 254 QPixmap pm;
255 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 255 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
256 256
257 //ljpotter 257 //ljpotter
258 CategoryTab *catTab ; 258 CategoryTab *catTab ;
259 catTab = new CategoryTab( pm, "Documents" ); 259 catTab = new CategoryTab( pm, "Documents" );
260 260
261 categoryBar->addTab( catTab ); 261 categoryBar->addTab( catTab );
262 262
263 fileSel = new DocumentTab( stack, 4, 0, "/",""); 263 fileSel = new DocumentTab( stack, 4, 0, "/","");
264 stack->addWidget( fileSel, tabs++ ); 264 stack->addWidget( fileSel, tabs++ );
265 265
266 // fileSel->hide(); 266 // fileSel->hide();
267 267
268 connect( fileSel, SIGNAL( fileSelected( const DocLnk & )), 268 connect( fileSel, SIGNAL( fileSelected( const DocLnk & )),
269 this, SLOT(clickie(const DocLnk&)) ); 269 this, SLOT(clickie(const DocLnk&)) );
270 270
271// connect( fileSel, SIGNAL( fileSelected( const QString & )), 271// connect( fileSel, SIGNAL( fileSelected( const QString & )),
272// this, SLOT(clickie(const QString&)) ); 272// this, SLOT(clickie(const QString&)) );
273 273
274 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); 274 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) );
275 275
276 ((LauncherView*)stack->widget(0))->setFocus(); 276 ((LauncherView*)stack->widget(0))->setFocus();
277 277
278 cfg. setGroup ( "GUI" ); 278 cfg. setGroup ( "GUI" );
279 setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); 279 setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null ));
280 280
281 if ( !current.isNull() ) { 281 if ( !current.isNull() ) {
282 showTab(current); 282 showTab(current);
283 } 283 }
284 284
285 categoryBar->show(); 285 categoryBar->show();
286 stack->show(); 286 stack->show();
287 287
288 288
289 QCopEnvelope e("QPE/TaskBar","reloadApps()"); 289 QCopEnvelope e("QPE/TaskBar","reloadApps()");
290} 290}
291 291
292void CategoryTabWidget::clickie(const DocLnk &lnk) { 292void CategoryTabWidget::clickie(const DocLnk &lnk) {
293 lnk.execute(); 293 lnk.execute();
294 // fileSel->reparse(); 294 // fileSel->reparse();
295} 295}
296 296
297void CategoryTabWidget::clickie(const QString &appStr) { 297void CategoryTabWidget::clickie(const QString &appStr) {
298// DocLnk lnk(appStr); 298// DocLnk lnk(appStr);
299// lnk.execute(); 299// lnk.execute();
300} 300}
301 301
302void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) 302void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
303{ 303{
304 QString grp( "Tab %1" ); // No tr 304 QString grp( "Tab %1" ); // No tr
305 cfg.setGroup( grp.arg(id) ); 305 cfg.setGroup( grp.arg(id) );
306 LauncherView *v = view( id ); 306 LauncherView *v = view( id );
307 int idx = ids.findIndex( id ); 307 int idx = ids.findIndex( id );
308 CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); 308 CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx );
309 309
310 // View 310 // View
311 QString view = cfg.readEntry( "View", "Icon" ); 311 QString view = cfg.readEntry( "View", "Icon" );