author | zecke <zecke> | 2004-07-24 18:46:24 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-24 18:46:24 (UTC) |
commit | 69df55bd0b74c7e59ff40390e2f1d902f882491f (patch) (side-by-side diff) | |
tree | efb617312c1e77ca3990487d727bd283516a2702 | |
parent | 5a8963dff615da61611f5cc4bf410e7a6eeef55b (diff) | |
download | opie-69df55bd0b74c7e59ff40390e2f1d902f882491f.zip opie-69df55bd0b74c7e59ff40390e2f1d902f882491f.tar.gz opie-69df55bd0b74c7e59ff40390e2f1d902f882491f.tar.bz2 |
Try to get the Keyup Event inside the IconView to not 'move'
forward later.
Long Return press triggers autorepeat
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 19 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 211314b..652acc9 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -393,118 +393,137 @@ void PIconView::slotViewChanged( int i) { PDirLister* lis = cur->dirLister(); connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), this, SLOT( slotThumbInfo(const QString&, const QString&))); connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), this, SLOT(slotThumbNail(const QString&, const QPixmap&))); connect(lis, SIGNAL(sig_start()), this, SLOT(slotStart())); connect(lis, SIGNAL(sig_end()) , this, SLOT(slotEnd()) ); /* reload now */ QTimer::singleShot( 0, this, SLOT(slotReloadDir())); } void PIconView::slotReloadDir() { slotChangeDir( m_path ); } /* * add files and folders */ void PIconView::addFolders( const QStringList& lst) { QStringList::ConstIterator it; IconViewItem * _iv; for(it=lst.begin(); it != lst.end(); ++it ) { _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); if (m_mode==3) _iv->setTextOnly(true); } } void PIconView::addFiles( const QStringList& lst) { QStringList::ConstIterator it; IconViewItem * _iv; QPixmap*m_pix = 0; QString pre = ""; if (!m_path.isEmpty()) { pre = m_path+"/"; } for (it=lst.begin(); it!= lst.end(); ++it ) { m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 ); _iv = new IconViewItem( m_view, pre+(*it), (*it) ); if (m_mode==3) { _iv->setTextOnly(true); _iv->setPixmap(QPixmap()); + + + } else { if (m_pix) _iv->setPixmap(*m_pix); } } } /* * user clicked on the item. Change dir or view */ void PIconView::slotClicked(QIconViewItem* _it) { if(!_it ) return; IconViewItem* it = static_cast<IconViewItem*>(_it); if( it->isDir() ) slotChangeDir( it->path() ); else // view image slotShowImage(); } /* + * Return was pressed. which is triggered by the keydown + * handler. The problem is that the key up will be handled + * by the ImageDisplayer and goes to the next image + */ +void PIconView::slotRetrun( QIconViewItem *_it ) { + if(!_it ) + return; + + IconViewItem* it = static_cast<IconViewItem*>(_it); + if( it->isDir() ) + slotChangeDir( it->path() ); + else + QTimer::singleShot(0, this, SLOT(slotShowImage()) ); +} + +/* * got thumb info add to the cache if items is visible * we later need update after processing of slave is done */ void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { IconViewItem* item = g_stringInf[_path]; if (!item ) return; if (m_mode == 2) { return; } if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), m_view->contentsWidth(), m_view->contentsHeight() ) ) ) m_updatet = true; item->setText( str ); g_stringInf.remove( _path ); } /* * got thumbnail and see if it is visible so we need to update later */ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { IconViewItem* item = g_stringPix[_path]; if (!item ) return; if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), m_view->contentsWidth(), m_view->contentsHeight() ) ) ) m_updatet = true; if (pix.width()>0) { PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); item->setPixmap(pix,true); } else { PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 ); } g_stringPix.remove( _path ); } /* * FIXME rename */ void PIconView::slotRename() { } diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index 14ad168..a424c5c 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h @@ -31,65 +31,66 @@ class PIconView : public QVBox { }; public: PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); ~PIconView(); void resetView(); Opie::Core::OKeyConfigManager* manager(); signals: void sig_showInfo( const QString& ); void sig_display( const QString& ); public slots: virtual void slotShowNext(); virtual void slotShowPrev(); protected: void resizeEvent( QResizeEvent* ); private: void initKeys(); QString currentFileName(bool &isDir)const; QString nextFileName(bool &isDir)const; QString prevFileName(bool &isDir)const; void loadViews(); void calculateGrid(); private slots: void slotDirUp(); void slotChangeDir(const QString&); void slotTrash(); void slotViewChanged( int ); void slotReloadDir(); void slotRename(); void slotBeam(); void slotBeamDone( Ir* ); void slotShowImage(); void slotShowImage( const QString& ); void slotImageInfo(); void slotImageInfo( const QString& ); void slotStart(); void slotEnd(); /* for performance reasons make it inline in the future */ void addFolders( const QStringList& ); void addFiles( const QStringList& ); void slotClicked(QIconViewItem* ); + void slotRetrun(QIconViewItem* ); /**/ void slotThumbInfo(const QString&, const QString&); void slotThumbNail(const QString&, const QPixmap&); void slotChangeMode( int ); private: Opie::Core::OKeyConfigManager *m_viewManager; Opie::Core::OConfig *m_cfg; QComboBox* m_views; QIconView* m_view; QString m_path; bool m_updatet : 1; int m_mode; }; #endif |