summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.cpp28
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.h3
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp173
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h3
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp4
5 files changed, 168 insertions, 43 deletions
diff --git a/noncore/graphics/opie-eye/gui/basesetup.cpp b/noncore/graphics/opie-eye/gui/basesetup.cpp
index 20dda5a..fdf3466 100644
--- a/noncore/graphics/opie-eye/gui/basesetup.cpp
+++ b/noncore/graphics/opie-eye/gui/basesetup.cpp
@@ -1,60 +1,80 @@
1#include "basesetup.h" 1#include "basesetup.h"
2 2
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qlayout.h> 4#include <qlayout.h>
5#include <qspinbox.h> 5#include <qspinbox.h>
6#include <qcheckbox.h> 6#include <qcheckbox.h>
7 7
8BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f) 8BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f)
9 :QFrame(parent,name,f) 9 :QFrame(parent,name,f)
10{ 10{
11 setFrameStyle(Box|Raised); 11 setFrameStyle(Box|Raised);
12 m_cfg = a_cfg; 12 m_cfg = a_cfg;
13 m_MainLayout = new QVBoxLayout( this, 11, 6, "m_MainLayout"); 13 m_MainLayout = new QVBoxLayout( this, 11, 6, "m_MainLayout");
14 14
15 m_SlidetimeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_SlidetimeLayout"); 15 m_SlidetimeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_SlidetimeLayout");
16 m_IconsizeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IconsizeLayout");
16 17
17 m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" ); 18 m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" );
18 m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); 19 m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
19 m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus ); 20 m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus );
20 m_SlideShowTime->setMaxValue( 60 ); 21 m_SlideShowTime->setMaxValue( 60 );
21 m_SlideShowTime->setMinValue(0); 22 m_SlideShowTime->setMinValue(0);
22 m_SlideShowTime->setValue( 2 ); 23 m_SlideShowTime->setValue( 2 );
23 m_SlideShowTime->setSuffix(tr(" seconds")); 24 m_SlideShowTime->setSuffix(tr(" seconds"));
24 25
25 m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 ); 26 m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 );
26 27
27 m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" ); 28 m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" );
28 m_SlidetimeLabel->setText(tr("Slideshow timeout:")); 29 m_SlidetimeLabel->setText(tr("Slideshow timeout:"));
29 m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 ); 30 m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 );
30 m_MainLayout->addLayout( m_SlidetimeLayout ); 31 m_MainLayout->addLayout( m_SlidetimeLayout );
31 32
33 m_Iconsize = new QSpinBox( this, "m_Iconsize" );
34 m_Iconsize->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
35 m_Iconsize->setButtonSymbols( QSpinBox::PlusMinus );
36 m_Iconsize->setMaxValue( 64 );
37 m_Iconsize->setMinValue(12);
38 m_Iconsize->setValue( 32 );
39 m_Iconsize->setSuffix(tr(" pixel"));
40 m_IconsizeLayout->addWidget( m_Iconsize, 0, 1 );
41 m_IconsizeLabel = new QLabel( this, "m_IconsizeLabel" );
42 m_IconsizeLabel->setText(tr("Size of thumbnails:"));
43 m_IconsizeLayout->addWidget( m_IconsizeLabel, 0, 0 );
44 m_MainLayout->addLayout(m_IconsizeLayout);
45
46
32#if 0 47#if 0
33 m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" ); 48 m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" );
34 m_ShowToolBar->setText(tr("Show toolbar on startup")); 49 m_ShowToolBar->setText(tr("Show toolbar on startup"));
35 m_MainLayout->addWidget( m_ShowToolBar ); 50 m_MainLayout->addWidget( m_ShowToolBar );
36#endif 51#endif
37 m_SaveStateAuto = new QCheckBox( this, "m_SaveStateAuto" ); 52 m_SaveStateAuto = new QCheckBox( this, "m_SaveStateAuto" );
38 m_SaveStateAuto->setText(tr("Save status of fullscreen/autorotate")); 53 m_SaveStateAuto->setText(tr("Save status of fullscreen/autorotate"));
39 m_MainLayout->addWidget( m_SaveStateAuto ); 54 m_MainLayout->addWidget( m_SaveStateAuto );
40 55
41 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); 56 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
42 m_MainLayout->addItem( spacer1 ); 57 m_MainLayout->addItem( spacer1 );
43 58
44 int stime = m_cfg->readNumEntry("base_slideshowtimeout",2); 59 int stime = m_cfg->readNumEntry("slideshowtimeout",2);
45 if (stime<0) stime=2; 60 if (stime<0) stime=2;
46 if (stime>60) stime=60; 61 if (stime>60) stime=60;
47 m_SlideShowTime->setValue(stime); 62 m_SlideShowTime->setValue(stime);
48 m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("base_savestatus",false)); 63 m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("savestatus",true));
64 stime = m_cfg->readNumEntry("iconsize", 32);
65 if (stime<12)stime = 12;
66 if (stime>64)stime = 64;
67 m_Iconsize->setValue(stime);
49} 68}
50 69
51BaseSetup::~BaseSetup() 70BaseSetup::~BaseSetup()
52{ 71{
53} 72}
54 73
55void BaseSetup::save_values() 74void BaseSetup::save_values()
56{ 75{
57 if (!m_cfg) return; 76 if (!m_cfg) return;
58 m_cfg->writeEntry("base_slideshowtimeout",m_SlideShowTime->value()); 77 m_cfg->writeEntry("slideshowtimeout",m_SlideShowTime->value());
59 m_cfg->writeEntry("base_savestatus",m_SaveStateAuto->isChecked()); 78 m_cfg->writeEntry("savestatus",m_SaveStateAuto->isChecked());
79 m_cfg->writeEntry("iconsize",m_Iconsize->value());
60} 80}
diff --git a/noncore/graphics/opie-eye/gui/basesetup.h b/noncore/graphics/opie-eye/gui/basesetup.h
index c343f88..95929f2 100644
--- a/noncore/graphics/opie-eye/gui/basesetup.h
+++ b/noncore/graphics/opie-eye/gui/basesetup.h
@@ -1,35 +1,38 @@
1#ifndef _BASESETUP_H 1#ifndef _BASESETUP_H
2#define _BASESETUP_H 2#define _BASESETUP_H
3 3
4#include <opie2/oconfig.h> 4#include <opie2/oconfig.h>
5 5
6#include <qframe.h> 6#include <qframe.h>
7 7
8class QVBoxLayout; 8class QVBoxLayout;
9class QGridLayout; 9class QGridLayout;
10class QSpinBox; 10class QSpinBox;
11class QLabel; 11class QLabel;
12class QCheckBox; 12class QCheckBox;
13class QSpacerItem; 13class QSpacerItem;
14 14
15class BaseSetup:public QFrame 15class BaseSetup:public QFrame
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18public: 18public:
19 BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent=0, const char * name=0, WFlags f=0); 19 BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent=0, const char * name=0, WFlags f=0);
20 virtual ~BaseSetup(); 20 virtual ~BaseSetup();
21 21
22public slots: 22public slots:
23 virtual void save_values(); 23 virtual void save_values();
24 24
25protected: 25protected:
26 Opie::Core::OConfig *m_cfg; 26 Opie::Core::OConfig *m_cfg;
27 QVBoxLayout * m_MainLayout; 27 QVBoxLayout * m_MainLayout;
28 QGridLayout * m_SlidetimeLayout; 28 QGridLayout * m_SlidetimeLayout;
29 QSpinBox * m_SlideShowTime; 29 QSpinBox * m_SlideShowTime;
30 QLabel * m_SlidetimeLabel; 30 QLabel * m_SlidetimeLabel;
31 QCheckBox *m_SaveStateAuto; 31 QCheckBox *m_SaveStateAuto;
32 QSpacerItem *spacer1; 32 QSpacerItem *spacer1;
33 QGridLayout * m_IconsizeLayout;
34 QSpinBox * m_Iconsize;
35 QLabel * m_IconsizeLabel;
33}; 36};
34 37
35#endif 38#endif
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index eafff1d..c037d0d 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -1,764 +1,865 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#include "iconview.h" 6#include "iconview.h"
7 7
8#include <lib/imagecache.h> 8#include <lib/imagecache.h>
9#include <gui/imageinfoui.h> 9#include <gui/imageinfoui.h>
10 10
11#include <iface/dirview.h> 11#include <iface/dirview.h>
12#include <iface/dirlister.h> 12#include <iface/dirlister.h>
13 13
14#include <opie2/oconfig.h> 14#include <opie2/oconfig.h>
15#include <opie2/okeyconfigwidget.h> 15#include <opie2/okeyconfigwidget.h>
16#include <opie2/odebug.h> 16#include <opie2/odebug.h>
17#include <opie2/oimagescrollview.h> 17#include <opie2/oimagescrollview.h>
18 18
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20#include <qpe/qpemessagebox.h> 20#include <qpe/qpemessagebox.h>
21#include <qpe/ir.h> 21#include <qpe/ir.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25#include <qiconview.h> 25#include <qiconview.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qhbox.h> 27#include <qhbox.h>
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qdir.h> 29#include <qdir.h>
30#include <qapplication.h> 30#include <qapplication.h>
31#include <qmainwindow.h> 31#include <qmainwindow.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qstyle.h> 33#include <qstyle.h>
34 34
35 35
36using Opie::Core::OKeyConfigItem; 36using Opie::Core::OKeyConfigItem;
37 37
38/* 38/*
39 * The Icons, Request Cache and IconViewItem for the IconView 39 * The Icons, Request Cache and IconViewItem for the IconView
40 */ 40 */
41namespace { 41namespace {
42 static QPixmap* _dirPix = 0; 42 static QPixmap* _dirPix = 0;
43 static QPixmap* _unkPix = 0; 43 static QPixmap* _unkPix = 0;
44 static QPixmap* _cpyPix = 0;
44 static QPixmap* _emptyPix = 0; 45 static QPixmap* _emptyPix = 0;
45 class IconViewItem : public QIconViewItem { 46 class IconViewItem : public QIconViewItem {
46 public: 47 public:
47 IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); 48 IconViewItem( QIconView*, const QString& path, const QString& name,int a_iconsize, bool isDir = false);
48 QPixmap* pixmap()const; 49 QPixmap* pixmap()const;
49 QString path()const { return m_path; } 50 QString path()const { return m_path; }
50 bool isDir()const { return m_isDir; } 51 bool isDir()const { return m_isDir; }
51 void setText( const QString& ); 52 void setText( const QString& );
52 bool textOnly()const{return m_textOnly;} 53 bool textOnly()const{return m_textOnly;}
53 void setTextOnly(bool how){m_textOnly=how;} 54 void setTextOnly(bool how){m_textOnly=how;}
54 /* just for starting recalc of item rect! */ 55 /* just for starting recalc of item rect! */
55 virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE ); 56 virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE );
56 /* just for starting recalc of item rect! */ 57 /* just for starting recalc of item rect! */
57 virtual void setPixmap( const QPixmap & icon); 58 virtual void setPixmap( const QPixmap & icon);
58 59
59 protected: 60 protected:
60 mutable QPixmap* m_pix; 61 mutable QPixmap* m_pix;
62 int m_iconsize;
63 void check_pix()const;
61 64
62 private: 65 private:
63 QString m_path; 66 QString m_path;
64 bool m_isDir : 1; 67 bool m_isDir : 1;
65 bool m_noInfo :1; 68 bool m_noInfo :1;
66 bool m_textOnly:1; 69 bool m_textOnly:1;
67 bool m_NameOnly:1; 70 bool m_NameOnly:1;
68 bool m_Pixset:1; 71 bool m_Pixset:1;
69 }; 72 };
70 class TextViewItem : public IconViewItem { 73 class TextViewItem : public IconViewItem {
71 TextViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); 74 TextViewItem( QIconView*, const QString& path, const QString& name, int a_iconsize , bool isDir = false);
72 QPixmap *pixmap()const; 75 QPixmap *pixmap()const;
73 void setText( const QString& ); 76 void setText( const QString& );
74 }; 77 };
75 class ThumbViewItem : public IconViewItem { 78 class ThumbViewItem : public IconViewItem {
76 ThumbViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); 79 ThumbViewItem( QIconView*, const QString& path, const QString& name, int a_iconsize, bool isDir = false );
77 QPixmap *pixmap()const; 80 QPixmap *pixmap()const;
78 void setText( const QString& ); 81 void setText( const QString& );
79 }; 82 };
80 83
81 84
82/* 85/*
83 * If we request an Image or String 86 * If we request an Image or String
84 * we add it to the map 87 * we add it to the map
85 */ 88 */
86 static QMap<QString, IconViewItem*> g_stringInf; 89 static QMap<QString, IconViewItem*> g_stringInf;
87 static QMap<QString, IconViewItem*> g_stringPix; 90 static QMap<QString, IconViewItem*> g_stringPix;
88 91
89 IconViewItem::IconViewItem( QIconView* view,const QString& path, 92 IconViewItem::IconViewItem( QIconView* view,const QString& path,
90 const QString& name, bool isDir ) 93 const QString& name, int a_iconsize, bool isDir)
91 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), 94 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ),
92 m_noInfo( false ),m_textOnly(false),m_Pixset(false) 95 m_noInfo( false ),m_textOnly(false),m_Pixset(false)
93 { 96 {
94 if ( isDir && !_dirPix ) 97 m_iconsize = a_iconsize;
95 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); 98 if ( isDir ) {
96 else if ( !isDir && !_unkPix ) 99 if (_dirPix && _dirPix->width()!=m_iconsize) {
97 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); 100 delete _dirPix;
101 _dirPix = 0;
102 }
103 if (!_dirPix ) {
104 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser"));
105 }
106 } else {
107 if (!_unkPix ) {
108 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) );
109 }
110 }
111 check_pix();
112 }
113
114 inline void IconViewItem::check_pix()const
115 {
116 if (_cpyPix && _cpyPix->width()!=m_iconsize) {
117 delete _cpyPix;
118 _cpyPix = 0;
119 }
120 if (_dirPix && _dirPix->width()>m_iconsize) {
121 QPixmap*Pix = new QPixmap(*_dirPix);
122 Pix->resize(m_iconsize,m_iconsize);
123 delete _dirPix;
124 _dirPix = Pix;
125 }
126 if (!_cpyPix && _unkPix) {
127 if (_unkPix->width()>=m_iconsize) {
128 _cpyPix = new QPixmap(*_unkPix);
129 if (_unkPix->width()>m_iconsize)
130 _cpyPix->resize(m_iconsize,m_iconsize);
131 } else {
132 _cpyPix = new QPixmap(m_iconsize,m_iconsize);
133 _cpyPix->fill();
134 QPainter pa(_cpyPix);
135 int offset = (m_iconsize-_unkPix->width())/2;
136 int offy = (m_iconsize-_unkPix->height())/2;
137 if (offy<0) offy=0;
138 pa.drawPixmap(offset,offy,*_unkPix);
139 pa.end();
140 }
141 }
98 } 142 }
99 143
100 inline void IconViewItem::setPixmap( const QPixmap & , bool, bool ) 144 inline void IconViewItem::setPixmap( const QPixmap & , bool, bool )
101 { 145 {
102 m_Pixset = true; 146 m_Pixset = true;
103 calcRect(text()); 147 calcRect(text());
104 } 148 }
105 inline void IconViewItem::setPixmap( const QPixmap & ) 149 inline void IconViewItem::setPixmap( const QPixmap & )
106 { 150 {
107 m_Pixset = true; 151 m_Pixset = true;
108 calcRect(text()); 152 calcRect(text());
109 } 153 }
110 154
111 inline QPixmap* IconViewItem::pixmap()const { 155 inline QPixmap* IconViewItem::pixmap()const {
112// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y() 156// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y()
113// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX() 157// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX()
114// << " " << iconView()->contentsY() << oendl; 158// << " " << iconView()->contentsY() << oendl;
115 159
116 if (textOnly()&&!m_isDir) { 160 if (textOnly()&&!m_isDir) {
117 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); 161 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1);
118 return _emptyPix; 162 return _emptyPix;
119 } 163 }
120 if ( m_isDir ) 164 if ( m_isDir )
121 return _dirPix; 165 return _dirPix;
122 else{ 166 else{
123 if (!m_noInfo && !g_stringInf.contains( m_path ) ) { 167 if (!m_noInfo && !g_stringInf.contains( m_path ) ) {
124 currentView()->dirLister()->imageInfo( m_path );
125 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); 168 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this));
169 currentView()->dirLister()->imageInfo( m_path );
126 } 170 }
127 171
128 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); 172 m_pix = PPixmapCache::self()->cachedImage( m_path, m_iconsize, m_iconsize );
129 if (!m_pix && !g_stringPix.contains( m_path )) { 173 if (!m_pix && !g_stringPix.contains( m_path )) {
130 currentView()->dirLister()->thumbNail( m_path, 64, 64 ); 174 check_pix();
131 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); 175 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
176 currentView()->dirLister()->thumbNail( m_path, m_iconsize, m_iconsize);
132 } 177 }
133 return m_pix ? m_pix : _unkPix; 178 return m_pix ? m_pix : _cpyPix;
134 } 179 }
135 } 180 }
136 inline void IconViewItem::setText( const QString& str ) { 181 inline void IconViewItem::setText( const QString& str ) {
137 QString text = QIconViewItem::text()+"\n"+str; 182 QString text = QIconViewItem::text()+"\n"+str;
138 m_noInfo = true; 183 m_noInfo = true;
139 QIconViewItem::setText( text ); 184 QIconViewItem::setText( text );
140 } 185 }
141} 186}
142 187
143 188
144/* 189/*
145 * Set up the GUI.. initialize the slave set up gui 190 * Set up the GUI.. initialize the slave set up gui
146 * and also load a dir 191 * and also load a dir
147 */ 192 */
148PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) 193PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
149 : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) 194 : QVBox( wid ), m_cfg( cfg ), m_updatet( false )
150{ 195{
151 { 196 {
152 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 197 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
153 } 198 }
154 m_path = QDir::homeDirPath(); 199 m_path = QDir::homeDirPath();
155 m_mode = 0; 200 m_mode = 0;
201 m_iconsize = 32;
156 m_internalReset = false; 202 m_internalReset = false;
157 203
158 QHBox *hbox = new QHBox( this ); 204 QHBox *hbox = new QHBox( this );
159 QLabel* lbl = new QLabel( hbox ); 205 QLabel* lbl = new QLabel( hbox );
160 lbl->setText( tr("View as" ) ); 206 lbl->setText( tr("View as" ) );
161 207
162 m_views = new QComboBox( hbox, "View As" ); 208 m_views = new QComboBox( hbox, "View As" );
163 209
164 m_view= new QIconView( this ); 210 m_view= new QIconView( this );
165 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 211 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
166 this, SLOT(slotClicked(QIconViewItem*)) ); 212 this, SLOT(slotClicked(QIconViewItem*)) );
167 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), 213 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
168 this, SLOT(slotClicked(QIconViewItem*)) ); 214 this, SLOT(slotClicked(QIconViewItem*)) );
169 215
170 m_view->setArrangement( QIconView::LeftToRight ); 216 m_view->setArrangement( QIconView::LeftToRight );
171 217
172 m_mode = m_cfg->readNumEntry("ListViewMode", 1); 218 m_mode = m_cfg->readNumEntry("ListViewMode", 1);
173 QString lastView = m_cfg->readEntry("LastView",""); 219 QString lastView = m_cfg->readEntry("LastView","");
174 220
175 if (m_mode < 1 || m_mode>3) m_mode = 1; 221 if (m_mode < 1 || m_mode>3) m_mode = 1;
176 222
177 m_view->setItemTextPos( QIconView::Right ); 223 m_view->setItemTextPos( QIconView::Right );
224 if (m_mode >1) {
225 m_view->setResizeMode(QIconView::Adjust);
226 } else {
227 m_view->setResizeMode(QIconView::Fixed);
228 }
229 m_iconsize = m_cfg->readNumEntry("iconsize", 32);
230 if (m_iconsize<12)m_iconsize = 12;
231 if (m_iconsize>64)m_iconsize = 64;
178 232
179 calculateGrid(); 233 calculateGrid();
180 234
181 initKeys(); 235 initKeys();
182 236
183 loadViews(); 237 loadViews();
184 int cc=0; 238 int cc=0;
185 for (; cc<m_views->count();++cc) { 239 for (; cc<m_views->count();++cc) {
186 if (m_views->text(cc)==lastView) { 240 if (m_views->text(cc)==lastView) {
187 break; 241 break;
188 } 242 }
189 } 243 }
190 if (cc<m_views->count()) { 244 if (cc<m_views->count()) {
191 m_views->setCurrentItem(cc); 245 m_views->setCurrentItem(cc);
192 slotViewChanged(cc); 246 slotViewChanged(cc);
193 } else { 247 } else {
194 slotViewChanged(m_views->currentItem()); 248 slotViewChanged(m_views->currentItem());
195 } 249 }
196 connect( m_views, SIGNAL(activated(int)), 250 connect( m_views, SIGNAL(activated(int)),
197 this, SLOT(slotViewChanged(int)) ); 251 this, SLOT(slotViewChanged(int)) );
198} 252}
199 253
200/* 254/*
201 * Unref the slave and save the keyboard manager 255 * Unref the slave and save the keyboard manager
202 */ 256 */
203PIconView::~PIconView() { 257PIconView::~PIconView() {
204 { 258 {
205 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 259 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
206 } 260 }
207 m_viewManager->save(); 261 m_viewManager->save();
208 delete m_viewManager; 262 delete m_viewManager;
209} 263}
210 264
211Opie::Core::OKeyConfigManager* PIconView::manager() { 265Opie::Core::OKeyConfigManager* PIconView::manager() {
212 return m_viewManager; 266 return m_viewManager;
213} 267}
214 268
215 269
216/* 270/*
217 * init the KeyBoard Shortcuts 271 * init the KeyBoard Shortcuts
218 * called from the c'tor 272 * called from the c'tor
219 */ 273 */
220void PIconView::initKeys() { 274void PIconView::initKeys() {
221 Opie::Core::OKeyPair::List lst; 275 Opie::Core::OKeyPair::List lst;
222 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 276 lst.append( Opie::Core::OKeyPair::upArrowKey() );
223 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 277 lst.append( Opie::Core::OKeyPair::downArrowKey() );
224 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 278 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
225 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 279 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
226 lst.append( Opie::Core::OKeyPair::returnKey() ); 280 lst.append( Opie::Core::OKeyPair::returnKey() );
227 281
228 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", 282 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config",
229 lst, false,this, "keyconfig name" ); 283 lst, false,this, "keyconfig name" );
230 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", 284 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam",
231 Resource::loadPixmap("beam"), BeamItem, 285 Resource::loadPixmap("beam"), BeamItem,
232 Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), 286 Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton),
233 this, SLOT(slotBeam())) ); 287 this, SLOT(slotBeam())) );
234 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", 288 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete",
235 Resource::loadPixmap("trash"), DeleteItem, 289 Resource::loadPixmap("trash"), DeleteItem,
236 Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), 290 Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton),
237 this, SLOT(slotTrash())) ); 291 this, SLOT(slotTrash())) );
238 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", 292 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view",
239 Resource::loadPixmap("1to1"), ViewItem, 293 Resource::loadPixmap("1to1"), ViewItem,
240 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), 294 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
241 this, SLOT(slotShowImage()))); 295 this, SLOT(slotShowImage())));
242 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", 296 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info",
243 Resource::loadPixmap("DocumentTypeWord"), InfoItem, 297 Resource::loadPixmap("DocumentTypeWord"), InfoItem,
244 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), 298 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
245 this, SLOT(slotImageInfo()) ) ); 299 this, SLOT(slotImageInfo()) ) );
246 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow", 300 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow",
247 Resource::loadPixmap("1to1"), SlideItem, 301 Resource::loadPixmap("1to1"), SlideItem,
248 Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton), 302 Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton),
249 this, SLOT(slotStartSlide()))); 303 this, SLOT(slotStartSlide())));
250 m_viewManager->load(); 304 m_viewManager->load();
251 m_viewManager->handleWidget( m_view ); 305 m_viewManager->handleWidget( m_view );
252} 306}
253 307
254 308
255/* 309/*
256 * change one dir up 310 * change one dir up
257 */ 311 */
258void PIconView::slotDirUp() 312void PIconView::slotDirUp()
259{ 313{
260 slotChangeDir( currentView()->dirLister()->dirUp( m_path ) ); 314 slotChangeDir( currentView()->dirLister()->dirUp( m_path ) );
261} 315}
262 316
263/* 317/*
264 * change the dir 318 * change the dir
265 */ 319 */
266void PIconView::slotChangeDir(const QString& path) { 320void PIconView::slotChangeDir(const QString& path) {
267 if ( !currentView() ) 321 if ( !currentView() )
268 return; 322 return;
269 323
270 PDirLister *lister = currentView()->dirLister(); 324 PDirLister *lister = currentView()->dirLister();
271 if (!lister ) 325 if (!lister )
272 return; 326 return;
273 327
274 /* 328 /*
275 * Say what we want and take what we get 329 * Say what we want and take what we get
276 */ 330 */
277 lister->setStartPath( path ); 331 lister->setStartPath( path );
278 m_path = lister->currentPath(); 332 m_path = lister->currentPath();
279 333
280 m_view->viewport()->setUpdatesEnabled( false ); 334 m_view->viewport()->setUpdatesEnabled( false );
281 m_view->clear(); 335 m_view->clear();
282 336
337 // Also invalidate the cache. We can't cancel the operations anyway
338 g_stringPix.clear();
339 g_stringInf.clear();
340
283 /* 341 /*
284 * add files and folders 342 * add files and folders
285 */ 343 */
286 addFolders( lister->folders() ); 344 addFolders( lister->folders() );
287 addFiles( lister->files() ); 345 addFiles( lister->files() );
288 m_view->viewport()->setUpdatesEnabled( true ); 346 m_view->viewport()->setUpdatesEnabled( true );
289 347
290 // Also invalidate the cache. We can't cancel the operations anyway
291 g_stringPix.clear();
292 g_stringInf.clear();
293
294 // looks ugly 348 // looks ugly
295 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); 349 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) );
296} 350}
297 351
298/** 352/**
299 * get the current file name 353 * get the current file name
300 * @param isDir see if this is a dir or real file 354 * @param isDir see if this is a dir or real file
301 */ 355 */
302QString PIconView::currentFileName(bool &isDir)const { 356QString PIconView::currentFileName(bool &isDir)const {
303 isDir = false; 357 isDir = false;
304 QIconViewItem* _it = m_view->currentItem(); 358 QIconViewItem* _it = m_view->currentItem();
305 if ( !_it ) 359 if ( !_it )
306 return QString::null; 360 return QString::null;
307 361
308 IconViewItem* it = static_cast<IconViewItem*>( _it ); 362 IconViewItem* it = static_cast<IconViewItem*>( _it );
309 isDir = it->isDir(); 363 isDir = it->isDir();
310 return it->path(); 364 return it->path();
311} 365}
312 366
313QString PIconView::nextFileName(bool &isDir)const 367QString PIconView::nextFileName(bool &isDir)const
314{ 368{
315 isDir = false; 369 isDir = false;
316 QIconViewItem* _it1 = m_view->currentItem(); 370 QIconViewItem* _it1 = m_view->currentItem();
317 if ( !_it1 ) 371 if ( !_it1 )
318 return QString::null; 372 return QString::null;
319 QIconViewItem* _it = _it1->nextItem(); 373 QIconViewItem* _it = _it1->nextItem();
320 if ( !_it ) 374 if ( !_it )
321 return QString::null; 375 return QString::null;
322 IconViewItem* it = static_cast<IconViewItem*>( _it ); 376 IconViewItem* it = static_cast<IconViewItem*>( _it );
323 isDir = it->isDir(); 377 isDir = it->isDir();
324 return it->path(); 378 return it->path();
325} 379}
326 380
327QString PIconView::prevFileName(bool &isDir)const{ 381QString PIconView::prevFileName(bool &isDir)const{
328 isDir = false; 382 isDir = false;
329 QIconViewItem* _it = m_view->currentItem(); 383 QIconViewItem* _it = m_view->currentItem();
330 if ( !_it ) 384 if ( !_it )
331 return QString::null; 385 return QString::null;
332 _it = _it->prevItem(); 386 _it = _it->prevItem();
333 if ( !_it ) 387 if ( !_it )
334 return QString::null; 388 return QString::null;
335 IconViewItem* it = static_cast<IconViewItem*>( _it ); 389 IconViewItem* it = static_cast<IconViewItem*>( _it );
336 isDir = it->isDir(); 390 isDir = it->isDir();
337 return it->path(); 391 return it->path();
338} 392}
339 393
340void PIconView::slotTrash() { 394void PIconView::slotTrash() {
341 bool isDir; 395 bool isDir;
342 QString pa = currentFileName( isDir ); 396 QString pa = currentFileName( isDir );
343 if ( isDir && pa.isEmpty() ) 397 if ( isDir && pa.isEmpty() )
344 return; 398 return;
345 399
346 if (!QPEMessageBox::confirmDelete( this, 400 if (!QPEMessageBox::confirmDelete( this,
347 tr("Delete Image" ), 401 tr("Delete Image" ),
348 tr("the Image %1" ).arg(pa))) 402 tr("the Image %1" ).arg(pa)))
349 return 403 return
350 404
351 405
352 currentView()->dirLister()->deleteImage( pa ); 406 currentView()->dirLister()->deleteImage( pa );
353 delete m_view->currentItem(); 407 delete m_view->currentItem();
354} 408}
355 409
356/* 410/*
357 * see what views are available 411 * see what views are available
358 */ 412 */
359void PIconView::loadViews() { 413void PIconView::loadViews() {
360 ViewMap::Iterator it; 414 ViewMap::Iterator it;
361 ViewMap* map = viewMap(); 415 ViewMap* map = viewMap();
362 for ( it = map->begin(); it != map->end(); ++it ) 416 for ( it = map->begin(); it != map->end(); ++it )
363 m_views->insertItem( it.key() ); 417 m_views->insertItem( it.key() );
364} 418}
365 419
366void PIconView::resetView() { 420void PIconView::resetView() {
367 m_internalReset = true; 421 m_internalReset = true;
422 // Also invalidate the cache. We can't cancel the operations anyway
423 g_stringPix.clear();
424 g_stringInf.clear();
425 if (m_mode>1) {
426 m_iconsize = m_cfg->readNumEntry("iconsize", 32);
427 if (m_iconsize<12)m_iconsize = 12;
428 if (m_iconsize>64)m_iconsize = 64;
429 } else {
430 m_iconsize = 64;
431 }
368 slotViewChanged(m_views->currentItem()); 432 slotViewChanged(m_views->currentItem());
369 m_internalReset = false; 433 m_internalReset = false;
370} 434}
371 435
372/* 436/*
373 *swicth view reloadDir and connect signals 437 *swicth view reloadDir and connect signals
374 */ 438 */
375void PIconView::slotViewChanged( int i) { 439void PIconView::slotViewChanged( int i) {
376 if (!m_views->count() ) { 440 if (!m_views->count() ) {
377 setCurrentView( 0l); 441 setCurrentView( 0l);
378 return; 442 return;
379 } 443 }
380 444
381 PDirView* cur = currentView(); 445 PDirView* cur = currentView();
382 if (cur) delete cur; 446 if (cur) delete cur;
383 QString str = m_views->text(i); 447 QString str = m_views->text(i);
384 ViewMap* map = viewMap(); 448 ViewMap* map = viewMap();
385 if (!map) { 449 if (!map) {
386 setCurrentView(0l); 450 setCurrentView(0l);
387 return; 451 return;
388 } 452 }
389 453
390 if (map->find(str) == map->end()) { 454 if (map->find(str) == map->end()) {
391 owarn << "Key not found" << oendl; 455 owarn << "Key not found" << oendl;
392 setCurrentView(0l); 456 setCurrentView(0l);
393 return; 457 return;
394 } 458 }
395 459
396 m_cfg->writeEntry("LastView",str); 460 m_cfg->writeEntry("LastView",str);
397 m_cfg->write(); 461 m_cfg->write();
398 cur = (*(*map)[str])(*m_cfg); 462 cur = (*(*map)[str])(*m_cfg);
399 setCurrentView( cur ); 463 setCurrentView( cur );
400 464
401 /* connect to the signals of the lister */ 465 /* connect to the signals of the lister */
402 PDirLister* lis = cur->dirLister(); 466 PDirLister* lis = cur->dirLister();
403 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), 467 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )),
404 this, SLOT( slotThumbInfo(const QString&, const QString&))); 468 this, SLOT( slotThumbInfo(const QString&, const QString&)));
405 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), 469 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
406 this, SLOT(slotThumbNail(const QString&, const QPixmap&))); 470 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
407 connect(lis, SIGNAL(sig_start()), 471 connect(lis, SIGNAL(sig_start()),
408 this, SLOT(slotStart())); 472 this, SLOT(slotStart()));
409 connect(lis, SIGNAL(sig_end()) , 473 connect(lis, SIGNAL(sig_end()) ,
410 this, SLOT(slotEnd()) ); 474 this, SLOT(slotEnd()) );
411 475
412 476
413 /* reload now with default Path 477 /* reload now with default Path
414 * but only if it isn't a reset like from setupdlg 478 * but only if it isn't a reset like from setupdlg
415 */ 479 */
416 if (!m_internalReset) 480 if (!m_internalReset) {
417 m_path = lis->defaultPath(); 481 m_path = lis->defaultPath();
482 }
418 QTimer::singleShot( 0, this, SLOT(slotReloadDir())); 483 QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
419} 484}
420 485
421 486
422void PIconView::slotReloadDir() { 487void PIconView::slotReloadDir() {
423 slotChangeDir( m_path ); 488 slotChangeDir( m_path );
424} 489}
425 490
426 491
427/* 492/*
428 * add files and folders 493 * add files and folders
429 */ 494 */
430void PIconView::addFolders( const QStringList& lst) { 495void PIconView::addFolders( const QStringList& lst) {
431 QStringList::ConstIterator it; 496 QStringList::ConstIterator it;
432 IconViewItem * _iv; 497 IconViewItem * _iv;
433 498
434 for(it=lst.begin(); it != lst.end(); ++it ) { 499 for(it=lst.begin(); it != lst.end(); ++it ) {
435 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); 500 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it),m_iconsize, true );
436 if (m_mode==3) _iv->setTextOnly(true); 501 if (m_mode==3) _iv->setTextOnly(true);
437 } 502 }
438} 503}
439 504
440void PIconView::addFiles( const QStringList& lst) { 505void PIconView::addFiles( const QStringList& lst) {
441 QStringList::ConstIterator it; 506 QStringList::ConstIterator it;
442 IconViewItem * _iv; 507 IconViewItem * _iv;
443 QPixmap*m_pix = 0; 508 QPixmap*m_pix = 0;
444 QString pre = ""; 509 QString pre = "";
445 if (!m_path.isEmpty()) { 510 if (!m_path.isEmpty()) {
446 pre = m_path+"/"; 511 pre = m_path+"/";
447 } 512 }
448 for (it=lst.begin(); it!= lst.end(); ++it ) { 513 for (it=lst.begin(); it!= lst.end(); ++it ) {
449 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 ); 514 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize );
450 _iv = new IconViewItem( m_view, pre+(*it), (*it) ); 515 _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize );
451 if (m_mode==3) { 516 if (m_mode==3) {
452 _iv->setTextOnly(true); 517 _iv->setTextOnly(true);
453 _iv->setPixmap(QPixmap()); 518 _iv->setPixmap(QPixmap());
454 519
455 520
456 521
457 } else { 522 } else {
458 if (m_pix) _iv->setPixmap(*m_pix); 523 if (m_pix) _iv->setPixmap(*m_pix);
459 } 524 }
460 } 525 }
461 526
462} 527}
463 528
464/* 529/*
465 * user clicked on the item. Change dir or view 530 * user clicked on the item. Change dir or view
466 */ 531 */
467void PIconView::slotClicked(QIconViewItem* _it) { 532void PIconView::slotClicked(QIconViewItem* _it) {
468 if(!_it ) 533 if(!_it )
469 return; 534 return;
470 535
471 IconViewItem* it = static_cast<IconViewItem*>(_it); 536 IconViewItem* it = static_cast<IconViewItem*>(_it);
472 if( it->isDir() ) 537 if( it->isDir() )
473 slotChangeDir( it->path() ); 538 slotChangeDir( it->path() );
474 else // view image 539 else // view image
475 slotShowImage(); 540 slotShowImage();
476} 541}
477 542
478/* 543/*
479 * Return was pressed. which is triggered by the keydown 544 * Return was pressed. which is triggered by the keydown
480 * handler. The problem is that the key up will be handled 545 * handler. The problem is that the key up will be handled
481 * by the ImageDisplayer and goes to the next image 546 * by the ImageDisplayer and goes to the next image
482 */ 547 */
483void PIconView::slotRetrun( QIconViewItem *_it ) { 548void PIconView::slotRetrun( QIconViewItem *_it ) {
484 if(!_it ) 549 if(!_it )
485 return; 550 return;
486 551
487 IconViewItem* it = static_cast<IconViewItem*>(_it); 552 IconViewItem* it = static_cast<IconViewItem*>(_it);
488 if( it->isDir() ) 553 if( it->isDir() )
489 slotChangeDir( it->path() ); 554 slotChangeDir( it->path() );
490 else 555 else
491 QTimer::singleShot(0, this, SLOT(slotShowImage()) ); 556 QTimer::singleShot(0, this, SLOT(slotShowImage()) );
492} 557}
493 558
494/* 559/*
495 * got thumb info add to the cache if items is visible 560 * got thumb info add to the cache if items is visible
496 * we later need update after processing of slave is done 561 * we later need update after processing of slave is done
497 */ 562 */
498void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 563void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
499 IconViewItem* item = g_stringInf[_path]; 564 IconViewItem* item = g_stringInf[_path];
500 if (!item ) 565 if (!item )
501 return; 566 return;
502 567
503 if (m_mode == 2) { 568 if (m_mode == 2) {
504 return; 569 return;
505 } 570 }
506 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 571 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
507 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 572 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
508 m_updatet = true; 573 m_updatet = true;
509 574
510 item->setText( str ); 575 item->setText( str );
511 g_stringInf.remove( _path ); 576 g_stringInf.remove( _path );
512} 577}
513 578
514/* 579/*
515 * got thumbnail and see if it is visible so we need to update later 580 * got thumbnail and see if it is visible so we need to update later
516 */ 581 */
517void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { 582void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
518 IconViewItem* item = g_stringPix[_path]; 583 IconViewItem* item = g_stringPix[_path];
519 if (!item ) 584 if (!item )
520 return; 585 return;
521 586
522 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 587 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
523 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 588 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
524 m_updatet = true; 589 m_updatet = true;
525 590
526 if (pix.width()>0) { 591 if (pix.width()>0) {
527 PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); 592 if (pix.width()<m_iconsize) {
528 item->setPixmap(pix,true); 593 QPixmap p(m_iconsize,m_iconsize);
594 p.fill();
595 QPainter pa(&p);
596 int offset = (m_iconsize-pix.width())/2;
597 int offy = (m_iconsize-pix.height())/2;
598 if (offy<0) offy=0;
599 pa.drawPixmap(offset,offy,pix);
600 pa.end();
601 PPixmapCache::self()->insertImage( _path, p, m_iconsize, m_iconsize );
602 item->setPixmap(p,true);
603 } else {
604 PPixmapCache::self()->insertImage( _path, pix, m_iconsize, m_iconsize );
605 item->setPixmap(pix,true);
606 }
607
529 } else { 608 } else {
530 PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 ); 609 PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), m_iconsize, m_iconsize );
531 } 610 }
532 g_stringPix.remove( _path ); 611 g_stringPix.remove( _path );
612 m_view->arrangeItemsInGrid(true);
533} 613}
534 614
535 615
536/* 616/*
537 * FIXME rename 617 * FIXME rename
538 */ 618 */
539void PIconView::slotRename() { 619void PIconView::slotRename() {
540 620
541} 621}
542 622
543 623
544/* 624/*
545 * BEAM the current file 625 * BEAM the current file
546 */ 626 */
547void PIconView::slotBeam() { 627void PIconView::slotBeam() {
548 bool isDir; 628 bool isDir;
549 QString pa = currentFileName( isDir ); 629 QString pa = currentFileName( isDir );
550 if ( isDir && pa.isEmpty() ) 630 if ( isDir && pa.isEmpty() )
551 return; 631 return;
552 632
553 Ir* ir = new Ir( this ); 633 Ir* ir = new Ir( this );
554 connect( ir, SIGNAL(done(Ir*)), 634 connect( ir, SIGNAL(done(Ir*)),
555 this, SLOT(slotBeamDone(Ir*))); 635 this, SLOT(slotBeamDone(Ir*)));
556 ir->send(pa, tr( "Image" ) ); 636 ir->send(pa, tr( "Image" ) );
557} 637}
558 638
559/* 639/*
560 * BEAM done clean up 640 * BEAM done clean up
561 */ 641 */
562void PIconView::slotBeamDone( Ir* ir) { 642void PIconView::slotBeamDone( Ir* ir) {
563 delete ir; 643 delete ir;
564} 644}
565 645
566void PIconView::slotStart() { 646void PIconView::slotStart() {
567 m_view->viewport()->setUpdatesEnabled( false ); 647 m_view->viewport()->setUpdatesEnabled( false );
568} 648}
569 649
570void PIconView::slotEnd() { 650void PIconView::slotEnd() {
571 if ( m_updatet ) 651 if ( m_updatet )
572 m_view->arrangeItemsInGrid( ); 652 m_view->arrangeItemsInGrid( );
573 m_view->viewport()->setUpdatesEnabled( true ); 653 m_view->viewport()->setUpdatesEnabled( true );
574 m_updatet = false; 654 m_updatet = false;
575} 655}
576 656
577void PIconView::slotShowLast() 657void PIconView::slotShowLast()
578{ 658{
579 QIconViewItem* last_it = m_view->lastItem(); 659 QIconViewItem* last_it = m_view->lastItem();
580 if (!last_it) return; 660 if (!last_it) return;
581 m_view->setCurrentItem(last_it); 661 m_view->setCurrentItem(last_it);
582 IconViewItem* it = static_cast<IconViewItem*>( last_it ); 662 IconViewItem* it = static_cast<IconViewItem*>( last_it );
583 bool isDir = it->isDir(); 663 bool isDir = it->isDir();
584 QString name = it->path(); 664 QString name = it->path();
585 if (!isDir && !name.isEmpty()) { 665 if (!isDir && !name.isEmpty()) {
586 slotShowImage(name); 666 slotShowImage(name);
587 return; 667 return;
588 } 668 }
589 bool first_loop = true; 669 bool first_loop = true;
590 while(isDir==true) { 670 while(isDir==true) {
591 if (!first_loop) { 671 if (!first_loop) {
592 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 672 m_view->setCurrentItem(m_view->currentItem()->prevItem());
593 } else { 673 } else {
594 first_loop = false; 674 first_loop = false;
595 } 675 }
596 name = prevFileName(isDir); 676 name = prevFileName(isDir);
597 } 677 }
598 678
599 if (name.isEmpty()) return; 679 if (name.isEmpty()) return;
600 /* if we got a name we have a prev item */ 680 /* if we got a name we have a prev item */
601 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 681 m_view->setCurrentItem(m_view->currentItem()->prevItem());
602 slotShowImage(name); 682 slotShowImage(name);
603} 683}
604 684
605bool PIconView::slotShowFirst() 685bool PIconView::slotShowFirst()
606{ 686{
607 /* stop when reached - otherwise we may get an endless loop */ 687 /* stop when reached - otherwise we may get an endless loop */
608 QIconViewItem* first_it = m_view->firstItem(); 688 QIconViewItem* first_it = m_view->firstItem();
609 if (!first_it) return false; 689 if (!first_it) return false;
610 m_view->setCurrentItem(first_it); 690 m_view->setCurrentItem(first_it);
611 IconViewItem* it = static_cast<IconViewItem*>( first_it ); 691 IconViewItem* it = static_cast<IconViewItem*>( first_it );
612 bool isDir = it->isDir(); 692 bool isDir = it->isDir();
613 QString name = it->path(); 693 QString name = it->path();
614 if (!isDir && !name.isEmpty()) { 694 if (!isDir && !name.isEmpty()) {
615 slotShowImage(name); 695 slotShowImage(name);
616 return false; 696 return false;
617 } 697 }
618 bool first_loop = true; 698 bool first_loop = true;
619 while(isDir==true) { 699 while(isDir==true) {
620 /* if name is empty isDir is false, too. */ 700 /* if name is empty isDir is false, too. */
621 if (!first_loop) { 701 if (!first_loop) {
622 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 702 m_view->setCurrentItem(m_view->currentItem()->nextItem());
623 } else { 703 } else {
624 first_loop = false; 704 first_loop = false;
625 } 705 }
626 name = nextFileName(isDir); 706 name = nextFileName(isDir);
627 } 707 }
628 if (name.isEmpty()) return false; 708 if (name.isEmpty()) return false;
629 /* if we got a name we have a next item */ 709 /* if we got a name we have a next item */
630 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 710 m_view->setCurrentItem(m_view->currentItem()->nextItem());
631 slotShowImage(name); 711 slotShowImage(name);
632 return true; 712 return true;
633} 713}
634 714
635void PIconView::slotShowNext() 715void PIconView::slotShowNext()
636{ 716{
637 bool isDir = false; 717 bool isDir = false;
638 QString name = nextFileName(isDir); 718 QString name = nextFileName(isDir);
639 while (isDir==true) { 719 while (isDir==true) {
640 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 720 m_view->setCurrentItem(m_view->currentItem()->nextItem());
641 name = nextFileName(isDir); 721 name = nextFileName(isDir);
642 } 722 }
643 if (name.isEmpty()) { 723 if (name.isEmpty()) {
644 slotShowFirst(); 724 slotShowFirst();
645 return; 725 return;
646 } 726 }
647 if (isDir) return; 727 if (isDir) return;
648 /* if we got a name we have a next item */ 728 /* if we got a name we have a next item */
649 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 729 m_view->setCurrentItem(m_view->currentItem()->nextItem());
650 slotShowImage(name); 730 slotShowImage(name);
651} 731}
652 732
653void PIconView::slotShowPrev() 733void PIconView::slotShowPrev()
654{ 734{
655 bool isDir = false; 735 bool isDir = false;
656 QString name = prevFileName(isDir); 736 QString name = prevFileName(isDir);
657 while (isDir==true) { 737 while (isDir==true) {
658 /* if name is empty isDir is false, too. */ 738 /* if name is empty isDir is false, too. */
659 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 739 m_view->setCurrentItem(m_view->currentItem()->prevItem());
660 name = prevFileName(isDir); 740 name = prevFileName(isDir);
661 } 741 }
662 if (name.isEmpty()) { 742 if (name.isEmpty()) {
663 slotShowLast(); 743 slotShowLast();
664 return; 744 return;
665 } 745 }
666 if (isDir) return; 746 if (isDir) return;
667 /* if we got a name we have a prev item */ 747 /* if we got a name we have a prev item */
668 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 748 m_view->setCurrentItem(m_view->currentItem()->prevItem());
669 slotShowImage(name); 749 slotShowImage(name);
670} 750}
671 751
672void PIconView::slotShowImage() 752void PIconView::slotShowImage()
673{ 753{
674 bool isDir = false; 754 bool isDir = false;
675 QString name = currentFileName(isDir); 755 QString name = currentFileName(isDir);
676 if (isDir) return; 756 if (isDir) return;
677 slotShowImage( name ); 757 slotShowImage( name );
678} 758}
679void PIconView::slotShowImage( const QString& name) { 759void PIconView::slotShowImage( const QString& name) {
680 PDirLister *lister = currentView()->dirLister(); 760 PDirLister *lister = currentView()->dirLister();
681 QString r_name = lister->nameToFname(name); 761 QString r_name = lister->nameToFname(name);
682 emit sig_display(r_name); 762 emit sig_display(r_name);
683} 763}
684 764
685void PIconView::slotStartSlide() { 765void PIconView::slotStartSlide() {
686 bool isDir = false; 766 bool isDir = false;
687 QString name = currentFileName(isDir); 767 QString name = currentFileName(isDir);
688 if (isDir) { 768 if (isDir) {
689 if (!slotShowFirst()) 769 if (!slotShowFirst())
690 return; 770 return;
691 } else { 771 } else {
692 slotShowImage( name ); 772 slotShowImage( name );
693 } 773 }
694 int t = m_cfg->readNumEntry("base_slideshowtimeout", 2); 774 int t = m_cfg->readNumEntry("slideshowtimeout", 2);
695 emit sig_startslide(t); 775 emit sig_startslide(t);
696} 776}
697 777
698void PIconView::slotImageInfo() { 778void PIconView::slotImageInfo() {
699 bool isDir = false; 779 bool isDir = false;
700 QString name = currentFileName(isDir); 780 QString name = currentFileName(isDir);
701 if (isDir) return; 781 if (isDir) return;
702 slotImageInfo( name ); 782 slotImageInfo( name );
703} 783}
704 784
705void PIconView::slotImageInfo( const QString& name) { 785void PIconView::slotImageInfo( const QString& name) {
706 PDirLister *lister = currentView()->dirLister(); 786 PDirLister *lister = currentView()->dirLister();
707 QString r_name = lister->nameToFname(name); 787 QString r_name = lister->nameToFname(name);
708 emit sig_showInfo(r_name ); 788 emit sig_showInfo(r_name );
709} 789}
710 790
711 791
712void PIconView::slotChangeMode( int mode ) { 792void PIconView::slotChangeMode( int mode ) {
713 if ( mode >= 1 && mode <= 3 ) 793 if ( mode >= 1 && mode <= 3 ) {
714 m_mode = mode; 794 m_mode = mode;
795 m_cfg->writeEntry("ListViewMode", m_mode);
796 /* performance! */
797 m_view->clear();
798 if (m_mode >1) {
799 m_view->setResizeMode(QIconView::Adjust);
800 } else {
801 m_view->setResizeMode(QIconView::Fixed);
802 }
803 if (m_mode==1) {
804 m_iconsize = 64;
805 } else {
806 m_iconsize = m_cfg->readNumEntry("iconsize", 32);
807 if (m_iconsize<12)m_iconsize = 12;
808 if (m_iconsize>64)m_iconsize = 64;
809 }
715 810
716 m_cfg->writeEntry("ListViewMode", m_mode); 811 calculateGrid();
717 /* performance! */ 812 slotReloadDir();
718 m_view->clear(); 813 }
719 calculateGrid();
720 slotReloadDir();
721} 814}
722 815
723 816
724void PIconView::resizeEvent( QResizeEvent* re ) { 817void PIconView::resizeEvent( QResizeEvent* re ) {
818 calculateGrid(re);
725 QVBox::resizeEvent( re ); 819 QVBox::resizeEvent( re );
726 calculateGrid(); 820 //calculateGrid();
727} 821}
728 822
729 823
730void PIconView::calculateGrid() { 824void PIconView::calculateGrid(QResizeEvent* re)
731 int dw = QApplication::desktop()->width(); 825{
732 int viewerWidth = dw-style().scrollBarExtent().width(); 826 int viewerWidth;
827 if (re) {
828 viewerWidth=re->size().width();
829 } else {
830 int dw = QApplication::desktop()->width();
831 viewerWidth = dw-style().scrollBarExtent().width();
832 }
733 833
734 QIconView::ItemTextPos pos; 834 QIconView::ItemTextPos pos;
735 switch( m_mode ) { 835 switch( m_mode ) {
736 case 2: 836 case 2:
737 pos = QIconView::Bottom; 837 pos = QIconView::Bottom;
738 break; 838 break;
739 case 3: 839 case 3:
740 case 1: 840 case 1:
741 default: 841 default:
742 pos = QIconView::Right; 842 pos = QIconView::Right;
743 break; 843 break;
744 } 844 }
745 m_view->setItemTextPos( pos ); 845 m_view->setItemTextPos( pos );
746 switch (m_mode) { 846 switch (m_mode) {
747 case 2: 847 case 2:
748 m_view->setGridX(50); 848 m_view->setGridX(m_iconsize);
749 m_view->setGridY(20); 849 m_view->setGridY(-1);
750 PPixmapCache::self()->setMaxImages(40); 850 PPixmapCache::self()->setMaxImages(40);
751 break; 851 break;
752 case 3: 852 case 3:
753 m_view->setGridX( fontMetrics().width("testimage.jpg")+20); 853 m_view->setGridX( fontMetrics().width("testimage.jpg")+20);
754 m_view->setGridY(8); 854 m_view->setGridY(8);
755 PPixmapCache::self()->setMaxImages(2); 855 PPixmapCache::self()->setMaxImages(2);
756 break; 856 break;
757 case 1: 857 case 1:
758 default: 858 default:
759 m_view->setGridX( viewerWidth-3*m_view->spacing()); 859 m_view->setGridX( viewerWidth-3*m_view->spacing());
760 m_view->setGridY( fontMetrics().height()*2+40 ); 860 m_view->setGridY( fontMetrics().height()*2+40 );
761 PPixmapCache::self()->setMaxImages(20); 861 PPixmapCache::self()->setMaxImages(20);
762 break; 862 break;
763 } 863 }
864 m_view->setSpacing(10);
764} 865}
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index bea35c2..b018c51 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -1,101 +1,102 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#ifndef PHUNK_ICON_VIEW_H 6#ifndef PHUNK_ICON_VIEW_H
7#define PHUNK_ICON_VIEW_H 7#define PHUNK_ICON_VIEW_H
8 8
9#include <qvbox.h> 9#include <qvbox.h>
10 10
11 11
12class QIconView; 12class QIconView;
13class QIconViewItem; 13class QIconViewItem;
14class QComboBox; 14class QComboBox;
15class PIconViewItem; 15class PIconViewItem;
16class PDirLister; 16class PDirLister;
17class Ir; 17class Ir;
18 18
19namespace Opie { 19namespace Opie {
20namespace Core{ 20namespace Core{
21 class OConfig; 21 class OConfig;
22 class OKeyConfigManager; 22 class OKeyConfigManager;
23} 23}
24} 24}
25 25
26class PIconView : public QVBox { 26class PIconView : public QVBox {
27 Q_OBJECT 27 Q_OBJECT
28 friend class PIconViewItem; 28 friend class PIconViewItem;
29 enum ActionIds { 29 enum ActionIds {
30 BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem 30 BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem
31 }; 31 };
32public: 32public:
33 PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); 33 PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
34 ~PIconView(); 34 ~PIconView();
35 void resetView(); 35 void resetView();
36 Opie::Core::OKeyConfigManager* manager(); 36 Opie::Core::OKeyConfigManager* manager();
37 37
38signals: 38signals:
39 void sig_showInfo( const QString& ); 39 void sig_showInfo( const QString& );
40 void sig_display(const QString&); 40 void sig_display(const QString&);
41 void sig_startslide(int timeout); 41 void sig_startslide(int timeout);
42 42
43public slots: 43public slots:
44 virtual void slotShowNext(); 44 virtual void slotShowNext();
45 virtual void slotShowPrev(); 45 virtual void slotShowPrev();
46 virtual void slotShowLast(); 46 virtual void slotShowLast();
47 virtual bool slotShowFirst(); 47 virtual bool slotShowFirst();
48 48
49protected: 49protected:
50 void resizeEvent( QResizeEvent* ); 50 void resizeEvent( QResizeEvent* );
51 51
52private: 52private:
53 void initKeys(); 53 void initKeys();
54 QString currentFileName(bool &isDir)const; 54 QString currentFileName(bool &isDir)const;
55 QString nextFileName(bool &isDir)const; 55 QString nextFileName(bool &isDir)const;
56 QString prevFileName(bool &isDir)const; 56 QString prevFileName(bool &isDir)const;
57 void loadViews(); 57 void loadViews();
58 void calculateGrid(); 58 void calculateGrid(QResizeEvent*e = 0);
59 59
60private slots: 60private slots:
61 void slotDirUp(); 61 void slotDirUp();
62 void slotChangeDir(const QString&); 62 void slotChangeDir(const QString&);
63 void slotTrash(); 63 void slotTrash();
64 void slotViewChanged( int ); 64 void slotViewChanged( int );
65 void slotReloadDir(); 65 void slotReloadDir();
66 void slotRename(); 66 void slotRename();
67 void slotBeam(); 67 void slotBeam();
68 void slotBeamDone( Ir* ); 68 void slotBeamDone( Ir* );
69 69
70 void slotShowImage(); 70 void slotShowImage();
71 void slotShowImage( const QString& ); 71 void slotShowImage( const QString& );
72 void slotImageInfo(); 72 void slotImageInfo();
73 void slotImageInfo( const QString& ); 73 void slotImageInfo( const QString& );
74 void slotStartSlide(); 74 void slotStartSlide();
75 75
76 void slotStart(); 76 void slotStart();
77 void slotEnd(); 77 void slotEnd();
78 78
79/* for performance reasons make it inline in the future */ 79/* for performance reasons make it inline in the future */
80 void addFolders( const QStringList& ); 80 void addFolders( const QStringList& );
81 void addFiles( const QStringList& ); 81 void addFiles( const QStringList& );
82 void slotClicked(QIconViewItem* ); 82 void slotClicked(QIconViewItem* );
83 void slotRetrun(QIconViewItem* ); 83 void slotRetrun(QIconViewItem* );
84 84
85/**/ 85/**/
86 void slotThumbInfo(const QString&, const QString&); 86 void slotThumbInfo(const QString&, const QString&);
87 void slotThumbNail(const QString&, const QPixmap&); 87 void slotThumbNail(const QString&, const QPixmap&);
88 88
89 void slotChangeMode( int ); 89 void slotChangeMode( int );
90private: 90private:
91 Opie::Core::OKeyConfigManager *m_viewManager; 91 Opie::Core::OKeyConfigManager *m_viewManager;
92 Opie::Core::OConfig *m_cfg; 92 Opie::Core::OConfig *m_cfg;
93 QComboBox* m_views; 93 QComboBox* m_views;
94 QIconView* m_view; 94 QIconView* m_view;
95 QString m_path; 95 QString m_path;
96 bool m_updatet : 1; 96 bool m_updatet : 1;
97 int m_mode; 97 int m_mode;
98 bool m_internalReset:1; 98 bool m_internalReset:1;
99 int m_iconsize;
99}; 100};
100 101
101#endif 102#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 30c9bf1..67eb277 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,696 +1,696 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5#include "mainwindow.h" 5#include "mainwindow.h"
6#include "imageview.h" 6#include "imageview.h"
7 7
8#include "iconview.h" 8#include "iconview.h"
9#include "filesystem.h" 9#include "filesystem.h"
10#include "imageinfoui.h" 10#include "imageinfoui.h"
11#include "viewmodebutton.h" 11#include "viewmodebutton.h"
12#include "basesetup.h" 12#include "basesetup.h"
13 13
14#include <iface/ifaceinfo.h> 14#include <iface/ifaceinfo.h>
15#include <iface/dirview.h> 15#include <iface/dirview.h>
16 16
17#include <opie2/odebug.h> 17#include <opie2/odebug.h>
18#include <opie2/owidgetstack.h> 18#include <opie2/owidgetstack.h>
19#include <opie2/oapplicationfactory.h> 19#include <opie2/oapplicationfactory.h>
20#include <opie2/otabwidget.h> 20#include <opie2/otabwidget.h>
21#include <opie2/okeyconfigwidget.h> 21#include <opie2/okeyconfigwidget.h>
22 22
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qpe/ir.h> 25#include <qpe/ir.h>
26#include <qpe/storage.h> 26#include <qpe/storage.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28 28
29#include <qtoolbar.h> 29#include <qtoolbar.h>
30#include <qtoolbutton.h> 30#include <qtoolbutton.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qmap.h> 33#include <qmap.h>
34#include <qtimer.h> 34#include <qtimer.h>
35#include <qframe.h> 35#include <qframe.h>
36#include <qmenubar.h> 36#include <qmenubar.h>
37#include <qaction.h> 37#include <qaction.h>
38 38
39//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 39//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
41 41
42PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 42PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
43 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 43 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
44{ 44{
45 setCaption( QObject::tr("Opie Eye Caramba" ) ); 45 setCaption( QObject::tr("Opie Eye Caramba" ) );
46 m_cfg = new Opie::Core::OConfig("opie-eye"); 46 m_cfg = new Opie::Core::OConfig("opie-eye");
47 m_cfg->setGroup("main" ); 47 m_cfg->setGroup("main" );
48 readConfig(); 48 readConfig();
49 49
50 m_storage = new StorageInfo(); 50 m_storage = new StorageInfo();
51 connect(m_storage, SIGNAL(disksChanged() ), 51 connect(m_storage, SIGNAL(disksChanged() ),
52 this, SLOT( dirChanged() ) ); 52 this, SLOT( dirChanged() ) );
53 53
54 m_stack = new Opie::Ui::OWidgetStack( this ); 54 m_stack = new Opie::Ui::OWidgetStack( this );
55 setCentralWidget( m_stack ); 55 setCentralWidget( m_stack );
56 56
57 m_view = new PIconView( m_stack, m_cfg ); 57 m_view = new PIconView( m_stack, m_cfg );
58 m_stack->addWidget( m_view, IconView ); 58 m_stack->addWidget( m_view, IconView );
59 m_stack->raiseWidget( IconView ); 59 m_stack->raiseWidget( IconView );
60 60
61 connect(m_view, SIGNAL(sig_display(const QString&)), 61 connect(m_view, SIGNAL(sig_display(const QString&)),
62 this, SLOT(slotDisplay(const QString&))); 62 this, SLOT(slotDisplay(const QString&)));
63 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 63 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
64 this, SLOT(slotShowInfo(const QString&)) ); 64 this, SLOT(slotShowInfo(const QString&)) );
65 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); 65 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
66 66
67 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 67 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
68 68
69 listviewMenu = 0; 69 listviewMenu = 0;
70 /* setup menu and toolbar */ 70 /* setup menu and toolbar */
71 setupActions(); 71 setupActions();
72 setupToolbar(); 72 setupToolbar();
73 setupMenu(); 73 setupMenu();
74 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); 74 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
75 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); 75 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
76} 76}
77 77
78PMainWindow::~PMainWindow() { 78PMainWindow::~PMainWindow() {
79} 79}
80 80
81void PMainWindow::slotToggleZoomer() 81void PMainWindow::slotToggleZoomer()
82{ 82{
83 m_aZoomer->setOn(!m_aZoomer->isOn()); 83 m_aZoomer->setOn(!m_aZoomer->isOn());
84} 84}
85 85
86void PMainWindow::slotZoomerToggled(bool how) 86void PMainWindow::slotZoomerToggled(bool how)
87{ 87{
88 if (m_disp) { 88 if (m_disp) {
89 m_disp->setShowZoomer(how); 89 m_disp->setShowZoomer(how);
90 } 90 }
91 if (autoSave) { 91 if (autoSave) {
92 m_cfg->writeEntry("zoomeron",how); 92 m_cfg->writeEntry("zoomeron",how);
93 } 93 }
94} 94}
95 95
96void PMainWindow::slotToggleAutorotate() 96void PMainWindow::slotToggleAutorotate()
97{ 97{
98 if (!m_aAutoRotate->isEnabled()) return; 98 if (!m_aAutoRotate->isEnabled()) return;
99 m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); 99 m_aAutoRotate->setOn(!m_aAutoRotate->isOn());
100} 100}
101 101
102void PMainWindow::slotToggleAutoscale() 102void PMainWindow::slotToggleAutoscale()
103{ 103{
104 m_aUnscaled->setOn(!m_aUnscaled->isOn()); 104 m_aUnscaled->setOn(!m_aUnscaled->isOn());
105} 105}
106 106
107void PMainWindow::slotRotateToggled(bool how) 107void PMainWindow::slotRotateToggled(bool how)
108{ 108{
109 if (autoSave) { 109 if (autoSave) {
110 m_cfg->writeEntry("autorotate",how); 110 m_cfg->writeEntry("autorotate",how);
111 } 111 }
112 if (m_disp) { 112 if (m_disp) {
113 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); 113 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how);
114 } 114 }
115} 115}
116 116
117void PMainWindow::slotScaleToggled(bool how) 117void PMainWindow::slotScaleToggled(bool how)
118{ 118{
119 if (autoSave) { 119 if (autoSave) {
120 m_cfg->writeEntry("unscaled",how); 120 m_cfg->writeEntry("unscaled",how);
121 } 121 }
122 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; 122 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl;
123 odebug << "How: " << how << oendl; 123 odebug << "How: " << how << oendl;
124 if (how) { 124 if (how) {
125 m_aAutoRotate->setOn(false); 125 m_aAutoRotate->setOn(false);
126 } 126 }
127 if (m_disp) { 127 if (m_disp) {
128 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); 128 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn());
129 } 129 }
130 m_aAutoRotate->setEnabled(!how); 130 m_aAutoRotate->setEnabled(!how);
131 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; 131 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl;
132} 132}
133 133
134void PMainWindow::slotConfig() { 134void PMainWindow::slotConfig() {
135 /* 135 /*
136 * have a tab with the possible views 136 * have a tab with the possible views
137 * a tab for globals image cache size.. scaled loading 137 * a tab for globals image cache size.. scaled loading
138 * and one tab for the KeyConfigs 138 * and one tab for the KeyConfigs
139 */ 139 */
140 QDialog dlg(this, 0, true); 140 QDialog dlg(this, 0, true);
141 dlg.setCaption( tr("Opie Eye - Config" ) ); 141 dlg.setCaption( tr("Opie Eye - Config" ) );
142 142
143 QHBoxLayout *lay = new QHBoxLayout(&dlg); 143 QHBoxLayout *lay = new QHBoxLayout(&dlg);
144 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 144 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
145 lay->addWidget( wid ); 145 lay->addWidget( wid );
146 146
147 BaseSetup*bSetup = new BaseSetup(m_cfg,wid); 147 BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
148 wid->addTab(bSetup,"SettingsIcon","Basics setup"); 148 wid->addTab(bSetup,"SettingsIcon","Basics setup");
149 149
150 ViewMap *vM = viewMap(); 150 ViewMap *vM = viewMap();
151 ViewMap::Iterator _it = vM->begin(); 151 ViewMap::Iterator _it = vM->begin();
152 QMap<PDirView*, QWidget*> lst; 152 QMap<PDirView*, QWidget*> lst;
153 153
154 for( ; _it != vM->end(); ++_it ) { 154 for( ; _it != vM->end(); ++_it ) {
155 PDirView *view = (_it.data())(*m_cfg); 155 PDirView *view = (_it.data())(*m_cfg);
156 PInterfaceInfo *inf = view->interfaceInfo(); 156 PInterfaceInfo *inf = view->interfaceInfo();
157 QWidget *_wid = inf->configWidget( *m_cfg ); 157 QWidget *_wid = inf->configWidget( *m_cfg );
158 if (!_wid) continue; 158 if (!_wid) continue;
159 _wid->reparent(wid, QPoint() ); 159 _wid->reparent(wid, QPoint() );
160 lst.insert( view, _wid ); 160 lst.insert( view, _wid );
161 wid->addTab( _wid, "fileopen", inf->name() ); 161 wid->addTab( _wid, "fileopen", inf->name() );
162 } 162 }
163 163
164/* 164/*
165 * Add the KeyConfigWidget 165 * Add the KeyConfigWidget
166 */ 166 */
167 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 167 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
168 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 168 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
169 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 169 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
170 QWidget*w = m_stack->visibleWidget(); 170 QWidget*w = m_stack->visibleWidget();
171 171
172 bool reminfo = false; 172 bool reminfo = false;
173 if ( !m_info ) { 173 if ( !m_info ) {
174 reminfo = true; 174 reminfo = true;
175 initInfo(); 175 initInfo();
176 m_info->hide(); 176 m_info->hide();
177 } 177 }
178 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 178 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
179 179
180 bool remdisp = false; 180 bool remdisp = false;
181 if ( !m_disp ) { 181 if ( !m_disp ) {
182 remdisp = true; 182 remdisp = true;
183 initDisp(); 183 initDisp();
184 m_disp->hide(); 184 m_disp->hide();
185 } 185 }
186 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 186 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
187 187
188 keyWid->load(); 188 keyWid->load();
189 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 189 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
190 wid->setCurrentTab(0); 190 wid->setCurrentTab(0);
191 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 191 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
192 192
193/* 193/*
194 * clean up 194 * clean up
195 *apply changes 195 *apply changes
196 */ 196 */
197 197
198 QMap<PDirView*, QWidget*>::Iterator it; 198 QMap<PDirView*, QWidget*>::Iterator it;
199 for ( it = lst.begin(); it != lst.end(); ++it ) { 199 for ( it = lst.begin(); it != lst.end(); ++it ) {
200 if ( act ) 200 if ( act )
201 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 201 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
202 delete it.key(); 202 delete it.key();
203 } 203 }
204 204
205 205
206 if ( act ) { 206 if ( act ) {
207 m_view->resetView();
208 keyWid->save(); 207 keyWid->save();
209 m_disp->manager()->save(); 208 m_disp->manager()->save();
210 m_info->manager()->save(); 209 m_info->manager()->save();
211 m_view->manager()->save(); 210 m_view->manager()->save();
212 bSetup->save_values(); 211 bSetup->save_values();
212 m_view->resetView();
213 readConfig(); 213 readConfig();
214 } 214 }
215 delete keyWid; 215 delete keyWid;
216 216
217 m_stack->raiseWidget(w); 217 m_stack->raiseWidget(w);
218 if (remdisp) { 218 if (remdisp) {
219 m_disp->hide(); 219 m_disp->hide();
220 } 220 }
221 if (reminfo) { 221 if (reminfo) {
222 m_info->hide(); 222 m_info->hide();
223 } 223 }
224} 224}
225 225
226/* 226/*
227 * create a new image info component 227 * create a new image info component
228 * and detach the current one 228 * and detach the current one
229 * we will make the other delete on exit 229 * we will make the other delete on exit
230 */ 230 */
231template<class T> 231template<class T>
232void PMainWindow::initT( const char* name, T** ptr, int id) { 232void PMainWindow::initT( const char* name, T** ptr, int id) {
233 if ( *ptr ) { 233 if ( *ptr ) {
234 (*ptr)->disconnect(this, SLOT(slotReturn())); 234 (*ptr)->disconnect(this, SLOT(slotReturn()));
235 (*ptr)->setDestructiveClose(); 235 (*ptr)->setDestructiveClose();
236 m_stack->removeWidget( *ptr ); 236 m_stack->removeWidget( *ptr );
237 } 237 }
238 *ptr = new T(m_cfg, m_stack, name ); 238 *ptr = new T(m_cfg, m_stack, name );
239 m_stack->addWidget( *ptr, id ); 239 m_stack->addWidget( *ptr, id );
240 240
241 connect(*ptr, SIGNAL(sig_return()), 241 connect(*ptr, SIGNAL(sig_return()),
242 this,SLOT(slotReturn())); 242 this,SLOT(slotReturn()));
243 243
244} 244}
245 245
246void PMainWindow::initInfo() { 246void PMainWindow::initInfo() {
247 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 247 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
248 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 248 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
249} 249}
250 250
251void PMainWindow::initDisp() { 251void PMainWindow::initDisp() {
252 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 252 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
253 if (m_disp) { 253 if (m_disp) {
254 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 254 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
255 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 255 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
256 } 256 }
257 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); 257 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType);
258 m_disp->setAutoScale(!m_aUnscaled->isOn()); 258 m_disp->setAutoScale(!m_aUnscaled->isOn());
259 m_disp->setAutoRotate(m_aAutoRotate->isOn()); 259 m_disp->setAutoRotate(m_aAutoRotate->isOn());
260 m_disp->setShowZoomer(m_aZoomer->isOn()); 260 m_disp->setShowZoomer(m_aZoomer->isOn());
261 m_disp->setBackgroundColor(white); 261 m_disp->setBackgroundColor(white);
262 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 262 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
263 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 263 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
264 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 264 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
265 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 265 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
266 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 266 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
267 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 267 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
268 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 268 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
269 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 269 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
270 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); 270 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int)));
271 slotFullScreenToggled(m_aFullScreen->isOn()); 271 slotFullScreenToggled(m_aFullScreen->isOn());
272 } 272 }
273} 273}
274 274
275void PMainWindow::slotToggleFullScreen() 275void PMainWindow::slotToggleFullScreen()
276{ 276{
277 bool current = !m_aFullScreen->isOn(); 277 bool current = !m_aFullScreen->isOn();
278 m_aFullScreen->setOn(current); 278 m_aFullScreen->setOn(current);
279} 279}
280 280
281void PMainWindow::slotFullScreenButton(bool current) 281void PMainWindow::slotFullScreenButton(bool current)
282{ 282{
283 if (autoSave) { 283 if (autoSave) {
284 m_cfg->writeEntry("fullscreen",current); 284 m_cfg->writeEntry("fullscreen",current);
285 } 285 }
286 if (!m_disp) return; 286 if (!m_disp) return;
287 if (m_disp->isVisible()) { 287 if (m_disp->isVisible()) {
288 setupViewWindow(current, true); 288 setupViewWindow(current, true);
289 } 289 }
290} 290}
291 291
292void PMainWindow::setupViewWindow(bool current, bool forceDisplay) 292void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
293{ 293{
294 if (!m_disp) return; 294 if (!m_disp) return;
295 if (current) { 295 if (current) {
296 m_disp->setBackgroundColor(black); 296 m_disp->setBackgroundColor(black);
297 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 297 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
298 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 298 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
299 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 299 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
300 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 300 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
301 } else { 301 } else {
302 setUpdatesEnabled(false); 302 setUpdatesEnabled(false);
303 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 303 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
304 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 304 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
305 } else { 305 } else {
306 m_disp->setMinimumSize(10,10); 306 m_disp->setMinimumSize(10,10);
307 } 307 }
308 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 308 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
309 m_disp->reparent(0,QPoint(50,50)); 309 m_disp->reparent(0,QPoint(50,50));
310 } else { 310 } else {
311 m_disp->reparent(0,QPoint(0,0)); 311 m_disp->reparent(0,QPoint(0,0));
312 } 312 }
313 m_disp->setBackgroundColor(white); 313 m_disp->setBackgroundColor(white);
314 m_stack->addWidget(m_disp,ImageDisplay); 314 m_stack->addWidget(m_disp,ImageDisplay);
315 m_disp->setVScrollBarMode(QScrollView::Auto); 315 m_disp->setVScrollBarMode(QScrollView::Auto);
316 m_disp->setHScrollBarMode(QScrollView::Auto); 316 m_disp->setHScrollBarMode(QScrollView::Auto);
317 if (forceDisplay || m_disp->isVisible()) 317 if (forceDisplay || m_disp->isVisible())
318 m_stack->raiseWidget(m_disp); 318 m_stack->raiseWidget(m_disp);
319 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 319 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
320 m_disp->resize(m_disp->minimumSize()); 320 m_disp->resize(m_disp->minimumSize());
321 } 321 }
322 setUpdatesEnabled(true); 322 setUpdatesEnabled(true);
323 } 323 }
324 m_disp->setFullScreen(current,forceDisplay); 324 m_disp->setFullScreen(current,forceDisplay);
325} 325}
326 326
327void PMainWindow::slotFullScreenToggled(bool current) 327void PMainWindow::slotFullScreenToggled(bool current)
328{ 328{
329 setupViewWindow(current,true); 329 setupViewWindow(current,true);
330} 330}
331 331
332/** 332/**
333 * With big Screen the plan could be to 'detach' the image 333 * With big Screen the plan could be to 'detach' the image
334 * window if visible and to create a ne wone 334 * window if visible and to create a ne wone
335 * init* already supports it but I make no use of it for 335 * init* already supports it but I make no use of it for
336 * now. We set filename and raise 336 * now. We set filename and raise
337 * 337 *
338 * ### FIXME and talk to alwin 338 * ### FIXME and talk to alwin
339 */ 339 */
340void PMainWindow::slotShowInfo( const QString& inf ) { 340void PMainWindow::slotShowInfo( const QString& inf ) {
341 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 341 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
342 return; 342 return;
343 } 343 }
344 if ( !m_info ) { 344 if ( !m_info ) {
345 initInfo(); 345 initInfo();
346 } 346 }
347 m_info->setPath( inf ); 347 m_info->setPath( inf );
348 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 348 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
349 m_aNext->removeFrom(toolBar); 349 m_aNext->removeFrom(toolBar);
350 m_aPrevious->removeFrom(toolBar); 350 m_aPrevious->removeFrom(toolBar);
351 m_aNext->setEnabled(false); 351 m_aNext->setEnabled(false);
352 m_aPrevious->setEnabled(false); 352 m_aPrevious->setEnabled(false);
353 m_aDirUp->setEnabled(false); 353 m_aDirUp->setEnabled(false);
354 m_aShowInfo->setEnabled(false); 354 m_aShowInfo->setEnabled(false);
355 m_aViewfile->setEnabled(true); 355 m_aViewfile->setEnabled(true);
356 m_aStartSlide->setEnabled(false); 356 m_aStartSlide->setEnabled(false);
357 fsButton->hide(); 357 fsButton->hide();
358 } 358 }
359 m_stack->raiseWidget( ImageInfo ); 359 m_stack->raiseWidget( ImageInfo );
360} 360}
361 361
362void PMainWindow::slotDisplay( const QString& inf ) { 362void PMainWindow::slotDisplay( const QString& inf ) {
363 bool nwindow = false; 363 bool nwindow = false;
364 if ( !m_disp ) { 364 if ( !m_disp ) {
365 nwindow = true; 365 nwindow = true;
366 initDisp(); 366 initDisp();
367 } 367 }
368 m_disp->setImage( inf ); 368 m_disp->setImage( inf );
369 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 369 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
370 if (m_gPrevNext->isEnabled()==false) { 370 if (m_gPrevNext->isEnabled()==false) {
371 m_gPrevNext->addTo(toolBar); 371 m_gPrevNext->addTo(toolBar);
372 m_gPrevNext->setEnabled(true); 372 m_gPrevNext->setEnabled(true);
373 373
374 m_aDirUp->setEnabled(false); 374 m_aDirUp->setEnabled(false);
375 m_aShowInfo->setEnabled(true); 375 m_aShowInfo->setEnabled(true);
376 m_aViewfile->setEnabled(false); 376 m_aViewfile->setEnabled(false);
377 m_aStartSlide->setEnabled(false); 377 m_aStartSlide->setEnabled(false);
378 fsButton->hide(); 378 fsButton->hide();
379 } 379 }
380 } 380 }
381 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { 381 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) {
382 slotFullScreenToggled(m_aFullScreen->isOn()); 382 slotFullScreenToggled(m_aFullScreen->isOn());
383 } 383 }
384 if (m_disp->fullScreen()) { 384 if (m_disp->fullScreen()) {
385 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 385 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
386 } else { 386 } else {
387 m_stack->raiseWidget( ImageDisplay ); 387 m_stack->raiseWidget( ImageDisplay );
388 } 388 }
389} 389}
390 390
391void PMainWindow::raiseIconView() { 391void PMainWindow::raiseIconView() {
392 setUpdatesEnabled(false); 392 setUpdatesEnabled(false);
393 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 393 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
394 m_gPrevNext->removeFrom(toolBar); 394 m_gPrevNext->removeFrom(toolBar);
395 m_gPrevNext->setEnabled(false); 395 m_gPrevNext->setEnabled(false);
396 m_aDirUp->setEnabled(true); 396 m_aDirUp->setEnabled(true);
397 m_aShowInfo->setEnabled(true); 397 m_aShowInfo->setEnabled(true);
398 m_aViewfile->setEnabled(true); 398 m_aViewfile->setEnabled(true);
399 m_aStartSlide->setEnabled(true); 399 m_aStartSlide->setEnabled(true);
400 fsButton->show(); 400 fsButton->show();
401 } 401 }
402 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 402 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
403 m_disp->stopSlide(); 403 m_disp->stopSlide();
404 m_disp->hide(); 404 m_disp->hide();
405 } 405 }
406 m_stack->raiseWidget( IconView ); 406 m_stack->raiseWidget( IconView );
407 setUpdatesEnabled(true); 407 setUpdatesEnabled(true);
408 repaint(); 408 repaint();
409} 409}
410 410
411void PMainWindow::slotReturn() { 411void PMainWindow::slotReturn() {
412 raiseIconView(); 412 raiseIconView();
413} 413}
414 414
415 415
416void PMainWindow::closeEvent( QCloseEvent* ev ) { 416void PMainWindow::closeEvent( QCloseEvent* ev ) {
417 /* 417 /*
418 * return from view 418 * return from view
419 * or properly quit 419 * or properly quit
420 */ 420 */
421 if ( m_stack->visibleWidget() == m_info || 421 if ( m_stack->visibleWidget() == m_info ||
422 m_stack->visibleWidget() == m_disp ) { 422 m_stack->visibleWidget() == m_disp ) {
423 ev->ignore(); 423 ev->ignore();
424 raiseIconView(); 424 raiseIconView();
425 return; 425 return;
426 } 426 }
427 if (m_disp && m_disp->fullScreen()) { 427 if (m_disp && m_disp->fullScreen()) {
428 /* otherwise opie-eye crashes in bigscreen mode! */ 428 /* otherwise opie-eye crashes in bigscreen mode! */
429 m_disp->reparent(0,QPoint(0,0)); 429 m_disp->reparent(0,QPoint(0,0));
430 m_stack->addWidget(m_disp,ImageDisplay); 430 m_stack->addWidget(m_disp,ImageDisplay);
431 } 431 }
432 ev->accept(); 432 ev->accept();
433 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 433 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
434} 434}
435 435
436void PMainWindow::setDocument( const QString& showImg ) { 436void PMainWindow::setDocument( const QString& showImg ) {
437 QString file = showImg; 437 QString file = showImg;
438 DocLnk lnk(showImg); 438 DocLnk lnk(showImg);
439 if (lnk.isValid() ) 439 if (lnk.isValid() )
440 file = lnk.file(); 440 file = lnk.file();
441 441
442 slotDisplay( file ); 442 slotDisplay( file );
443} 443}
444 444
445void PMainWindow::slotSelectDir(int id) 445void PMainWindow::slotSelectDir(int id)
446{ 446{
447 emit changeDir( m_dev[fsMenu->text(id )] ); 447 emit changeDir( m_dev[fsMenu->text(id )] );
448} 448}
449 449
450void PMainWindow::dirChanged() 450void PMainWindow::dirChanged()
451{ 451{
452 fsMenu->clear(); 452 fsMenu->clear();
453 m_dev.clear(); 453 m_dev.clear();
454 454
455 /* home dir, too */ 455 /* home dir, too */
456 QString f = getenv( "HOME" ); 456 QString f = getenv( "HOME" );
457 if (!f.isEmpty()) { 457 if (!f.isEmpty()) {
458 m_dev.insert("Home directory",f); 458 m_dev.insert("Home directory",f);
459 fsMenu->insertItem("Home directory"); 459 fsMenu->insertItem("Home directory");
460 } 460 }
461 const QList<FileSystem> &fs = m_storage->fileSystems(); 461 const QList<FileSystem> &fs = m_storage->fileSystems();
462 QListIterator<FileSystem> it(fs ); 462 QListIterator<FileSystem> it(fs );
463 for ( ; it.current(); ++it ) { 463 for ( ; it.current(); ++it ) {
464 const QString disk = (*it)->name(); 464 const QString disk = (*it)->name();
465 const QString path = (*it)->path(); 465 const QString path = (*it)->path();
466 m_dev.insert( disk, path ); 466 m_dev.insert( disk, path );
467 fsMenu->insertItem( disk ); 467 fsMenu->insertItem( disk );
468 } 468 }
469} 469}
470 470
471void PMainWindow::showToolbar(bool how) 471void PMainWindow::showToolbar(bool how)
472{ 472{
473 if (!how) toolBar->hide(); 473 if (!how) toolBar->hide();
474 else toolBar->show(); 474 else toolBar->show();
475 if (autoSave) { 475 if (autoSave) {
476 m_cfg->writeEntry("showtoolbar",how); 476 m_cfg->writeEntry("showtoolbar",how);
477 } 477 }
478} 478}
479 479
480void PMainWindow::setupActions() 480void PMainWindow::setupActions()
481{ 481{
482 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); 482 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true );
483 m_aDirUp->setToggleAction(false); 483 m_aDirUp->setToggleAction(false);
484 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); 484 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
485 485
486 if ( Ir::supported() ) { 486 if ( Ir::supported() ) {
487 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); 487 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true );
488 m_aBeam->setToggleAction(false); 488 m_aBeam->setToggleAction(false);
489 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); 489 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
490 } else { 490 } else {
491 m_aBeam = 0; 491 m_aBeam = 0;
492 } 492 }
493 493
494 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); 494 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true );
495 m_aShowInfo->setToggleAction(false); 495 m_aShowInfo->setToggleAction(false);
496 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); 496 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
497 497
498 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); 498 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true );
499 m_aTrash->setToggleAction(false); 499 m_aTrash->setToggleAction(false);
500 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); 500 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
501 501
502 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); 502 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true );
503 m_aViewfile->setToggleAction(false); 503 m_aViewfile->setToggleAction(false);
504 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); 504 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
505 505
506 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); 506 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true );
507 m_aStartSlide->setToggleAction(false); 507 m_aStartSlide->setToggleAction(false);
508 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); 508 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
509 509
510 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); 510 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true );
511 m_aHideToolbar->setOn (true); 511 m_aHideToolbar->setOn (true);
512 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); 512 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
513 513
514 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); 514 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true );
515 m_aSetup->setToggleAction(false); 515 m_aSetup->setToggleAction(false);
516 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); 516 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig()));
517 517
518 m_gListViewMode = new QActionGroup(this,"Select listmode",true); 518 m_gListViewMode = new QActionGroup(this,"Select listmode",true);
519 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); 519 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*)));
520 520
521 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); 521 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true );
522 m_aDirLong->setToggleAction(true); 522 m_aDirLong->setToggleAction(true);
523 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); 523 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true );
524 m_aDirShort->setToggleAction(true); 524 m_aDirShort->setToggleAction(true);
525 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); 525 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true );
526 m_aDirName->setToggleAction(true); 526 m_aDirName->setToggleAction(true);
527 int mode = m_cfg->readNumEntry("ListViewMode", 1); 527 int mode = m_cfg->readNumEntry("ListViewMode", 1);
528 if (mode < 1 || mode>3) mode = 1; 528 if (mode < 1 || mode>3) mode = 1;
529 switch (mode) { 529 switch (mode) {
530 case 3: 530 case 3:
531 m_aDirName->setOn(true); 531 m_aDirName->setOn(true);
532 break; 532 break;
533 case 2: 533 case 2:
534 m_aDirShort->setOn(true); 534 m_aDirShort->setOn(true);
535 break; 535 break;
536 case 1: 536 case 1:
537 default: 537 default:
538 m_aDirLong->setOn(true); 538 m_aDirLong->setOn(true);
539 } 539 }
540 m_gListViewMode->insert(m_aDirLong); 540 m_gListViewMode->insert(m_aDirLong);
541 m_gListViewMode->insert(m_aDirShort); 541 m_gListViewMode->insert(m_aDirShort);
542 m_gListViewMode->insert(m_aDirName); 542 m_gListViewMode->insert(m_aDirName);
543 543
544 m_gPrevNext = new QActionGroup(this,"imageprevnext",false); 544 m_gPrevNext = new QActionGroup(this,"imageprevnext",false);
545 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); 545 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true );
546 m_aNext->setToggleAction(false); 546 m_aNext->setToggleAction(false);
547 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); 547 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext()));
548 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); 548 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true );
549 m_aPrevious->setToggleAction(false); 549 m_aPrevious->setToggleAction(false);
550 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); 550 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev()));
551 m_gPrevNext->insert(m_aPrevious); 551 m_gPrevNext->insert(m_aPrevious);
552 m_gPrevNext->insert(m_aNext); 552 m_gPrevNext->insert(m_aNext);
553 553
554 m_aFullScreen = new QAction( tr( "Show images fullscreen" ), 554 m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
555 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); 555 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
556 m_aFullScreen->setToggleAction(true); 556 m_aFullScreen->setToggleAction(true);
557 if (autoSave) { 557 if (autoSave) {
558 m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false)); 558 m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false));
559 } else { 559 } else {
560 m_aFullScreen->setOn(false); 560 m_aFullScreen->setOn(false);
561 } 561 }
562 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool))); 562 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool)));
563 563
564 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); 564 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
565 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); 565 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
566 m_aAutoRotate->setToggleAction(true); 566 m_aAutoRotate->setToggleAction(true);
567 567
568 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 568 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
569 m_aAutoRotate->setOn(true); 569 m_aAutoRotate->setOn(true);
570 } else { 570 } else {
571 m_aAutoRotate->setOn(false); 571 m_aAutoRotate->setOn(false);
572 } 572 }
573 if (autoSave) { 573 if (autoSave) {
574 m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn())); 574 m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn()));
575 } 575 }
576 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 576 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
577 577
578 m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); 578 m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
579 m_aUnscaled->setToggleAction(true); 579 m_aUnscaled->setToggleAction(true);
580 connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 580 connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
581 if (autoSave) { 581 if (autoSave) {
582 m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); 582 m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false));
583 } else { 583 } else {
584 m_aUnscaled->setOn(false); 584 m_aUnscaled->setOn(false);
585 } 585 }
586 586
587 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); 587 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true );
588 m_aZoomer->setToggleAction(true); 588 m_aZoomer->setToggleAction(true);
589 if (autoSave) { 589 if (autoSave) {
590 m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); 590 m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true));
591 } else { 591 } else {
592 m_aZoomer->setOn (true); 592 m_aZoomer->setOn (true);
593 } 593 }
594 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 594 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
595 m_gDisplayType->insert(m_aAutoRotate); 595 m_gDisplayType->insert(m_aAutoRotate);
596 m_gDisplayType->insert(m_aUnscaled); 596 m_gDisplayType->insert(m_aUnscaled);
597 m_gDisplayType->insert(m_aZoomer); 597 m_gDisplayType->insert(m_aZoomer);
598 598
599 m_hGroup = new QActionGroup(this,"actioncollection",false); 599 m_hGroup = new QActionGroup(this,"actioncollection",false);
600 m_hGroup->insert(m_aFullScreen); 600 m_hGroup->insert(m_aFullScreen);
601} 601}
602 602
603void PMainWindow::setupToolbar() 603void PMainWindow::setupToolbar()
604{ 604{
605 toolBar = new QToolBar( this ); 605 toolBar = new QToolBar( this );
606 addToolBar(toolBar); 606 addToolBar(toolBar);
607 toolBar->setHorizontalStretchable( true ); 607 toolBar->setHorizontalStretchable( true );
608 setToolBarsMovable( false ); 608 setToolBarsMovable( false );
609 m_aDirUp->addTo( toolBar ); 609 m_aDirUp->addTo( toolBar );
610 610
611 fsButton = new PFileSystem( toolBar ); 611 fsButton = new PFileSystem( toolBar );
612 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 612 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
613 m_view, SLOT(slotChangeDir( const QString& ) ) ); 613 m_view, SLOT(slotChangeDir( const QString& ) ) );
614 connect( this, SIGNAL( changeDir( const QString& ) ), 614 connect( this, SIGNAL( changeDir( const QString& ) ),
615 m_view, SLOT(slotChangeDir( const QString& ) ) ); 615 m_view, SLOT(slotChangeDir( const QString& ) ) );
616 616
617 if (m_aBeam) { 617 if (m_aBeam) {
618 m_aBeam->addTo( toolBar ); 618 m_aBeam->addTo( toolBar );
619 } 619 }
620 m_aShowInfo->addTo(toolBar); 620 m_aShowInfo->addTo(toolBar);
621 m_aTrash->addTo(toolBar); 621 m_aTrash->addTo(toolBar);
622// m_aSetup->addTo(toolBar); 622// m_aSetup->addTo(toolBar);
623 623
624 m_gDisplayType->addTo(toolBar); 624 m_gDisplayType->addTo(toolBar);
625 625
626 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 626 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
627 m_gPrevNext->addTo(toolBar); 627 m_gPrevNext->addTo(toolBar);
628 } else { 628 } else {
629 m_gPrevNext->setEnabled(false); 629 m_gPrevNext->setEnabled(false);
630 } 630 }
631} 631}
632 632
633void PMainWindow::setupMenu() 633void PMainWindow::setupMenu()
634{ 634{
635 fileMenu = new QPopupMenu( menuBar() ); 635 fileMenu = new QPopupMenu( menuBar() );
636 menuBar()->insertItem( tr( "File" ), fileMenu ); 636 menuBar()->insertItem( tr( "File" ), fileMenu );
637 dispMenu = new QPopupMenu( menuBar() ); 637 dispMenu = new QPopupMenu( menuBar() );
638 menuBar()->insertItem( tr( "Show" ), dispMenu ); 638 menuBar()->insertItem( tr( "Show" ), dispMenu );
639 settingsMenu = new QPopupMenu( menuBar() ); 639 settingsMenu = new QPopupMenu( menuBar() );
640 menuBar()->insertItem( tr( "Settings" ), settingsMenu ); 640 menuBar()->insertItem( tr( "Settings" ), settingsMenu );
641 641
642 m_aViewfile->addTo(fileMenu); 642 m_aViewfile->addTo(fileMenu);
643 m_aShowInfo->addTo(fileMenu); 643 m_aShowInfo->addTo(fileMenu);
644 m_aStartSlide->addTo(fileMenu); 644 m_aStartSlide->addTo(fileMenu);
645 645
646 fileMenu->insertSeparator(); 646 fileMenu->insertSeparator();
647 m_aDirUp->addTo( fileMenu ); 647 m_aDirUp->addTo( fileMenu );
648 648
649 fsMenu = new QPopupMenu(fileMenu); 649 fsMenu = new QPopupMenu(fileMenu);
650 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); 650 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
651 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); 651 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) );
652 dirChanged(); 652 dirChanged();
653 653
654 if ( m_aBeam ) { 654 if ( m_aBeam ) {
655 fileMenu->insertSeparator(); 655 fileMenu->insertSeparator();
656 m_aBeam->addTo( fileMenu ); 656 m_aBeam->addTo( fileMenu );
657 } 657 }
658 fileMenu->insertSeparator(); 658 fileMenu->insertSeparator();
659 m_aTrash->addTo(fileMenu); 659 m_aTrash->addTo(fileMenu);
660 660
661 listviewMenu = new QPopupMenu(dispMenu); 661 listviewMenu = new QPopupMenu(dispMenu);
662 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); 662 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
663 m_gListViewMode->addTo(listviewMenu); 663 m_gListViewMode->addTo(listviewMenu);
664 dispMenu->insertSeparator(); 664 dispMenu->insertSeparator();
665 m_aFullScreen->addTo(dispMenu); 665 m_aFullScreen->addTo(dispMenu);
666 m_gDisplayType->addTo(dispMenu); 666 m_gDisplayType->addTo(dispMenu);
667 dispMenu->insertSeparator(); 667 dispMenu->insertSeparator();
668 m_gPrevNext->addTo(dispMenu); 668 m_gPrevNext->addTo(dispMenu);
669 669
670 m_aSetup->addTo(settingsMenu); 670 m_aSetup->addTo(settingsMenu);
671 m_aHideToolbar->addTo(settingsMenu); 671 m_aHideToolbar->addTo(settingsMenu);
672} 672}
673 673
674void PMainWindow::listviewselected(QAction*which) 674void PMainWindow::listviewselected(QAction*which)
675{ 675{
676 if (!which || which->isOn()==false) return; 676 if (!which || which->isOn()==false) return;
677 int val = 1; 677 int val = 1;
678// QString name; 678// QString name;
679 679
680 if (which==m_aDirName) { 680 if (which==m_aDirName) {
681 val = 3; 681 val = 3;
682// name = "opie-eye/opie-eye-textview"; 682// name = "opie-eye/opie-eye-textview";
683 } else if (which==m_aDirShort) { 683 } else if (which==m_aDirShort) {
684 val = 2; 684 val = 2;
685// name = "opie-eye/opie-eye-thumbonly"; 685// name = "opie-eye/opie-eye-thumbonly";
686 } else if (which==m_aDirLong) { 686 } else if (which==m_aDirLong) {
687 val = 1; 687 val = 1;
688// name = "opie-eye/opie-eye-thumb"; 688// name = "opie-eye/opie-eye-thumb";
689 } 689 }
690 emit changeListMode(val); 690 emit changeListMode(val);
691} 691}
692 692
693void PMainWindow::readConfig() 693void PMainWindow::readConfig()
694{ 694{
695 autoSave =m_cfg->readBoolEntry("base_savestatus",true); 695 autoSave =m_cfg->readBoolEntry("savestatus",true);
696} 696}