-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 4ced52d..c07a1e5 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -198,13 +198,12 @@ void PIconView::initKeys() { * change one dir up */ void PIconView::slotDirUp() { QDir dir( m_path ); dir.cdUp(); slotChangeDir( dir.absPath() ); - } /* * change the dir */ void PIconView::slotChangeDir(const QString& path) { @@ -212,29 +211,40 @@ void PIconView::slotChangeDir(const QString& path) { return; PDirLister *lister = currentView()->dirLister(); if (!lister ) return; + /* + * Say what we want and take what we get + */ lister->setStartPath( path ); m_path = lister->currentPath(); m_view->viewport()->setUpdatesEnabled( false ); m_view->clear(); + + /* + * add files and folders + */ addFolders( lister->folders() ); addFiles( lister->files() ); m_view->viewport()->setUpdatesEnabled( true ); // Also invalidate the cache. We can't cancel the operations anyway g_stringPix.clear(); g_stringInf.clear(); // looks ugly static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); } +/** + * get the current file name + * @param isDir see if this is a dir or real file + */ QString PIconView::currentFileName(bool &isDir)const { isDir = false; QIconViewItem* _it = m_view->currentItem(); if ( !_it ) return QString::null; @@ -255,23 +265,30 @@ void PIconView::slotTrash() { return currentView()->dirLister()->deleteImage( pa ); delete m_view->currentItem(); } + +/* + * see what views are available + */ void PIconView::loadViews() { ViewMap::Iterator it; ViewMap* map = viewMap(); for ( it = map->begin(); it != map->end(); ++it ) m_views->insertItem( QObject::tr(it.key() ) ); } void PIconView::resetView() { slotViewChanged(m_views->currentItem()); } +/* + *swicth view reloadDir and connect signals + */ void PIconView::slotViewChanged( int i) { if (!m_views->count() ) { setCurrentView( 0l); return; } @@ -300,12 +317,15 @@ void PIconView::slotViewChanged( int i) { void PIconView::slotReloadDir() { slotChangeDir( m_path ); } +/* + * add files and folders + */ void PIconView::addFolders( const QStringList& lst) { QStringList::ConstIterator it; for(it=lst.begin(); it != lst.end(); ++it ) (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); @@ -316,35 +336,46 @@ void PIconView::addFiles( const QStringList& lst) { QStringList::ConstIterator it; for (it=lst.begin(); it!= lst.end(); ++it ) (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); } +/* + * 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(); } +/* + * 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 ( 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(), @@ -356,16 +387,23 @@ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { g_stringPix.remove( _path ); } +/* + * FIXME rename + */ void PIconView::slotRename() { } + +/* + * BEAM the current file + */ void PIconView::slotBeam() { bool isDir; QString pa = currentFileName( isDir ); if ( isDir && pa.isEmpty() ) return; @@ -373,12 +411,15 @@ void PIconView::slotBeam() { connect( ir, SIGNAL(done(Ir*)), this, SLOT(slotBeamDone(Ir*))); ir->send(pa, tr( "Image" ) ); } +/* + * BEAM done clean up + */ void PIconView::slotBeamDone( Ir* ir) { delete ir; } void PIconView::slotStart() { m_view->viewport()->setUpdatesEnabled( false ); @@ -390,24 +431,22 @@ void PIconView::slotEnd() { m_view->viewport()->setUpdatesEnabled( true ); m_updatet = false; } void PIconView::slotShowImage() { - qWarning( "SLotShowImage" ); bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; slotShowImage( name ); } void PIconView::slotShowImage( const QString& name) { emit sig_display( name ); } void PIconView::slotImageInfo() { - qWarning( "SlotImageInfo" ); bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; slotImageInfo( name ); } |