-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index c07a1e5..7e4164b 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -82,96 +82,98 @@ namespace { if ( m_isDir ) return _dirPix; else{ if (!m_noInfo && !g_stringInf.contains( m_path ) ) { currentView()->dirLister()->imageInfo( m_path ); g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); } m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); if ( !m_pix && !g_stringPix.contains( m_path )) { currentView()->dirLister()->thumbNail( m_path, 64, 64 ); g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); } return m_pix ? m_pix : _unkPix; } } inline void IconViewItem::setText( const QString& str ) { QString text = QIconViewItem::text()+"\n"+str; m_noInfo = true; QIconViewItem::setText( text ); } } /* * Set up the GUI.. initialize the slave set up gui * and also load a dir */ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); } m_path = QDir::homeDirPath(); QHBox *hbox = new QHBox( this ); QLabel* lbl = new QLabel( hbox ); lbl->setText( tr("View as" ) ); m_views = new QComboBox( hbox, "View As" ); connect( m_views, SIGNAL(activated(int)), this, SLOT(slotViewChanged(int)) ); m_view= new QIconView( this ); connect(m_view, SIGNAL(clicked(QIconViewItem*) ), this, SLOT(slotClicked(QIconViewItem*)) ); + connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), + this, SLOT(slotClicked(QIconViewItem*)) ); m_view->setArrangement( QIconView::LeftToRight ); m_view->setItemTextPos( QIconView::Right ); int dw = QApplication::desktop()->width(); int viewerWidth = dw-style().scrollBarExtent().width(); m_view->setGridX( viewerWidth-3*m_view->spacing()); m_view->setGridY( fontMetrics().height()*2+40 ); initKeys(); loadViews(); slotViewChanged( m_views->currentItem() ); } /* * Unref the slave and save the keyboard manager */ PIconView::~PIconView() { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); } m_viewManager->save(); delete m_viewManager; } Opie::Ui::OKeyConfigManager* PIconView::manager() { return m_viewManager; } /* * init the KeyBoard Shortcuts * called from the c'tor */ void PIconView::initKeys() { Opie::Ui::OKeyPair::List lst; lst.append( Opie::Ui::OKeyPair::upArrowKey() ); lst.append( Opie::Ui::OKeyPair::downArrowKey() ); lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); lst.append( Opie::Ui::OKeyPair::returnKey() ); m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", lst, false,this, "keyconfig name" ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", Resource::loadPixmap("beam"), BeamItem, @@ -366,91 +368,90 @@ void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 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 ); 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; Ir* ir = new Ir( this ); 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 ); } void PIconView::slotEnd() { if ( m_updatet ) m_view->arrangeItemsInGrid( ); m_view->viewport()->setUpdatesEnabled( true ); m_updatet = false; } void PIconView::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() { bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; slotImageInfo( name ); } void PIconView::slotImageInfo( const QString& name) { emit sig_showInfo( name ); } |