summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-23 17:18:31 (UTC)
committer zecke <zecke>2002-04-23 17:18:31 (UTC)
commitadf10e0e160b18fe329b6baccf5dc666d612fe8e (patch) (unidiff)
treeafe9af2b6a884ef31ce64e22f2a6fbcfb839742a
parent20959a35ed4ffa132643968b23d9af74003b41a2 (diff)
downloadopie-adf10e0e160b18fe329b6baccf5dc666d612fe8e.zip
opie-adf10e0e160b18fe329b6baccf5dc666d612fe8e.tar.gz
opie-adf10e0e160b18fe329b6baccf5dc666d612fe8e.tar.bz2
fix the bugs
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp10
-rw-r--r--core/launcher/mediummountgui.cpp56
-rw-r--r--core/launcher/mediummountgui.h17
3 files changed, 47 insertions, 36 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index d1df4cc..f9c6c02 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -176,782 +176,788 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
176 tabs=0; 176 tabs=0;
177 177
178 ids.clear(); 178 ids.clear();
179 179
180 QStringList types = rootFolder->types(); 180 QStringList types = rootFolder->types();
181 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 181 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
182 if ( !(*it).isEmpty() ) { 182 if ( !(*it).isEmpty() ) {
183 newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); 183 newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it));
184 } 184 }
185 } 185 }
186 QListIterator<AppLnk> it( rootFolder->children() ); 186 QListIterator<AppLnk> it( rootFolder->children() );
187 AppLnk* l; 187 AppLnk* l;
188 while ( (l=it.current()) ) { 188 while ( (l=it.current()) ) {
189 if ( l->type() == "Separator" ) { 189 if ( l->type() == "Separator" ) {
190 rootFolder->remove(l); 190 rootFolder->remove(l);
191 delete l; 191 delete l;
192 } else { 192 } else {
193 int i=0; 193 int i=0;
194 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 194 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
195 if ( *it == l->type() ) 195 if ( *it == l->type() )
196 ((LauncherView*)stack->widget(i))->addItem(l,FALSE); 196 ((LauncherView*)stack->widget(i))->addItem(l,FALSE);
197 i++; 197 i++;
198 } 198 }
199 } 199 }
200 ++it; 200 ++it;
201 } 201 }
202 rootFolder->detachChildren(); 202 rootFolder->detachChildren();
203 for (int i=0; i<tabs; i++) 203 for (int i=0; i<tabs; i++)
204 ((LauncherView*)stack->widget(i))->sort(); 204 ((LauncherView*)stack->widget(i))->sort();
205 205
206 // all documents 206 // all documents
207 docview = newView( QString::null, Resource::loadPixmap("DocsIcon"), tr("Documents")); 207 docview = newView( QString::null, Resource::loadPixmap("DocsIcon"), tr("Documents"));
208 docview->populate( docFolder, QString::null ); 208 docview->populate( docFolder, QString::null );
209 docFolder->detachChildren(); 209 docFolder->detachChildren();
210 docview->setFileSystems(fs); 210 docview->setFileSystems(fs);
211 docview->setToolsEnabled(TRUE); 211 docview->setToolsEnabled(TRUE);
212 212
213 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); 213 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) );
214 214
215 ((LauncherView*)stack->widget(0))->setFocus(); 215 ((LauncherView*)stack->widget(0))->setFocus();
216 216
217 categoryBar->show(); 217 categoryBar->show();
218 stack->show(); 218 stack->show();
219} 219}
220 220
221void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) 221void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs)
222{ 222{
223 docview->populate( docFolder, QString::null ); 223 docview->populate( docFolder, QString::null );
224 docFolder->detachChildren(); 224 docFolder->detachChildren();
225 docview->setFileSystems(fs); 225 docview->setFileSystems(fs);
226 docview->updateTools(); 226 docview->updateTools();
227} 227}
228 228
229LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 229LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
230{ 230{
231 LauncherView* view = new LauncherView( stack ); 231 LauncherView* view = new LauncherView( stack );
232 connect( view, SIGNAL(clicked(const AppLnk*)), 232 connect( view, SIGNAL(clicked(const AppLnk*)),
233 this, SIGNAL(clicked(const AppLnk*))); 233 this, SIGNAL(clicked(const AppLnk*)));
234 connect( view, SIGNAL(rightPressed(AppLnk*)), 234 connect( view, SIGNAL(rightPressed(AppLnk*)),
235 this, SIGNAL(rightPressed(AppLnk*))); 235 this, SIGNAL(rightPressed(AppLnk*)));
236 ids.append(id); 236 ids.append(id);
237 categoryBar->addTab( new QTab( pm, label ) ); 237 categoryBar->addTab( new QTab( pm, label ) );
238 stack->addWidget( view, tabs++ ); 238 stack->addWidget( view, tabs++ );
239 return view; 239 return view;
240} 240}
241 241
242void CategoryTabWidget::updateLink(const QString& linkfile) 242void CategoryTabWidget::updateLink(const QString& linkfile)
243{ 243{
244 int i=0; 244 int i=0;
245 LauncherView* view; 245 LauncherView* view;
246 while ((view = (LauncherView*)stack->widget(i++))) { 246 while ((view = (LauncherView*)stack->widget(i++))) {
247 if ( view->removeLink(linkfile) ) 247 if ( view->removeLink(linkfile) )
248 break; 248 break;
249 } 249 }
250 addItem(linkfile); 250 addItem(linkfile);
251 docview->updateTools(); 251 docview->updateTools();
252} 252}
253 253
254void CategoryTabWidget::paletteChange( const QPalette &p ) 254void CategoryTabWidget::paletteChange( const QPalette &p )
255{ 255{
256 QVBox::paletteChange( p ); 256 QVBox::paletteChange( p );
257 QPalette pal = palette(); 257 QPalette pal = palette();
258 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 258 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
259 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 259 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
260 categoryBar->setPalette( pal ); 260 categoryBar->setPalette( pal );
261 categoryBar->update(); 261 categoryBar->update();
262} 262}
263 263
264void CategoryTabWidget::setBusy(bool on) 264void CategoryTabWidget::setBusy(bool on)
265{ 265{
266 if ( on ) 266 if ( on )
267 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); 267 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE);
268 else 268 else
269 for (int i=0; i<tabs; i++) 269 for (int i=0; i<tabs; i++)
270 ((LauncherView*)stack->widget(i))->setBusy(FALSE); 270 ((LauncherView*)stack->widget(i))->setBusy(FALSE);
271} 271}
272 272
273 273
274CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) 274CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name )
275 : QTabBar( parent, name ) 275 : QTabBar( parent, name )
276{ 276{
277 setFocusPolicy( NoFocus ); 277 setFocusPolicy( NoFocus );
278 connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); 278 connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) );
279} 279}
280 280
281CategoryTabBar::~CategoryTabBar() 281CategoryTabBar::~CategoryTabBar()
282{ 282{
283} 283}
284 284
285void CategoryTabBar::layoutTabs() 285void CategoryTabBar::layoutTabs()
286{ 286{
287 if ( !count() ) 287 if ( !count() )
288 return; 288 return;
289 289
290// int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; 290// int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 };
291 int hiddenTabWidth = -12; 291 int hiddenTabWidth = -12;
292 int middleTab = currentTab(); 292 int middleTab = currentTab();
293 int hframe, vframe, overlap; 293 int hframe, vframe, overlap;
294 style().tabbarMetrics( this, hframe, vframe, overlap ); 294 style().tabbarMetrics( this, hframe, vframe, overlap );
295 QFontMetrics fm = fontMetrics(); 295 QFontMetrics fm = fontMetrics();
296 int x = 0; 296 int x = 0;
297 QRect r; 297 QRect r;
298 QTab *t; 298 QTab *t;
299 int available = width()-1; 299 int available = width()-1;
300 int required = 0; 300 int required = 0;
301 for ( int i = 0; i < count(); i++ ) { 301 for ( int i = 0; i < count(); i++ ) {
302 t = tab(i); 302 t = tab(i);
303 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { 303 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) {
304 if ( i != middleTab ) { 304 if ( i != middleTab ) {
305 // required += hiddenTabWidth + hframe - overlap; 305 // required += hiddenTabWidth + hframe - overlap;
306 available -= hiddenTabWidth + hframe - overlap; 306 available -= hiddenTabWidth + hframe - overlap;
307 if ( t->iconSet() != 0 ) 307 if ( t->iconSet() != 0 )
308 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 308 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
309 } else { 309 } else {
310 required += fm.width( t->text() ) + hframe - overlap; 310 required += fm.width( t->text() ) + hframe - overlap;
311 if ( t->iconSet() != 0 ) 311 if ( t->iconSet() != 0 )
312 required += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 312 required += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
313 } 313 }
314 } 314 }
315 for ( int i = 0; i < count(); i++ ) { 315 for ( int i = 0; i < count(); i++ ) {
316 t = tab(i); 316 t = tab(i);
317 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { 317 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) {
318 if ( i != middleTab ) { 318 if ( i != middleTab ) {
319 int w = hiddenTabWidth; 319 int w = hiddenTabWidth;
320 int ih = 0; 320 int ih = 0;
321 if ( t->iconSet() != 0 ) { 321 if ( t->iconSet() != 0 ) {
322 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 322 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
323 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 323 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
324 } 324 }
325 int h = QMAX( fm.height(), ih ); 325 int h = QMAX( fm.height(), ih );
326 h = QMAX( h, QApplication::globalStrut().height() ); 326 h = QMAX( h, QApplication::globalStrut().height() );
327 327
328 h += vframe; 328 h += vframe;
329 w += hframe; 329 w += hframe;
330 330
331 t->setRect( QRect(x, 0, w, h) ); 331 t->setRect( QRect(x, 0, w, h) );
332 x += t->rect().width() - overlap; 332 x += t->rect().width() - overlap;
333 r = r.unite( t->rect() ); 333 r = r.unite( t->rect() );
334 } else { 334 } else {
335 int w = fm.width( t->text() ); 335 int w = fm.width( t->text() );
336 int ih = 0; 336 int ih = 0;
337 if ( t->iconSet() != 0 ) { 337 if ( t->iconSet() != 0 ) {
338 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 338 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
339 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 339 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
340 } 340 }
341 int h = QMAX( fm.height(), ih ); 341 int h = QMAX( fm.height(), ih );
342 h = QMAX( h, QApplication::globalStrut().height() ); 342 h = QMAX( h, QApplication::globalStrut().height() );
343 343
344 h += vframe; 344 h += vframe;
345 w += hframe; 345 w += hframe;
346 346
347 // t->setRect( QRect(x, 0, w * available/required, h) ); 347 // t->setRect( QRect(x, 0, w * available/required, h) );
348 t->setRect( QRect(x, 0, available, h) ); 348 t->setRect( QRect(x, 0, available, h) );
349 x += t->rect().width() - overlap; 349 x += t->rect().width() - overlap;
350 r = r.unite( t->rect() ); 350 r = r.unite( t->rect() );
351 } 351 }
352 } 352 }
353 353
354 QRect rr = tab(count()-1)->rect(); 354 QRect rr = tab(count()-1)->rect();
355 rr.setRight(width()-1); 355 rr.setRight(width()-1);
356 tab(count()-1)->setRect( rr ); 356 tab(count()-1)->setRect( rr );
357 357
358 for ( t = tabList()->first(); t; t = tabList()->next() ) { 358 for ( t = tabList()->first(); t; t = tabList()->next() ) {
359 QRect tr = t->rect(); 359 QRect tr = t->rect();
360 tr.setHeight( r.height() ); 360 tr.setHeight( r.height() );
361 t->setRect( tr ); 361 t->setRect( tr );
362 } 362 }
363 363
364 update(); 364 update();
365} 365}
366 366
367 367
368void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const 368void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
369{ 369{
370#if QT_VERSION >= 300 370#if QT_VERSION >= 300
371 QStyle::SFlags flags = QStyle::Style_Default; 371 QStyle::SFlags flags = QStyle::Style_Default;
372 if ( selected ) 372 if ( selected )
373 flags |= QStyle::Style_Selected; 373 flags |= QStyle::Style_Selected;
374 style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(), 374 style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(),
375 colorGroup(), flags, QStyleOption(t) ); 375 colorGroup(), flags, QStyleOption(t) );
376#else 376#else
377 style().drawTab( p, this, t, selected ); 377 style().drawTab( p, this, t, selected );
378#endif 378#endif
379 379
380 QRect r( t->rect() ); 380 QRect r( t->rect() );
381 QFont f( font() ); 381 QFont f( font() );
382 if ( selected ) 382 if ( selected )
383 f.setBold( TRUE ); 383 f.setBold( TRUE );
384 p->setFont( f ); 384 p->setFont( f );
385 385
386 int iw = 0; 386 int iw = 0;
387 int ih = 0; 387 int ih = 0;
388 if ( t->iconSet() != 0 ) { 388 if ( t->iconSet() != 0 ) {
389 iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; 389 iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2;
390 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 390 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
391 } 391 }
392 int w = iw + p->fontMetrics().width( t->text() ) + 4; 392 int w = iw + p->fontMetrics().width( t->text() ) + 4;
393 int h = QMAX(p->fontMetrics().height() + 4, ih ); 393 int h = QMAX(p->fontMetrics().height() + 4, ih );
394 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, 394 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3,
395 r.top() + (r.height()-h)/2, w, h ), t, 395 r.top() + (r.height()-h)/2, w, h ), t,
396#if QT_VERSION >= 300 396#if QT_VERSION >= 300
397 t->identifier() == keyboardFocusTab() 397 t->identifier() == keyboardFocusTab()
398#else 398#else
399 t->identitifer() == keyboardFocusTab() 399 t->identitifer() == keyboardFocusTab()
400#endif 400#endif
401 ); 401 );
402} 402}
403 403
404 404
405void CategoryTabBar::paintLabel( QPainter* p, const QRect&, 405void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
406 QTab* t, bool has_focus ) const 406 QTab* t, bool has_focus ) const
407{ 407{
408 QRect r = t->rect(); 408 QRect r = t->rect();
409 // if ( t->id != currentTab() ) 409 // if ( t->id != currentTab() )
410 //r.moveBy( 1, 1 ); 410 //r.moveBy( 1, 1 );
411 // 411 //
412 if ( t->iconSet() ) { 412 if ( t->iconSet() ) {
413 // the tab has an iconset, draw it in the right mode 413 // the tab has an iconset, draw it in the right mode
414 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; 414 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
415 if ( mode == QIconSet::Normal && has_focus ) 415 if ( mode == QIconSet::Normal && has_focus )
416 mode = QIconSet::Active; 416 mode = QIconSet::Active;
417 QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); 417 QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode );
418 int pixw = pixmap.width(); 418 int pixw = pixmap.width();
419 int pixh = pixmap.height(); 419 int pixh = pixmap.height();
420 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); 420 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap );
421 r.setLeft( r.left() + pixw + 5 ); 421 r.setLeft( r.left() + pixw + 5 );
422 } 422 }
423 423
424 QRect tr = r; 424 QRect tr = r;
425 425
426 if ( r.width() < 20 ) 426 if ( r.width() < 20 )
427 return; 427 return;
428 428
429 if ( t->isEnabled() && isEnabled() ) { 429 if ( t->isEnabled() && isEnabled() ) {
430#if defined(_WS_WIN32_) 430#if defined(_WS_WIN32_)
431 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) 431 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) )
432 p->setPen( colorGroup().buttonText() ); 432 p->setPen( colorGroup().buttonText() );
433 else 433 else
434 p->setPen( colorGroup().foreground() ); 434 p->setPen( colorGroup().foreground() );
435#else 435#else
436 p->setPen( colorGroup().foreground() ); 436 p->setPen( colorGroup().foreground() );
437#endif 437#endif
438 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); 438 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
439 } else { 439 } else {
440 p->setPen( palette().disabled().foreground() ); 440 p->setPen( palette().disabled().foreground() );
441 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); 441 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
442 } 442 }
443} 443}
444 444
445//--------------------------------------------------------------------------- 445//---------------------------------------------------------------------------
446 446
447Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) 447Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
448 : QMainWindow( parent, name, fl ) 448 : QMainWindow( parent, name, fl )
449{ 449{
450 setCaption( tr("Launcher") ); 450 setCaption( tr("Launcher") );
451 451
452 syncDialog = 0; 452 syncDialog = 0;
453 453
454 // we have a pretty good idea how big we'll be 454 // we have a pretty good idea how big we'll be
455 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); 455 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() );
456 456
457 tabs = 0; 457 tabs = 0;
458 rootFolder = 0; 458 rootFolder = 0;
459 docsFolder = 0; 459 docsFolder = 0;
460 int stamp = uidgen.generate(); // this is our timestamp to see which devices we know 460 int stamp = uidgen.generate(); // this is our timestamp to see which devices we know
461 //uidgen.store( stamp ); 461 //uidgen.store( stamp );
462 m_timeStamp = QString::number( stamp ); 462 m_timeStamp = QString::number( stamp );
463 463
464 tabs = new CategoryTabWidget( this ); 464 tabs = new CategoryTabWidget( this );
465 tabs->setMaximumWidth( qApp->desktop()->width() ); 465 tabs->setMaximumWidth( qApp->desktop()->width() );
466 setCentralWidget( tabs ); 466 setCentralWidget( tabs );
467 467
468 connect( tabs, SIGNAL(selected(const QString&)), 468 connect( tabs, SIGNAL(selected(const QString&)),
469 this, SLOT(viewSelected(const QString&)) ); 469 this, SLOT(viewSelected(const QString&)) );
470 connect( tabs, SIGNAL(clicked(const AppLnk*)), 470 connect( tabs, SIGNAL(clicked(const AppLnk*)),
471 this, SLOT(select(const AppLnk*))); 471 this, SLOT(select(const AppLnk*)));
472 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 472 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
473 this, SLOT(properties(AppLnk*))); 473 this, SLOT(properties(AppLnk*)));
474 474
475#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 475#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
476 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 476 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
477 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), 477 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
478 this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); 478 this, SLOT(systemMessage( const QCString &, const QByteArray &)) );
479#endif 479#endif
480 480
481 storage = new StorageInfo( this ); 481 storage = new StorageInfo( this );
482 connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); 482 connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) );
483 483
484 updateTabs(); 484 updateTabs();
485 485
486 preloadApps(); 486 preloadApps();
487 487
488 in_lnk_props = FALSE; 488 in_lnk_props = FALSE;
489 got_lnk_change = FALSE; 489 got_lnk_change = FALSE;
490} 490}
491 491
492Launcher::~Launcher() 492Launcher::~Launcher()
493{ 493{
494} 494}
495 495
496static bool isVisibleWindow(int wid) 496static bool isVisibleWindow(int wid)
497{ 497{
498 const QList<QWSWindow> &list = qwsServer->clientWindows(); 498 const QList<QWSWindow> &list = qwsServer->clientWindows();
499 QWSWindow* w; 499 QWSWindow* w;
500 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 500 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
501 if ( w->winId() == wid ) 501 if ( w->winId() == wid )
502 return !w->isFullyObscured(); 502 return !w->isFullyObscured();
503 } 503 }
504 return FALSE; 504 return FALSE;
505} 505}
506 506
507void Launcher::showMaximized() 507void Launcher::showMaximized()
508{ 508{
509 if ( isVisibleWindow( winId() ) ) 509 if ( isVisibleWindow( winId() ) )
510 doMaximize(); 510 doMaximize();
511 else 511 else
512 QTimer::singleShot( 20, this, SLOT(doMaximize()) ); 512 QTimer::singleShot( 20, this, SLOT(doMaximize()) );
513} 513}
514 514
515void Launcher::doMaximize() 515void Launcher::doMaximize()
516{ 516{
517 QMainWindow::showMaximized(); 517 QMainWindow::showMaximized();
518} 518}
519 519
520void Launcher::updateMimeTypes() 520void Launcher::updateMimeTypes()
521{ 521{
522 MimeType::clear(); 522 MimeType::clear();
523 updateMimeTypes(rootFolder); 523 updateMimeTypes(rootFolder);
524} 524}
525 525
526void Launcher::updateMimeTypes(AppLnkSet* folder) 526void Launcher::updateMimeTypes(AppLnkSet* folder)
527{ 527{
528 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { 528 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) {
529 AppLnk *app = it.current(); 529 AppLnk *app = it.current();
530 if ( app->type() == "Folder" ) 530 if ( app->type() == "Folder" )
531 updateMimeTypes((AppLnkSet *)app); 531 updateMimeTypes((AppLnkSet *)app);
532 else { 532 else {
533 MimeType::registerApp(*app); 533 MimeType::registerApp(*app);
534 } 534 }
535 } 535 }
536} 536}
537 537
538void Launcher::loadDocs() // ok here comes a hack belonging to Global:: 538void Launcher::loadDocs() // ok here comes a hack belonging to Global::
539{ 539{
540 qWarning("loading Documents" ); 540 qWarning("loading Documents" );
541 qWarning("The currentTimeStamp is: %s", m_timeStamp.latin1() ); 541 qWarning("The currentTimeStamp is: %s", m_timeStamp.latin1() );
542 delete docsFolder; 542 delete docsFolder;
543 docsFolder = new DocLnkSet; 543 docsFolder = new DocLnkSet;
544 qWarning("new DocLnkSet" ); 544 qWarning("new DocLnkSet" );
545 DocLnkSet *tmp = 0; 545 DocLnkSet *tmp = 0;
546 QString home = QString(getenv("HOME")) + "/Documents"; 546 QString home = QString(getenv("HOME")) + "/Documents";
547 tmp = new DocLnkSet( home , QString::null); 547 tmp = new DocLnkSet( home , QString::null);
548 docsFolder->appendFrom( *tmp ); 548 docsFolder->appendFrom( *tmp );
549 delete tmp; 549 delete tmp;
550 // find out wich filesystems are new in this round 550 // find out wich filesystems are new in this round
551 // We will do this by having a timestamp inside each mountpoint 551 // We will do this by having a timestamp inside each mountpoint
552 // if the current timestamp doesn't match this is a new file system and 552 // if the current timestamp doesn't match this is a new file system and
553 // come up with our MediumMountGui :) let the hacking begin 553 // come up with our MediumMountGui :) let the hacking begin
554 int stamp = uidgen.generate(); 554 int stamp = uidgen.generate();
555 555
556 QString newStamp = QString::number( stamp ); // generates newtime Stamp 556 QString newStamp = QString::number( stamp ); // generates newtime Stamp
557 StorageInfo storage; 557 StorageInfo storage;
558 const QList<FileSystem> &fileSystems = storage.fileSystems(); 558 const QList<FileSystem> &fileSystems = storage.fileSystems();
559 QListIterator<FileSystem> it ( fileSystems ); 559 QListIterator<FileSystem> it ( fileSystems );
560
561
560 for ( ; it.current(); ++it ) { 562 for ( ; it.current(); ++it ) {
561 if ( (*it)->isRemovable() ) { // let's find out if we should search on it 563 if ( (*it)->isRemovable() ) { // let's find out if we should search on it
562 qWarning("%s is removeable", (*it)->path().latin1() ); 564 qWarning("%s is removeable", (*it)->path().latin1() );
563 OConfig cfg( (*it)->path() + "/.opiestorage.cf"); 565 OConfig cfg( (*it)->path() + "/.opiestorage.cf");
564 cfg.setGroup("main"); 566 cfg.setGroup("main");
565 QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); 567 QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() );
566 if( stamp == m_timeStamp ){ // ok we know this card 568 if( stamp == m_timeStamp ){ // ok we know this card
567 cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp 569 cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp
568 // we need to scan the list now. Hopefully the cache will be there 570 // we need to scan the list now. Hopefully the cache will be there
569 // read the mimetypes from the config and search for documents 571 // read the mimetypes from the config and search for documents
570 QStringList mimetypes = configToMime( &cfg); 572 QStringList mimetypes = configToMime( &cfg);
571 tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); 573 tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") );
572 docsFolder->appendFrom( *tmp ); 574 docsFolder->appendFrom( *tmp );
573 delete tmp; 575 delete tmp;
574 576
575 }else{ // come up with the gui cause this a new card 577 }else{ // come up with the gui cause this a new card
576 MediumMountGui medium((*it)->path() ); 578 MediumMountGui medium(&cfg, (*it)->path() );
577 if( medium.check() ){ // we did not ask before or ask again is off 579 if( medium.check() ){ // we did not ask before or ask again is off
578 if( medium.exec() ){ // he clicked yes so search it 580 if( medium.exec() ){ // he clicked yes so search it
579 // speicher 581 // speicher
580 cfg.read(); // cause of a race we need to reread 582 //cfg.read(); // cause of a race we need to reread - fixed
581 cfg.writeEntry("timestamp", newStamp ); 583 cfg.writeEntry("timestamp", newStamp );
584 cfg.write();
585 tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) );
586 docsFolder->appendFrom( *tmp );
587 delete tmp;
582 }// no else 588 }// no else
583 }else{ // we checked 589 }else{ // we checked
584 // do something different see what we need to do 590 // do something different see what we need to do
585 // let's see if we should check the device 591 // let's see if we should check the device
586 cfg.setGroup("main" ); 592 cfg.setGroup("main" );
587 bool check = cfg.readBoolEntry("autocheck", true ); 593 bool check = cfg.readBoolEntry("autocheck", true );
588 if( check ){ // find the documents 594 if( check ){ // find the documents
589 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); 595 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") );
590 docsFolder->appendFrom( *tmp ); 596 docsFolder->appendFrom( *tmp );
591 delete tmp; 597 delete tmp;
592 } 598 }
593 } 599 }
594 } 600 }
595 } 601 }
596 } 602 }
597 m_timeStamp = newStamp; 603 m_timeStamp = newStamp;
598} 604}
599 605
600void Launcher::updateTabs() 606void Launcher::updateTabs()
601{ 607{
602 MimeType::updateApplications(); // ### reads all applnks twice 608 MimeType::updateApplications(); // ### reads all applnks twice
603 609
604 delete rootFolder; 610 delete rootFolder;
605 rootFolder = new AppLnkSet( MimeType::appsFolderName() ); 611 rootFolder = new AppLnkSet( MimeType::appsFolderName() );
606 612
607 loadDocs(); 613 loadDocs();
608 614
609 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); 615 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
610} 616}
611 617
612void Launcher::updateDocs() 618void Launcher::updateDocs()
613{ 619{
614 loadDocs(); 620 loadDocs();
615 tabs->updateDocs(docsFolder,storage->fileSystems()); 621 tabs->updateDocs(docsFolder,storage->fileSystems());
616} 622}
617 623
618void Launcher::viewSelected(const QString& s) 624void Launcher::viewSelected(const QString& s)
619{ 625{
620 setCaption( s + tr(" - Launcher") ); 626 setCaption( s + tr(" - Launcher") );
621} 627}
622 628
623void Launcher::nextView() 629void Launcher::nextView()
624{ 630{
625 tabs->nextTab(); 631 tabs->nextTab();
626} 632}
627 633
628 634
629void Launcher::select( const AppLnk *appLnk ) 635void Launcher::select( const AppLnk *appLnk )
630{ 636{
631 if ( appLnk->type() == "Folder" ) { 637 if ( appLnk->type() == "Folder" ) {
632 // Not supported: flat is simpler for the user 638 // Not supported: flat is simpler for the user
633 } else { 639 } else {
634 if ( appLnk->exec().isNull() ) { 640 if ( appLnk->exec().isNull() ) {
635 QMessageBox::information(this,tr("No application"), 641 QMessageBox::information(this,tr("No application"),
636 tr("<p>No application is defined for this document." 642 tr("<p>No application is defined for this document."
637 "<p>Type is %1.").arg(appLnk->type())); 643 "<p>Type is %1.").arg(appLnk->type()));
638 return; 644 return;
639 } 645 }
640 tabs->setBusy(TRUE); 646 tabs->setBusy(TRUE);
641 emit executing( appLnk ); 647 emit executing( appLnk );
642 appLnk->execute(); 648 appLnk->execute();
643 } 649 }
644} 650}
645 651
646void Launcher::externalSelected(const AppLnk *appLnk) 652void Launcher::externalSelected(const AppLnk *appLnk)
647{ 653{
648 tabs->setBusy(TRUE); 654 tabs->setBusy(TRUE);
649 emit executing( appLnk ); 655 emit executing( appLnk );
650} 656}
651 657
652void Launcher::properties( AppLnk *appLnk ) 658void Launcher::properties( AppLnk *appLnk )
653{ 659{
654 if ( appLnk->type() == "Folder" ) { 660 if ( appLnk->type() == "Folder" ) {
655 // Not supported: flat is simpler for the user 661 // Not supported: flat is simpler for the user
656 } else { 662 } else {
657 in_lnk_props = TRUE; 663 in_lnk_props = TRUE;
658 got_lnk_change = FALSE; 664 got_lnk_change = FALSE;
659 LnkProperties prop(appLnk); 665 LnkProperties prop(appLnk);
660 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 666 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
661 prop.showMaximized(); 667 prop.showMaximized();
662 prop.exec(); 668 prop.exec();
663 in_lnk_props = FALSE; 669 in_lnk_props = FALSE;
664 if ( got_lnk_change ) { 670 if ( got_lnk_change ) {
665 updateLink(lnk_change); 671 updateLink(lnk_change);
666 } 672 }
667 } 673 }
668} 674}
669 675
670void Launcher::updateLink(const QString& link) 676void Launcher::updateLink(const QString& link)
671{ 677{
672 if (link.isNull()) 678 if (link.isNull())
673 updateTabs(); 679 updateTabs();
674 else if (link.isEmpty()) 680 else if (link.isEmpty())
675 updateDocs(); 681 updateDocs();
676 else 682 else
677 tabs->updateLink(link); 683 tabs->updateLink(link);
678} 684}
679 685
680void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 686void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
681{ 687{
682 QDataStream stream( data, IO_ReadOnly ); 688 QDataStream stream( data, IO_ReadOnly );
683 if ( msg == "closing(QString)" ){ 689 if ( msg == "closing(QString)" ){
684 QString app; 690 QString app;
685 stream >> app; 691 stream >> app;
686 qWarning("app closed %s", app.latin1() ); 692 qWarning("app closed %s", app.latin1() );
687 MRUList::removeTask( app ); 693 MRUList::removeTask( app );
688 }else if ( msg == "linkChanged(QString)" ) { 694 }else if ( msg == "linkChanged(QString)" ) {
689 QString link; 695 QString link;
690 stream >> link; 696 stream >> link;
691 if ( in_lnk_props ) { 697 if ( in_lnk_props ) {
692 got_lnk_change = TRUE; 698 got_lnk_change = TRUE;
693 lnk_change = link; 699 lnk_change = link;
694 } else { 700 } else {
695 updateLink(link); 701 updateLink(link);
696 } 702 }
697 } else if ( msg == "busy()" ) { 703 } else if ( msg == "busy()" ) {
698 emit busy(); 704 emit busy();
699 } else if ( msg == "notBusy(QString)" ) { 705 } else if ( msg == "notBusy(QString)" ) {
700 QString app; 706 QString app;
701 stream >> app; 707 stream >> app;
702 tabs->setBusy(FALSE); 708 tabs->setBusy(FALSE);
703 emit notBusy(app); 709 emit notBusy(app);
704 } else if ( msg == "mkdir(QString)" ) { 710 } else if ( msg == "mkdir(QString)" ) {
705 QString dir; 711 QString dir;
706 stream >> dir; 712 stream >> dir;
707 if ( !dir.isEmpty() ) 713 if ( !dir.isEmpty() )
708 mkdir( dir ); 714 mkdir( dir );
709 } else if ( msg == "rdiffGenSig(QString,QString)" ) { 715 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
710 QString baseFile, sigFile; 716 QString baseFile, sigFile;
711 stream >> baseFile >> sigFile; 717 stream >> baseFile >> sigFile;
712 QRsync::generateSignature( baseFile, sigFile ); 718 QRsync::generateSignature( baseFile, sigFile );
713 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { 719 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
714 QString baseFile, sigFile, deltaFile; 720 QString baseFile, sigFile, deltaFile;
715 stream >> baseFile >> sigFile >> deltaFile; 721 stream >> baseFile >> sigFile >> deltaFile;
716 QRsync::generateDiff( baseFile, sigFile, deltaFile ); 722 QRsync::generateDiff( baseFile, sigFile, deltaFile );
717 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { 723 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
718 QString baseFile, deltaFile; 724 QString baseFile, deltaFile;
719 stream >> baseFile >> deltaFile; 725 stream >> baseFile >> deltaFile;
720 if ( !QFile::exists( baseFile ) ) { 726 if ( !QFile::exists( baseFile ) ) {
721 QFile f( baseFile ); 727 QFile f( baseFile );
722 f.open( IO_WriteOnly ); 728 f.open( IO_WriteOnly );
723 f.close(); 729 f.close();
724 } 730 }
725 QRsync::applyDiff( baseFile, deltaFile ); 731 QRsync::applyDiff( baseFile, deltaFile );
726 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); 732 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
727 e << baseFile; 733 e << baseFile;
728 } else if ( msg == "rdiffCleanup()" ) { 734 } else if ( msg == "rdiffCleanup()" ) {
729 mkdir( "/tmp/rdiff" ); 735 mkdir( "/tmp/rdiff" );
730 QDir dir; 736 QDir dir;
731 dir.setPath( "/tmp/rdiff" ); 737 dir.setPath( "/tmp/rdiff" );
732 QStringList entries = dir.entryList(); 738 QStringList entries = dir.entryList();
733 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) 739 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
734 dir.remove( *it ); 740 dir.remove( *it );
735 } else if ( msg == "sendHandshakeInfo()" ) { 741 } else if ( msg == "sendHandshakeInfo()" ) {
736 QString home = getenv( "HOME" ); 742 QString home = getenv( "HOME" );
737 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); 743 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
738 e << home; 744 e << home;
739 int locked = (int) Desktop::screenLocked(); 745 int locked = (int) Desktop::screenLocked();
740 e << locked; 746 e << locked;
741 // register an app for autostart 747 // register an app for autostart
742 // if clear is send the list is cleared. 748 // if clear is send the list is cleared.
743 } else if ( msg == "autoStart(QString)" ) { 749 } else if ( msg == "autoStart(QString)" ) {
744 QString appName; 750 QString appName;
745 stream >> appName; 751 stream >> appName;
746 Config cfg( "autostart" ); 752 Config cfg( "autostart" );
747 cfg.setGroup( "AutoStart" ); 753 cfg.setGroup( "AutoStart" );
748 if ( appName.compare("clear") == 0){ 754 if ( appName.compare("clear") == 0){
749 cfg.writeEntry("Apps", ""); 755 cfg.writeEntry("Apps", "");
750 } 756 }
751 } else if ( msg == "autoStart(QString,QString)" ) { 757 } else if ( msg == "autoStart(QString,QString)" ) {
752 QString modifier, appName; 758 QString modifier, appName;
753 stream >> modifier >> appName; 759 stream >> modifier >> appName;
754 Config cfg( "autostart" ); 760 Config cfg( "autostart" );
755 cfg.setGroup( "AutoStart" ); 761 cfg.setGroup( "AutoStart" );
756 if ( modifier.compare("add") == 0 ){ 762 if ( modifier.compare("add") == 0 ){
757 // only add if appname is entered 763 // only add if appname is entered
758 if (!appName.isEmpty()) { 764 if (!appName.isEmpty()) {
759 cfg.writeEntry("Apps", appName); 765 cfg.writeEntry("Apps", appName);
760 } 766 }
761 } else if (modifier.compare("remove") == 0 ) { 767 } else if (modifier.compare("remove") == 0 ) {
762 // need to change for multiple entries 768 // need to change for multiple entries
763 // actually remove is right now simular to clear, but in future there 769 // actually remove is right now simular to clear, but in future there
764 // should be multiple apps in autostart possible. 770 // should be multiple apps in autostart possible.
765 QString checkName; 771 QString checkName;
766 checkName = cfg.readEntry("Apps", ""); 772 checkName = cfg.readEntry("Apps", "");
767 if (checkName == appName) { 773 if (checkName == appName) {
768 cfg.writeEntry("Apps", ""); 774 cfg.writeEntry("Apps", "");
769 } 775 }
770 } 776 }
771 // case the autostart feature should be delayed 777 // case the autostart feature should be delayed
772 } else if ( msg == "autoStart(QString, QString, QString)") { 778 } else if ( msg == "autoStart(QString, QString, QString)") {
773 QString modifier, appName, delay; 779 QString modifier, appName, delay;
774 stream >> modifier >> appName >> delay; 780 stream >> modifier >> appName >> delay;
775 Config cfg( "autostart" ); 781 Config cfg( "autostart" );
776 cfg.setGroup( "AutoStart" ); 782 cfg.setGroup( "AutoStart" );
777 if ( modifier.compare("add") == 0 ){ 783 if ( modifier.compare("add") == 0 ){
778 // only add it appname is entered 784 // only add it appname is entered
779 if (!appName.isEmpty()) { 785 if (!appName.isEmpty()) {
780 cfg.writeEntry("Apps", appName); 786 cfg.writeEntry("Apps", appName);
781 cfg.writeEntry("Delay", delay); 787 cfg.writeEntry("Delay", delay);
782 } 788 }
783 } else { 789 } else {
784 } 790 }
785 } else if ( msg == "sendCardInfo()" ) { 791 } else if ( msg == "sendCardInfo()" ) {
786 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); 792 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
787 const QList<FileSystem> &fs = storage->fileSystems(); 793 const QList<FileSystem> &fs = storage->fileSystems();
788 QListIterator<FileSystem> it ( fs ); 794 QListIterator<FileSystem> it ( fs );
789 QString s; 795 QString s;
790 QString homeDir = getenv("HOME"); 796 QString homeDir = getenv("HOME");
791 QString hardDiskHome; 797 QString hardDiskHome;
792 for ( ; it.current(); ++it ) { 798 for ( ; it.current(); ++it ) {
793 if ( (*it)->isRemovable() ) 799 if ( (*it)->isRemovable() )
794 s += (*it)->name() + "=" + (*it)->path() + "/Documents " 800 s += (*it)->name() + "=" + (*it)->path() + "/Documents "
795 + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) 801 + QString::number( (*it)->availBlocks() * (*it)->blockSize() )
796 + " " + (*it)->options() + ";"; 802 + " " + (*it)->options() + ";";
797 else if ( (*it)->disk() == "/dev/mtdblock1" || 803 else if ( (*it)->disk() == "/dev/mtdblock1" ||
798 (*it)->disk() == "/dev/mtdblock/1" ) 804 (*it)->disk() == "/dev/mtdblock/1" )
799 s += (*it)->name() + "=" + homeDir + "/Documents " 805 s += (*it)->name() + "=" + homeDir + "/Documents "
800 + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) 806 + QString::number( (*it)->availBlocks() * (*it)->blockSize() )
801 + " " + (*it)->options() + ";"; 807 + " " + (*it)->options() + ";";
802 else if ( (*it)->name().contains( "Hard Disk") && 808 else if ( (*it)->name().contains( "Hard Disk") &&
803 homeDir.contains( (*it)->path() ) && 809 homeDir.contains( (*it)->path() ) &&
804 (*it)->path().length() > hardDiskHome.length() ) 810 (*it)->path().length() > hardDiskHome.length() )
805 hardDiskHome = 811 hardDiskHome =
806 (*it)->name() + "=" + homeDir + "/Documents " 812 (*it)->name() + "=" + homeDir + "/Documents "
807 + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) 813 + QString::number( (*it)->availBlocks() * (*it)->blockSize() )
808 + " " + (*it)->options() + ";"; 814 + " " + (*it)->options() + ";";
809 } 815 }
810 if ( !hardDiskHome.isEmpty() ) 816 if ( !hardDiskHome.isEmpty() )
811 s += hardDiskHome; 817 s += hardDiskHome;
812 818
813 e << s; 819 e << s;
814 } else if ( msg == "sendSyncDate(QString)" ) { 820 } else if ( msg == "sendSyncDate(QString)" ) {
815 QString app; 821 QString app;
816 stream >> app; 822 stream >> app;
817 Config cfg( "qpe" ); 823 Config cfg( "qpe" );
818 cfg.setGroup("SyncDate"); 824 cfg.setGroup("SyncDate");
819 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); 825 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" );
820 e << app << cfg.readEntry( app ); 826 e << app << cfg.readEntry( app );
821 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), 827 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(),
822 //cfg.readEntry( app ).latin1() ); 828 //cfg.readEntry( app ).latin1() );
823 } else if ( msg == "setSyncDate(QString,QString)" ) { 829 } else if ( msg == "setSyncDate(QString,QString)" ) {
824 QString app, date; 830 QString app, date;
825 stream >> app >> date; 831 stream >> app >> date;
826 Config cfg( "qpe" ); 832 Config cfg( "qpe" );
827 cfg.setGroup("SyncDate"); 833 cfg.setGroup("SyncDate");
828 cfg.writeEntry( app, date ); 834 cfg.writeEntry( app, date );
829 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); 835 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1());
830 } else if ( msg == "startSync(QString)" ) { 836 } else if ( msg == "startSync(QString)" ) {
831 QString what; 837 QString what;
832 stream >> what; 838 stream >> what;
833 delete syncDialog; syncDialog = 0; 839 delete syncDialog; syncDialog = 0;
834 syncDialog = new SyncDialog( this, "syncProgress", FALSE, 840 syncDialog = new SyncDialog( this, "syncProgress", FALSE,
835 WStyle_Tool | WStyle_Customize | 841 WStyle_Tool | WStyle_Customize |
836 Qt::WStyle_StaysOnTop ); 842 Qt::WStyle_StaysOnTop );
837 syncDialog->showMaximized(); 843 syncDialog->showMaximized();
838 syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); 844 syncDialog->whatLabel->setText( "<b>" + what + "</b>" );
839 connect( syncDialog->buttonCancel, SIGNAL( clicked() ), 845 connect( syncDialog->buttonCancel, SIGNAL( clicked() ),
840 SLOT( cancelSync() ) ); 846 SLOT( cancelSync() ) );
841 } 847 }
842 else if ( msg == "stopSync()") { 848 else if ( msg == "stopSync()") {
843 delete syncDialog; syncDialog = 0; 849 delete syncDialog; syncDialog = 0;
844 } else if ( msg == "getAllDocLinks()" ) { 850 } else if ( msg == "getAllDocLinks()" ) {
845 loadDocs(); 851 loadDocs();
846 852
847 QString contents; 853 QString contents;
848 854
849 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { 855 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) {
850 DocLnk *doc = it.current(); 856 DocLnk *doc = it.current();
851 QFileInfo fi( doc->file() ); 857 QFileInfo fi( doc->file() );
852 if ( !fi.exists() ) 858 if ( !fi.exists() )
853 continue; 859 continue;
854 860
855 bool fake = !doc->linkFileKnown(); 861 bool fake = !doc->linkFileKnown();
856 if ( !fake ) { 862 if ( !fake ) {
857 QFile f( doc->linkFile() ); 863 QFile f( doc->linkFile() );
858 if ( f.open( IO_ReadOnly ) ) { 864 if ( f.open( IO_ReadOnly ) ) {
859 QTextStream ts( &f ); 865 QTextStream ts( &f );
860 ts.setEncoding( QTextStream::UnicodeUTF8 ); 866 ts.setEncoding( QTextStream::UnicodeUTF8 );
861 contents += ts.read(); 867 contents += ts.read();
862 f.close(); 868 f.close();
863 } else 869 } else
864 fake = TRUE; 870 fake = TRUE;
865 } 871 }
866 if (fake) { 872 if (fake) {
867 contents += "[Desktop Entry]\n"; 873 contents += "[Desktop Entry]\n";
868 contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n"; 874 contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n";
869 contents += "File = "+doc->file()+"\n"; 875 contents += "File = "+doc->file()+"\n";
870 contents += "Name = "+doc->name()+"\n"; 876 contents += "Name = "+doc->name()+"\n";
871 contents += "Type = "+doc->type()+"\n"; 877 contents += "Type = "+doc->type()+"\n";
872 } 878 }
873 contents += QString("Size = %1\n").arg( fi.size() ); 879 contents += QString("Size = %1\n").arg( fi.size() );
874 } 880 }
875 881
876 //qDebug( "sending length %d", contents.length() ); 882 //qDebug( "sending length %d", contents.length() );
877 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); 883 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
878 e << contents; 884 e << contents;
879 885
880 qDebug( "================ \n\n%s\n\n===============", 886 qDebug( "================ \n\n%s\n\n===============",
881 contents.latin1() ); 887 contents.latin1() );
882 888
883 delete docsFolder; 889 delete docsFolder;
884 docsFolder = 0; 890 docsFolder = 0;
885 } 891 }
886} 892}
887 893
888void Launcher::cancelSync() 894void Launcher::cancelSync()
889{ 895{
890 QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); 896 QCopEnvelope e( "QPE/Desktop", "cancelSync()" );
891} 897}
892 898
893void Launcher::storageChanged() 899void Launcher::storageChanged()
894{ 900{
895 if ( in_lnk_props ) { 901 if ( in_lnk_props ) {
896 got_lnk_change = TRUE; 902 got_lnk_change = TRUE;
897 lnk_change = ""; 903 lnk_change = "";
898 } else { 904 } else {
899 updateDocs(); 905 updateDocs();
900 } 906 }
901} 907}
902 908
903 909
904bool Launcher::mkdir(const QString &localPath) 910bool Launcher::mkdir(const QString &localPath)
905{ 911{
906 QDir fullDir(localPath); 912 QDir fullDir(localPath);
907 if (fullDir.exists()) 913 if (fullDir.exists())
908 return true; 914 return true;
909 915
910 // at this point the directory doesn't exist 916 // at this point the directory doesn't exist
911 // go through the directory tree and start creating the direcotories 917 // go through the directory tree and start creating the direcotories
912 // that don't exist; if we can't create the directories, return false 918 // that don't exist; if we can't create the directories, return false
913 919
914 QString dirSeps = "/"; 920 QString dirSeps = "/";
915 int dirIndex = localPath.find(dirSeps); 921 int dirIndex = localPath.find(dirSeps);
916 QString checkedPath; 922 QString checkedPath;
917 923
918 // didn't find any seps; weird, use the cur dir instead 924 // didn't find any seps; weird, use the cur dir instead
919 if (dirIndex == -1) { 925 if (dirIndex == -1) {
920 //qDebug("No seperators found in path %s", localPath.latin1()); 926 //qDebug("No seperators found in path %s", localPath.latin1());
921 checkedPath = QDir::currentDirPath(); 927 checkedPath = QDir::currentDirPath();
922 } 928 }
923 929
924 while (checkedPath != localPath) { 930 while (checkedPath != localPath) {
925 // no more seperators found, use the local path 931 // no more seperators found, use the local path
926 if (dirIndex == -1) 932 if (dirIndex == -1)
927 checkedPath = localPath; 933 checkedPath = localPath;
928 else { 934 else {
929 // the next directory to check 935 // the next directory to check
930 checkedPath = localPath.left(dirIndex) + "/"; 936 checkedPath = localPath.left(dirIndex) + "/";
931 // advance the iterator; the next dir seperator 937 // advance the iterator; the next dir seperator
932 dirIndex = localPath.find(dirSeps, dirIndex+1); 938 dirIndex = localPath.find(dirSeps, dirIndex+1);
933 } 939 }
934 940
935 QDir checkDir(checkedPath); 941 QDir checkDir(checkedPath);
936 if (!checkDir.exists()) { 942 if (!checkDir.exists()) {
937 //qDebug("mkdir making dir %s", checkedPath.latin1()); 943 //qDebug("mkdir making dir %s", checkedPath.latin1());
938 944
939 if (!checkDir.mkdir(checkedPath)) { 945 if (!checkDir.mkdir(checkedPath)) {
940 qDebug("Unable to make directory %s", checkedPath.latin1()); 946 qDebug("Unable to make directory %s", checkedPath.latin1());
941 return FALSE; 947 return FALSE;
942 } 948 }
943 } 949 }
944 950
945 } 951 }
946 return TRUE; 952 return TRUE;
947} 953}
948 954
949void Launcher::preloadApps() 955void Launcher::preloadApps()
950{ 956{
951 Config cfg("Launcher"); 957 Config cfg("Launcher");
952 cfg.setGroup("Preload"); 958 cfg.setGroup("Preload");
953 QStringList apps = cfg.readListEntry("Apps",','); 959 QStringList apps = cfg.readListEntry("Apps",',');
954 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { 960 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
955 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); 961 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
956 } 962 }
957} 963}
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp
index e0acf4e..8cc2411 100644
--- a/core/launcher/mediummountgui.cpp
+++ b/core/launcher/mediummountgui.cpp
@@ -1,231 +1,233 @@
1 1
2#include "mediummountgui.h" 2#include "mediummountgui.h"
3 3
4#include <qvariant.h> 4#include <qvariant.h>
5#include <qcheckbox.h> 5#include <qcheckbox.h>
6#include <qgroupbox.h> 6#include <qgroupbox.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qlayout.h> 10#include <qlayout.h>
11#include <qtooltip.h> 11#include <qtooltip.h>
12#include <qwhatsthis.h> 12#include <qwhatsthis.h>
13#include <qimage.h> 13#include <qimage.h>
14#include <qpixmap.h> 14#include <qpixmap.h>
15 15
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <qpe/config.h>
18
17#include <opie/oconfig.h> 19#include <opie/oconfig.h>
18 20
19 21
20#include <qapplication.h> 22#include <qapplication.h>
21 23
22 24
23MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl ) 25MediumMountGui::MediumMountGui( Config *cfg, const QString &path ,QWidget* parent, const char* name, bool , WFlags )
24 : QDialog( parent, name, true ) { 26 : QDialog( parent, name, true ) {
25 27
26 28 m_cfg = cfg;
27 QWidget *d = QApplication::desktop(); 29 QWidget *d = QApplication::desktop();
28 int w=d->width(); 30 int w=d->width();
29 int h=d->height(); 31 int h=d->height();
30 resize( w , h ); 32 resize( w , h );
31 setCaption( tr( "Medium inserted" ) ); 33 setCaption( tr( "Medium inserted" ) );
32 34
33 mediumPath = path; 35 mediumPath = path;
34 readConfig(); 36 readConfig();
35 startGui(); 37 startGui();
36} 38}
37 39
38void MediumMountGui::readConfig(){ 40void MediumMountGui::readConfig(){
39 41
40 OConfig cfg (mediumPath +"/.opiestorage.cf"); 42 //OConfig cfg (mediumPath +"/.opiestorage.cf");
41 cfg.setGroup("main"); 43 m_cfg->setGroup("main");
42 checkagain = cfg.readBoolEntry("check", false); 44 checkagain = m_cfg->readBoolEntry("check", false);
43 45
44 cfg.setGroup("mimetypes"); 46 m_cfg->setGroup("mimetypes");
45 checkmimeaudio = cfg.readBoolEntry("audio", true); 47 checkmimeaudio = m_cfg->readBoolEntry("audio", true);
46 checkmimeimage = cfg.readBoolEntry("image", true); 48 checkmimeimage = m_cfg->readBoolEntry("image", true);
47 checkmimetext = cfg.readBoolEntry("text", true); 49 checkmimetext = m_cfg->readBoolEntry("text", true);
48 checkmimevideo = cfg.readBoolEntry("video", true); 50 checkmimevideo = m_cfg->readBoolEntry("video", true);
49 checkmimeall = cfg.readBoolEntry("all", true); 51 checkmimeall = m_cfg->readBoolEntry("all", true);
50 52
51 cfg.setGroup("dirs"); 53 m_cfg->setGroup("dirs");
52 limittodirs = cfg.readEntry("dirs", ""); 54 limittodirs = m_cfg->readEntry("dirs", "");
53} 55}
54 56
55bool MediumMountGui::check() { 57bool MediumMountGui::check() {
56 return !checkagain; 58 return !checkagain;
57} 59}
58 60
59QStringList MediumMountGui::dirs() { 61QStringList MediumMountGui::dirs() {
60 QStringList list = QStringList::split(",", limittodirs ); 62 QStringList list = QStringList::split(",", limittodirs );
61 return list; 63 return list;
62} 64}
63 65
64void MediumMountGui::writeConfig(bool autocheck) { 66void MediumMountGui::writeConfig(bool autocheck) {
65 67
66 OConfig cfg (mediumPath +"/.opiestorage.cf"); 68 //OConfig cfg (mediumPath +"/.opiestorage.cf");
67 cfg.setGroup("main"); 69 m_cfg->setGroup("main");
68 cfg.writeEntry("check", AskBox->isChecked() ); 70 m_cfg->writeEntry("check", AskBox->isChecked() );
69 cfg.writeEntry("autocheck", autocheck ); 71 m_cfg->writeEntry("autocheck", autocheck );
70 72
71 cfg.setGroup("mimetypes"); 73 m_cfg->setGroup("mimetypes");
72 74
73 cfg.writeEntry("audio", CheckBoxAudio->isChecked() ); 75 m_cfg->writeEntry("audio", CheckBoxAudio->isChecked() );
74 cfg.writeEntry("image",CheckBoxImage->isChecked() ); 76 m_cfg->writeEntry("image",CheckBoxImage->isChecked() );
75 cfg.writeEntry("text",CheckBoxImage->isChecked() ); 77 m_cfg->writeEntry("text",CheckBoxImage->isChecked() );
76 cfg.writeEntry("video",CheckBoxVideo->isChecked() ); 78 m_cfg->writeEntry("video",CheckBoxVideo->isChecked() );
77 cfg.writeEntry("all",CheckBoxAll->isChecked() ); 79 m_cfg->writeEntry("all",CheckBoxAll->isChecked() );
78 80
79 cfg.setGroup("dirs"); 81 m_cfg->setGroup("dirs");
80 cfg.writeEntry("dirs", ""); 82 m_cfg->writeEntry("dirs", "");
81 83
82 84
83 // if all is checked then add only "QString::null" to the list. 85 // if all is checked then add only "QString::null" to the list.
84 if (checkmimeall) { 86 if (checkmimeall) {
85 mimeTypeList.clear(); 87 mimeTypeList.clear();
86 mimeTypeList += QString::null; 88 mimeTypeList += QString::null;
87 } else { 89 } else {
88 if (checkmimeaudio) { 90 if (checkmimeaudio) {
89 mimeTypeList += ("audio/*"); 91 mimeTypeList += ("audio/*");
90 } 92 }
91 if (checkmimetext) { 93 if (checkmimetext) {
92 mimeTypeList += ("text/*"); 94 mimeTypeList += ("text/*");
93 } 95 }
94 if (checkmimevideo) { 96 if (checkmimevideo) {
95 mimeTypeList += ("video/*"); 97 mimeTypeList += ("video/*");
96 } 98 }
97 if (checkmimeimage) { 99 if (checkmimeimage) {
98 mimeTypeList += ("image/*"); 100 mimeTypeList += ("image/*");
99 } 101 }
100 } 102 }
101 cfg.write(); // not really needed here but just to be sure 103 m_cfg->write(); // not really needed here but just to be sure
102} 104}
103 105
104void MediumMountGui::startGui() { 106void MediumMountGui::startGui() {
105 107
106 QPixmap image = Resource::loadPixmap( "HelpBrowser"); 108 QPixmap image = Resource::loadPixmap( "HelpBrowser");
107 109
108 Text_2 = new QLabel( this ); 110 Text_2 = new QLabel( this );
109 Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); 111 Text_2->setGeometry( QRect( 10, 15, 40, 40 ) );
110 Text_2->setPixmap( image ); 112 Text_2->setPixmap( image );
111 113
112 Text = new QLabel( this, "Text" ); 114 Text = new QLabel( this, "Text" );
113 Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); 115 Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) );
114 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); 116 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) );
115 117
116 // media box 118 // media box
117 GroupBox1 = new QGroupBox( this, "GroupBox1" ); 119 GroupBox1 = new QGroupBox( this, "GroupBox1" );
118 GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) ); 120 GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) );
119 GroupBox1->setTitle( tr( "Which media files" ) ); 121 GroupBox1->setTitle( tr( "Which media files" ) );
120 122
121 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); 123 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" );
122 CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) ); 124 CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) );
123 CheckBoxAudio->setText( tr( "Audio" ) ); 125 CheckBoxAudio->setText( tr( "Audio" ) );
124 126
125 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); 127 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" );
126 CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) ); 128 CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) );
127 CheckBoxImage->setText( tr( "Image" ) ); 129 CheckBoxImage->setText( tr( "Image" ) );
128 130
129 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); 131 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" );
130 CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) ); 132 CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) );
131 CheckBoxText->setText( tr( "Text" ) ); 133 CheckBoxText->setText( tr( "Text" ) );
132 134
133 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); 135 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" );
134 CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) ); 136 CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) );
135 CheckBoxVideo->setText( tr( "Video" ) ); 137 CheckBoxVideo->setText( tr( "Video" ) );
136 138
137 CheckBoxAll = new QCheckBox ( GroupBox1); 139 CheckBoxAll = new QCheckBox ( GroupBox1);
138 CheckBoxAll->setGeometry( QRect( 10, 55, (GroupBox1->width()/2)-15, 15 ) ); 140 CheckBoxAll->setGeometry( QRect( 10, 55, (GroupBox1->width()/2)-15, 15 ) );
139 CheckBoxAll->setText( tr( "All" ) ); 141 CheckBoxAll->setText( tr( "All" ) );
140 QObject::connect( (QObject*)CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers()) ); 142 QObject::connect( (QObject*)CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers()) );
141 143
142 144
143 145
144 CheckBoxLink = new QCheckBox ( GroupBox1); 146 CheckBoxLink = new QCheckBox ( GroupBox1);
145 CheckBoxLink->setGeometry( QRect( (GroupBox1->width()/2), 55, (GroupBox1->width()/2)-15, 15 ) ); 147 CheckBoxLink->setGeometry( QRect( (GroupBox1->width()/2), 55, (GroupBox1->width()/2)-15, 15 ) );
146 CheckBoxLink->setText( tr( "Link apps" ) ); 148 CheckBoxLink->setText( tr( "Link apps" ) );
147 // as long as the feature is not supported 149 // as long as the feature is not supported
148 CheckBoxLink->setEnabled(false); 150 CheckBoxLink->setEnabled(false);
149 151
150 152
151 // select dirs 153 // select dirs
152 154
153 DirSelectText = new QLabel( this, "DirSelectText" ); 155 DirSelectText = new QLabel( this, "DirSelectText" );
154 DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) ); 156 DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) );
155 DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) ); 157 DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) );
156 158
157 LineEdit1 = new QLineEdit( this ); 159 LineEdit1 = new QLineEdit( this );
158 LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) ); 160 LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) );
159 161
160 PushButton3 = new QPushButton( this ); 162 PushButton3 = new QPushButton( this );
161 PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) ); 163 PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) );
162 PushButton3->setText( tr( "Add" ) ); 164 PushButton3->setText( tr( "Add" ) );
163 165
164 166
165 // decision 167 // decision
166 DirSelectText_2 = new QLabel( this ); 168 DirSelectText_2 = new QLabel( this );
167 DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) ); 169 DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) );
168 DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) ); 170 DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) );
169 171
170 // ask again 172 // ask again
171 AskBox = new QCheckBox( this ); 173 AskBox = new QCheckBox( this );
172 AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) ); 174 AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) );
173 AskBox->setText( tr( "Do not ask again for this medium" ) ); 175 AskBox->setText( tr( "Do not ask again for this medium" ) );
174 176
175 177
176 AskBox->setChecked(checkagain); 178 AskBox->setChecked(checkagain);
177 CheckBoxAudio->setChecked(checkmimeaudio); 179 CheckBoxAudio->setChecked(checkmimeaudio);
178 CheckBoxImage->setChecked(checkmimeimage); 180 CheckBoxImage->setChecked(checkmimeimage);
179 CheckBoxText->setChecked(checkmimetext); 181 CheckBoxText->setChecked(checkmimetext);
180 CheckBoxVideo->setChecked(checkmimevideo); 182 CheckBoxVideo->setChecked(checkmimevideo);
181 183
182 // buttons 184 // buttons
183 quit = new QPushButton( this ); 185 quit = new QPushButton( this );
184 quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) ); 186 quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) );
185 quit->setFocus(); 187 quit->setFocus();
186 quit->setText( tr( "Yes" ) ); 188 quit->setText( tr( "Yes" ) );
187 189
188 quit_2 = new QPushButton( this ); 190 quit_2 = new QPushButton( this );
189 quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) ); 191 quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) );
190 quit_2->setText( tr( "No" ) ); 192 quit_2->setText( tr( "No" ) );
191 193
192 QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) ); 194 QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) );
193 QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) ); 195 QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) );
194 196
195 197
196} 198}
197 199
198 200
199void MediumMountGui::deactivateOthers() { 201void MediumMountGui::deactivateOthers() {
200 bool mod = !(CheckBoxAll->isChecked()); 202 bool mod = !(CheckBoxAll->isChecked());
201 203
202 //if (!CheckBoxVideo->isChecked()){ 204 //if (!CheckBoxVideo->isChecked()){
203 // mod = false; 205 // mod = false;
204 //} else { 206 //} else {
205 // mod = true; 207 // mod = true;
206 //} 208 //}
207 CheckBoxVideo->setEnabled(mod); 209 CheckBoxVideo->setEnabled(mod);
208 CheckBoxAudio->setEnabled(mod); 210 CheckBoxAudio->setEnabled(mod);
209 CheckBoxText->setEnabled(mod); 211 CheckBoxText->setEnabled(mod);
210 CheckBoxImage->setEnabled(mod); 212 CheckBoxImage->setEnabled(mod);
211} 213}
212 214
213void MediumMountGui::yesPressed() { 215void MediumMountGui::yesPressed() {
214 writeConfig(true); 216 writeConfig(true);
215 // and do something 217 // and do something
216 accept(); 218 accept();
217} 219}
218 220
219 221
220QStringList MediumMountGui::mimeTypes(){ 222QStringList MediumMountGui::mimeTypes(){
221 return mimeTypeList; 223 return mimeTypeList;
222} 224}
223 225
224void MediumMountGui::noPressed() { 226void MediumMountGui::noPressed() {
225 writeConfig(false); 227 writeConfig(false);
226 reject(); 228 reject();
227} 229}
228 230
229MediumMountGui::~MediumMountGui(){ 231MediumMountGui::~MediumMountGui(){
230} 232}
231 233
diff --git a/core/launcher/mediummountgui.h b/core/launcher/mediummountgui.h
index 2e04f94..8292c3a 100644
--- a/core/launcher/mediummountgui.h
+++ b/core/launcher/mediummountgui.h
@@ -1,68 +1,71 @@
1#ifndef MEDIUMMOUNTGUI_H 1#ifndef MEDIUMMOUNTGUI_H
2#define MEDIUMMOUNTGUI_H 2#define MEDIUMMOUNTGUI_H
3 3
4#include <qvariant.h> 4#include <qvariant.h>
5#include <qdialog.h> 5#include <qdialog.h>
6class QVBoxLayout; 6class QVBoxLayout;
7class QHBoxLayout; 7class QHBoxLayout;
8class QGridLayout; 8class QGridLayout;
9class QCheckBox; 9class QCheckBox;
10class QGroupBox; 10class QGroupBox;
11class QLabel; 11class QLabel;
12class QLineEdit; 12class QLineEdit;
13class QPushButton; 13class QPushButton;
14class Config;
14 15
15class MediumMountGui : public QDialog 16class MediumMountGui : public QDialog
16{ 17{
17 Q_OBJECT 18 Q_OBJECT
18 19
19public: 20public:
20 MediumMountGui( const QString &path = "tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 ); 21 MediumMountGui( Config *cfg, const QString &path = "tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 );
21 ~MediumMountGui(); 22 ~MediumMountGui();
22 23
23protected: 24protected:
24 QPushButton* quit; 25 QPushButton* quit;
25 QPushButton* quit_2; 26 QPushButton* quit_2;
26 QLabel* DirSelectText_2; 27 QLabel* DirSelectText_2;
27 QLineEdit* LineEdit1; 28 QLineEdit* LineEdit1;
28 QPushButton* PushButton3; 29 QPushButton* PushButton3;
29 QLabel* DirSelectText; 30 QLabel* DirSelectText;
30 QLabel* Text_2; 31 QLabel* Text_2;
31 QLabel* Text; 32 QLabel* Text;
32 QGroupBox* GroupBox1; 33 QGroupBox* GroupBox1;
33 QCheckBox* CheckBoxAudio; 34 QCheckBox* CheckBoxAudio;
34 QCheckBox* CheckBoxImage; 35 QCheckBox* CheckBoxImage;
35 QCheckBox* CheckBoxText; 36 QCheckBox* CheckBoxText;
36 QCheckBox* CheckBoxVideo; 37 QCheckBox* CheckBoxVideo;
37 QCheckBox* CheckBoxAll; 38 QCheckBox* CheckBoxAll;
38 QCheckBox* CheckBoxLink; 39 QCheckBox* CheckBoxLink;
39 QCheckBox* AskBox; 40 QCheckBox* AskBox;
41
40 42
41public: 43public:
42 bool check(); 44 bool check();
43 QStringList mimeTypes(); 45 QStringList mimeTypes();
44 QStringList dirs(); 46 QStringList dirs();
45private: 47private:
46 void startGui(); 48 void startGui();
47 void readConfig(); 49 void readConfig();
48 void writeConfig(bool checkagain); 50 void writeConfig(bool checkagain);
49 51
50private slots: 52private slots:
51 void yesPressed(); 53 void yesPressed();
52 void noPressed(); 54 void noPressed();
53 void deactivateOthers(); 55 void deactivateOthers();
54 private: 56 private:
55 QString mediumPath; 57 QString mediumPath;
56 58
57 bool checkagain; 59 bool checkagain:1;
58 bool checkmimeaudio; 60 bool checkmimeaudio:1;
59 bool checkmimeimage; 61 bool checkmimeimage:1;
60 bool checkmimetext; 62 bool checkmimetext:1;
61 bool checkmimevideo; 63 bool checkmimevideo:1;
62 bool checkmimeall; 64 bool checkmimeall:1;
63 QString limittodirs; 65 QString limittodirs;
64 QStringList mimeTypeList; 66 QStringList mimeTypeList;
67 Config *m_cfg;
65 68
66}; 69};
67 70
68#endif 71#endif