summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/iconview.cpp
Unidiff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp64
1 files changed, 40 insertions, 24 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
@@ -196,6 +196,7 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
196 m_iconsize = 32; 196 m_iconsize = 32;
197 m_internalReset = false; 197 m_internalReset = false;
198 m_customWidget = 0; 198 m_customWidget = 0;
199 m_setDocCalled = false;
199 200
200 m_hbox = new QHBox( this ); 201 m_hbox = new QHBox( this );
201 QLabel* lbl = new QLabel( m_hbox ); 202 QLabel* lbl = new QLabel( m_hbox );
@@ -212,10 +213,7 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
212 m_view->setArrangement( QIconView::LeftToRight ); 213 m_view->setArrangement( QIconView::LeftToRight );
213 214
214 m_mode = m_cfg->readNumEntry("ListViewMode", 1); 215 m_mode = m_cfg->readNumEntry("ListViewMode", 1);
215 QString lastView = m_cfg->readEntry("LastView","");
216
217 if (m_mode < 1 || m_mode>3) m_mode = 1; 216 if (m_mode < 1 || m_mode>3) m_mode = 1;
218
219 m_view->setItemTextPos( QIconView::Right ); 217 m_view->setItemTextPos( QIconView::Right );
220 if (m_mode >1) { 218 if (m_mode >1) {
221 m_view->setResizeMode(QIconView::Adjust); 219 m_view->setResizeMode(QIconView::Adjust);
@@ -227,24 +225,13 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
227 if (m_iconsize>64)m_iconsize = 64; 225 if (m_iconsize>64)m_iconsize = 64;
228 226
229 calculateGrid(); 227 calculateGrid();
230
231 initKeys(); 228 initKeys();
232
233 loadViews(); 229 loadViews();
234 int cc=0; 230}
235 for (; cc<m_views->count();++cc) { 231
236 if (m_views->text(cc)==lastView) { 232void PIconView::setDoccalled(bool how)
237 break; 233{
238 } 234 m_setDocCalled = how;
239 }
240 if (cc<m_views->count()) {
241 m_views->setCurrentItem(cc);
242 slotViewChanged(cc);
243 } else {
244 slotViewChanged(m_views->currentItem());
245 }
246 connect( m_views, SIGNAL(activated(int)),
247 this, SLOT(slotViewChanged(int)) );
248} 235}
249 236
250/* 237/*
@@ -441,6 +428,30 @@ void PIconView::resetView() {
441 m_internalReset = false; 428 m_internalReset = false;
442} 429}
443 430
431void PIconView::polish()
432{
433 odebug << "===\n"
434 << "PIconView::polish()\n"
435 << "====" << oendl;
436 QVBox::polish();
437
438 QString lastView = m_cfg->readEntry("LastView","");
439 int cc=0;
440 for (; cc<m_views->count();++cc) {
441 if (m_views->text(cc)==lastView) {
442 break;
443 }
444 }
445 if (cc<m_views->count()) {
446 m_views->setCurrentItem(cc);
447 slotViewChanged(cc);
448 } else {
449 slotViewChanged(m_views->currentItem());
450 }
451 connect( m_views, SIGNAL(activated(int)),
452 this, SLOT(slotViewChanged(int)) );
453}
454
444/* 455/*
445 *swicth view reloadDir and connect signals 456 *swicth view reloadDir and connect signals
446 */ 457 */
@@ -529,15 +540,20 @@ void PIconView::addFiles( const QStringList& lst) {
529 if (!m_path.isEmpty()) { 540 if (!m_path.isEmpty()) {
530 pre = m_path+"/"; 541 pre = m_path+"/";
531 } 542 }
543 QString s = "";
544 int pos;
532 for (it=lst.begin(); it!= lst.end(); ++it ) { 545 for (it=lst.begin(); it!= lst.end(); ++it ) {
533 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize ); 546 s = (*it);
534 _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize ); 547 pos = s.find(char(0));
548 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize );
549 if (pos>-1) {
550 _iv = new IconViewItem( m_view, s.mid(pos+1), s.left(pos),m_iconsize );
551 } else {
552 _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize );
553 }
535 if (m_mode==3) { 554 if (m_mode==3) {
536 _iv->setTextOnly(true); 555 _iv->setTextOnly(true);
537 _iv->setPixmap(QPixmap()); 556 _iv->setPixmap(QPixmap());
538
539
540
541 } else { 557 } else {
542 if (m_pix) _iv->setPixmap(*m_pix); 558 if (m_pix) _iv->setPixmap(*m_pix);
543 } 559 }