Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 948477c..138e661 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -195,8 +195,9 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) m_mode = 0; m_iconsize = 32; m_internalReset = false; m_customWidget = 0; + m_setDocCalled = false; m_hbox = new QHBox( this ); QLabel* lbl = new QLabel( m_hbox ); lbl->setText( tr("View as" ) ); @@ -211,12 +212,9 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) m_view->setArrangement( QIconView::LeftToRight ); m_mode = m_cfg->readNumEntry("ListViewMode", 1); - QString lastView = m_cfg->readEntry("LastView",""); - if (m_mode < 1 || m_mode>3) m_mode = 1; - m_view->setItemTextPos( QIconView::Right ); if (m_mode >1) { m_view->setResizeMode(QIconView::Adjust); } else { @@ -226,26 +224,15 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) if (m_iconsize<12)m_iconsize = 12; if (m_iconsize>64)m_iconsize = 64; calculateGrid(); - initKeys(); - loadViews(); - int cc=0; - for (; cc<m_views->count();++cc) { - if (m_views->text(cc)==lastView) { - break; - } - } - if (cc<m_views->count()) { - m_views->setCurrentItem(cc); - slotViewChanged(cc); - } else { - slotViewChanged(m_views->currentItem()); } - connect( m_views, SIGNAL(activated(int)), - this, SLOT(slotViewChanged(int)) ); + +void PIconView::setDoccalled(bool how) +{ + m_setDocCalled = how; } /* * Unref the slave and save the keyboard manager @@ -440,8 +427,32 @@ void PIconView::resetView() { slotViewChanged(m_views->currentItem()); m_internalReset = false; } +void PIconView::polish() +{ + odebug << "===\n" + << "PIconView::polish()\n" + << "====" << oendl; + QVBox::polish(); + + QString lastView = m_cfg->readEntry("LastView",""); + int cc=0; + for (; cc<m_views->count();++cc) { + if (m_views->text(cc)==lastView) { + break; + } + } + if (cc<m_views->count()) { + m_views->setCurrentItem(cc); + slotViewChanged(cc); + } else { + slotViewChanged(m_views->currentItem()); + } + connect( m_views, SIGNAL(activated(int)), + this, SLOT(slotViewChanged(int)) ); +} + /* *swicth view reloadDir and connect signals */ void PIconView::slotViewChanged( int i) { @@ -528,17 +539,22 @@ void PIconView::addFiles( const QStringList& lst) { QString pre = ""; if (!m_path.isEmpty()) { pre = m_path+"/"; } + QString s = ""; + int pos; for (it=lst.begin(); it!= lst.end(); ++it ) { + s = (*it); + pos = s.find(char(0)); m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize ); + if (pos>-1) { + _iv = new IconViewItem( m_view, s.mid(pos+1), s.left(pos),m_iconsize ); + } else { _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize ); + } if (m_mode==3) { _iv->setTextOnly(true); _iv->setPixmap(QPixmap()); - - - } else { if (m_pix) _iv->setPixmap(*m_pix); } } |