summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/gui.pro6
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp3
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp19
3 files changed, 23 insertions, 5 deletions
diff --git a/noncore/graphics/opie-eye/gui/gui.pro b/noncore/graphics/opie-eye/gui/gui.pro
index b9f0bf8..2759dd5 100644
--- a/noncore/graphics/opie-eye/gui/gui.pro
+++ b/noncore/graphics/opie-eye/gui/gui.pro
@@ -1,15 +1,17 @@
1HEADERS += gui/filesystem.h \ 1HEADERS += gui/filesystem.h \
2 gui/iconview.h \ 2 gui/iconview.h \
3 gui/imageinfoui.h \ 3 gui/imageinfoui.h \
4 gui/imageview.h \ 4 gui/imageview.h \
5 gui/mainwindow.h \ 5 gui/mainwindow.h \
6 gui/viewmodebutton.h 6 gui/viewmodebutton.h \
7 gui/basesetup.h
7 8
8SOURCES += gui/filesystem.cpp \ 9SOURCES += gui/filesystem.cpp \
9 gui/iconview.cpp \ 10 gui/iconview.cpp \
10 gui/imageinfoui.cpp \ 11 gui/imageinfoui.cpp \
11 gui/imageview.cpp \ 12 gui/imageview.cpp \
12 gui/mainwindow.cpp \ 13 gui/mainwindow.cpp \
13 gui/viewmodebutton.cpp 14 gui/viewmodebutton.cpp \
15 gui/basesetup.cpp
14 16
15 17
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index a41ce9f..7c8c88d 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -304,454 +304,455 @@ QString PIconView::currentFileName(bool &isDir)const {
304 if ( !_it ) 304 if ( !_it )
305 return QString::null; 305 return QString::null;
306 306
307 IconViewItem* it = static_cast<IconViewItem*>( _it ); 307 IconViewItem* it = static_cast<IconViewItem*>( _it );
308 isDir = it->isDir(); 308 isDir = it->isDir();
309 return it->path(); 309 return it->path();
310} 310}
311 311
312QString PIconView::nextFileName(bool &isDir)const 312QString PIconView::nextFileName(bool &isDir)const
313{ 313{
314 isDir = false; 314 isDir = false;
315 QIconViewItem* _it1 = m_view->currentItem(); 315 QIconViewItem* _it1 = m_view->currentItem();
316 if ( !_it1 ) 316 if ( !_it1 )
317 return QString::null; 317 return QString::null;
318 QIconViewItem* _it = _it1->nextItem(); 318 QIconViewItem* _it = _it1->nextItem();
319 if ( !_it ) 319 if ( !_it )
320 return QString::null; 320 return QString::null;
321 IconViewItem* it = static_cast<IconViewItem*>( _it ); 321 IconViewItem* it = static_cast<IconViewItem*>( _it );
322 isDir = it->isDir(); 322 isDir = it->isDir();
323 return it->path(); 323 return it->path();
324} 324}
325 325
326QString PIconView::prevFileName(bool &isDir)const{ 326QString PIconView::prevFileName(bool &isDir)const{
327 isDir = false; 327 isDir = false;
328 QIconViewItem* _it = m_view->currentItem(); 328 QIconViewItem* _it = m_view->currentItem();
329 if ( !_it ) 329 if ( !_it )
330 return QString::null; 330 return QString::null;
331 _it = _it->prevItem(); 331 _it = _it->prevItem();
332 if ( !_it ) 332 if ( !_it )
333 return QString::null; 333 return QString::null;
334 IconViewItem* it = static_cast<IconViewItem*>( _it ); 334 IconViewItem* it = static_cast<IconViewItem*>( _it );
335 isDir = it->isDir(); 335 isDir = it->isDir();
336 return it->path(); 336 return it->path();
337} 337}
338 338
339void PIconView::slotTrash() { 339void PIconView::slotTrash() {
340 bool isDir; 340 bool isDir;
341 QString pa = currentFileName( isDir ); 341 QString pa = currentFileName( isDir );
342 if ( isDir && pa.isEmpty() ) 342 if ( isDir && pa.isEmpty() )
343 return; 343 return;
344 344
345 if (!QPEMessageBox::confirmDelete( this, 345 if (!QPEMessageBox::confirmDelete( this,
346 tr("Delete Image" ), 346 tr("Delete Image" ),
347 tr("the Image %1" ).arg(pa))) 347 tr("the Image %1" ).arg(pa)))
348 return 348 return
349 349
350 350
351 currentView()->dirLister()->deleteImage( pa ); 351 currentView()->dirLister()->deleteImage( pa );
352 delete m_view->currentItem(); 352 delete m_view->currentItem();
353} 353}
354 354
355/* 355/*
356 * see what views are available 356 * see what views are available
357 */ 357 */
358void PIconView::loadViews() { 358void PIconView::loadViews() {
359 ViewMap::Iterator it; 359 ViewMap::Iterator it;
360 ViewMap* map = viewMap(); 360 ViewMap* map = viewMap();
361 for ( it = map->begin(); it != map->end(); ++it ) 361 for ( it = map->begin(); it != map->end(); ++it )
362 m_views->insertItem( it.key() ); 362 m_views->insertItem( it.key() );
363} 363}
364 364
365void PIconView::resetView() { 365void PIconView::resetView() {
366 slotViewChanged(m_views->currentItem()); 366 slotViewChanged(m_views->currentItem());
367} 367}
368 368
369/* 369/*
370 *swicth view reloadDir and connect signals 370 *swicth view reloadDir and connect signals
371 */ 371 */
372void PIconView::slotViewChanged( int i) { 372void PIconView::slotViewChanged( int i) {
373 if (!m_views->count() ) { 373 if (!m_views->count() ) {
374 setCurrentView( 0l); 374 setCurrentView( 0l);
375 return; 375 return;
376 } 376 }
377 377
378 PDirView* cur = currentView(); 378 PDirView* cur = currentView();
379 if (cur) delete cur; 379 if (cur) delete cur;
380 QString str = m_views->text(i); 380 QString str = m_views->text(i);
381 ViewMap* map = viewMap(); 381 ViewMap* map = viewMap();
382 if (!map) { 382 if (!map) {
383 setCurrentView(0l); 383 setCurrentView(0l);
384 return; 384 return;
385 } 385 }
386 386
387 if (map->find(str) == map->end()) { 387 if (map->find(str) == map->end()) {
388 owarn << "Key not found" << oendl; 388 owarn << "Key not found" << oendl;
389 setCurrentView(0l); 389 setCurrentView(0l);
390 return; 390 return;
391 } 391 }
392 392
393 m_cfg->writeEntry("LastView",str); 393 m_cfg->writeEntry("LastView",str);
394 m_cfg->write(); 394 m_cfg->write();
395 cur = (*(*map)[str])(*m_cfg); 395 cur = (*(*map)[str])(*m_cfg);
396 setCurrentView( cur ); 396 setCurrentView( cur );
397 397
398 /* connect to the signals of the lister */ 398 /* connect to the signals of the lister */
399 PDirLister* lis = cur->dirLister(); 399 PDirLister* lis = cur->dirLister();
400 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), 400 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )),
401 this, SLOT( slotThumbInfo(const QString&, const QString&))); 401 this, SLOT( slotThumbInfo(const QString&, const QString&)));
402 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), 402 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
403 this, SLOT(slotThumbNail(const QString&, const QPixmap&))); 403 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
404 connect(lis, SIGNAL(sig_start()), 404 connect(lis, SIGNAL(sig_start()),
405 this, SLOT(slotStart())); 405 this, SLOT(slotStart()));
406 connect(lis, SIGNAL(sig_end()) , 406 connect(lis, SIGNAL(sig_end()) ,
407 this, SLOT(slotEnd()) ); 407 this, SLOT(slotEnd()) );
408 408
409 409
410 /* reload now with default Path*/ 410 /* reload now with default Path*/
411 m_path = lis->defaultPath(); 411 m_path = lis->defaultPath();
412 QTimer::singleShot( 0, this, SLOT(slotReloadDir())); 412 QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
413} 413}
414 414
415 415
416void PIconView::slotReloadDir() { 416void PIconView::slotReloadDir() {
417 slotChangeDir( m_path ); 417 slotChangeDir( m_path );
418} 418}
419 419
420 420
421/* 421/*
422 * add files and folders 422 * add files and folders
423 */ 423 */
424void PIconView::addFolders( const QStringList& lst) { 424void PIconView::addFolders( const QStringList& lst) {
425 QStringList::ConstIterator it; 425 QStringList::ConstIterator it;
426 IconViewItem * _iv; 426 IconViewItem * _iv;
427 427
428 for(it=lst.begin(); it != lst.end(); ++it ) { 428 for(it=lst.begin(); it != lst.end(); ++it ) {
429 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); 429 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
430 if (m_mode==3) _iv->setTextOnly(true); 430 if (m_mode==3) _iv->setTextOnly(true);
431 } 431 }
432} 432}
433 433
434void PIconView::addFiles( const QStringList& lst) { 434void PIconView::addFiles( const QStringList& lst) {
435 QStringList::ConstIterator it; 435 QStringList::ConstIterator it;
436 IconViewItem * _iv; 436 IconViewItem * _iv;
437 QPixmap*m_pix = 0; 437 QPixmap*m_pix = 0;
438 QString pre = ""; 438 QString pre = "";
439 if (!m_path.isEmpty()) { 439 if (!m_path.isEmpty()) {
440 pre = m_path+"/"; 440 pre = m_path+"/";
441 } 441 }
442 for (it=lst.begin(); it!= lst.end(); ++it ) { 442 for (it=lst.begin(); it!= lst.end(); ++it ) {
443 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 ); 443 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 );
444 _iv = new IconViewItem( m_view, pre+(*it), (*it) ); 444 _iv = new IconViewItem( m_view, pre+(*it), (*it) );
445 if (m_mode==3) { 445 if (m_mode==3) {
446 _iv->setTextOnly(true); 446 _iv->setTextOnly(true);
447 _iv->setPixmap(QPixmap()); 447 _iv->setPixmap(QPixmap());
448 448
449 449
450 450
451 } else { 451 } else {
452 if (m_pix) _iv->setPixmap(*m_pix); 452 if (m_pix) _iv->setPixmap(*m_pix);
453 } 453 }
454 } 454 }
455 455
456} 456}
457 457
458/* 458/*
459 * user clicked on the item. Change dir or view 459 * user clicked on the item. Change dir or view
460 */ 460 */
461void PIconView::slotClicked(QIconViewItem* _it) { 461void PIconView::slotClicked(QIconViewItem* _it) {
462 if(!_it ) 462 if(!_it )
463 return; 463 return;
464 464
465 IconViewItem* it = static_cast<IconViewItem*>(_it); 465 IconViewItem* it = static_cast<IconViewItem*>(_it);
466 if( it->isDir() ) 466 if( it->isDir() )
467 slotChangeDir( it->path() ); 467 slotChangeDir( it->path() );
468 else // view image 468 else // view image
469 slotShowImage(); 469 slotShowImage();
470} 470}
471 471
472/* 472/*
473 * Return was pressed. which is triggered by the keydown 473 * Return was pressed. which is triggered by the keydown
474 * handler. The problem is that the key up will be handled 474 * handler. The problem is that the key up will be handled
475 * by the ImageDisplayer and goes to the next image 475 * by the ImageDisplayer and goes to the next image
476 */ 476 */
477void PIconView::slotRetrun( QIconViewItem *_it ) { 477void PIconView::slotRetrun( QIconViewItem *_it ) {
478 if(!_it ) 478 if(!_it )
479 return; 479 return;
480 480
481 IconViewItem* it = static_cast<IconViewItem*>(_it); 481 IconViewItem* it = static_cast<IconViewItem*>(_it);
482 if( it->isDir() ) 482 if( it->isDir() )
483 slotChangeDir( it->path() ); 483 slotChangeDir( it->path() );
484 else 484 else
485 QTimer::singleShot(0, this, SLOT(slotShowImage()) ); 485 QTimer::singleShot(0, this, SLOT(slotShowImage()) );
486} 486}
487 487
488/* 488/*
489 * got thumb info add to the cache if items is visible 489 * got thumb info add to the cache if items is visible
490 * we later need update after processing of slave is done 490 * we later need update after processing of slave is done
491 */ 491 */
492void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 492void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
493 IconViewItem* item = g_stringInf[_path]; 493 IconViewItem* item = g_stringInf[_path];
494 if (!item ) 494 if (!item )
495 return; 495 return;
496 496
497 if (m_mode == 2) { 497 if (m_mode == 2) {
498 return; 498 return;
499 } 499 }
500 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 500 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
501 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 501 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
502 m_updatet = true; 502 m_updatet = true;
503 503
504 item->setText( str ); 504 item->setText( str );
505 g_stringInf.remove( _path ); 505 g_stringInf.remove( _path );
506} 506}
507 507
508/* 508/*
509 * got thumbnail and see if it is visible so we need to update later 509 * got thumbnail and see if it is visible so we need to update later
510 */ 510 */
511void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { 511void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
512 IconViewItem* item = g_stringPix[_path]; 512 IconViewItem* item = g_stringPix[_path];
513 if (!item ) 513 if (!item )
514 return; 514 return;
515 515
516 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 516 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
517 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 517 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
518 m_updatet = true; 518 m_updatet = true;
519 519
520 if (pix.width()>0) { 520 if (pix.width()>0) {
521 PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); 521 PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
522 item->setPixmap(pix,true); 522 item->setPixmap(pix,true);
523 } else { 523 } else {
524 PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 ); 524 PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 );
525 } 525 }
526 g_stringPix.remove( _path ); 526 g_stringPix.remove( _path );
527} 527}
528 528
529 529
530/* 530/*
531 * FIXME rename 531 * FIXME rename
532 */ 532 */
533void PIconView::slotRename() { 533void PIconView::slotRename() {
534 534
535} 535}
536 536
537 537
538/* 538/*
539 * BEAM the current file 539 * BEAM the current file
540 */ 540 */
541void PIconView::slotBeam() { 541void PIconView::slotBeam() {
542 bool isDir; 542 bool isDir;
543 QString pa = currentFileName( isDir ); 543 QString pa = currentFileName( isDir );
544 if ( isDir && pa.isEmpty() ) 544 if ( isDir && pa.isEmpty() )
545 return; 545 return;
546 546
547 Ir* ir = new Ir( this ); 547 Ir* ir = new Ir( this );
548 connect( ir, SIGNAL(done(Ir*)), 548 connect( ir, SIGNAL(done(Ir*)),
549 this, SLOT(slotBeamDone(Ir*))); 549 this, SLOT(slotBeamDone(Ir*)));
550 ir->send(pa, tr( "Image" ) ); 550 ir->send(pa, tr( "Image" ) );
551} 551}
552 552
553/* 553/*
554 * BEAM done clean up 554 * BEAM done clean up
555 */ 555 */
556void PIconView::slotBeamDone( Ir* ir) { 556void PIconView::slotBeamDone( Ir* ir) {
557 delete ir; 557 delete ir;
558} 558}
559 559
560void PIconView::slotStart() { 560void PIconView::slotStart() {
561 m_view->viewport()->setUpdatesEnabled( false ); 561 m_view->viewport()->setUpdatesEnabled( false );
562} 562}
563 563
564void PIconView::slotEnd() { 564void PIconView::slotEnd() {
565 if ( m_updatet ) 565 if ( m_updatet )
566 m_view->arrangeItemsInGrid( ); 566 m_view->arrangeItemsInGrid( );
567 m_view->viewport()->setUpdatesEnabled( true ); 567 m_view->viewport()->setUpdatesEnabled( true );
568 m_updatet = false; 568 m_updatet = false;
569} 569}
570 570
571void PIconView::slotShowLast() 571void PIconView::slotShowLast()
572{ 572{
573 QIconViewItem* last_it = m_view->lastItem(); 573 QIconViewItem* last_it = m_view->lastItem();
574 if (!last_it) return; 574 if (!last_it) return;
575 m_view->setCurrentItem(last_it); 575 m_view->setCurrentItem(last_it);
576 IconViewItem* it = static_cast<IconViewItem*>( last_it ); 576 IconViewItem* it = static_cast<IconViewItem*>( last_it );
577 bool isDir = it->isDir(); 577 bool isDir = it->isDir();
578 QString name = it->path(); 578 QString name = it->path();
579 if (!isDir && !name.isEmpty()) { 579 if (!isDir && !name.isEmpty()) {
580 slotShowImage(name); 580 slotShowImage(name);
581 return; 581 return;
582 } 582 }
583 bool first_loop = true; 583 bool first_loop = true;
584 while(isDir==true) { 584 while(isDir==true) {
585 if (!first_loop) { 585 if (!first_loop) {
586 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 586 m_view->setCurrentItem(m_view->currentItem()->prevItem());
587 } else { 587 } else {
588 first_loop = false; 588 first_loop = false;
589 } 589 }
590 name = prevFileName(isDir); 590 name = prevFileName(isDir);
591 } 591 }
592 592
593 if (name.isEmpty()) return; 593 if (name.isEmpty()) return;
594 /* if we got a name we have a prev item */ 594 /* if we got a name we have a prev item */
595 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 595 m_view->setCurrentItem(m_view->currentItem()->prevItem());
596 slotShowImage(name); 596 slotShowImage(name);
597} 597}
598 598
599bool PIconView::slotShowFirst() 599bool PIconView::slotShowFirst()
600{ 600{
601 /* stop when reached - otherwise we may get an endless loop */ 601 /* stop when reached - otherwise we may get an endless loop */
602 QIconViewItem* first_it = m_view->firstItem(); 602 QIconViewItem* first_it = m_view->firstItem();
603 if (!first_it) return false; 603 if (!first_it) return false;
604 m_view->setCurrentItem(first_it); 604 m_view->setCurrentItem(first_it);
605 IconViewItem* it = static_cast<IconViewItem*>( first_it ); 605 IconViewItem* it = static_cast<IconViewItem*>( first_it );
606 bool isDir = it->isDir(); 606 bool isDir = it->isDir();
607 QString name = it->path(); 607 QString name = it->path();
608 if (!isDir && !name.isEmpty()) { 608 if (!isDir && !name.isEmpty()) {
609 slotShowImage(name); 609 slotShowImage(name);
610 return false; 610 return false;
611 } 611 }
612 bool first_loop = true; 612 bool first_loop = true;
613 while(isDir==true) { 613 while(isDir==true) {
614 /* if name is empty isDir is false, too. */ 614 /* if name is empty isDir is false, too. */
615 if (!first_loop) { 615 if (!first_loop) {
616 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 616 m_view->setCurrentItem(m_view->currentItem()->nextItem());
617 } else { 617 } else {
618 first_loop = false; 618 first_loop = false;
619 } 619 }
620 name = nextFileName(isDir); 620 name = nextFileName(isDir);
621 } 621 }
622 if (name.isEmpty()) return false; 622 if (name.isEmpty()) return false;
623 /* if we got a name we have a next item */ 623 /* if we got a name we have a next item */
624 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 624 m_view->setCurrentItem(m_view->currentItem()->nextItem());
625 slotShowImage(name); 625 slotShowImage(name);
626 return true; 626 return true;
627} 627}
628 628
629void PIconView::slotShowNext() 629void PIconView::slotShowNext()
630{ 630{
631 bool isDir = false; 631 bool isDir = false;
632 QString name = nextFileName(isDir); 632 QString name = nextFileName(isDir);
633 while (isDir==true) { 633 while (isDir==true) {
634 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 634 m_view->setCurrentItem(m_view->currentItem()->nextItem());
635 name = nextFileName(isDir); 635 name = nextFileName(isDir);
636 } 636 }
637 if (name.isEmpty()) { 637 if (name.isEmpty()) {
638 slotShowFirst(); 638 slotShowFirst();
639 return; 639 return;
640 } 640 }
641 if (isDir) return; 641 if (isDir) return;
642 /* if we got a name we have a next item */ 642 /* if we got a name we have a next item */
643 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 643 m_view->setCurrentItem(m_view->currentItem()->nextItem());
644 slotShowImage(name); 644 slotShowImage(name);
645} 645}
646 646
647void PIconView::slotShowPrev() 647void PIconView::slotShowPrev()
648{ 648{
649 bool isDir = false; 649 bool isDir = false;
650 QString name = prevFileName(isDir); 650 QString name = prevFileName(isDir);
651 while (isDir==true) { 651 while (isDir==true) {
652 /* if name is empty isDir is false, too. */ 652 /* if name is empty isDir is false, too. */
653 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 653 m_view->setCurrentItem(m_view->currentItem()->prevItem());
654 name = prevFileName(isDir); 654 name = prevFileName(isDir);
655 } 655 }
656 if (name.isEmpty()) { 656 if (name.isEmpty()) {
657 slotShowLast(); 657 slotShowLast();
658 return; 658 return;
659 } 659 }
660 if (isDir) return; 660 if (isDir) return;
661 /* if we got a name we have a prev item */ 661 /* if we got a name we have a prev item */
662 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 662 m_view->setCurrentItem(m_view->currentItem()->prevItem());
663 slotShowImage(name); 663 slotShowImage(name);
664} 664}
665 665
666void PIconView::slotShowImage() 666void PIconView::slotShowImage()
667{ 667{
668 bool isDir = false; 668 bool isDir = false;
669 QString name = currentFileName(isDir); 669 QString name = currentFileName(isDir);
670 if (isDir) return; 670 if (isDir) return;
671 slotShowImage( name ); 671 slotShowImage( name );
672} 672}
673void PIconView::slotShowImage( const QString& name) { 673void PIconView::slotShowImage( const QString& name) {
674 PDirLister *lister = currentView()->dirLister(); 674 PDirLister *lister = currentView()->dirLister();
675 QString r_name = lister->nameToFname(name); 675 QString r_name = lister->nameToFname(name);
676 emit sig_display(r_name); 676 emit sig_display(r_name);
677} 677}
678 678
679void PIconView::slotStartSlide() { 679void PIconView::slotStartSlide() {
680 bool isDir = false; 680 bool isDir = false;
681 QString name = currentFileName(isDir); 681 QString name = currentFileName(isDir);
682 if (isDir) { 682 if (isDir) {
683 if (!slotShowFirst()) 683 if (!slotShowFirst())
684 return; 684 return;
685 } else { 685 } else {
686 slotShowImage( name ); 686 slotShowImage( name );
687 } 687 }
688 emit sig_startslide(2); 688 int t = m_cfg->readNumEntry("base_slideshowtimeout", 2);
689 emit sig_startslide(t);
689} 690}
690 691
691void PIconView::slotImageInfo() { 692void PIconView::slotImageInfo() {
692 bool isDir = false; 693 bool isDir = false;
693 QString name = currentFileName(isDir); 694 QString name = currentFileName(isDir);
694 if (isDir) return; 695 if (isDir) return;
695 slotImageInfo( name ); 696 slotImageInfo( name );
696} 697}
697 698
698void PIconView::slotImageInfo( const QString& name) { 699void PIconView::slotImageInfo( const QString& name) {
699 PDirLister *lister = currentView()->dirLister(); 700 PDirLister *lister = currentView()->dirLister();
700 QString r_name = lister->nameToFname(name); 701 QString r_name = lister->nameToFname(name);
701 emit sig_showInfo(r_name ); 702 emit sig_showInfo(r_name );
702} 703}
703 704
704 705
705void PIconView::slotChangeMode( int mode ) { 706void PIconView::slotChangeMode( int mode ) {
706 if ( mode >= 1 && mode <= 3 ) 707 if ( mode >= 1 && mode <= 3 )
707 m_mode = mode; 708 m_mode = mode;
708 709
709 m_cfg->writeEntry("ListViewMode", m_mode); 710 m_cfg->writeEntry("ListViewMode", m_mode);
710 /* performance! */ 711 /* performance! */
711 m_view->clear(); 712 m_view->clear();
712 calculateGrid(); 713 calculateGrid();
713 slotReloadDir(); 714 slotReloadDir();
714} 715}
715 716
716 717
717void PIconView::resizeEvent( QResizeEvent* re ) { 718void PIconView::resizeEvent( QResizeEvent* re ) {
718 QVBox::resizeEvent( re ); 719 QVBox::resizeEvent( re );
719 calculateGrid(); 720 calculateGrid();
720} 721}
721 722
722 723
723void PIconView::calculateGrid() { 724void PIconView::calculateGrid() {
724 int dw = QApplication::desktop()->width(); 725 int dw = QApplication::desktop()->width();
725 int viewerWidth = dw-style().scrollBarExtent().width(); 726 int viewerWidth = dw-style().scrollBarExtent().width();
726 727
727 QIconView::ItemTextPos pos; 728 QIconView::ItemTextPos pos;
728 switch( m_mode ) { 729 switch( m_mode ) {
729 case 2: 730 case 2:
730 pos = QIconView::Bottom; 731 pos = QIconView::Bottom;
731 break; 732 break;
732 case 3: 733 case 3:
733 case 1: 734 case 1:
734 default: 735 default:
735 pos = QIconView::Right; 736 pos = QIconView::Right;
736 break; 737 break;
737 } 738 }
738 m_view->setItemTextPos( pos ); 739 m_view->setItemTextPos( pos );
739 switch (m_mode) { 740 switch (m_mode) {
740 case 2: 741 case 2:
741 m_view->setGridX(50); 742 m_view->setGridX(50);
742 m_view->setGridY(20); 743 m_view->setGridY(20);
743 PPixmapCache::self()->setMaxImages(40); 744 PPixmapCache::self()->setMaxImages(40);
744 break; 745 break;
745 case 3: 746 case 3:
746 m_view->setGridX( fontMetrics().width("testimage.jpg")+20); 747 m_view->setGridX( fontMetrics().width("testimage.jpg")+20);
747 m_view->setGridY(8); 748 m_view->setGridY(8);
748 PPixmapCache::self()->setMaxImages(2); 749 PPixmapCache::self()->setMaxImages(2);
749 break; 750 break;
750 case 1: 751 case 1:
751 default: 752 default:
752 m_view->setGridX( viewerWidth-3*m_view->spacing()); 753 m_view->setGridX( viewerWidth-3*m_view->spacing());
753 m_view->setGridY( fontMetrics().height()*2+40 ); 754 m_view->setGridY( fontMetrics().height()*2+40 );
754 PPixmapCache::self()->setMaxImages(20); 755 PPixmapCache::self()->setMaxImages(20);
755 break; 756 break;
756 } 757 }
757} 758}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index e714e84..570ee45 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,623 +1,638 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5#include "mainwindow.h" 5#include "mainwindow.h"
6#include "imageview.h" 6#include "imageview.h"
7 7
8#include "iconview.h" 8#include "iconview.h"
9#include "filesystem.h" 9#include "filesystem.h"
10#include "imageinfoui.h" 10#include "imageinfoui.h"
11#include "viewmodebutton.h" 11#include "viewmodebutton.h"
12#include "basesetup.h"
12 13
13#include <iface/ifaceinfo.h> 14#include <iface/ifaceinfo.h>
14#include <iface/dirview.h> 15#include <iface/dirview.h>
15 16
16#include <opie2/odebug.h> 17#include <opie2/odebug.h>
17#include <opie2/owidgetstack.h> 18#include <opie2/owidgetstack.h>
18#include <opie2/oapplicationfactory.h> 19#include <opie2/oapplicationfactory.h>
19#include <opie2/otabwidget.h> 20#include <opie2/otabwidget.h>
20#include <opie2/okeyconfigwidget.h> 21#include <opie2/okeyconfigwidget.h>
21 22
22#include <qpe/resource.h> 23#include <qpe/resource.h>
23#include <qpe/config.h> 24#include <qpe/config.h>
24#include <qpe/ir.h> 25#include <qpe/ir.h>
25#include <qpe/storage.h> 26#include <qpe/storage.h>
26#include <qpe/applnk.h> 27#include <qpe/applnk.h>
27 28
28#include <qtoolbar.h> 29#include <qtoolbar.h>
29#include <qtoolbutton.h> 30#include <qtoolbutton.h>
30#include <qlayout.h> 31#include <qlayout.h>
31#include <qdialog.h> 32#include <qdialog.h>
32#include <qmap.h> 33#include <qmap.h>
33#include <qtimer.h> 34#include <qtimer.h>
34#include <qframe.h> 35#include <qframe.h>
35#include <qmenubar.h> 36#include <qmenubar.h>
36#include <qaction.h> 37#include <qaction.h>
37 38
38//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 39//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
39OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
40 41
41PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 42PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
42 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 43 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
43{ 44{
44 setCaption( QObject::tr("Opie Eye Caramba" ) ); 45 setCaption( QObject::tr("Opie Eye Caramba" ) );
45 m_cfg = new Opie::Core::OConfig("phunkview"); 46 m_cfg = new Opie::Core::OConfig("phunkview");
46 m_cfg->setGroup("Zecke_view" ); 47 m_cfg->setGroup("Zecke_view" );
47 48
48 m_storage = new StorageInfo(); 49 m_storage = new StorageInfo();
49 connect(m_storage, SIGNAL(disksChanged() ), 50 connect(m_storage, SIGNAL(disksChanged() ),
50 this, SLOT( dirChanged() ) ); 51 this, SLOT( dirChanged() ) );
51 52
52 m_stack = new Opie::Ui::OWidgetStack( this ); 53 m_stack = new Opie::Ui::OWidgetStack( this );
53 setCentralWidget( m_stack ); 54 setCentralWidget( m_stack );
54 55
55 m_view = new PIconView( m_stack, m_cfg ); 56 m_view = new PIconView( m_stack, m_cfg );
56 m_stack->addWidget( m_view, IconView ); 57 m_stack->addWidget( m_view, IconView );
57 m_stack->raiseWidget( IconView ); 58 m_stack->raiseWidget( IconView );
58 59
59 connect(m_view, SIGNAL(sig_display(const QString&)), 60 connect(m_view, SIGNAL(sig_display(const QString&)),
60 this, SLOT(slotDisplay(const QString&))); 61 this, SLOT(slotDisplay(const QString&)));
61 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 62 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
62 this, SLOT(slotShowInfo(const QString&)) ); 63 this, SLOT(slotShowInfo(const QString&)) );
63 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); 64 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
64 65
65 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 66 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
66 67
67 listviewMenu = 0; 68 listviewMenu = 0;
68 /* setup menu and toolbar */ 69 /* setup menu and toolbar */
69 setupActions(); 70 setupActions();
70 setupToolbar(); 71 setupToolbar();
71 setupMenu(); 72 setupMenu();
73 m_aHideToolbar->setOn(m_cfg->readBoolEntry("base_showtoolbar",true));
72} 74}
73 75
74PMainWindow::~PMainWindow() { 76PMainWindow::~PMainWindow() {
75} 77}
76 78
77void PMainWindow::slotToggleZoomer() 79void PMainWindow::slotToggleZoomer()
78{ 80{
79 if (!m_disp) return; 81 if (!m_disp) return;
80 bool cur = m_aZoomer->isOn(); 82 bool cur = m_aZoomer->isOn();
81 m_aZoomer->setOn(!cur); 83 m_aZoomer->setOn(!cur);
82} 84}
83 85
84void PMainWindow::slotZoomerToggled(bool how) 86void PMainWindow::slotZoomerToggled(bool how)
85{ 87{
86 zoomerOn = how; 88 zoomerOn = how;
87 if (m_disp) { 89 if (m_disp) {
88 m_disp->setShowZoomer(zoomerOn); 90 m_disp->setShowZoomer(zoomerOn);
89 } 91 }
90} 92}
91 93
92void PMainWindow::slotToggleAutorotate() 94void PMainWindow::slotToggleAutorotate()
93{ 95{
94 if (!m_disp) return; 96 if (!m_disp) return;
95 if (!m_aAutoRotate->isEnabled()) return; 97 if (!m_aAutoRotate->isEnabled()) return;
96 bool cur = m_aAutoRotate->isOn(); 98 bool cur = m_aAutoRotate->isOn();
97 m_aAutoRotate->setOn(!cur); 99 m_aAutoRotate->setOn(!cur);
98} 100}
99 101
100void PMainWindow::slotToggleAutoscale() 102void PMainWindow::slotToggleAutoscale()
101{ 103{
102 if (!m_disp) return; 104 if (!m_disp) return;
103 bool cur = m_aAutoScale->isOn(); 105 bool cur = m_aAutoScale->isOn();
104 m_aAutoScale->setOn(!cur); 106 m_aAutoScale->setOn(!cur);
105} 107}
106 108
107void PMainWindow::slotRotateToggled(bool how) 109void PMainWindow::slotRotateToggled(bool how)
108{ 110{
109 odebug << "Autorotate: " << how << oendl; 111 odebug << "Autorotate: " << how << oendl;
110 autoRotate = how; 112 autoRotate = how;
111 if (m_disp) { 113 if (m_disp) {
112 m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); 114 m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn());
113 } 115 }
114} 116}
115 117
116void PMainWindow::slotScaleToggled(bool how) 118void PMainWindow::slotScaleToggled(bool how)
117{ 119{
118 autoScale = !how; 120 autoScale = !how;
119 if (!how) { 121 if (!how) {
120 autoRotate = how; 122 autoRotate = how;
121 } 123 }
122 if (!autoScale) { 124 if (!autoScale) {
123 m_aAutoRotate->setOn(false); 125 m_aAutoRotate->setOn(false);
124 } 126 }
125 if (m_disp) { 127 if (m_disp) {
126 m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); 128 m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn());
127 } 129 }
128 m_aAutoRotate->setEnabled(!how); 130 m_aAutoRotate->setEnabled(!how);
129} 131}
130 132
131void PMainWindow::slotConfig() { 133void PMainWindow::slotConfig() {
132 /* 134 /*
133 * have a tab with the possible views 135 * have a tab with the possible views
134 * a tab for globals image cache size.. scaled loading 136 * a tab for globals image cache size.. scaled loading
135 * and one tab for the KeyConfigs 137 * and one tab for the KeyConfigs
136 */ 138 */
137 QDialog dlg(this, 0, true); 139 QDialog dlg(this, 0, true);
138 dlg.setCaption( tr("Phunk View - Config" ) ); 140 dlg.setCaption( tr("Phunk View - Config" ) );
139 141
140 QHBoxLayout *lay = new QHBoxLayout(&dlg); 142 QHBoxLayout *lay = new QHBoxLayout(&dlg);
141 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 143 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
142 lay->addWidget( wid ); 144 lay->addWidget( wid );
145
146 BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
147 wid->addTab(bSetup,"SettingsIcon","Basics setup");
148
143 ViewMap *vM = viewMap(); 149 ViewMap *vM = viewMap();
144 ViewMap::Iterator _it = vM->begin(); 150 ViewMap::Iterator _it = vM->begin();
145 QMap<PDirView*, QWidget*> lst; 151 QMap<PDirView*, QWidget*> lst;
146 152
147 for( ; _it != vM->end(); ++_it ) { 153 for( ; _it != vM->end(); ++_it ) {
148 PDirView *view = (_it.data())(*m_cfg); 154 PDirView *view = (_it.data())(*m_cfg);
149 PInterfaceInfo *inf = view->interfaceInfo(); 155 PInterfaceInfo *inf = view->interfaceInfo();
150 QWidget *_wid = inf->configWidget( *m_cfg ); 156 QWidget *_wid = inf->configWidget( *m_cfg );
151 if (!_wid) continue; 157 if (!_wid) continue;
152 _wid->reparent(wid, QPoint() ); 158 _wid->reparent(wid, QPoint() );
153 lst.insert( view, _wid ); 159 lst.insert( view, _wid );
154 wid->addTab( _wid, "fileopen", inf->name() ); 160 wid->addTab( _wid, "fileopen", inf->name() );
155 } 161 }
156 162
157/* 163/*
158 * Add the KeyConfigWidget 164 * Add the KeyConfigWidget
159 */ 165 */
160 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 166 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
161 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 167 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
162 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 168 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
163 169
164 if ( !m_info ) { 170 if ( !m_info ) {
165 initInfo(); 171 initInfo();
166 } 172 }
167 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 173 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
168 174
169 if ( !m_disp ) { 175 if ( !m_disp ) {
170 initDisp(); 176 initDisp();
171 } 177 }
172 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 178 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
173 179
174 keyWid->load(); 180 keyWid->load();
175 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 181 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
176 182
177 183
178 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 184 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
179 185
180/* 186/*
181 * clean up 187 * clean up
182 *apply changes 188 *apply changes
183 */ 189 */
184 190
185 QMap<PDirView*, QWidget*>::Iterator it; 191 QMap<PDirView*, QWidget*>::Iterator it;
186 for ( it = lst.begin(); it != lst.end(); ++it ) { 192 for ( it = lst.begin(); it != lst.end(); ++it ) {
187 if ( act ) 193 if ( act )
188 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 194 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
189 delete it.key(); 195 delete it.key();
190 } 196 }
191 197
192 198
193 if ( act ) { 199 if ( act ) {
194 m_view->resetView(); 200 m_view->resetView();
195 keyWid->save(); 201 keyWid->save();
196 m_disp->manager()->save(); 202 m_disp->manager()->save();
197 m_info->manager()->save(); 203 m_info->manager()->save();
198 m_view->manager()->save(); 204 m_view->manager()->save();
205 bSetup->save_values();
199 } 206 }
200 delete keyWid; 207 delete keyWid;
201} 208}
202 209
203/* 210/*
204 * create a new image info component 211 * create a new image info component
205 * and detach the current one 212 * and detach the current one
206 * we will make the other delete on exit 213 * we will make the other delete on exit
207 */ 214 */
208template<class T> 215template<class T>
209void PMainWindow::initT( const char* name, T** ptr, int id) { 216void PMainWindow::initT( const char* name, T** ptr, int id) {
210 if ( *ptr ) { 217 if ( *ptr ) {
211 (*ptr)->disconnect(this, SLOT(slotReturn())); 218 (*ptr)->disconnect(this, SLOT(slotReturn()));
212 (*ptr)->setDestructiveClose(); 219 (*ptr)->setDestructiveClose();
213 m_stack->removeWidget( *ptr ); 220 m_stack->removeWidget( *ptr );
214 } 221 }
215 *ptr = new T(m_cfg, m_stack, name ); 222 *ptr = new T(m_cfg, m_stack, name );
216 m_stack->addWidget( *ptr, id ); 223 m_stack->addWidget( *ptr, id );
217 224
218 connect(*ptr, SIGNAL(sig_return()), 225 connect(*ptr, SIGNAL(sig_return()),
219 this,SLOT(slotReturn())); 226 this,SLOT(slotReturn()));
220 227
221} 228}
222void PMainWindow::initInfo() { 229void PMainWindow::initInfo() {
223 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 230 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
224 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 231 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
225} 232}
226void PMainWindow::initDisp() { 233void PMainWindow::initDisp() {
227 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 234 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
228 if (m_disp) { 235 if (m_disp) {
229 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 236 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
230 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 237 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
231 } 238 }
232 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); 239 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType);
233 m_disp->setAutoScale(!m_aAutoScale->isOn()); 240 m_disp->setAutoScale(!m_aAutoScale->isOn());
234 m_disp->setAutoRotate(m_aAutoRotate->isOn()); 241 m_disp->setAutoRotate(m_aAutoRotate->isOn());
235 m_disp->setShowZoomer(m_aZoomer->isOn()); 242 m_disp->setShowZoomer(m_aZoomer->isOn());
236 m_disp->setBackgroundColor(white); 243 m_disp->setBackgroundColor(white);
237 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 244 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
238 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 245 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
239 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 246 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
240 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 247 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
241 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 248 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
242 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 249 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
243 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 250 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
244 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 251 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
245 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); 252 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int)));
246 slotFullScreenToggled(m_aFullScreen->isOn()); 253 slotFullScreenToggled(m_aFullScreen->isOn());
247 } 254 }
248} 255}
249 256
250void PMainWindow::slotToggleFullScreen() 257void PMainWindow::slotToggleFullScreen()
251{ 258{
252 odebug << "Toggle full " << oendl; 259 odebug << "Toggle full " << oendl;
253 bool current = !m_aFullScreen->isOn(); 260 bool current = !m_aFullScreen->isOn();
254 m_aFullScreen->setOn(current); 261 m_aFullScreen->setOn(current);
255} 262}
256 263
257void PMainWindow::slotFullScreenToggled(bool current) 264void PMainWindow::slotFullScreenToggled(bool current)
258{ 265{
259 odebug << "slotFullScreenToggled " << current << oendl; 266 odebug << "slotFullScreenToggled " << current << oendl;
260 if (!m_disp) return; 267 if (!m_disp) return;
261 if (current) { 268 if (current) {
262 odebug << "full" << oendl; 269 odebug << "full" << oendl;
263 m_disp->setBackgroundColor(black); 270 m_disp->setBackgroundColor(black);
264 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 271 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
265 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 272 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
266 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 273 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
267 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 274 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
268 } else { 275 } else {
269 setUpdatesEnabled(false); 276 setUpdatesEnabled(false);
270 odebug << "window" << oendl; 277 odebug << "window" << oendl;
271 m_disp->setMinimumSize(10,10); 278 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
272 m_disp->reparent(0,QPoint(0,0)); 279 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
280 } else {
281 m_disp->setMinimumSize(10,10);
282 }
283 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
284 m_disp->reparent(0,QPoint(50,50));
285 } else {
286 m_disp->reparent(0,QPoint(0,0));
287 }
273 m_disp->setBackgroundColor(white); 288 m_disp->setBackgroundColor(white);
274 m_stack->addWidget(m_disp,ImageDisplay); 289 m_stack->addWidget(m_disp,ImageDisplay);
275 m_disp->setVScrollBarMode(QScrollView::Auto); 290 m_disp->setVScrollBarMode(QScrollView::Auto);
276 m_disp->setHScrollBarMode(QScrollView::Auto); 291 m_disp->setHScrollBarMode(QScrollView::Auto);
277 m_stack->raiseWidget(m_disp); 292 m_stack->raiseWidget(m_disp);
278 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 293 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
279 m_disp->resize(m_disp->minimumSize()); 294 m_disp->resize(m_disp->minimumSize());
280 } 295 }
281 setUpdatesEnabled(true); 296 setUpdatesEnabled(true);
282 } 297 }
283 m_disp->setFullScreen(current); 298 m_disp->setFullScreen(current);
284} 299}
285 300
286/** 301/**
287 * With big Screen the plan could be to 'detach' the image 302 * With big Screen the plan could be to 'detach' the image
288 * window if visible and to create a ne wone 303 * window if visible and to create a ne wone
289 * init* already supports it but I make no use of it for 304 * init* already supports it but I make no use of it for
290 * now. We set filename and raise 305 * now. We set filename and raise
291 * 306 *
292 * ### FIXME and talk to alwin 307 * ### FIXME and talk to alwin
293 */ 308 */
294void PMainWindow::slotShowInfo( const QString& inf ) { 309void PMainWindow::slotShowInfo( const QString& inf ) {
295 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 310 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
296 return; 311 return;
297 } 312 }
298 if ( !m_info ) { 313 if ( !m_info ) {
299 initInfo(); 314 initInfo();
300 } 315 }
301 m_info->setPath( inf ); 316 m_info->setPath( inf );
302 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 317 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
303 m_aNext->removeFrom(toolBar); 318 m_aNext->removeFrom(toolBar);
304 m_aPrevious->removeFrom(toolBar); 319 m_aPrevious->removeFrom(toolBar);
305 m_aNext->setEnabled(false); 320 m_aNext->setEnabled(false);
306 m_aPrevious->setEnabled(false); 321 m_aPrevious->setEnabled(false);
307 m_aDirUp->setEnabled(false); 322 m_aDirUp->setEnabled(false);
308 m_aShowInfo->setEnabled(false); 323 m_aShowInfo->setEnabled(false);
309 m_aViewfile->setEnabled(true); 324 m_aViewfile->setEnabled(true);
310 m_aStartSlide->setEnabled(false); 325 m_aStartSlide->setEnabled(false);
311 fsButton->hide(); 326 fsButton->hide();
312 } 327 }
313 m_stack->raiseWidget( ImageInfo ); 328 m_stack->raiseWidget( ImageInfo );
314} 329}
315 330
316void PMainWindow::slotDisplay( const QString& inf ) { 331void PMainWindow::slotDisplay( const QString& inf ) {
317 odebug << "slotDisplay: " << inf << oendl; 332 odebug << "slotDisplay: " << inf << oendl;
318 if ( !m_disp ) { 333 if ( !m_disp ) {
319 initDisp(); 334 initDisp();
320 } 335 }
321 m_disp->setImage( inf ); 336 m_disp->setImage( inf );
322 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 337 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
323 if (m_gPrevNext->isEnabled()==false) { 338 if (m_gPrevNext->isEnabled()==false) {
324 m_gPrevNext->addTo(toolBar); 339 m_gPrevNext->addTo(toolBar);
325 m_gPrevNext->setEnabled(true); 340 m_gPrevNext->setEnabled(true);
326 341
327 m_aDirUp->setEnabled(false); 342 m_aDirUp->setEnabled(false);
328 m_aShowInfo->setEnabled(true); 343 m_aShowInfo->setEnabled(true);
329 m_aViewfile->setEnabled(false); 344 m_aViewfile->setEnabled(false);
330 m_aStartSlide->setEnabled(false); 345 m_aStartSlide->setEnabled(false);
331 fsButton->hide(); 346 fsButton->hide();
332 } 347 }
333 } 348 }
334 if (m_disp->fullScreen()) { 349 if (m_disp->fullScreen()) {
335 //m_disp->showFullScreen(); 350 //m_disp->showFullScreen();
336 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 351 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
337 } else { 352 } else {
338 m_stack->raiseWidget( ImageDisplay ); 353 m_stack->raiseWidget( ImageDisplay );
339 } 354 }
340} 355}
341 356
342void PMainWindow::raiseIconView() { 357void PMainWindow::raiseIconView() {
343 setUpdatesEnabled(false); 358 setUpdatesEnabled(false);
344 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 359 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
345 m_gPrevNext->removeFrom(toolBar); 360 m_gPrevNext->removeFrom(toolBar);
346 m_gPrevNext->setEnabled(false); 361 m_gPrevNext->setEnabled(false);
347 m_aDirUp->setEnabled(true); 362 m_aDirUp->setEnabled(true);
348 m_aShowInfo->setEnabled(true); 363 m_aShowInfo->setEnabled(true);
349 m_aViewfile->setEnabled(true); 364 m_aViewfile->setEnabled(true);
350 m_aStartSlide->setEnabled(true); 365 m_aStartSlide->setEnabled(true);
351 fsButton->show(); 366 fsButton->show();
352 } 367 }
353 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 368 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
354 m_disp->stopSlide(); 369 m_disp->stopSlide();
355 m_disp->hide(); 370 m_disp->hide();
356 } 371 }
357 m_stack->raiseWidget( IconView ); 372 m_stack->raiseWidget( IconView );
358 setUpdatesEnabled(true); 373 setUpdatesEnabled(true);
359 repaint(); 374 repaint();
360} 375}
361 376
362void PMainWindow::slotReturn() { 377void PMainWindow::slotReturn() {
363 raiseIconView(); 378 raiseIconView();
364} 379}
365 380
366 381
367void PMainWindow::closeEvent( QCloseEvent* ev ) { 382void PMainWindow::closeEvent( QCloseEvent* ev ) {
368 /* 383 /*
369 * return from view 384 * return from view
370 * or properly quit 385 * or properly quit
371 */ 386 */
372 if ( m_stack->visibleWidget() == m_info || 387 if ( m_stack->visibleWidget() == m_info ||
373 m_stack->visibleWidget() == m_disp ) { 388 m_stack->visibleWidget() == m_disp ) {
374 ev->ignore(); 389 ev->ignore();
375 raiseIconView(); 390 raiseIconView();
376 return; 391 return;
377 } 392 }
378 if (m_disp && m_disp->fullScreen()) { 393 if (m_disp && m_disp->fullScreen()) {
379 /* otherwise opie-eye crashes in bigscreen mode! */ 394 /* otherwise opie-eye crashes in bigscreen mode! */
380 m_disp->reparent(0,QPoint(0,0)); 395 m_disp->reparent(0,QPoint(0,0));
381 m_stack->addWidget(m_disp,ImageDisplay); 396 m_stack->addWidget(m_disp,ImageDisplay);
382 } 397 }
383 ev->accept(); 398 ev->accept();
384 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 399 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
385} 400}
386 401
387void PMainWindow::setDocument( const QString& showImg ) { 402void PMainWindow::setDocument( const QString& showImg ) {
388 QString file = showImg; 403 QString file = showImg;
389 DocLnk lnk(showImg); 404 DocLnk lnk(showImg);
390 if (lnk.isValid() ) 405 if (lnk.isValid() )
391 file = lnk.file(); 406 file = lnk.file();
392 407
393 slotDisplay( file ); 408 slotDisplay( file );
394} 409}
395 410
396void PMainWindow::slotSelectDir(int id) 411void PMainWindow::slotSelectDir(int id)
397{ 412{
398 emit changeDir( m_dev[fsMenu->text(id )] ); 413 emit changeDir( m_dev[fsMenu->text(id )] );
399} 414}
400 415
401void PMainWindow::dirChanged() 416void PMainWindow::dirChanged()
402{ 417{
403 fsMenu->clear(); 418 fsMenu->clear();
404 m_dev.clear(); 419 m_dev.clear();
405 420
406 /* home dir, too */ 421 /* home dir, too */
407 QString f = getenv( "HOME" ); 422 QString f = getenv( "HOME" );
408 if (!f.isEmpty()) { 423 if (!f.isEmpty()) {
409 m_dev.insert("Home directory",f); 424 m_dev.insert("Home directory",f);
410 fsMenu->insertItem("Home directory"); 425 fsMenu->insertItem("Home directory");
411 } 426 }
412 const QList<FileSystem> &fs = m_storage->fileSystems(); 427 const QList<FileSystem> &fs = m_storage->fileSystems();
413 QListIterator<FileSystem> it(fs ); 428 QListIterator<FileSystem> it(fs );
414 for ( ; it.current(); ++it ) { 429 for ( ; it.current(); ++it ) {
415 const QString disk = (*it)->name(); 430 const QString disk = (*it)->name();
416 const QString path = (*it)->path(); 431 const QString path = (*it)->path();
417 m_dev.insert( disk, path ); 432 m_dev.insert( disk, path );
418 fsMenu->insertItem( disk ); 433 fsMenu->insertItem( disk );
419 } 434 }
420} 435}
421 436
422void PMainWindow::showToolbar(bool how) 437void PMainWindow::showToolbar(bool how)
423{ 438{
424 if (!how) toolBar->hide(); 439 if (!how) toolBar->hide();
425 else toolBar->show(); 440 else toolBar->show();
426} 441}
427 442
428void PMainWindow::setupActions() 443void PMainWindow::setupActions()
429{ 444{
430 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); 445 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true );
431 m_aDirUp->setToggleAction(false); 446 m_aDirUp->setToggleAction(false);
432 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); 447 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
433 448
434 if ( Ir::supported() ) { 449 if ( Ir::supported() ) {
435 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); 450 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true );
436 m_aBeam->setToggleAction(false); 451 m_aBeam->setToggleAction(false);
437 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); 452 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
438 } else { 453 } else {
439 m_aBeam = 0; 454 m_aBeam = 0;
440 } 455 }
441 456
442 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); 457 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true );
443 m_aShowInfo->setToggleAction(false); 458 m_aShowInfo->setToggleAction(false);
444 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); 459 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
445 460
446 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); 461 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true );
447 m_aTrash->setToggleAction(false); 462 m_aTrash->setToggleAction(false);
448 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); 463 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
449 464
450 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); 465 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true );
451 m_aViewfile->setToggleAction(false); 466 m_aViewfile->setToggleAction(false);
452 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); 467 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
453 468
454 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); 469 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true );
455 m_aStartSlide->setToggleAction(false); 470 m_aStartSlide->setToggleAction(false);
456 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); 471 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
457 472
458 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); 473 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true );
459 m_aHideToolbar->setOn (true); 474 m_aHideToolbar->setOn (true);
460 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); 475 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
461 476
462 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); 477 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true );
463 m_aSetup->setToggleAction(false); 478 m_aSetup->setToggleAction(false);
464 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); 479 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig()));
465 480
466 m_gListViewMode = new QActionGroup(this,"Select listmode",true); 481 m_gListViewMode = new QActionGroup(this,"Select listmode",true);
467 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); 482 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*)));
468 483
469 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); 484 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true );
470 m_aDirLong->setToggleAction(true); 485 m_aDirLong->setToggleAction(true);
471 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); 486 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true );
472 m_aDirShort->setToggleAction(true); 487 m_aDirShort->setToggleAction(true);
473 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); 488 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true );
474 m_aDirName->setToggleAction(true); 489 m_aDirName->setToggleAction(true);
475 int mode = m_cfg->readNumEntry("ListViewMode", 1); 490 int mode = m_cfg->readNumEntry("ListViewMode", 1);
476 if (mode < 1 || mode>3) mode = 1; 491 if (mode < 1 || mode>3) mode = 1;
477 switch (mode) { 492 switch (mode) {
478 case 3: 493 case 3:
479 m_aDirName->setOn(true); 494 m_aDirName->setOn(true);
480 break; 495 break;
481 case 2: 496 case 2:
482 m_aDirShort->setOn(true); 497 m_aDirShort->setOn(true);
483 break; 498 break;
484 case 1: 499 case 1:
485 default: 500 default:
486 m_aDirLong->setOn(true); 501 m_aDirLong->setOn(true);
487 } 502 }
488 m_gListViewMode->insert(m_aDirLong); 503 m_gListViewMode->insert(m_aDirLong);
489 m_gListViewMode->insert(m_aDirShort); 504 m_gListViewMode->insert(m_aDirShort);
490 m_gListViewMode->insert(m_aDirName); 505 m_gListViewMode->insert(m_aDirName);
491 506
492 m_gPrevNext = new QActionGroup(this,"imageprevnext",false); 507 m_gPrevNext = new QActionGroup(this,"imageprevnext",false);
493 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); 508 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true );
494 m_aNext->setToggleAction(false); 509 m_aNext->setToggleAction(false);
495 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); 510 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext()));
496 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); 511 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true );
497 m_aPrevious->setToggleAction(false); 512 m_aPrevious->setToggleAction(false);
498 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); 513 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev()));
499 m_gPrevNext->insert(m_aPrevious); 514 m_gPrevNext->insert(m_aPrevious);
500 m_gPrevNext->insert(m_aNext); 515 m_gPrevNext->insert(m_aNext);
501 516
502 m_aFullScreen = new QAction( tr( "Show images fullscreen" ), 517 m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
503 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); 518 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
504 m_aFullScreen->setToggleAction(true); 519 m_aFullScreen->setToggleAction(true);
505 m_aFullScreen->setOn(false); 520 m_aFullScreen->setOn(false);
506 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenToggled(bool))); 521 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenToggled(bool)));
507 522
508 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); 523 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
509 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); 524 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
510 m_aAutoRotate->setToggleAction(true); 525 m_aAutoRotate->setToggleAction(true);
511 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 526 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
512 m_aAutoRotate->setOn(true); 527 m_aAutoRotate->setOn(true);
513 autoRotate = true; 528 autoRotate = true;
514 } else { 529 } else {
515 m_aAutoRotate->setOn(false); 530 m_aAutoRotate->setOn(false);
516 autoRotate = false; 531 autoRotate = false;
517 } 532 }
518 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 533 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
519 534
520 m_aAutoScale = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); 535 m_aAutoScale = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
521 m_aAutoScale->setToggleAction(true); 536 m_aAutoScale->setToggleAction(true);
522 m_aAutoScale->setOn (false); 537 m_aAutoScale->setOn (false);
523 connect(m_aAutoScale,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 538 connect(m_aAutoScale,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
524 539
525 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); 540 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true );
526 m_aZoomer->setToggleAction(true); 541 m_aZoomer->setToggleAction(true);
527 m_aZoomer->setOn (true); 542 m_aZoomer->setOn (true);
528 zoomerOn = true; 543 zoomerOn = true;
529 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 544 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
530 m_gDisplayType->insert(m_aAutoRotate); 545 m_gDisplayType->insert(m_aAutoRotate);
531 m_gDisplayType->insert(m_aAutoScale); 546 m_gDisplayType->insert(m_aAutoScale);
532 m_gDisplayType->insert(m_aZoomer); 547 m_gDisplayType->insert(m_aZoomer);
533 548
534 m_hGroup = new QActionGroup(this,"actioncollection",false); 549 m_hGroup = new QActionGroup(this,"actioncollection",false);
535 m_hGroup->insert(m_aFullScreen); 550 m_hGroup->insert(m_aFullScreen);
536} 551}
537 552
538void PMainWindow::setupToolbar() 553void PMainWindow::setupToolbar()
539{ 554{
540 toolBar = new QToolBar( this ); 555 toolBar = new QToolBar( this );
541 addToolBar(toolBar); 556 addToolBar(toolBar);
542 toolBar->setHorizontalStretchable( true ); 557 toolBar->setHorizontalStretchable( true );
543 setToolBarsMovable( false ); 558 setToolBarsMovable( false );
544 m_aDirUp->addTo( toolBar ); 559 m_aDirUp->addTo( toolBar );
545 560
546 fsButton = new PFileSystem( toolBar ); 561 fsButton = new PFileSystem( toolBar );
547 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 562 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
548 m_view, SLOT(slotChangeDir( const QString& ) ) ); 563 m_view, SLOT(slotChangeDir( const QString& ) ) );
549 connect( this, SIGNAL( changeDir( const QString& ) ), 564 connect( this, SIGNAL( changeDir( const QString& ) ),
550 m_view, SLOT(slotChangeDir( const QString& ) ) ); 565 m_view, SLOT(slotChangeDir( const QString& ) ) );
551 566
552 if (m_aBeam) { 567 if (m_aBeam) {
553 m_aBeam->addTo( toolBar ); 568 m_aBeam->addTo( toolBar );
554 } 569 }
555 m_aShowInfo->addTo(toolBar); 570 m_aShowInfo->addTo(toolBar);
556 m_aTrash->addTo(toolBar); 571 m_aTrash->addTo(toolBar);
557 m_aSetup->addTo(toolBar); 572 m_aSetup->addTo(toolBar);
558 573
559 m_gDisplayType->addTo(toolBar); 574 m_gDisplayType->addTo(toolBar);
560 575
561 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 576 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
562 m_gPrevNext->addTo(toolBar); 577 m_gPrevNext->addTo(toolBar);
563 } else { 578 } else {
564 m_gPrevNext->setEnabled(false); 579 m_gPrevNext->setEnabled(false);
565 } 580 }
566} 581}
567 582
568void PMainWindow::setupMenu() 583void PMainWindow::setupMenu()
569{ 584{
570 fileMenu = new QPopupMenu( menuBar() ); 585 fileMenu = new QPopupMenu( menuBar() );
571 menuBar()->insertItem( tr( "File" ), fileMenu ); 586 menuBar()->insertItem( tr( "File" ), fileMenu );
572 dispMenu = new QPopupMenu( menuBar() ); 587 dispMenu = new QPopupMenu( menuBar() );
573 menuBar()->insertItem( tr( "Show" ), dispMenu ); 588 menuBar()->insertItem( tr( "Show" ), dispMenu );
574 589
575 m_aViewfile->addTo(fileMenu); 590 m_aViewfile->addTo(fileMenu);
576 m_aShowInfo->addTo(fileMenu); 591 m_aShowInfo->addTo(fileMenu);
577 m_aStartSlide->addTo(fileMenu); 592 m_aStartSlide->addTo(fileMenu);
578 593
579 fileMenu->insertSeparator(); 594 fileMenu->insertSeparator();
580 m_aDirUp->addTo( fileMenu ); 595 m_aDirUp->addTo( fileMenu );
581 596
582 fsMenu = new QPopupMenu(fileMenu); 597 fsMenu = new QPopupMenu(fileMenu);
583 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); 598 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
584 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); 599 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) );
585 dirChanged(); 600 dirChanged();
586 601
587 if ( m_aBeam ) { 602 if ( m_aBeam ) {
588 fileMenu->insertSeparator(); 603 fileMenu->insertSeparator();
589 m_aBeam->addTo( fileMenu ); 604 m_aBeam->addTo( fileMenu );
590 } 605 }
591 fileMenu->insertSeparator(); 606 fileMenu->insertSeparator();
592 m_aSetup->addTo(fileMenu); 607 m_aSetup->addTo(fileMenu);
593 m_aTrash->addTo(fileMenu); 608 m_aTrash->addTo(fileMenu);
594 609
595 m_aHideToolbar->addTo(dispMenu); 610 m_aHideToolbar->addTo(dispMenu);
596 listviewMenu = new QPopupMenu(dispMenu); 611 listviewMenu = new QPopupMenu(dispMenu);
597 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); 612 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
598 m_gListViewMode->addTo(listviewMenu); 613 m_gListViewMode->addTo(listviewMenu);
599 dispMenu->insertSeparator(); 614 dispMenu->insertSeparator();
600 m_aFullScreen->addTo(dispMenu); 615 m_aFullScreen->addTo(dispMenu);
601 m_gDisplayType->addTo(dispMenu); 616 m_gDisplayType->addTo(dispMenu);
602 dispMenu->insertSeparator(); 617 dispMenu->insertSeparator();
603 m_gPrevNext->addTo(dispMenu); 618 m_gPrevNext->addTo(dispMenu);
604} 619}
605 620
606void PMainWindow::listviewselected(QAction*which) 621void PMainWindow::listviewselected(QAction*which)
607{ 622{
608 if (!which || which->isOn()==false) return; 623 if (!which || which->isOn()==false) return;
609 int val = 1; 624 int val = 1;
610// QString name; 625// QString name;
611 626
612 if (which==m_aDirName) { 627 if (which==m_aDirName) {
613 val = 3; 628 val = 3;
614// name = "opie-eye/opie-eye-textview"; 629// name = "opie-eye/opie-eye-textview";
615 } else if (which==m_aDirShort) { 630 } else if (which==m_aDirShort) {
616 val = 2; 631 val = 2;
617// name = "opie-eye/opie-eye-thumbonly"; 632// name = "opie-eye/opie-eye-thumbonly";
618 } else if (which==m_aDirLong) { 633 } else if (which==m_aDirLong) {
619 val = 1; 634 val = 1;
620// name = "opie-eye/opie-eye-thumb"; 635// name = "opie-eye/opie-eye-thumb";
621 } 636 }
622 emit changeListMode(val); 637 emit changeListMode(val);
623} 638}