-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 77597d2..6c5f5ea 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -159,10 +159,8 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) 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*)) ); @@ -170,9 +168,10 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) this, SLOT(slotClicked(QIconViewItem*)) ); m_view->setArrangement( QIconView::LeftToRight ); - m_mode = cfg->readNumEntry("ListViewMode", 1); + 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 ); @@ -181,10 +180,23 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) 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)) ); +} /* * Unref the slave and save the keyboard manager */ @@ -371,8 +383,10 @@ void PIconView::slotViewChanged( int i) { if (map->find(str) == map->end()) { owarn << "Key not found" << oendl; setCurrentView(0l); return; } + m_cfg->writeEntry("LastView",str); + m_cfg->write(); cur = (*(*map)[str])(*m_cfg); setCurrentView( cur ); /* connect to the signals of the lister */ |