summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-19 11:39:36 (UTC)
committer alwin <alwin>2004-04-19 11:39:36 (UTC)
commit2add0a39efab1af658ab3515090b31fba30df0d5 (patch) (side-by-side diff)
tree50ba1101316b70d724b218dfc8f89ecfaa7f7149
parente3ca538f7ce2e7b7df2f29f263778acc342d51db (diff)
downloadopie-2add0a39efab1af658ab3515090b31fba30df0d5.zip
opie-2add0a39efab1af658ab3515090b31fba30df0d5.tar.gz
opie-2add0a39efab1af658ab3515090b31fba30df0d5.tar.bz2
last iconview mode will be saved and restored
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp45
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp4
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.cpp4
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.h2
4 files changed, 30 insertions, 25 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
@@ -171,11 +171,12 @@ 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();
initKeys();
@@ -566,17 +567,5 @@ void PIconView::slotChangeMode( int mode ) {
m_mode = 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();
slotReloadDir();
@@ -593,5 +582,19 @@ void PIconView::calculateGrid() {
odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl;
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) {
case 2:
@@ -601,5 +604,5 @@ void PIconView::calculateGrid() {
break;
case 3:
- m_view->setGridX(m_view->width());
+ m_view->setGridX( fontMetrics().width("testimage.jpg")+20);
m_view->setGridY(8);
PPixmapCache::self()->setMaxImages(2);
@@ -607,6 +610,6 @@ void PIconView::calculateGrid() {
case 1:
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);
break;
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index ef6e6df..a90231b 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -92,5 +92,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
- viewModeButton = new ViewModeButton( bar );
+ int mode = m_cfg->readNumEntry("ListViewMode", 1);
+ if (mode < 1 || mode>3) mode = 1;
+ viewModeButton = new ViewModeButton( bar,mode );
connect( viewModeButton, SIGNAL(changeMode(int)),
m_view, SLOT(slotChangeMode(int)));
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
index 0e4a7cb..36e5dcf 100644
--- a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
+++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
@@ -6,8 +6,8 @@
#include <qpopupmenu.h>
-ViewModeButton::ViewModeButton( QToolBar* bar )
+ViewModeButton::ViewModeButton( QToolBar* bar,int def )
: QToolButton( bar )
{
- slotChange( 1 );
+ slotChange( def );
QPopupMenu *pop= new QPopupMenu( this );
pop->setCheckable( true );
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.h b/noncore/graphics/opie-eye/gui/viewmodebutton.h
index 3247114..48f0e67 100644
--- a/noncore/graphics/opie-eye/gui/viewmodebutton.h
+++ b/noncore/graphics/opie-eye/gui/viewmodebutton.h
@@ -14,5 +14,5 @@ class ViewModeButton : public QToolButton {
Q_OBJECT
public:
- ViewModeButton( QToolBar* );
+ ViewModeButton( QToolBar*,int def=1 );
~ViewModeButton();