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
@@ -197,8 +197,9 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
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
@@ -451,4 +452,10 @@ void PIconView::slotViewChanged( int i) {
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);
@@ -470,2 +477,7 @@ void PIconView::slotViewChanged( int i) {
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
@@ -481,3 +493,3 @@ void PIconView::slotViewChanged( int i) {
481 this, SLOT(slotEnd()) ); 493 this, SLOT(slotEnd()) );
482 494 connect(lis,SIGNAL(sig_reloadDir()),this,SLOT(slotReloadDir()));
483 495
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
@@ -99,2 +99,4 @@ private:
99 int m_iconsize; 99 int m_iconsize;
100 QHBox*m_hbox;
101 QWidget*m_customWidget;
100}; 102};
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
@@ -46,2 +46,3 @@ signals:
46 void sig_thumbNail( const QString&, const QPixmap& ); 46 void sig_thumbNail( const QString&, const QPixmap& );
47 void sig_reloadDir();
47 48
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
@@ -14,2 +14,3 @@ class PInterfaceInfo;
14class PDirLister; 14class PDirLister;
15class QWidget;
15 16
@@ -20,2 +21,3 @@ struct PDirView {
20 virtual PDirLister* dirLister()const = 0; 21 virtual PDirLister* dirLister()const = 0;
22 virtual QWidget* widget(QWidget*)=0;
21}; 23};
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
@@ -28 +28,6 @@ PDirLister* DCIM_DirView::dirLister()const {
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
@@ -19,3 +19,3 @@ struct DCIM_DirView : public PDirView {
19 PDirLister * dirLister ()const; 19 PDirLister * dirLister ()const;
20 20 virtual QWidget* widget(QWidget*);
21private: 21private:
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
@@ -33 +33,6 @@ PDirLister* Dir_DirView::dirLister()const{
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
@@ -16,2 +16,3 @@ struct Dir_DirView : public PDirView {
16 PDirLister* dirLister()const; 16 PDirLister* dirLister()const;
17 virtual QWidget* widget(QWidget*);
17private: 18private:
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
@@ -28 +28,8 @@ PDirLister* Doc_DirView::dirLister()const{
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
@@ -9,2 +9,3 @@
9 9
10class Doc_DirLister;
10 11
@@ -16,5 +17,6 @@ struct Doc_DirView : public PDirView {
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;
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
@@ -14,2 +14,5 @@
14 14
15#include <qtopia/private/categories.h>
16#include <qtopia/categoryselect.h>
17
15using namespace Opie::Core; 18using namespace Opie::Core;
@@ -24,2 +27,3 @@ Doc_DirLister::Doc_DirLister()
24 /* connect the signals */ 27 /* connect the signals */
28 m_catFilter = 0;
25 SlaveMaster* master = SlaveMaster::self(); 29 SlaveMaster* master = SlaveMaster::self();
@@ -42,2 +46,11 @@ QString Doc_DirLister::defaultPath()const {
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&) {
@@ -49,3 +62,4 @@ QString Doc_DirLister::setStartPath(const QString&) {
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();
@@ -149 +163,26 @@ QString Doc_DirLister::dirUp( const QString& p ) const{
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
@@ -13,2 +13,4 @@
13class Config; 13class Config;
14class AppLnk;
15
14class Doc_DirLister : public PDirLister { 16class Doc_DirLister : public PDirLister {
@@ -32,2 +34,3 @@ public:
32 QString dirUp( const QString& )const; 34 QString dirUp( const QString& )const;
35 QWidget* widget(QWidget*parent);
33 36
@@ -35,2 +38,5 @@ 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
36protected slots: 42protected slots:
@@ -39,2 +45,3 @@ protected slots:
39 virtual void slotThumbNail(const QString&, const QPixmap&); 45 virtual void slotThumbNail(const QString&, const QPixmap&);
46 virtual void showCategory(int);
40}; 47};