author | alwin <alwin> | 2004-04-19 11:39:36 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-19 11:39:36 (UTC) |
commit | 2add0a39efab1af658ab3515090b31fba30df0d5 (patch) (side-by-side diff) | |
tree | 50ba1101316b70d724b218dfc8f89ecfaa7f7149 /noncore/graphics/opie-eye/gui/iconview.cpp | |
parent | e3ca538f7ce2e7b7df2f29f263778acc342d51db (diff) | |
download | opie-2add0a39efab1af658ab3515090b31fba30df0d5.zip opie-2add0a39efab1af658ab3515090b31fba30df0d5.tar.gz opie-2add0a39efab1af658ab3515090b31fba30df0d5.tar.bz2 |
last iconview mode will be saved and restored
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 | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index d546b64..660c4fa 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -172,9 +172,10 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) 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 ); + m_mode = cfg->readNumEntry("ListViewMode", 1); + if (m_mode < 1 || m_mode>3) m_mode = 1; + + m_view->setItemTextPos( QIconView::Right ); + + calculateGrid(); @@ -567,15 +568,3 @@ void PIconView::slotChangeMode( int mode ) { - QIconView::ItemTextPos pos; - switch( m_mode ) { - case 2: - pos = QIconView::Bottom; - break; - case 3: - case 1: - default: - pos = QIconView::Right; - break; - } - m_view->setItemTextPos( pos ); - + m_cfg->writeEntry("ListViewMode", m_mode); calculateGrid(); @@ -594,3 +583,17 @@ void PIconView::calculateGrid() { odebug << "Size of view: " << m_view->size() << oendl; + int dw = QApplication::desktop()->width(); + int viewerWidth = dw-style().scrollBarExtent().width(); + QIconView::ItemTextPos pos; + switch( m_mode ) { + case 2: + pos = QIconView::Bottom; + break; + case 3: + case 1: + default: + pos = QIconView::Right; + break; + } + m_view->setItemTextPos( pos ); switch (m_mode) { @@ -602,3 +605,3 @@ void PIconView::calculateGrid() { case 3: - m_view->setGridX(m_view->width()); + m_view->setGridX( fontMetrics().width("testimage.jpg")+20); m_view->setGridY(8); @@ -608,4 +611,4 @@ void PIconView::calculateGrid() { default: - m_view->setGridX(m_view->width()); - m_view->setGridY(80); + m_view->setGridX( viewerWidth-3*m_view->spacing()); + m_view->setGridY( fontMetrics().height()*2+40 ); PPixmapCache::self()->setMaxImages(20); |