summaryrefslogtreecommitdiff
authoralwin <alwin>2004-11-10 23:42:14 (UTC)
committer alwin <alwin>2004-11-10 23:42:14 (UTC)
commit79060b829e9231cddc0acfe2dd2b7da3f13dfbc4 (patch) (unidiff)
tree0e7a6a344bfce1aaf76bedd939a9765014f6ec09
parenta57e46d9b290712fa1ff106a1be133f4f9751a96 (diff)
downloadopie-79060b829e9231cddc0acfe2dd2b7da3f13dfbc4.zip
opie-79060b829e9231cddc0acfe2dd2b7da3f13dfbc4.tar.gz
opie-79060b829e9231cddc0acfe2dd2b7da3f13dfbc4.tar.bz2
lister modules can insert special widgets.
doc_dirlister will insert a category select widget
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp22
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h2
-rw-r--r--noncore/graphics/opie-eye/iface/dirlister.h1
-rw-r--r--noncore/graphics/opie-eye/iface/dirview.h2
-rw-r--r--noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp5
-rw-r--r--noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h2
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp5
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_dirview.h1
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp7
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_dirview.h4
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_lister.cpp41
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_lister.h7
12 files changed, 91 insertions, 8 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 5472ead..948477c 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -150,102 +150,103 @@ namespace {
150 inline QPixmap* IconViewItem::pixmap()const { 150 inline QPixmap* IconViewItem::pixmap()const {
151// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y() 151// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y()
152// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX() 152// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX()
153// << " " << iconView()->contentsY() << oendl; 153// << " " << iconView()->contentsY() << oendl;
154 154
155 if (textOnly()&&!m_isDir) { 155 if (textOnly()&&!m_isDir) {
156 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); 156 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1);
157 return _emptyPix; 157 return _emptyPix;
158 } 158 }
159 if ( m_isDir ) 159 if ( m_isDir )
160 return _dirPix; 160 return _dirPix;
161 else{ 161 else{
162 if (!m_noInfo && !g_stringInf.contains( m_path ) ) { 162 if (!m_noInfo && !g_stringInf.contains( m_path ) ) {
163 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); 163 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this));
164 currentView()->dirLister()->imageInfo( m_path ); 164 currentView()->dirLister()->imageInfo( m_path );
165 } 165 }
166 166
167 m_pix = PPixmapCache::self()->cachedImage( m_path, m_iconsize, m_iconsize ); 167 m_pix = PPixmapCache::self()->cachedImage( m_path, m_iconsize, m_iconsize );
168 if (!m_pix && !g_stringPix.contains( m_path )) { 168 if (!m_pix && !g_stringPix.contains( m_path )) {
169 check_pix(); 169 check_pix();
170 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); 170 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
171 currentView()->dirLister()->thumbNail( m_path, m_iconsize, m_iconsize); 171 currentView()->dirLister()->thumbNail( m_path, m_iconsize, m_iconsize);
172 } 172 }
173 return m_pix ? m_pix : _cpyPix; 173 return m_pix ? m_pix : _cpyPix;
174 } 174 }
175 } 175 }
176 inline void IconViewItem::setText( const QString& str ) { 176 inline void IconViewItem::setText( const QString& str ) {
177 QString text = QIconViewItem::text()+"\n"+str; 177 QString text = QIconViewItem::text()+"\n"+str;
178 m_noInfo = true; 178 m_noInfo = true;
179 QIconViewItem::setText( text ); 179 QIconViewItem::setText( text );
180 } 180 }
181} 181}
182 182
183 183
184/* 184/*
185 * Set up the GUI.. initialize the slave set up gui 185 * Set up the GUI.. initialize the slave set up gui
186 * and also load a dir 186 * and also load a dir
187 */ 187 */
188PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) 188PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
189 : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) 189 : QVBox( wid ), m_cfg( cfg ), m_updatet( false )
190{ 190{
191 { 191 {
192 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 192 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
193 } 193 }
194 m_path = QDir::homeDirPath(); 194 m_path = QDir::homeDirPath();
195 m_mode = 0; 195 m_mode = 0;
196 m_iconsize = 32; 196 m_iconsize = 32;
197 m_internalReset = false; 197 m_internalReset = false;
198 m_customWidget = 0;
198 199
199 QHBox *hbox = new QHBox( this ); 200 m_hbox = new QHBox( this );
200 QLabel* lbl = new QLabel( hbox ); 201 QLabel* lbl = new QLabel( m_hbox );
201 lbl->setText( tr("View as" ) ); 202 lbl->setText( tr("View as" ) );
202 203
203 m_views = new QComboBox( hbox, "View As" ); 204 m_views = new QComboBox( m_hbox, "View As" );
204 205
205 m_view= new QIconView( this ); 206 m_view= new QIconView( this );
206 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 207 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
207 this, SLOT(slotClicked(QIconViewItem*)) ); 208 this, SLOT(slotClicked(QIconViewItem*)) );
208 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), 209 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
209 this, SLOT(slotClicked(QIconViewItem*)) ); 210 this, SLOT(slotClicked(QIconViewItem*)) );
210 211
211 m_view->setArrangement( QIconView::LeftToRight ); 212 m_view->setArrangement( QIconView::LeftToRight );
212 213
213 m_mode = m_cfg->readNumEntry("ListViewMode", 1); 214 m_mode = m_cfg->readNumEntry("ListViewMode", 1);
214 QString lastView = m_cfg->readEntry("LastView",""); 215 QString lastView = m_cfg->readEntry("LastView","");
215 216
216 if (m_mode < 1 || m_mode>3) m_mode = 1; 217 if (m_mode < 1 || m_mode>3) m_mode = 1;
217 218
218 m_view->setItemTextPos( QIconView::Right ); 219 m_view->setItemTextPos( QIconView::Right );
219 if (m_mode >1) { 220 if (m_mode >1) {
220 m_view->setResizeMode(QIconView::Adjust); 221 m_view->setResizeMode(QIconView::Adjust);
221 } else { 222 } else {
222 m_view->setResizeMode(QIconView::Fixed); 223 m_view->setResizeMode(QIconView::Fixed);
223 } 224 }
224 m_iconsize = m_cfg->readNumEntry("iconsize", 32); 225 m_iconsize = m_cfg->readNumEntry("iconsize", 32);
225 if (m_iconsize<12)m_iconsize = 12; 226 if (m_iconsize<12)m_iconsize = 12;
226 if (m_iconsize>64)m_iconsize = 64; 227 if (m_iconsize>64)m_iconsize = 64;
227 228
228 calculateGrid(); 229 calculateGrid();
229 230
230 initKeys(); 231 initKeys();
231 232
232 loadViews(); 233 loadViews();
233 int cc=0; 234 int cc=0;
234 for (; cc<m_views->count();++cc) { 235 for (; cc<m_views->count();++cc) {
235 if (m_views->text(cc)==lastView) { 236 if (m_views->text(cc)==lastView) {
236 break; 237 break;
237 } 238 }
238 } 239 }
239 if (cc<m_views->count()) { 240 if (cc<m_views->count()) {
240 m_views->setCurrentItem(cc); 241 m_views->setCurrentItem(cc);
241 slotViewChanged(cc); 242 slotViewChanged(cc);
242 } else { 243 } else {
243 slotViewChanged(m_views->currentItem()); 244 slotViewChanged(m_views->currentItem());
244 } 245 }
245 connect( m_views, SIGNAL(activated(int)), 246 connect( m_views, SIGNAL(activated(int)),
246 this, SLOT(slotViewChanged(int)) ); 247 this, SLOT(slotViewChanged(int)) );
247} 248}
248 249
249/* 250/*
250 * Unref the slave and save the keyboard manager 251 * Unref the slave and save the keyboard manager
251 */ 252 */
@@ -404,127 +405,138 @@ void PIconView::slotTrash() {
404 405
405/* 406/*
406 * see what views are available 407 * see what views are available
407 */ 408 */
408void PIconView::loadViews() { 409void PIconView::loadViews() {
409 ViewMap::Iterator it; 410 ViewMap::Iterator it;
410 ViewMap* map = viewMap(); 411 ViewMap* map = viewMap();
411 for ( it = map->begin(); it != map->end(); ++it ) 412 for ( it = map->begin(); it != map->end(); ++it )
412 m_views->insertItem( it.key() ); 413 m_views->insertItem( it.key() );
413} 414}
414 415
415void PIconView::resetView() { 416void PIconView::resetView() {
416 m_internalReset = true; 417 m_internalReset = true;
417 // Also invalidate the cache. We can't cancel the operations anyway 418 // Also invalidate the cache. We can't cancel the operations anyway
418 g_stringPix.clear(); 419 g_stringPix.clear();
419 g_stringInf.clear(); 420 g_stringInf.clear();
420 if (m_mode>1) { 421 if (m_mode>1) {
421 int osize = m_iconsize; 422 int osize = m_iconsize;
422 m_iconsize = m_cfg->readNumEntry("iconsize", 32); 423 m_iconsize = m_cfg->readNumEntry("iconsize", 32);
423 if (m_iconsize<12)m_iconsize = 12; 424 if (m_iconsize<12)m_iconsize = 12;
424 if (m_iconsize>64)m_iconsize = 64; 425 if (m_iconsize>64)m_iconsize = 64;
425 if (osize != m_iconsize) { 426 if (osize != m_iconsize) {
426 if (_dirPix){ 427 if (_dirPix){
427 delete _dirPix; 428 delete _dirPix;
428 _dirPix = 0; 429 _dirPix = 0;
429 } 430 }
430 if (_cpyPix){ 431 if (_cpyPix){
431 delete _cpyPix; 432 delete _cpyPix;
432 _cpyPix = 0; 433 _cpyPix = 0;
433 } 434 }
434 calculateGrid(); 435 calculateGrid();
435 } 436 }
436 } else { 437 } else {
437 m_iconsize = 64; 438 m_iconsize = 64;
438 } 439 }
439 slotViewChanged(m_views->currentItem()); 440 slotViewChanged(m_views->currentItem());
440 m_internalReset = false; 441 m_internalReset = false;
441} 442}
442 443
443/* 444/*
444 *swicth view reloadDir and connect signals 445 *swicth view reloadDir and connect signals
445 */ 446 */
446void PIconView::slotViewChanged( int i) { 447void PIconView::slotViewChanged( int i) {
447 if (!m_views->count() ) { 448 if (!m_views->count() ) {
448 setCurrentView( 0l); 449 setCurrentView( 0l);
449 return; 450 return;
450 } 451 }
451 452
453 if (m_customWidget) {
454 delete m_customWidget;
455 m_customWidget = 0;
456 }
452 PDirView* cur = currentView(); 457 PDirView* cur = currentView();
453 if (cur) delete cur; 458 if (cur) {
459 delete cur;
460 }
454 QString str = m_views->text(i); 461 QString str = m_views->text(i);
455 ViewMap* map = viewMap(); 462 ViewMap* map = viewMap();
456 if (!map) { 463 if (!map) {
457 setCurrentView(0l); 464 setCurrentView(0l);
458 return; 465 return;
459 } 466 }
460 467
461 if (map->find(str) == map->end()) { 468 if (map->find(str) == map->end()) {
462 owarn << "Key not found" << oendl; 469 owarn << "Key not found" << oendl;
463 setCurrentView(0l); 470 setCurrentView(0l);
464 return; 471 return;
465 } 472 }
466 473
467 m_cfg->writeEntry("LastView",str); 474 m_cfg->writeEntry("LastView",str);
468 m_cfg->write(); 475 m_cfg->write();
469 cur = (*(*map)[str])(*m_cfg); 476 cur = (*(*map)[str])(*m_cfg);
470 setCurrentView( cur ); 477 setCurrentView( cur );
478 m_customWidget = cur->widget(m_hbox);
479 if (m_customWidget) {
480 odebug << "Got a widget" << oendl;
481 m_customWidget->show();
482 }
471 483
472 /* connect to the signals of the lister */ 484 /* connect to the signals of the lister */
473 PDirLister* lis = cur->dirLister(); 485 PDirLister* lis = cur->dirLister();
474 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), 486 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )),
475 this, SLOT( slotThumbInfo(const QString&, const QString&))); 487 this, SLOT( slotThumbInfo(const QString&, const QString&)));
476 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), 488 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
477 this, SLOT(slotThumbNail(const QString&, const QPixmap&))); 489 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
478 connect(lis, SIGNAL(sig_start()), 490 connect(lis, SIGNAL(sig_start()),
479 this, SLOT(slotStart())); 491 this, SLOT(slotStart()));
480 connect(lis, SIGNAL(sig_end()) , 492 connect(lis, SIGNAL(sig_end()) ,
481 this, SLOT(slotEnd()) ); 493 this, SLOT(slotEnd()) );
482 494 connect(lis,SIGNAL(sig_reloadDir()),this,SLOT(slotReloadDir()));
483 495
484 /* reload now with default Path 496 /* reload now with default Path
485 * but only if it isn't a reset like from setupdlg 497 * but only if it isn't a reset like from setupdlg
486 */ 498 */
487 if (!m_internalReset) { 499 if (!m_internalReset) {
488 m_path = lis->defaultPath(); 500 m_path = lis->defaultPath();
489 } 501 }
490 QTimer::singleShot( 0, this, SLOT(slotReloadDir())); 502 QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
491} 503}
492 504
493 505
494void PIconView::slotReloadDir() { 506void PIconView::slotReloadDir() {
495 slotChangeDir( m_path ); 507 slotChangeDir( m_path );
496} 508}
497 509
498 510
499/* 511/*
500 * add files and folders 512 * add files and folders
501 */ 513 */
502void PIconView::addFolders( const QStringList& lst) { 514void PIconView::addFolders( const QStringList& lst) {
503 QStringList::ConstIterator it; 515 QStringList::ConstIterator it;
504 IconViewItem * _iv; 516 IconViewItem * _iv;
505 517
506 for(it=lst.begin(); it != lst.end(); ++it ) { 518 for(it=lst.begin(); it != lst.end(); ++it ) {
507 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it),m_iconsize, true ); 519 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it),m_iconsize, true );
508 if (m_mode==3) _iv->setTextOnly(true); 520 if (m_mode==3) _iv->setTextOnly(true);
509 } 521 }
510} 522}
511 523
512void PIconView::addFiles( const QStringList& lst) { 524void PIconView::addFiles( const QStringList& lst) {
513 QStringList::ConstIterator it; 525 QStringList::ConstIterator it;
514 IconViewItem * _iv; 526 IconViewItem * _iv;
515 QPixmap*m_pix = 0; 527 QPixmap*m_pix = 0;
516 QString pre = ""; 528 QString pre = "";
517 if (!m_path.isEmpty()) { 529 if (!m_path.isEmpty()) {
518 pre = m_path+"/"; 530 pre = m_path+"/";
519 } 531 }
520 for (it=lst.begin(); it!= lst.end(); ++it ) { 532 for (it=lst.begin(); it!= lst.end(); ++it ) {
521 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize ); 533 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize );
522 _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize ); 534 _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize );
523 if (m_mode==3) { 535 if (m_mode==3) {
524 _iv->setTextOnly(true); 536 _iv->setTextOnly(true);
525 _iv->setPixmap(QPixmap()); 537 _iv->setPixmap(QPixmap());
526 538
527 539
528 540
529 } else { 541 } else {
530 if (m_pix) _iv->setPixmap(*m_pix); 542 if (m_pix) _iv->setPixmap(*m_pix);
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index b018c51..78dda58 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -52,51 +52,53 @@ protected:
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(QResizeEvent*e = 0); 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 int m_iconsize;
100 QHBox*m_hbox;
101 QWidget*m_customWidget;
100}; 102};
101 103
102#endif 104#endif
diff --git a/noncore/graphics/opie-eye/iface/dirlister.h b/noncore/graphics/opie-eye/iface/dirlister.h
index 68e8495..6997f52 100644
--- a/noncore/graphics/opie-eye/iface/dirlister.h
+++ b/noncore/graphics/opie-eye/iface/dirlister.h
@@ -1,52 +1,53 @@
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_DIR_LISTER_H 6#ifndef PHUNK_DIR_LISTER_H
7#define PHUNK_DIR_LISTER_H 7#define PHUNK_DIR_LISTER_H
8 8
9#include <qobject.h> 9#include <qobject.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qstringlist.h> 11#include <qstringlist.h>
12 12
13 13
14class PDirLister : public QObject { 14class PDirLister : public QObject {
15 Q_OBJECT 15 Q_OBJECT
16public: 16public:
17 enum Factor { Width, Height, None }; 17 enum Factor { Width, Height, None };
18 18
19 PDirLister( const char* name ); 19 PDirLister( const char* name );
20 20
21 virtual QString defaultPath()const = 0; 21 virtual QString defaultPath()const = 0;
22 virtual QString setStartPath( const QString& ) = 0; 22 virtual QString setStartPath( const QString& ) = 0;
23 virtual QString currentPath()const = 0; 23 virtual QString currentPath()const = 0;
24 virtual QStringList folders()const = 0; 24 virtual QStringList folders()const = 0;
25 virtual QStringList files()const = 0; 25 virtual QStringList files()const = 0;
26 virtual QString nameToFname(const QString&name)const = 0; 26 virtual QString nameToFname(const QString&name)const = 0;
27 virtual QString dirUp(const QString&)const ; 27 virtual QString dirUp(const QString&)const ;
28 28
29 29
30public slots: 30public slots:
31 virtual void deleteImage( const QString& ) = 0; 31 virtual void deleteImage( const QString& ) = 0;
32 virtual void imageInfo( const QString&) = 0; 32 virtual void imageInfo( const QString&) = 0;
33 virtual void fullImageInfo( const QString& ) = 0; 33 virtual void fullImageInfo( const QString& ) = 0;
34 virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; 34 virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0;
35 virtual QImage image( const QString&, Factor, int max = 0) = 0; 35 virtual QImage image( const QString&, Factor, int max = 0) = 0;
36 36
37 37
38signals: 38signals:
39 void sig_dirchanged(); 39 void sig_dirchanged();
40 void sig_filechanged(); 40 void sig_filechanged();
41 void sig_start(); 41 void sig_start();
42 void sig_end(); 42 void sig_end();
43// If this app ever happens to get multithreaded... 43// If this app ever happens to get multithreaded...
44 void sig_thumbInfo( const QString&, const QString& ); 44 void sig_thumbInfo( const QString&, const QString& );
45 void sig_fullInfo( const QString&, const QString& ); 45 void sig_fullInfo( const QString&, const QString& );
46 void sig_thumbNail( const QString&, const QPixmap& ); 46 void sig_thumbNail( const QString&, const QPixmap& );
47 void sig_reloadDir();
47 48
48protected: 49protected:
49 virtual ~PDirLister(); 50 virtual ~PDirLister();
50}; 51};
51 52
52#endif 53#endif
diff --git a/noncore/graphics/opie-eye/iface/dirview.h b/noncore/graphics/opie-eye/iface/dirview.h
index 20d9062..3c05b60 100644
--- a/noncore/graphics/opie-eye/iface/dirview.h
+++ b/noncore/graphics/opie-eye/iface/dirview.h
@@ -1,40 +1,42 @@
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_DIR_VIEW_H 6#ifndef PHUNK_DIR_VIEW_H
7#define PHUNK_DIR_VIEW_H 7#define PHUNK_DIR_VIEW_H
8 8
9#include <qmap.h> 9#include <qmap.h>
10 10
11#include <qpe/config.h> 11#include <qpe/config.h>
12 12
13class PInterfaceInfo; 13class PInterfaceInfo;
14class PDirLister; 14class PDirLister;
15class QWidget;
15 16
16struct PDirView { 17struct PDirView {
17 PDirView( const Config& ); 18 PDirView( const Config& );
18 virtual ~PDirView(); 19 virtual ~PDirView();
19 virtual PInterfaceInfo* interfaceInfo()const = 0; 20 virtual PInterfaceInfo* interfaceInfo()const = 0;
20 virtual PDirLister* dirLister()const = 0; 21 virtual PDirLister* dirLister()const = 0;
22 virtual QWidget* widget(QWidget*)=0;
21}; 23};
22 24
23typedef PDirView* (*phunkViewCreateFunc )(const Config& ); 25typedef PDirView* (*phunkViewCreateFunc )(const Config& );
24typedef QMap<QString,phunkViewCreateFunc> ViewMap; 26typedef QMap<QString,phunkViewCreateFunc> ViewMap;
25 27
26ViewMap* viewMap(); 28ViewMap* viewMap();
27PDirView* currentView(); 29PDirView* currentView();
28void setCurrentView( PDirView* ); 30void setCurrentView( PDirView* );
29 31
30 32
31 33
32#define PHUNK_VIEW_INTERFACE( NAME, IMPL ) \ 34#define PHUNK_VIEW_INTERFACE( NAME, IMPL ) \
33 static PDirView *create_ ## IMPL( const Config& cfg ) { \ 35 static PDirView *create_ ## IMPL( const Config& cfg ) { \
34 return new IMPL( cfg ); \ 36 return new IMPL( cfg ); \
35 } \ 37 } \
36 static ViewMap::Iterator dummy_ ## IMPL = viewMap()->insert( NAME, create_ ## IMPL ); 38 static ViewMap::Iterator dummy_ ## IMPL = viewMap()->insert( NAME, create_ ## IMPL );
37 39
38 40
39 41
40#endif 42#endif
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp
index e55c27a..3f6044f 100644
--- a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp
+++ b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp
@@ -1,28 +1,33 @@
1#include "dcim_dirview.h" 1#include "dcim_dirview.h"
2 2
3#include "dcim_lister.h" 3#include "dcim_lister.h"
4#include "dcim_ifaceinfo.h" 4#include "dcim_ifaceinfo.h"
5 5
6PHUNK_VIEW_INTERFACE( "Digital Camera", DCIM_DirView ); 6PHUNK_VIEW_INTERFACE( "Digital Camera", DCIM_DirView );
7 7
8DCIM_DirView::DCIM_DirView( const Config& cfg ) 8DCIM_DirView::DCIM_DirView( const Config& cfg )
9 : PDirView( cfg ), m_lister( 0l ), m_info( 0l ) 9 : PDirView( cfg ), m_lister( 0l ), m_info( 0l )
10{} 10{}
11 11
12DCIM_DirView::~DCIM_DirView() 12DCIM_DirView::~DCIM_DirView()
13{} 13{}
14 14
15PInterfaceInfo* DCIM_DirView::interfaceInfo()const { 15PInterfaceInfo* DCIM_DirView::interfaceInfo()const {
16 if ( !m_info ) 16 if ( !m_info )
17 m_info = new DCIM_InterfaceInfo; 17 m_info = new DCIM_InterfaceInfo;
18 18
19 return m_info; 19 return m_info;
20} 20}
21 21
22 22
23PDirLister* DCIM_DirView::dirLister()const { 23PDirLister* DCIM_DirView::dirLister()const {
24 if ( !m_lister ) 24 if ( !m_lister )
25 m_lister = new DCIM_DirLister(); 25 m_lister = new DCIM_DirLister();
26 26
27 return m_lister; 27 return m_lister;
28} 28}
29
30QWidget* DCIM_DirView::widget(QWidget*)
31{
32 return 0L;
33}
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h
index 7fc38ec..8394b34 100644
--- a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h
+++ b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h
@@ -1,26 +1,26 @@
1/* 1/*
2 * GPLv2 only zecke@handhelds.org 2 * GPLv2 only zecke@handhelds.org
3 */ 3 */
4 4
5#ifndef DCIM_DIR_VIEW_H 5#ifndef DCIM_DIR_VIEW_H
6#define DCIM_DIR_VIEW_H 6#define DCIM_DIR_VIEW_H
7 7
8#include <iface/dirview.h> 8#include <iface/dirview.h>
9 9
10/* 10/*
11 * Implementation for USB Host Digital Cameras 11 * Implementation for USB Host Digital Cameras
12 * like my Casio QV 500 and boring Yakumo 12 * like my Casio QV 500 and boring Yakumo
13 */ 13 */
14struct DCIM_DirView : public PDirView { 14struct DCIM_DirView : public PDirView {
15 DCIM_DirView( const Config& ); 15 DCIM_DirView( const Config& );
16 ~DCIM_DirView(); 16 ~DCIM_DirView();
17 17
18 PInterfaceInfo* interfaceInfo()const; 18 PInterfaceInfo* interfaceInfo()const;
19 PDirLister * dirLister ()const; 19 PDirLister * dirLister ()const;
20 20 virtual QWidget* widget(QWidget*);
21private: 21private:
22 mutable PDirLister *m_lister; 22 mutable PDirLister *m_lister;
23 mutable PInterfaceInfo *m_info ; 23 mutable PInterfaceInfo *m_info ;
24}; 24};
25 25
26#endif 26#endif
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
index fc502d4..9c2c840 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
@@ -1,33 +1,38 @@
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", false); 11 m_cfg = cfg.readBoolEntry( "Dir_Check_All_Files", false);
12 m_recursive = cfg.readBoolEntry( "Dir_Check_Recursive_Files", false); 12 m_recursive = cfg.readBoolEntry( "Dir_Check_Recursive_Files", false);
13 m_recursive_depth = cfg.readNumEntry("Dir_Recursive_Files_Depth",10); 13 m_recursive_depth = cfg.readNumEntry("Dir_Recursive_Files_Depth",10);
14 m_lister = 0; 14 m_lister = 0;
15 m_info = 0; 15 m_info = 0;
16} 16}
17 17
18Dir_DirView::~Dir_DirView() { 18Dir_DirView::~Dir_DirView() {
19} 19}
20 20
21PInterfaceInfo* Dir_DirView::interfaceInfo()const{ 21PInterfaceInfo* Dir_DirView::interfaceInfo()const{
22 if (!m_info ) { 22 if (!m_info ) {
23 m_info = new DirInterfaceInfo; 23 m_info = new DirInterfaceInfo;
24 } 24 }
25 return m_info; 25 return m_info;
26} 26}
27 27
28PDirLister* Dir_DirView::dirLister()const{ 28PDirLister* Dir_DirView::dirLister()const{
29 if (!m_lister ) { 29 if (!m_lister ) {
30 m_lister = new Dir_DirLister(m_cfg,m_recursive,m_recursive_depth); 30 m_lister = new Dir_DirLister(m_cfg,m_recursive,m_recursive_depth);
31 } 31 }
32 return m_lister; 32 return m_lister;
33} 33}
34
35QWidget* Dir_DirView::widget(QWidget*)
36{
37 return 0L;
38} \ No newline at end of file
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
index 89cf6c9..ae53a5c 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
+++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
@@ -1,26 +1,27 @@
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;
17 virtual QWidget* widget(QWidget*);
17private: 18private:
18 bool m_cfg : 1; 19 bool m_cfg : 1;
19 bool m_recursive:1; 20 bool m_recursive:1;
20 int m_recursive_depth; 21 int m_recursive_depth;
21 mutable PDirLister* m_lister; 22 mutable PDirLister* m_lister;
22 mutable PInterfaceInfo *m_info; 23 mutable PInterfaceInfo *m_info;
23}; 24};
24 25
25 26
26#endif 27#endif
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp
index 0d6e25f..2cc897b 100644
--- a/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp
+++ b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp
@@ -1,28 +1,35 @@
1#include "doc_lister.h" 1#include "doc_lister.h"
2#include "doc_ifaceinfo.h" 2#include "doc_ifaceinfo.h"
3#include "doc_dirview.h" 3#include "doc_dirview.h"
4 4
5PHUNK_VIEW_INTERFACE("Document View", Doc_DirView ); 5PHUNK_VIEW_INTERFACE("Document View", Doc_DirView );
6 6
7 7
8Doc_DirView::Doc_DirView( const Config& cfg) 8Doc_DirView::Doc_DirView( const Config& cfg)
9 : PDirView(cfg) 9 : PDirView(cfg)
10{ 10{
11 m_lister = 0; 11 m_lister = 0;
12 m_info = 0; 12 m_info = 0;
13} 13}
14 14
15Doc_DirView::~Doc_DirView() { 15Doc_DirView::~Doc_DirView() {
16} 16}
17 17
18PInterfaceInfo* Doc_DirView::interfaceInfo()const{ 18PInterfaceInfo* Doc_DirView::interfaceInfo()const{
19 if (!m_info ) 19 if (!m_info )
20 m_info =new DocInterfaceInfo; 20 m_info =new DocInterfaceInfo;
21 return m_info; 21 return m_info;
22} 22}
23 23
24PDirLister* Doc_DirView::dirLister()const{ 24PDirLister* Doc_DirView::dirLister()const{
25 if (!m_lister ) 25 if (!m_lister )
26 m_lister = new Doc_DirLister(); 26 m_lister = new Doc_DirLister();
27 return m_lister; 27 return m_lister;
28} 28}
29
30QWidget* Doc_DirView::widget(QWidget*parent)
31{
32 if (!m_lister)
33 dirLister();
34 return m_lister->widget(parent);
35}
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.h b/noncore/graphics/opie-eye/impl/doc/doc_dirview.h
index 3a2fd71..55ba6f2 100644
--- a/noncore/graphics/opie-eye/impl/doc/doc_dirview.h
+++ b/noncore/graphics/opie-eye/impl/doc/doc_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 DOC_DIR_VIEW_H 5#ifndef DOC_DIR_VIEW_H
6#define DOC_DIR_VIEW_H 6#define DOC_DIR_VIEW_H
7 7
8#include <iface/dirview.h> 8#include <iface/dirview.h>
9 9
10class Doc_DirLister;
10 11
11struct Doc_DirView : public PDirView { 12struct Doc_DirView : public PDirView {
12 Doc_DirView( const Config& ); 13 Doc_DirView( const Config& );
13 ~Doc_DirView(); 14 ~Doc_DirView();
14 15
15 PInterfaceInfo* interfaceInfo()const; 16 PInterfaceInfo* interfaceInfo()const;
16 PDirLister* dirLister()const; 17 PDirLister* dirLister()const;
18 QWidget* widget(QWidget*parent);
17private: 19private:
18 bool m_cfg : 1; 20 bool m_cfg : 1;
19 mutable PDirLister* m_lister; 21 mutable Doc_DirLister* 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/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp
index 722fb95..d60149f 100644
--- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp
+++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp
@@ -1,98 +1,112 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 */ 3 */
4 4
5#include "doc_lister.h" 5#include "doc_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>
13#include <qpe/applnk.h> 13#include <qpe/applnk.h>
14 14
15#include <qtopia/private/categories.h>
16#include <qtopia/categoryselect.h>
17
15using namespace Opie::Core; 18using namespace Opie::Core;
16 19
17/* QT */ 20/* QT */
18#include <qdir.h> 21#include <qdir.h>
19#include <qfileinfo.h> 22#include <qfileinfo.h>
20 23
21Doc_DirLister::Doc_DirLister() 24Doc_DirLister::Doc_DirLister()
22 : PDirLister( "doc_dir_lister" ) 25 : PDirLister( "doc_dir_lister" )
23{ 26{
24 /* connect the signals */ 27 /* connect the signals */
28 m_catFilter = 0;
25 SlaveMaster* master = SlaveMaster::self(); 29 SlaveMaster* master = SlaveMaster::self();
26 connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); 30 connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) );
27 connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); 31 connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) );
28 connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), 32 connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)),
29 this, SLOT(slotThumbInfo(const QString&, const QString&)) ); 33 this, SLOT(slotThumbInfo(const QString&, const QString&)) );
30 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), 34 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
31 this, SLOT(slotFullInfo(const QString&, const QString&)) ); 35 this, SLOT(slotFullInfo(const QString&, const QString&)) );
32 connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), 36 connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)),
33 this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); 37 this, SLOT(slotThumbNail(const QString&, const QPixmap&)) );
34 38
35 m_namemap.clear(); 39 m_namemap.clear();
36 m_filemap.clear(); 40 m_filemap.clear();
37} 41}
38 42
39QString Doc_DirLister::defaultPath()const { 43QString Doc_DirLister::defaultPath()const {
40 return QString::null; 44 return QString::null;
41} 45}
42 46
47bool Doc_DirLister::matchCat(const AppLnk* app)
48{
49 if (!app) return false;
50 if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) {
51 return true;
52 }
53 return false;
54}
55
43QString Doc_DirLister::setStartPath(const QString&) { 56QString Doc_DirLister::setStartPath(const QString&) {
44 static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); 57 static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png");
45 if (m_namemap.isEmpty()) { 58 if (m_namemap.isEmpty()) {
46 DocLnkSet ds; 59 DocLnkSet ds;
47 Global::findDocuments(&ds,Mtype_str); 60 Global::findDocuments(&ds,Mtype_str);
48 QListIterator<DocLnk> dit(ds.children()); 61 QListIterator<DocLnk> dit(ds.children());
49 for( ; dit.current(); ++dit) { 62 for( ; dit.current(); ++dit) {
50// if (! (*dit)->isValid()) continue; 63 if (! (*dit)->isValid()) continue;
64 if (!matchCat((*dit))) continue;
51 m_namemap[(*dit)->name()]=(*dit)->file(); 65 m_namemap[(*dit)->name()]=(*dit)->file();
52 m_filemap[(*dit)->file()]=(*dit)->name(); 66 m_filemap[(*dit)->file()]=(*dit)->name();
53 } 67 }
54 } 68 }
55 return QString::null; 69 return QString::null;
56} 70}
57 71
58QString Doc_DirLister::currentPath()const { 72QString Doc_DirLister::currentPath()const {
59 return QString::null; 73 return QString::null;
60} 74}
61 75
62 76
63QStringList Doc_DirLister::folders()const { 77QStringList Doc_DirLister::folders()const {
64 return QStringList(); 78 return QStringList();
65} 79}
66 80
67QStringList Doc_DirLister::files()const { 81QStringList Doc_DirLister::files()const {
68 QStringList out; 82 QStringList out;
69 QMap<QString,QString>::ConstIterator it; 83 QMap<QString,QString>::ConstIterator it;
70 for (it = m_namemap.begin();it != m_namemap.end();++it) { 84 for (it = m_namemap.begin();it != m_namemap.end();++it) {
71 out.append(it.key()); 85 out.append(it.key());
72 } 86 }
73 return out; 87 return out;
74} 88}
75 89
76void Doc_DirLister::deleteImage( const QString& ) 90void Doc_DirLister::deleteImage( const QString& )
77{ 91{
78} 92}
79 93
80void Doc_DirLister::thumbNail( const QString& str, int w, int h) { 94void Doc_DirLister::thumbNail( const QString& str, int w, int h) {
81 if (m_namemap.find(str)==m_namemap.end()) { 95 if (m_namemap.find(str)==m_namemap.end()) {
82 return; 96 return;
83 } 97 }
84 QString fname = m_namemap[str]; 98 QString fname = m_namemap[str];
85 SlaveMaster::self()->thumbNail( fname, w, h ); 99 SlaveMaster::self()->thumbNail( fname, w, h );
86} 100}
87 101
88QImage Doc_DirLister::image( const QString& str, Factor f, int m) { 102QImage Doc_DirLister::image( const QString& str, Factor f, int m) {
89 if (m_namemap.find(str)==m_namemap.end()) { 103 if (m_namemap.find(str)==m_namemap.end()) {
90 return QImage(); 104 return QImage();
91 } 105 }
92 QString fname = m_namemap[str]; 106 QString fname = m_namemap[str];
93 return SlaveMaster::self()->image( fname, f, m ); 107 return SlaveMaster::self()->image( fname, f, m );
94} 108}
95 109
96void Doc_DirLister::imageInfo( const QString& str) { 110void Doc_DirLister::imageInfo( const QString& str) {
97 if (m_namemap.find(str)==m_namemap.end()) { 111 if (m_namemap.find(str)==m_namemap.end()) {
98 return; 112 return;
@@ -102,48 +116,73 @@ void Doc_DirLister::imageInfo( const QString& str) {
102} 116}
103 117
104void Doc_DirLister::fullImageInfo( const QString& str) { 118void Doc_DirLister::fullImageInfo( const QString& str) {
105 if (m_namemap.find(str)==m_namemap.end()) { 119 if (m_namemap.find(str)==m_namemap.end()) {
106 return; 120 return;
107 } 121 }
108 QString fname = m_namemap[str]; 122 QString fname = m_namemap[str];
109 SlaveMaster::self()->imageInfo( fname ); 123 SlaveMaster::self()->imageInfo( fname );
110} 124}
111 125
112void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) 126void Doc_DirLister::slotFullInfo(const QString&f, const QString&t)
113{ 127{
114 if (m_filemap.find(f)==m_filemap.end()) { 128 if (m_filemap.find(f)==m_filemap.end()) {
115 return; 129 return;
116 } 130 }
117 QString name = m_filemap[f]; 131 QString name = m_filemap[f];
118 emit sig_fullInfo(name, t); 132 emit sig_fullInfo(name, t);
119} 133}
120 134
121void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) 135void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t)
122{ 136{
123 if (m_filemap.find(f)==m_filemap.end()) { 137 if (m_filemap.find(f)==m_filemap.end()) {
124 return; 138 return;
125 } 139 }
126 QString name = m_filemap[f]; 140 QString name = m_filemap[f];
127 emit sig_thumbInfo(name, t); 141 emit sig_thumbInfo(name, t);
128} 142}
129 143
130void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) 144void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p)
131{ 145{
132 if (m_filemap.find(f)==m_filemap.end()) { 146 if (m_filemap.find(f)==m_filemap.end()) {
133 return; 147 return;
134 } 148 }
135 QString name = m_filemap[f]; 149 QString name = m_filemap[f];
136 emit sig_thumbNail(name, p); 150 emit sig_thumbNail(name, p);
137} 151}
138 152
139QString Doc_DirLister::nameToFname(const QString&name)const 153QString Doc_DirLister::nameToFname(const QString&name)const
140{ 154{
141 if (m_namemap.find(name)==m_namemap.end()) { 155 if (m_namemap.find(name)==m_namemap.end()) {
142 return QString::null; 156 return QString::null;
143 } 157 }
144 return m_namemap[name]; 158 return m_namemap[name];
145} 159}
146 160
147QString Doc_DirLister::dirUp( const QString& p ) const{ 161QString Doc_DirLister::dirUp( const QString& p ) const{
148 return p; 162 return p;
149} 163}
164
165QWidget* Doc_DirLister::widget(QWidget*parent)
166{
167 CategorySelect * catmb = new CategorySelect(parent);
168 Categories cats( 0 );
169 cats.load( categoryFileName() );
170 QArray<int> vl( 0 );
171 catmb->setCategories( vl, "Document View", // No tr
172 "Document View" );
173 catmb->setRemoveCategoryEdit( TRUE );
174 catmb->setAllCategories( TRUE );
175 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
176 catmb->setCurrentCategory(-2);
177 return catmb;
178}
179
180void Doc_DirLister::showCategory(int which)
181{
182 Categories cat;
183 cat.load( categoryFileName() );
184 m_catFilter = which==-2?0:which;
185 m_namemap.clear();
186 setStartPath("");
187 emit sig_reloadDir();
188}
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h
index 5884a35..e148ac0 100644
--- a/noncore/graphics/opie-eye/impl/doc/doc_lister.h
+++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h
@@ -1,42 +1,49 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 */ 3 */
4 4
5#ifndef DOC_LISTER_INTERFACE_LISTER_H 5#ifndef DOC_LISTER_INTERFACE_LISTER_H
6#define DOC_LISTER_INTERFACE_LISTER_H 6#define DOC_LISTER_INTERFACE_LISTER_H
7 7
8#include <iface/dirlister.h> 8#include <iface/dirlister.h>
9 9
10#include <qstring.h> 10#include <qstring.h>
11#include <qmap.h> 11#include <qmap.h>
12 12
13class Config; 13class Config;
14class AppLnk;
15
14class Doc_DirLister : public PDirLister { 16class Doc_DirLister : public PDirLister {
15 Q_OBJECT 17 Q_OBJECT
16public: 18public:
17 Doc_DirLister(); 19 Doc_DirLister();
18 virtual ~Doc_DirLister(){} 20 virtual ~Doc_DirLister(){}
19 21
20 QString defaultPath()const; 22 QString defaultPath()const;
21 QString setStartPath( const QString& ); 23 QString setStartPath( const QString& );
22 QString currentPath()const; 24 QString currentPath()const;
23 QStringList folders()const; 25 QStringList folders()const;
24 QStringList files()const; 26 QStringList files()const;
25 27
26 void deleteImage( const QString& ); 28 void deleteImage( const QString& );
27 void thumbNail( const QString&, int, int ); 29 void thumbNail( const QString&, int, int );
28 QImage image( const QString&, Factor, int ); 30 QImage image( const QString&, Factor, int );
29 void imageInfo( const QString& ); 31 void imageInfo( const QString& );
30 void fullImageInfo( const QString& ); 32 void fullImageInfo( const QString& );
31 virtual QString nameToFname(const QString&name)const; 33 virtual QString nameToFname(const QString&name)const;
32 QString dirUp( const QString& )const; 34 QString dirUp( const QString& )const;
35 QWidget* widget(QWidget*parent);
33 36
34private: 37private:
35 QMap<QString,QString> m_namemap,m_filemap; 38 QMap<QString,QString> m_namemap,m_filemap;
39 int m_catFilter;
40 bool matchCat(const AppLnk* app);
41
36protected slots: 42protected slots:
37 virtual void slotFullInfo(const QString&, const QString&); 43 virtual void slotFullInfo(const QString&, const QString&);
38 virtual void slotThumbInfo(const QString&, const QString&); 44 virtual void slotThumbInfo(const QString&, const QString&);
39 virtual void slotThumbNail(const QString&, const QPixmap&); 45 virtual void slotThumbNail(const QString&, const QPixmap&);
46 virtual void showCategory(int);
40}; 47};
41 48
42#endif 49#endif