Diffstat (limited to 'noncore/graphics/opie-eye/impl/doc') (more/less context) (ignore whitespace changes)
4 files changed, 57 insertions, 2 deletions
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 @@ -26,3 +26,10 @@ PDirLister* Doc_DirView::dirLister()const{ m_lister = new Doc_DirLister(); return m_lister; } + +QWidget* Doc_DirView::widget(QWidget*parent) +{ + if (!m_lister) + dirLister(); + return m_lister->widget(parent); +} 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 @@ -7,6 +7,7 @@ #include <iface/dirview.h> +class Doc_DirLister; struct Doc_DirView : public PDirView { Doc_DirView( const Config& ); @@ -14,9 +15,10 @@ struct Doc_DirView : public PDirView { PInterfaceInfo* interfaceInfo()const; PDirLister* dirLister()const; + QWidget* widget(QWidget*parent); private: bool m_cfg : 1; - mutable PDirLister* m_lister; + mutable Doc_DirLister* m_lister; 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 @@ -12,6 +12,9 @@ #include <qpe/qpeapplication.h> #include <qpe/applnk.h> +#include <qtopia/private/categories.h> +#include <qtopia/categoryselect.h> + using namespace Opie::Core; /* QT */ @@ -22,6 +25,7 @@ Doc_DirLister::Doc_DirLister() : PDirLister( "doc_dir_lister" ) { /* connect the signals */ + m_catFilter = 0; SlaveMaster* master = SlaveMaster::self(); connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); @@ -40,6 +44,15 @@ QString Doc_DirLister::defaultPath()const { return QString::null; } +bool Doc_DirLister::matchCat(const AppLnk* app) +{ + if (!app) return false; + if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) { + return true; + } + return false; +} + QString Doc_DirLister::setStartPath(const QString&) { static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); if (m_namemap.isEmpty()) { @@ -47,7 +60,8 @@ QString Doc_DirLister::setStartPath(const QString&) { Global::findDocuments(&ds,Mtype_str); QListIterator<DocLnk> dit(ds.children()); for( ; dit.current(); ++dit) { -// if (! (*dit)->isValid()) continue; + if (! (*dit)->isValid()) continue; + if (!matchCat((*dit))) continue; m_namemap[(*dit)->name()]=(*dit)->file(); m_filemap[(*dit)->file()]=(*dit)->name(); } @@ -147,3 +161,28 @@ QString Doc_DirLister::nameToFname(const QString&name)const QString Doc_DirLister::dirUp( const QString& p ) const{ return p; } + +QWidget* Doc_DirLister::widget(QWidget*parent) +{ + CategorySelect * catmb = new CategorySelect(parent); + Categories cats( 0 ); + cats.load( categoryFileName() ); + QArray<int> vl( 0 ); + catmb->setCategories( vl, "Document View", // No tr + "Document View" ); + catmb->setRemoveCategoryEdit( TRUE ); + catmb->setAllCategories( TRUE ); + connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); + catmb->setCurrentCategory(-2); + return catmb; +} + +void Doc_DirLister::showCategory(int which) +{ + Categories cat; + cat.load( categoryFileName() ); + m_catFilter = which==-2?0:which; + m_namemap.clear(); + setStartPath(""); + emit sig_reloadDir(); +} 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 @@ -11,6 +11,8 @@ #include <qmap.h> class Config; +class AppLnk; + class Doc_DirLister : public PDirLister { Q_OBJECT public: @@ -30,13 +32,18 @@ public: void fullImageInfo( const QString& ); virtual QString nameToFname(const QString&name)const; QString dirUp( const QString& )const; + QWidget* widget(QWidget*parent); private: QMap<QString,QString> m_namemap,m_filemap; + int m_catFilter; + bool matchCat(const AppLnk* app); + protected slots: virtual void slotFullInfo(const QString&, const QString&); virtual void slotThumbInfo(const QString&, const QString&); virtual void slotThumbNail(const QString&, const QPixmap&); + virtual void showCategory(int); }; #endif |