summaryrefslogtreecommitdiff
authoralwin <alwin>2004-11-02 17:52:41 (UTC)
committer alwin <alwin>2004-11-02 17:52:41 (UTC)
commitebdc2d346272bae27c867b855207993985df4450 (patch) (unidiff)
tree37b4710141434e33df3873c16937a6ad6a015eb4
parente246d0590286f6b9b0d5d40f1a17caa78c015b21 (diff)
downloadopie-ebdc2d346272bae27c867b855207993985df4450.zip
opie-ebdc2d346272bae27c867b855207993985df4450.tar.gz
opie-ebdc2d346272bae27c867b855207993985df4450.tar.bz2
if wanted the user may search directories recursiv
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp10
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h1
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp2
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp14
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_dirview.h2
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp32
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_lister.cpp53
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_lister.h12
8 files changed, 96 insertions, 30 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 7c8c88d..eafff1d 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -108,96 +108,97 @@ namespace {
108 calcRect(text()); 108 calcRect(text());
109 } 109 }
110 110
111 inline QPixmap* IconViewItem::pixmap()const { 111 inline QPixmap* IconViewItem::pixmap()const {
112// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y() 112// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y()
113// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX() 113// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX()
114// << " " << iconView()->contentsY() << oendl; 114// << " " << iconView()->contentsY() << oendl;
115 115
116 if (textOnly()&&!m_isDir) { 116 if (textOnly()&&!m_isDir) {
117 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); 117 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1);
118 return _emptyPix; 118 return _emptyPix;
119 } 119 }
120 if ( m_isDir ) 120 if ( m_isDir )
121 return _dirPix; 121 return _dirPix;
122 else{ 122 else{
123 if (!m_noInfo && !g_stringInf.contains( m_path ) ) { 123 if (!m_noInfo && !g_stringInf.contains( m_path ) ) {
124 currentView()->dirLister()->imageInfo( m_path ); 124 currentView()->dirLister()->imageInfo( m_path );
125 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); 125 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this));
126 } 126 }
127 127
128 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); 128 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 );
129 if (!m_pix && !g_stringPix.contains( m_path )) { 129 if (!m_pix && !g_stringPix.contains( m_path )) {
130 currentView()->dirLister()->thumbNail( m_path, 64, 64 ); 130 currentView()->dirLister()->thumbNail( m_path, 64, 64 );
131 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); 131 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
132 } 132 }
133 return m_pix ? m_pix : _unkPix; 133 return m_pix ? m_pix : _unkPix;
134 } 134 }
135 } 135 }
136 inline void IconViewItem::setText( const QString& str ) { 136 inline void IconViewItem::setText( const QString& str ) {
137 QString text = QIconViewItem::text()+"\n"+str; 137 QString text = QIconViewItem::text()+"\n"+str;
138 m_noInfo = true; 138 m_noInfo = true;
139 QIconViewItem::setText( text ); 139 QIconViewItem::setText( text );
140 } 140 }
141} 141}
142 142
143 143
144/* 144/*
145 * Set up the GUI.. initialize the slave set up gui 145 * Set up the GUI.. initialize the slave set up gui
146 * and also load a dir 146 * and also load a dir
147 */ 147 */
148PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) 148PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
149 : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) 149 : QVBox( wid ), m_cfg( cfg ), m_updatet( false )
150{ 150{
151 { 151 {
152 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 152 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
153 } 153 }
154 m_path = QDir::homeDirPath(); 154 m_path = QDir::homeDirPath();
155 m_mode = 0; 155 m_mode = 0;
156 m_internalReset = false;
156 157
157 QHBox *hbox = new QHBox( this ); 158 QHBox *hbox = new QHBox( this );
158 QLabel* lbl = new QLabel( hbox ); 159 QLabel* lbl = new QLabel( hbox );
159 lbl->setText( tr("View as" ) ); 160 lbl->setText( tr("View as" ) );
160 161
161 m_views = new QComboBox( hbox, "View As" ); 162 m_views = new QComboBox( hbox, "View As" );
162 163
163 m_view= new QIconView( this ); 164 m_view= new QIconView( this );
164 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 165 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
165 this, SLOT(slotClicked(QIconViewItem*)) ); 166 this, SLOT(slotClicked(QIconViewItem*)) );
166 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), 167 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
167 this, SLOT(slotClicked(QIconViewItem*)) ); 168 this, SLOT(slotClicked(QIconViewItem*)) );
168 169
169 m_view->setArrangement( QIconView::LeftToRight ); 170 m_view->setArrangement( QIconView::LeftToRight );
170 171
171 m_mode = m_cfg->readNumEntry("ListViewMode", 1); 172 m_mode = m_cfg->readNumEntry("ListViewMode", 1);
172 QString lastView = m_cfg->readEntry("LastView",""); 173 QString lastView = m_cfg->readEntry("LastView","");
173 174
174 if (m_mode < 1 || m_mode>3) m_mode = 1; 175 if (m_mode < 1 || m_mode>3) m_mode = 1;
175 176
176 m_view->setItemTextPos( QIconView::Right ); 177 m_view->setItemTextPos( QIconView::Right );
177 178
178 calculateGrid(); 179 calculateGrid();
179 180
180 initKeys(); 181 initKeys();
181 182
182 loadViews(); 183 loadViews();
183 int cc=0; 184 int cc=0;
184 for (; cc<m_views->count();++cc) { 185 for (; cc<m_views->count();++cc) {
185 if (m_views->text(cc)==lastView) { 186 if (m_views->text(cc)==lastView) {
186 break; 187 break;
187 } 188 }
188 } 189 }
189 if (cc<m_views->count()) { 190 if (cc<m_views->count()) {
190 m_views->setCurrentItem(cc); 191 m_views->setCurrentItem(cc);
191 slotViewChanged(cc); 192 slotViewChanged(cc);
192 } else { 193 } else {
193 slotViewChanged(m_views->currentItem()); 194 slotViewChanged(m_views->currentItem());
194 } 195 }
195 connect( m_views, SIGNAL(activated(int)), 196 connect( m_views, SIGNAL(activated(int)),
196 this, SLOT(slotViewChanged(int)) ); 197 this, SLOT(slotViewChanged(int)) );
197} 198}
198 199
199/* 200/*
200 * Unref the slave and save the keyboard manager 201 * Unref the slave and save the keyboard manager
201 */ 202 */
202PIconView::~PIconView() { 203PIconView::~PIconView() {
203 { 204 {
@@ -318,142 +319,147 @@ QString PIconView::nextFileName(bool &isDir)const
318 QIconViewItem* _it = _it1->nextItem(); 319 QIconViewItem* _it = _it1->nextItem();
319 if ( !_it ) 320 if ( !_it )
320 return QString::null; 321 return QString::null;
321 IconViewItem* it = static_cast<IconViewItem*>( _it ); 322 IconViewItem* it = static_cast<IconViewItem*>( _it );
322 isDir = it->isDir(); 323 isDir = it->isDir();
323 return it->path(); 324 return it->path();
324} 325}
325 326
326QString PIconView::prevFileName(bool &isDir)const{ 327QString PIconView::prevFileName(bool &isDir)const{
327 isDir = false; 328 isDir = false;
328 QIconViewItem* _it = m_view->currentItem(); 329 QIconViewItem* _it = m_view->currentItem();
329 if ( !_it ) 330 if ( !_it )
330 return QString::null; 331 return QString::null;
331 _it = _it->prevItem(); 332 _it = _it->prevItem();
332 if ( !_it ) 333 if ( !_it )
333 return QString::null; 334 return QString::null;
334 IconViewItem* it = static_cast<IconViewItem*>( _it ); 335 IconViewItem* it = static_cast<IconViewItem*>( _it );
335 isDir = it->isDir(); 336 isDir = it->isDir();
336 return it->path(); 337 return it->path();
337} 338}
338 339
339void PIconView::slotTrash() { 340void PIconView::slotTrash() {
340 bool isDir; 341 bool isDir;
341 QString pa = currentFileName( isDir ); 342 QString pa = currentFileName( isDir );
342 if ( isDir && pa.isEmpty() ) 343 if ( isDir && pa.isEmpty() )
343 return; 344 return;
344 345
345 if (!QPEMessageBox::confirmDelete( this, 346 if (!QPEMessageBox::confirmDelete( this,
346 tr("Delete Image" ), 347 tr("Delete Image" ),
347 tr("the Image %1" ).arg(pa))) 348 tr("the Image %1" ).arg(pa)))
348 return 349 return
349 350
350 351
351 currentView()->dirLister()->deleteImage( pa ); 352 currentView()->dirLister()->deleteImage( pa );
352 delete m_view->currentItem(); 353 delete m_view->currentItem();
353} 354}
354 355
355/* 356/*
356 * see what views are available 357 * see what views are available
357 */ 358 */
358void PIconView::loadViews() { 359void PIconView::loadViews() {
359 ViewMap::Iterator it; 360 ViewMap::Iterator it;
360 ViewMap* map = viewMap(); 361 ViewMap* map = viewMap();
361 for ( it = map->begin(); it != map->end(); ++it ) 362 for ( it = map->begin(); it != map->end(); ++it )
362 m_views->insertItem( it.key() ); 363 m_views->insertItem( it.key() );
363} 364}
364 365
365void PIconView::resetView() { 366void PIconView::resetView() {
367 m_internalReset = true;
366 slotViewChanged(m_views->currentItem()); 368 slotViewChanged(m_views->currentItem());
369 m_internalReset = false;
367} 370}
368 371
369/* 372/*
370 *swicth view reloadDir and connect signals 373 *swicth view reloadDir and connect signals
371 */ 374 */
372void PIconView::slotViewChanged( int i) { 375void PIconView::slotViewChanged( int i) {
373 if (!m_views->count() ) { 376 if (!m_views->count() ) {
374 setCurrentView( 0l); 377 setCurrentView( 0l);
375 return; 378 return;
376 } 379 }
377 380
378 PDirView* cur = currentView(); 381 PDirView* cur = currentView();
379 if (cur) delete cur; 382 if (cur) delete cur;
380 QString str = m_views->text(i); 383 QString str = m_views->text(i);
381 ViewMap* map = viewMap(); 384 ViewMap* map = viewMap();
382 if (!map) { 385 if (!map) {
383 setCurrentView(0l); 386 setCurrentView(0l);
384 return; 387 return;
385 } 388 }
386 389
387 if (map->find(str) == map->end()) { 390 if (map->find(str) == map->end()) {
388 owarn << "Key not found" << oendl; 391 owarn << "Key not found" << oendl;
389 setCurrentView(0l); 392 setCurrentView(0l);
390 return; 393 return;
391 } 394 }
392 395
393 m_cfg->writeEntry("LastView",str); 396 m_cfg->writeEntry("LastView",str);
394 m_cfg->write(); 397 m_cfg->write();
395 cur = (*(*map)[str])(*m_cfg); 398 cur = (*(*map)[str])(*m_cfg);
396 setCurrentView( cur ); 399 setCurrentView( cur );
397 400
398 /* connect to the signals of the lister */ 401 /* connect to the signals of the lister */
399 PDirLister* lis = cur->dirLister(); 402 PDirLister* lis = cur->dirLister();
400 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), 403 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )),
401 this, SLOT( slotThumbInfo(const QString&, const QString&))); 404 this, SLOT( slotThumbInfo(const QString&, const QString&)));
402 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), 405 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
403 this, SLOT(slotThumbNail(const QString&, const QPixmap&))); 406 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
404 connect(lis, SIGNAL(sig_start()), 407 connect(lis, SIGNAL(sig_start()),
405 this, SLOT(slotStart())); 408 this, SLOT(slotStart()));
406 connect(lis, SIGNAL(sig_end()) , 409 connect(lis, SIGNAL(sig_end()) ,
407 this, SLOT(slotEnd()) ); 410 this, SLOT(slotEnd()) );
408 411
409 412
410 /* reload now with default Path*/ 413 /* reload now with default Path
411 m_path = lis->defaultPath(); 414 * but only if it isn't a reset like from setupdlg
415 */
416 if (!m_internalReset)
417 m_path = lis->defaultPath();
412 QTimer::singleShot( 0, this, SLOT(slotReloadDir())); 418 QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
413} 419}
414 420
415 421
416void PIconView::slotReloadDir() { 422void PIconView::slotReloadDir() {
417 slotChangeDir( m_path ); 423 slotChangeDir( m_path );
418} 424}
419 425
420 426
421/* 427/*
422 * add files and folders 428 * add files and folders
423 */ 429 */
424void PIconView::addFolders( const QStringList& lst) { 430void PIconView::addFolders( const QStringList& lst) {
425 QStringList::ConstIterator it; 431 QStringList::ConstIterator it;
426 IconViewItem * _iv; 432 IconViewItem * _iv;
427 433
428 for(it=lst.begin(); it != lst.end(); ++it ) { 434 for(it=lst.begin(); it != lst.end(); ++it ) {
429 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); 435 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
430 if (m_mode==3) _iv->setTextOnly(true); 436 if (m_mode==3) _iv->setTextOnly(true);
431 } 437 }
432} 438}
433 439
434void PIconView::addFiles( const QStringList& lst) { 440void PIconView::addFiles( const QStringList& lst) {
435 QStringList::ConstIterator it; 441 QStringList::ConstIterator it;
436 IconViewItem * _iv; 442 IconViewItem * _iv;
437 QPixmap*m_pix = 0; 443 QPixmap*m_pix = 0;
438 QString pre = ""; 444 QString pre = "";
439 if (!m_path.isEmpty()) { 445 if (!m_path.isEmpty()) {
440 pre = m_path+"/"; 446 pre = m_path+"/";
441 } 447 }
442 for (it=lst.begin(); it!= lst.end(); ++it ) { 448 for (it=lst.begin(); it!= lst.end(); ++it ) {
443 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 ); 449 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 );
444 _iv = new IconViewItem( m_view, pre+(*it), (*it) ); 450 _iv = new IconViewItem( m_view, pre+(*it), (*it) );
445 if (m_mode==3) { 451 if (m_mode==3) {
446 _iv->setTextOnly(true); 452 _iv->setTextOnly(true);
447 _iv->setPixmap(QPixmap()); 453 _iv->setPixmap(QPixmap());
448 454
449 455
450 456
451 } else { 457 } else {
452 if (m_pix) _iv->setPixmap(*m_pix); 458 if (m_pix) _iv->setPixmap(*m_pix);
453 } 459 }
454 } 460 }
455 461
456} 462}
457 463
458/* 464/*
459 * user clicked on the item. Change dir or view 465 * user clicked on the item. Change dir or view
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index dff55ed..bea35c2 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -50,51 +50,52 @@ protected:
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();
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}; 99};
99 100
100#endif 101#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 6660eb2..30c9bf1 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -128,103 +128,105 @@ void PMainWindow::slotScaleToggled(bool how)
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 } 177 }
177 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 178 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
178 179
179 bool remdisp = false; 180 bool remdisp = false;
180 if ( !m_disp ) { 181 if ( !m_disp ) {
181 remdisp = true; 182 remdisp = true;
182 initDisp(); 183 initDisp();
184 m_disp->hide();
183 } 185 }
184 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 186 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
185 187
186 keyWid->load(); 188 keyWid->load();
187 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 189 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
188 wid->setCurrentTab(0); 190 wid->setCurrentTab(0);
189 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 191 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
190 192
191/* 193/*
192 * clean up 194 * clean up
193 *apply changes 195 *apply changes
194 */ 196 */
195 197
196 QMap<PDirView*, QWidget*>::Iterator it; 198 QMap<PDirView*, QWidget*>::Iterator it;
197 for ( it = lst.begin(); it != lst.end(); ++it ) { 199 for ( it = lst.begin(); it != lst.end(); ++it ) {
198 if ( act ) 200 if ( act )
199 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 201 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
200 delete it.key(); 202 delete it.key();
201 } 203 }
202 204
203 205
204 if ( act ) { 206 if ( act ) {
205 m_view->resetView(); 207 m_view->resetView();
206 keyWid->save(); 208 keyWid->save();
207 m_disp->manager()->save(); 209 m_disp->manager()->save();
208 m_info->manager()->save(); 210 m_info->manager()->save();
209 m_view->manager()->save(); 211 m_view->manager()->save();
210 bSetup->save_values(); 212 bSetup->save_values();
211 readConfig(); 213 readConfig();
212 } 214 }
213 delete keyWid; 215 delete keyWid;
214 216
215 m_stack->raiseWidget(w); 217 m_stack->raiseWidget(w);
216 if (remdisp) { 218 if (remdisp) {
217 m_disp->hide(); 219 m_disp->hide();
218 } 220 }
219 if (reminfo) { 221 if (reminfo) {
220 m_info->hide(); 222 m_info->hide();
221 } 223 }
222} 224}
223 225
224/* 226/*
225 * create a new image info component 227 * create a new image info component
226 * and detach the current one 228 * and detach the current one
227 * we will make the other delete on exit 229 * we will make the other delete on exit
228 */ 230 */
229template<class T> 231template<class T>
230void PMainWindow::initT( const char* name, T** ptr, int id) { 232void PMainWindow::initT( const char* name, T** ptr, int id) {
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
index 97e3dcb..fc502d4 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
@@ -1,29 +1,33 @@
1#include "dir_lister.h" 1#include "dir_lister.h"
2#include "dir_ifaceinfo.h" 2#include "dir_ifaceinfo.h"
3#include "dir_dirview.h" 3#include "dir_dirview.h"
4 4
5PHUNK_VIEW_INTERFACE("Dir View", Dir_DirView ); 5PHUNK_VIEW_INTERFACE("Dir View", Dir_DirView );
6 6
7 7
8Dir_DirView::Dir_DirView( const Config& cfg) 8Dir_DirView::Dir_DirView( const Config& cfg)
9 : PDirView(cfg) 9 : PDirView(cfg)
10{ 10{
11 m_cfg = cfg.readBoolEntry( "Dir_Check_All_Files", true); 11 m_cfg = cfg.readBoolEntry( "Dir_Check_All_Files", false);
12 m_recursive = cfg.readBoolEntry( "Dir_Check_Recursive_Files", false);
13 m_recursive_depth = cfg.readNumEntry("Dir_Recursive_Files_Depth",10);
12 m_lister = 0; 14 m_lister = 0;
13 m_info = 0; 15 m_info = 0;
14} 16}
15 17
16Dir_DirView::~Dir_DirView() { 18Dir_DirView::~Dir_DirView() {
17} 19}
18 20
19PInterfaceInfo* Dir_DirView::interfaceInfo()const{ 21PInterfaceInfo* Dir_DirView::interfaceInfo()const{
20 if (!m_info ) 22 if (!m_info ) {
21 m_info =new DirInterfaceInfo; 23 m_info = new DirInterfaceInfo;
24 }
22 return m_info; 25 return m_info;
23} 26}
24 27
25PDirLister* Dir_DirView::dirLister()const{ 28PDirLister* Dir_DirView::dirLister()const{
26 if (!m_lister ) 29 if (!m_lister ) {
27 m_lister = new Dir_DirLister(m_cfg); 30 m_lister = new Dir_DirLister(m_cfg,m_recursive,m_recursive_depth);
31 }
28 return m_lister; 32 return m_lister;
29} 33}
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
index 3b9b7a6..89cf6c9 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
+++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
@@ -1,24 +1,26 @@
1/* 1/*
2 * GPLv2 only zecke@handhelds.org 2 * GPLv2 only zecke@handhelds.org
3 */ 3 */
4 4
5#ifndef DIR_DIR_VIEW_H 5#ifndef DIR_DIR_VIEW_H
6#define DIR_DIR_VIEW_H 6#define DIR_DIR_VIEW_H
7 7
8#include <iface/dirview.h> 8#include <iface/dirview.h>
9 9
10 10
11struct Dir_DirView : public PDirView { 11struct Dir_DirView : public PDirView {
12 Dir_DirView( const Config& ); 12 Dir_DirView( const Config& );
13 ~Dir_DirView(); 13 ~Dir_DirView();
14 14
15 PInterfaceInfo* interfaceInfo()const; 15 PInterfaceInfo* interfaceInfo()const;
16 PDirLister* dirLister()const; 16 PDirLister* dirLister()const;
17private: 17private:
18 bool m_cfg : 1; 18 bool m_cfg : 1;
19 bool m_recursive:1;
20 int m_recursive_depth;
19 mutable PDirLister* m_lister; 21 mutable PDirLister* m_lister;
20 mutable PInterfaceInfo *m_info; 22 mutable PInterfaceInfo *m_info;
21}; 23};
22 24
23 25
24#endif 26#endif
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
index 9c69ce5..1e4ec40 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
@@ -1,58 +1,82 @@
1/* 1/*
2 * GPLv2 2 * GPLv2
3 * zecke@handhelds.org 3 * zecke@handhelds.org
4 */ 4 */
5 5
6#include "dir_ifaceinfo.h" 6#include "dir_ifaceinfo.h"
7 7
8/* OPIE */ 8/* OPIE */
9#include <opie2/odebug.h> 9#include <opie2/odebug.h>
10#include <qpe/config.h> 10#include <qpe/config.h>
11 11
12/* QT */ 12/* QT */
13#include <qwidget.h> 13#include <qwidget.h>
14#include <qcheckbox.h> 14#include <qcheckbox.h>
15#include <qframe.h> 15#include <qframe.h>
16#include <qhbox.h> 16#include <qhbox.h>
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qlayout.h> 18#include <qlayout.h>
19#include <qspinbox.h>
19 20
20namespace { 21namespace {
21 class DirImageWidget : public QFrame { 22 class DirImageWidget : public QFrame {
22 public: 23 public:
23 DirImageWidget(): QFrame() { 24 DirImageWidget(): QFrame() {
24 setFrameStyle(Box|Raised); 25 setFrameStyle(Box|Raised);
25 QVBoxLayout *m_MainLayout = new QVBoxLayout( this, 6, 2, "m_MainLayout"); 26 QVBoxLayout *m_MainLayout = new QVBoxLayout( this, 6, 2, "m_MainLayout");
27 QGridLayout*RecDepthLayout = new QGridLayout( 0, 1, 1, 0, 6, "RecDepthLayout");
28
26 chkbox = new QCheckBox( QObject::tr("Show all files"), this ); 29 chkbox = new QCheckBox( QObject::tr("Show all files"), this );
27 m_MainLayout->addWidget(chkbox); 30 m_MainLayout->addWidget(chkbox);
31 recWarningLabel = new QLabel(this);
32 recWarningLabel->setText(QObject::tr("<center><b>Be carefull with the following options!</b></center>"));
33 m_MainLayout->addWidget(recWarningLabel);
34 recBox = new QCheckBox( QObject::tr("Show files recursive"),this);
35 m_MainLayout->addWidget(recBox);
36 recDepthLabel = new QLabel(this);
37 recDepthLabel->setText(QObject::tr("Recursion depth:"));
38 RecDepthLayout->addWidget(recDepthLabel,0,0);
39 recDepth = new QSpinBox(this);
40 recDepth->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
41 recDepth->setMaxValue(10);
42 recDepth->setMinValue(1);
43 recDepth->setSuffix(QObject::tr(" directories"));
44 RecDepthLayout->addWidget(recDepth,0,1);
45 m_MainLayout->addLayout(RecDepthLayout);
28 QSpacerItem *spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); 46 QSpacerItem *spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
29 m_MainLayout->addItem( spacer1 ); 47 m_MainLayout->addItem( spacer1 );
30 48
31 } 49 }
32 ~DirImageWidget() {} 50 ~DirImageWidget() {}
33 QCheckBox* chkbox; 51 QCheckBox* chkbox,*recBox;
52 QSpinBox * recDepth;
53 QLabel* recDepthLabel,*recWarningLabel;
54
34 }; 55 };
35} 56}
36 57
37 58
38DirInterfaceInfo::DirInterfaceInfo() { 59DirInterfaceInfo::DirInterfaceInfo() {
39} 60}
40DirInterfaceInfo::~DirInterfaceInfo() { 61DirInterfaceInfo::~DirInterfaceInfo() {
41} 62}
42 63
43QString DirInterfaceInfo::name()const { 64QString DirInterfaceInfo::name()const {
44 return QObject::tr("Directory View" ); 65 return QObject::tr("Directory View" );
45} 66}
46 67
47QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { 68QWidget* DirInterfaceInfo::configWidget(const Config& cfg) {
48 DirImageWidget* wid = new DirImageWidget(); 69 DirImageWidget* wid = new DirImageWidget();
49 wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); 70 wid->chkbox->setChecked(cfg.readBoolEntry("Dir_Check_All_Files",false));
50 71 wid->recBox->setChecked(cfg.readBoolEntry("Dir_Check_Recursive_Files",false));
72 wid->recDepth->setValue(cfg.readNumEntry("Dir_Recursive_Files_Depth",10));
51 return wid; 73 return wid;
52} 74}
53 75
54void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { 76void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) {
55 owarn << "Write Config" << oendl; 77 owarn << "Write Config" << oendl;
56 DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); 78 DirImageWidget* wid = static_cast<DirImageWidget*>(_wid);
57 cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); 79 cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked());
80 cfg.writeEntry("Dir_Check_Recursive_Files", wid->recBox->isChecked());
81 cfg.writeEntry("Dir_Recursive_Files_Depth",wid->recDepth->value());
58} 82}
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
index d8b332a..ff33cf2 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
@@ -1,92 +1,111 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 */ 3 */
4 4
5#include "dir_lister.h" 5#include "dir_lister.h"
6 6
7#include <lib/slavemaster.h> 7#include <lib/slavemaster.h>
8 8
9/* OPIE */ 9/* OPIE */
10#include <opie2/odebug.h> 10#include <opie2/odebug.h>
11#include <qpe/config.h> 11#include <qpe/config.h>
12#include <qpe/qpeapplication.h> 12#include <qpe/qpeapplication.h>
13using namespace Opie::Core; 13using namespace Opie::Core;
14 14
15/* QT */ 15/* QT */
16#include <qdir.h> 16#include <qdir.h>
17#include <qfileinfo.h> 17#include <qfileinfo.h>
18 18
19Dir_DirLister::Dir_DirLister( bool list ) 19Dir_DirLister::Dir_DirLister( bool list,bool rec,int recdepth )
20 : PDirLister( "dir_dir_lister" ) 20 : PDirLister( "dir_dir_lister" )
21{ 21{
22 m_allFiles = list; 22 m_allFiles = list;
23 m_recursive = rec;
24 m_recDepth = recdepth;
25 if (m_recDepth<1) m_recDepth = 1;
26 if (m_recDepth>10) m_recDepth = 10;
23 owarn << "All Files " << m_allFiles << "" << oendl; 27 owarn << "All Files " << m_allFiles << "" << oendl;
24 SlaveHelper::slaveConnectSignals( this ); 28 SlaveHelper::slaveConnectSignals( this );
29 m_Filter = (m_allFiles?"*":"*.jpg;*.jpeg;*.JPG;*.PNG;*.GIF;*.BMP;*.png;*.bmp;*.gif");
25} 30}
26 31
27QString Dir_DirLister::defaultPath()const { 32QString Dir_DirLister::defaultPath()const {
28 return QPEApplication::documentDir(); 33 return QPEApplication::documentDir();
29} 34}
30 35
31QString Dir_DirLister::setStartPath( const QString& path ) { 36QString Dir_DirLister::setStartPath( const QString& path ) {
32 m_currentDir.cd( path ); 37 m_currentDir.cd( path );
33 if (!m_currentDir.exists() ) 38 if (!m_currentDir.exists() )
34 m_currentDir.cd(defaultPath()); 39 m_currentDir.cd(defaultPath());
35 40
36 41
37 return m_currentDir.absPath(); 42 return m_currentDir.absPath();
38} 43}
39 44
40QString Dir_DirLister::currentPath()const { 45QString Dir_DirLister::currentPath()const {
41 return m_currentDir.absPath(); 46 return m_currentDir.absPath();
42} 47}
43 48
44 49
45QStringList Dir_DirLister::folders()const { 50QStringList Dir_DirLister::folders()const {
46 return m_currentDir.entryList( QDir::Dirs ); 51 return m_currentDir.entryList( QDir::Dirs );
47} 52}
48 53
49QStringList Dir_DirLister::files()const { 54QStringList Dir_DirLister::recFiles(const QString&aPath,int currentDepth)const
50 if ( m_allFiles ) 55{
51 return m_currentDir.entryList( QDir::Files ); 56 QStringList all;
52 else { 57 if (currentDepth>m_recDepth) return all;
53 QStringList out; 58
54 QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); 59 QString subPath;
55 for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { 60 subPath = aPath;
56 QFileInfo inf( *it ); 61 if (subPath.length()==0) {
57 QString ext = inf.extension(false).lower(); 62 subPath=".";
58 if( ext == QString::fromLatin1("jpg") || 63 }
59 ext == QString::fromLatin1("jpeg" ) || 64 QDir checkDir(currentPath()+"/"+aPath);
60 ext == QString::fromLatin1("png" ) || 65
61 ext == QString::fromLatin1("bmp" ) || 66 QStringList p = checkDir.entryList( QDir::Dirs );
62 ext == QString::fromLatin1("gif" ) ) 67 all+=checkDir.entryList(m_Filter,QDir::Files|QDir::Readable);
63 out.append( *it ); 68 QStringList tmp;
69 for (unsigned i = 0; i < p.count();++i) {
70 if (p[i]=="." || p[i]=="..") continue;
71 tmp =recFiles(subPath+"/"+p[i],currentDepth+1);
72 for (unsigned j = 0; j < tmp.count();++j) {
73 all.append(p[i]+"/"+tmp[j]);
64 } 74 }
65 return out;
66 } 75 }
76 return all;
77}
78
79QStringList Dir_DirLister::files()const
80{
81 if (m_recursive) {
82 odebug << "Startpfad: "<<m_currentDir.absPath()<<oendl;
83 return recFiles("",0);
84 }
85 return m_currentDir.entryList(m_Filter,QDir::Files|QDir::Readable);
67} 86}
68 87
69void Dir_DirLister::deleteImage( const QString& fl) { 88void Dir_DirLister::deleteImage( const QString& fl) {
70 QFile::remove( fl ); 89 QFile::remove( fl );
71} 90}
72 91
73void Dir_DirLister::thumbNail( const QString& str, int w, int h) { 92void Dir_DirLister::thumbNail( const QString& str, int w, int h) {
74 SlaveMaster::self()->thumbNail( str, w, h ); 93 SlaveMaster::self()->thumbNail( str, w, h );
75} 94}
76 95
77QImage Dir_DirLister::image( const QString& str, Factor f, int m) { 96QImage Dir_DirLister::image( const QString& str, Factor f, int m) {
78 return SlaveMaster::self()->image( str, f, m ); 97 return SlaveMaster::self()->image( str, f, m );
79} 98}
80 99
81void Dir_DirLister::imageInfo( const QString& str) { 100void Dir_DirLister::imageInfo( const QString& str) {
82 SlaveMaster::self()->thumbInfo( str ); 101 SlaveMaster::self()->thumbInfo( str );
83} 102}
84 103
85void Dir_DirLister::fullImageInfo( const QString& str) { 104void Dir_DirLister::fullImageInfo( const QString& str) {
86 SlaveMaster::self()->imageInfo( str ); 105 SlaveMaster::self()->imageInfo( str );
87} 106}
88 107
89QString Dir_DirLister::nameToFname(const QString&name)const 108QString Dir_DirLister::nameToFname(const QString&name)const
90{ 109{
91 return name; 110 return name;
92} 111}
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.h b/noncore/graphics/opie-eye/impl/dir/dir_lister.h
index d6ca6c0..445adbf 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_lister.h
+++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.h
@@ -1,37 +1,45 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 */ 3 */
4 4
5#ifndef DIR_LISTER_INTERFACE_LISTER_H 5#ifndef DIR_LISTER_INTERFACE_LISTER_H
6#define DIR_LISTER_INTERFACE_LISTER_H 6#define DIR_LISTER_INTERFACE_LISTER_H
7 7
8#include <qdir.h> 8#include <qdir.h>
9 9
10#include <iface/dirlister.h> 10#include <iface/dirlister.h>
11 11
12class Config; 12class Config;
13class Dir_DirLister : public PDirLister { 13class Dir_DirLister : public PDirLister {
14 Q_OBJECT 14 Q_OBJECT
15public: 15public:
16 Dir_DirLister( bool ); 16 Dir_DirLister(bool,bool,int);
17 virtual ~Dir_DirLister(){} 17 virtual ~Dir_DirLister(){}
18 18
19 QString defaultPath()const; 19 QString defaultPath()const;
20 QString setStartPath( const QString& ); 20 QString setStartPath( const QString& );
21 QString currentPath()const; 21 QString currentPath()const;
22 QStringList folders()const; 22 QStringList folders()const;
23 QStringList files()const; 23 QStringList files()const;
24 24
25 void deleteImage( const QString& ); 25 void deleteImage( const QString& );
26 void thumbNail( const QString&, int, int ); 26 void thumbNail( const QString&, int, int );
27 QImage image( const QString&, Factor, int ); 27 QImage image( const QString&, Factor, int );
28 void imageInfo( const QString& ); 28 void imageInfo( const QString& );
29 void fullImageInfo( const QString& ); 29 void fullImageInfo( const QString& );
30 virtual QString nameToFname(const QString&name)const; 30 virtual QString nameToFname(const QString&name)const;
31 31
32private: 32private:
33 bool m_allFiles; 33 bool m_allFiles:1;
34 bool m_recursive:1;
35 int m_recDepth;
34 QDir m_currentDir; 36 QDir m_currentDir;
37 //! recursive listing.
38 /*!
39 * \param path this is the offset to the current path. eg. when currentDepth = 0 then it MUST empty
40 */
41 QStringList recFiles(const QString&path,int currentDepth)const;
42 QString m_Filter;
35}; 43};
36 44
37#endif 45#endif