-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 22 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/iface/dirlister.h | 1 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/iface/dirview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_dirview.h | 1 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 41 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 7 |
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 | |||
@@ -194,14 +194,15 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | |||
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*)) ); |
@@ -448,10 +449,16 @@ void PIconView::slotViewChanged( int i) { | |||
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); |
@@ -467,8 +474,13 @@ void PIconView::slotViewChanged( int i) { | |||
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& )), |
@@ -478,9 +490,9 @@ void PIconView::slotViewChanged( int i) { | |||
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 | */ |
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 | |||
@@ -96,7 +96,9 @@ private: | |||
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 | |||
@@ -43,8 +43,9 @@ signals: | |||
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 | ||
48 | protected: | 49 | protected: |
49 | virtual ~PDirLister(); | 50 | virtual ~PDirLister(); |
50 | }; | 51 | }; |
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 | |||
@@ -11,14 +11,16 @@ | |||
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | 12 | ||
13 | class PInterfaceInfo; | 13 | class PInterfaceInfo; |
14 | class PDirLister; | 14 | class PDirLister; |
15 | class QWidget; | ||
15 | 16 | ||
16 | struct PDirView { | 17 | struct 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 | ||
23 | typedef PDirView* (*phunkViewCreateFunc )(const Config& ); | 25 | typedef PDirView* (*phunkViewCreateFunc )(const Config& ); |
24 | typedef QMap<QString,phunkViewCreateFunc> ViewMap; | 26 | typedef QMap<QString,phunkViewCreateFunc> ViewMap; |
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 | |||
@@ -25,4 +25,9 @@ PDirLister* DCIM_DirView::dirLister()const { | |||
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 | |||
30 | QWidget* 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 | |||
@@ -16,9 +16,9 @@ struct DCIM_DirView : public PDirView { | |||
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*); | |
21 | private: | 21 | private: |
22 | mutable PDirLister *m_lister; | 22 | mutable PDirLister *m_lister; |
23 | mutable PInterfaceInfo *m_info ; | 23 | mutable PInterfaceInfo *m_info ; |
24 | }; | 24 | }; |
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 | |||
@@ -30,4 +30,9 @@ PDirLister* Dir_DirView::dirLister()const{ | |||
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 | |||
35 | QWidget* 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 | |||
@@ -13,8 +13,9 @@ struct Dir_DirView : public PDirView { | |||
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*); | ||
17 | private: | 18 | private: |
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; |
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 | |||
@@ -25,4 +25,11 @@ PDirLister* 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 | |||
30 | QWidget* 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 | |||
@@ -6,18 +6,20 @@ | |||
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 | ||
10 | class Doc_DirLister; | ||
10 | 11 | ||
11 | struct Doc_DirView : public PDirView { | 12 | struct 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); | ||
17 | private: | 19 | private: |
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 | ||
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 | |||
@@ -11,8 +11,11 @@ | |||
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 | |||
15 | using namespace Opie::Core; | 18 | using namespace Opie::Core; |
16 | 19 | ||
17 | /* QT */ | 20 | /* QT */ |
18 | #include <qdir.h> | 21 | #include <qdir.h> |
@@ -21,8 +24,9 @@ using namespace Opie::Core; | |||
21 | Doc_DirLister::Doc_DirLister() | 24 | Doc_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&)), |
@@ -39,16 +43,26 @@ Doc_DirLister::Doc_DirLister() | |||
39 | QString Doc_DirLister::defaultPath()const { | 43 | QString Doc_DirLister::defaultPath()const { |
40 | return QString::null; | 44 | return QString::null; |
41 | } | 45 | } |
42 | 46 | ||
47 | bool 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 | |||
43 | QString Doc_DirLister::setStartPath(const QString&) { | 56 | QString 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 | } |
@@ -146,4 +160,29 @@ QString Doc_DirLister::nameToFname(const QString&name)const | |||
146 | 160 | ||
147 | QString Doc_DirLister::dirUp( const QString& p ) const{ | 161 | QString Doc_DirLister::dirUp( const QString& p ) const{ |
148 | return p; | 162 | return p; |
149 | } | 163 | } |
164 | |||
165 | QWidget* 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 | |||
180 | void 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 | |||
@@ -10,8 +10,10 @@ | |||
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qmap.h> | 11 | #include <qmap.h> |
12 | 12 | ||
13 | class Config; | 13 | class Config; |
14 | class AppLnk; | ||
15 | |||
14 | class Doc_DirLister : public PDirLister { | 16 | class Doc_DirLister : public PDirLister { |
15 | Q_OBJECT | 17 | Q_OBJECT |
16 | public: | 18 | public: |
17 | Doc_DirLister(); | 19 | Doc_DirLister(); |
@@ -29,14 +31,19 @@ public: | |||
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 | ||
34 | private: | 37 | private: |
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 | |||
36 | protected slots: | 42 | protected 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 |