summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/iconview.cpp
Unidiff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp94
1 files changed, 92 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 7196aba..0499af9 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -243,4 +243,8 @@ void PIconView::initKeys() {
243 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), 243 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
244 this, SLOT(slotImageInfo()) ) ); 244 this, SLOT(slotImageInfo()) ) );
245 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow",
246 Resource::loadPixmap("1to1"), SlideItem,
247 Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton),
248 this, SLOT(slotStartSlide())));
245 m_viewManager->load(); 249 m_viewManager->load();
246 m_viewManager->handleWidget( m_view ); 250 m_viewManager->handleWidget( m_view );
@@ -565,9 +569,74 @@ void PIconView::slotEnd() {
565} 569}
566 570
571void PIconView::slotShowLast()
572{
573 QIconViewItem* last_it = m_view->lastItem();
574 if (!last_it) return;
575 m_view->setCurrentItem(last_it);
576 IconViewItem* it = static_cast<IconViewItem*>( last_it );
577 bool isDir = it->isDir();
578 QString name = it->path();
579 if (!isDir && !name.isEmpty()) {
580 slotShowImage(name);
581 return;
582 }
583 bool first_loop = true;
584 while(isDir==true) {
585 if (!first_loop) {
586 m_view->setCurrentItem(m_view->currentItem()->prevItem());
587 } else {
588 first_loop = false;
589 }
590 name = prevFileName(isDir);
591 }
592
593 if (name.isEmpty()) return;
594 /* if we got a name we have a prev item */
595 m_view->setCurrentItem(m_view->currentItem()->prevItem());
596 slotShowImage(name);
597}
598
599bool PIconView::slotShowFirst()
600{
601 /* stop when reached - otherwise we may get an endless loop */
602 QIconViewItem* first_it = m_view->firstItem();
603 if (!first_it) return false;
604 m_view->setCurrentItem(first_it);
605 IconViewItem* it = static_cast<IconViewItem*>( first_it );
606 bool isDir = it->isDir();
607 QString name = it->path();
608 if (!isDir && !name.isEmpty()) {
609 slotShowImage(name);
610 return false;
611 }
612 bool first_loop = true;
613 while(isDir==true) {
614 /* if name is empty isDir is false, too. */
615 if (!first_loop) {
616 m_view->setCurrentItem(m_view->currentItem()->nextItem());
617 } else {
618 first_loop = false;
619 }
620 name = nextFileName(isDir);
621 }
622 if (name.isEmpty()) return false;
623 /* if we got a name we have a next item */
624 m_view->setCurrentItem(m_view->currentItem()->nextItem());
625 slotShowImage(name);
626 return true;
627}
628
567void PIconView::slotShowNext() 629void PIconView::slotShowNext()
568{ 630{
569 bool isDir = false; 631 bool isDir = false;
570 QString name = nextFileName(isDir); 632 QString name = nextFileName(isDir);
571 if (name.isEmpty()) return; 633 while (isDir==true) {
634 m_view->setCurrentItem(m_view->currentItem()->nextItem());
635 name = nextFileName(isDir);
636 }
637 if (name.isEmpty()) {
638 slotShowFirst();
639 return;
640 }
572 if (isDir) return; 641 if (isDir) return;
573 /* if we got a name we have a next item */ 642 /* if we got a name we have a next item */
@@ -580,5 +649,13 @@ void PIconView::slotShowPrev()
580 bool isDir = false; 649 bool isDir = false;
581 QString name = prevFileName(isDir); 650 QString name = prevFileName(isDir);
582 if (name.isEmpty()) return; 651 while (isDir==true) {
652 /* if name is empty isDir is false, too. */
653 m_view->setCurrentItem(m_view->currentItem()->prevItem());
654 name = prevFileName(isDir);
655 }
656 if (name.isEmpty()) {
657 slotShowLast();
658 return;
659 }
583 if (isDir) return; 660 if (isDir) return;
584 /* if we got a name we have a prev item */ 661 /* if we got a name we have a prev item */
@@ -599,4 +676,17 @@ void PIconView::slotShowImage( const QString& name) {
599 emit sig_display( r_name ); 676 emit sig_display( r_name );
600} 677}
678
679void PIconView::slotStartSlide() {
680 bool isDir = false;
681 QString name = currentFileName(isDir);
682 if (isDir) {
683 if (!slotShowFirst())
684 return;
685 } else {
686 slotShowImage( name );
687 }
688 emit sig_startslide(2);
689}
690
601void PIconView::slotImageInfo() { 691void PIconView::slotImageInfo() {
602 bool isDir = false; 692 bool isDir = false;