summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp48
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h6
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp25
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h5
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp2
5 files changed, 86 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 5633312..f6e1816 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -269,4 +269,33 @@ QString PIconView::currentFileName(bool &isDir)const {
}
+QString PIconView::nextFileName(bool &isDir)const
+{
+ isDir = false;
+ QIconViewItem* _it1 = m_view->currentItem();
+ if ( !_it1 )
+ return QString::null;
+ QIconViewItem* _it = _it1->nextItem();
+ if ( !_it )
+ return QString::null;
+ IconViewItem* it = static_cast<IconViewItem*>( _it );
+ isDir = it->isDir();
+ m_view->setCurrentItem(_it);
+ return it->path();
+}
+
+QString PIconView::prevFileName(bool &isDir)const{
+ isDir = false;
+ QIconViewItem* _it = m_view->currentItem();
+ if ( !_it )
+ return QString::null;
+ _it = _it->prevItem();
+ if ( !_it )
+ return QString::null;
+ IconViewItem* it = static_cast<IconViewItem*>( _it );
+ isDir = it->isDir();
+ m_view->setCurrentItem(_it);
+ return it->path();
+}
+
void PIconView::slotTrash() {
bool isDir;
@@ -447,4 +476,23 @@ void PIconView::slotEnd() {
}
+void PIconView::slotShowNext()
+{
+ bool isDir = false;
+ QString name = nextFileName(isDir);
+ if (isDir) return;
+ if (name.isEmpty()) return;
+ odebug << "Show next: " << name << oendl;
+ slotShowImage(name);
+}
+
+void PIconView::slotShowPrev()
+{
+ bool isDir = false;
+ QString name = prevFileName(isDir);
+ if (isDir) return;
+ if (name.isEmpty()) return;
+ slotShowImage(name);
+}
+
void PIconView::slotShowImage()
{
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index 903c4fd..14ad168 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -40,4 +40,8 @@ signals:
void sig_display( const QString& );
+public slots:
+ virtual void slotShowNext();
+ virtual void slotShowPrev();
+
protected:
void resizeEvent( QResizeEvent* );
@@ -46,4 +50,6 @@ private:
void initKeys();
QString currentFileName(bool &isDir)const;
+ QString nextFileName(bool &isDir)const;
+ QString prevFileName(bool &isDir)const;
void loadViews();
void calculateGrid();
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index db3ae74..aa2b9bc 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -51,8 +51,33 @@ void ImageView::initKeys()
Opie::Core::OKeyPair(Qt::Key_I,Qt::ShiftButton),
this, SLOT(slotShowImageInfo())));
+#if 0
+ m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Next image"), "nextimage",
+ Resource::loadPixmap("next"), ViewInfo,
+ Opie::Core::OKeyPair(Qt::Key_N,0),
+ this, SLOT(slotDispNext())));
+#endif
m_viewManager->handleWidget( this );
m_viewManager->load();
}
+void ImageView::keyReleaseEvent(QKeyEvent * e)
+{
+ if (!e || e->state()!=0) {
+ return;
+ }
+ if (e->key()==Qt::Key_N) slotDispNext();
+ if (e->key()==Qt::Key_P) slotDispPrev();
+}
+
+void ImageView::slotDispNext()
+{
+ emit dispNext();
+}
+
+void ImageView::slotDispPrev()
+{
+ emit dispPrev();
+}
+
void ImageView::slotShowImageInfo()
{
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index 1790c4f..f467f00 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -26,4 +26,6 @@ public:
signals:
void dispImageInfo(const QString&);
+ void dispNext();
+ void dispPrev();
protected:
@@ -33,4 +35,7 @@ protected:
protected slots:
virtual void slotShowImageInfo();
+ virtual void slotDispNext();
+ virtual void slotDispPrev();
+ virtual void keyReleaseEvent(QKeyEvent * e);
};
#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 09f562a..57be247 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -267,4 +267,6 @@ void PMainWindow::initDisp() {
m_disp->setShowZoomer(zoomerOn);
connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
+ connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
+ connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
}
}