summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/iconview.cpp
Side-by-side diff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (ignore 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
@@ -244,2 +244,6 @@ void PIconView::initKeys() {
this, SLOT(slotImageInfo()) ) );
+ m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow",
+ Resource::loadPixmap("1to1"), SlideItem,
+ Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton),
+ this, SLOT(slotStartSlide())));
m_viewManager->load();
@@ -566,2 +570,60 @@ void PIconView::slotEnd() {
+void PIconView::slotShowLast()
+{
+ QIconViewItem* last_it = m_view->lastItem();
+ if (!last_it) return;
+ m_view->setCurrentItem(last_it);
+ IconViewItem* it = static_cast<IconViewItem*>( last_it );
+ bool isDir = it->isDir();
+ QString name = it->path();
+ if (!isDir && !name.isEmpty()) {
+ slotShowImage(name);
+ return;
+ }
+ bool first_loop = true;
+ while(isDir==true) {
+ if (!first_loop) {
+ m_view->setCurrentItem(m_view->currentItem()->prevItem());
+ } else {
+ first_loop = false;
+ }
+ name = prevFileName(isDir);
+ }
+
+ if (name.isEmpty()) return;
+ /* if we got a name we have a prev item */
+ m_view->setCurrentItem(m_view->currentItem()->prevItem());
+ slotShowImage(name);
+}
+
+bool PIconView::slotShowFirst()
+{
+ /* stop when reached - otherwise we may get an endless loop */
+ QIconViewItem* first_it = m_view->firstItem();
+ if (!first_it) return false;
+ m_view->setCurrentItem(first_it);
+ IconViewItem* it = static_cast<IconViewItem*>( first_it );
+ bool isDir = it->isDir();
+ QString name = it->path();
+ if (!isDir && !name.isEmpty()) {
+ slotShowImage(name);
+ return false;
+ }
+ bool first_loop = true;
+ while(isDir==true) {
+ /* if name is empty isDir is false, too. */
+ if (!first_loop) {
+ m_view->setCurrentItem(m_view->currentItem()->nextItem());
+ } else {
+ first_loop = false;
+ }
+ name = nextFileName(isDir);
+ }
+ if (name.isEmpty()) return false;
+ /* if we got a name we have a next item */
+ m_view->setCurrentItem(m_view->currentItem()->nextItem());
+ slotShowImage(name);
+ return true;
+}
+
void PIconView::slotShowNext()
@@ -570,3 +632,10 @@ void PIconView::slotShowNext()
QString name = nextFileName(isDir);
- if (name.isEmpty()) return;
+ while (isDir==true) {
+ m_view->setCurrentItem(m_view->currentItem()->nextItem());
+ name = nextFileName(isDir);
+ }
+ if (name.isEmpty()) {
+ slotShowFirst();
+ return;
+ }
if (isDir) return;
@@ -581,3 +650,11 @@ void PIconView::slotShowPrev()
QString name = prevFileName(isDir);
- if (name.isEmpty()) return;
+ while (isDir==true) {
+ /* if name is empty isDir is false, too. */
+ m_view->setCurrentItem(m_view->currentItem()->prevItem());
+ name = prevFileName(isDir);
+ }
+ if (name.isEmpty()) {
+ slotShowLast();
+ return;
+ }
if (isDir) return;
@@ -600,2 +677,15 @@ void PIconView::slotShowImage( const QString& name) {
}
+
+void PIconView::slotStartSlide() {
+ bool isDir = false;
+ QString name = currentFileName(isDir);
+ if (isDir) {
+ if (!slotShowFirst())
+ return;
+ } else {
+ slotShowImage( name );
+ }
+ emit sig_startslide(2);
+}
+
void PIconView::slotImageInfo() {