Diffstat (limited to 'noncore/graphics/opie-eye/gui') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 22 |
1 files changed, 18 insertions, 4 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 | |||
@@ -157,35 +157,47 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | |||
157 | 157 | ||
158 | QHBox *hbox = new QHBox( this ); | 158 | QHBox *hbox = new QHBox( this ); |
159 | QLabel* lbl = new QLabel( hbox ); | 159 | QLabel* lbl = new QLabel( hbox ); |
160 | lbl->setText( tr("View as" ) ); | 160 | lbl->setText( tr("View as" ) ); |
161 | 161 | ||
162 | m_views = new QComboBox( hbox, "View As" ); | 162 | m_views = new QComboBox( hbox, "View As" ); |
163 | connect( m_views, SIGNAL(activated(int)), | ||
164 | this, SLOT(slotViewChanged(int)) ); | ||
165 | 163 | ||
166 | m_view= new QIconView( this ); | 164 | m_view= new QIconView( this ); |
167 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 165 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
168 | this, SLOT(slotClicked(QIconViewItem*)) ); | 166 | this, SLOT(slotClicked(QIconViewItem*)) ); |
169 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), | 167 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), |
170 | this, SLOT(slotClicked(QIconViewItem*)) ); | 168 | this, SLOT(slotClicked(QIconViewItem*)) ); |
171 | 169 | ||
172 | m_view->setArrangement( QIconView::LeftToRight ); | 170 | m_view->setArrangement( QIconView::LeftToRight ); |
173 | 171 | ||
174 | m_mode = cfg->readNumEntry("ListViewMode", 1); | 172 | m_mode = m_cfg->readNumEntry("ListViewMode", 1); |
173 | QString lastView = m_cfg->readEntry("LastView",""); | ||
175 | 174 | ||
176 | if (m_mode < 1 || m_mode>3) m_mode = 1; | 175 | if (m_mode < 1 || m_mode>3) m_mode = 1; |
177 | 176 | ||
178 | m_view->setItemTextPos( QIconView::Right ); | 177 | m_view->setItemTextPos( QIconView::Right ); |
179 | 178 | ||
180 | calculateGrid(); | 179 | calculateGrid(); |
181 | 180 | ||
182 | initKeys(); | 181 | initKeys(); |
183 | 182 | ||
184 | loadViews(); | 183 | loadViews(); |
185 | slotViewChanged( m_views->currentItem() ); | 184 | int cc=0; |
185 | for (; cc<m_views->count();++cc) { | ||
186 | if (m_views->text(cc)==lastView) { | ||
187 | break; | ||
188 | } | ||
189 | } | ||
190 | if (cc<m_views->count()) { | ||
191 | m_views->setCurrentItem(cc); | ||
192 | slotViewChanged(cc); | ||
193 | } else { | ||
194 | slotViewChanged(m_views->currentItem()); | ||
195 | } | ||
196 | connect( m_views, SIGNAL(activated(int)), | ||
197 | this, SLOT(slotViewChanged(int)) ); | ||
186 | } | 198 | } |
187 | 199 | ||
188 | /* | 200 | /* |
189 | * Unref the slave and save the keyboard manager | 201 | * Unref the slave and save the keyboard manager |
190 | */ | 202 | */ |
191 | PIconView::~PIconView() { | 203 | PIconView::~PIconView() { |
@@ -369,12 +381,14 @@ void PIconView::slotViewChanged( int i) { | |||
369 | ViewMap* map = viewMap(); | 381 | ViewMap* map = viewMap(); |
370 | if (!map) {setCurrentView(0l); return;} | 382 | if (!map) {setCurrentView(0l); return;} |
371 | if (map->find(str) == map->end()) { | 383 | if (map->find(str) == map->end()) { |
372 | owarn << "Key not found" << oendl; | 384 | owarn << "Key not found" << oendl; |
373 | setCurrentView(0l); return; | 385 | setCurrentView(0l); return; |
374 | } | 386 | } |
387 | m_cfg->writeEntry("LastView",str); | ||
388 | m_cfg->write(); | ||
375 | cur = (*(*map)[str])(*m_cfg); | 389 | cur = (*(*map)[str])(*m_cfg); |
376 | setCurrentView( cur ); | 390 | setCurrentView( cur ); |
377 | 391 | ||
378 | /* connect to the signals of the lister */ | 392 | /* connect to the signals of the lister */ |
379 | PDirLister* lis = cur->dirLister(); | 393 | PDirLister* lis = cur->dirLister(); |
380 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), | 394 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), |