summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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
@@ -190,22 +190,23 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
{
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
}
m_path = QDir::homeDirPath();
m_mode = 0;
m_iconsize = 32;
m_internalReset = false;
+ m_customWidget = 0;
- QHBox *hbox = new QHBox( this );
- QLabel* lbl = new QLabel( hbox );
+ m_hbox = new QHBox( this );
+ QLabel* lbl = new QLabel( m_hbox );
lbl->setText( tr("View as" ) );
- m_views = new QComboBox( hbox, "View As" );
+ m_views = new QComboBox( m_hbox, "View As" );
m_view= new QIconView( this );
connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
this, SLOT(slotClicked(QIconViewItem*)) );
connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
this, SLOT(slotClicked(QIconViewItem*)) );
m_view->setArrangement( QIconView::LeftToRight );
@@ -444,18 +445,24 @@ void PIconView::resetView() {
*swicth view reloadDir and connect signals
*/
void PIconView::slotViewChanged( int i) {
if (!m_views->count() ) {
setCurrentView( 0l);
return;
}
+ if (m_customWidget) {
+ delete m_customWidget;
+ m_customWidget = 0;
+ }
PDirView* cur = currentView();
- if (cur) delete cur;
+ if (cur) {
+ delete cur;
+ }
QString str = m_views->text(i);
ViewMap* map = viewMap();
if (!map) {
setCurrentView(0l);
return;
}
if (map->find(str) == map->end()) {
@@ -463,28 +470,33 @@ void PIconView::slotViewChanged( int i) {
setCurrentView(0l);
return;
}
m_cfg->writeEntry("LastView",str);
m_cfg->write();
cur = (*(*map)[str])(*m_cfg);
setCurrentView( cur );
+ m_customWidget = cur->widget(m_hbox);
+ if (m_customWidget) {
+ odebug << "Got a widget" << oendl;
+ m_customWidget->show();
+ }
/* connect to the signals of the lister */
PDirLister* lis = cur->dirLister();
connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )),
this, SLOT( slotThumbInfo(const QString&, const QString&)));
connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
connect(lis, SIGNAL(sig_start()),
this, SLOT(slotStart()));
connect(lis, SIGNAL(sig_end()) ,
this, SLOT(slotEnd()) );
-
+ connect(lis,SIGNAL(sig_reloadDir()),this,SLOT(slotReloadDir()));
/* reload now with default Path
* but only if it isn't a reset like from setupdlg
*/
if (!m_internalReset) {
m_path = lis->defaultPath();
}
QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
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
@@ -92,11 +92,13 @@ private:
Opie::Core::OConfig *m_cfg;
QComboBox* m_views;
QIconView* m_view;
QString m_path;
bool m_updatet : 1;
int m_mode;
bool m_internalReset:1;
int m_iconsize;
+ QHBox*m_hbox;
+ QWidget*m_customWidget;
};
#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
@@ -39,14 +39,15 @@ signals:
void sig_dirchanged();
void sig_filechanged();
void sig_start();
void sig_end();
// If this app ever happens to get multithreaded...
void sig_thumbInfo( const QString&, const QString& );
void sig_fullInfo( const QString&, const QString& );
void sig_thumbNail( const QString&, const QPixmap& );
+ void sig_reloadDir();
protected:
virtual ~PDirLister();
};
#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
@@ -7,22 +7,24 @@
#define PHUNK_DIR_VIEW_H
#include <qmap.h>
#include <qpe/config.h>
class PInterfaceInfo;
class PDirLister;
+class QWidget;
struct PDirView {
PDirView( const Config& );
virtual ~PDirView();
virtual PInterfaceInfo* interfaceInfo()const = 0;
virtual PDirLister* dirLister()const = 0;
+ virtual QWidget* widget(QWidget*)=0;
};
typedef PDirView* (*phunkViewCreateFunc )(const Config& );
typedef QMap<QString,phunkViewCreateFunc> ViewMap;
ViewMap* viewMap();
PDirView* currentView();
void setCurrentView( PDirView* );
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
@@ -21,8 +21,13 @@ PInterfaceInfo* DCIM_DirView::interfaceInfo()const {
PDirLister* DCIM_DirView::dirLister()const {
if ( !m_lister )
m_lister = new DCIM_DirLister();
return m_lister;
}
+
+QWidget* DCIM_DirView::widget(QWidget*)
+{
+ return 0L;
+}
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
@@ -12,15 +12,15 @@
* like my Casio QV 500 and boring Yakumo
*/
struct DCIM_DirView : public PDirView {
DCIM_DirView( const Config& );
~DCIM_DirView();
PInterfaceInfo* interfaceInfo()const;
PDirLister * dirLister ()const;
-
+ virtual QWidget* widget(QWidget*);
private:
mutable PDirLister *m_lister;
mutable PInterfaceInfo *m_info ;
};
#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
@@ -26,8 +26,13 @@ PInterfaceInfo* Dir_DirView::interfaceInfo()const{
}
PDirLister* Dir_DirView::dirLister()const{
if (!m_lister ) {
m_lister = new Dir_DirLister(m_cfg,m_recursive,m_recursive_depth);
}
return m_lister;
}
+
+QWidget* Dir_DirView::widget(QWidget*)
+{
+ return 0L;
+} \ 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
@@ -9,16 +9,17 @@
struct Dir_DirView : public PDirView {
Dir_DirView( const Config& );
~Dir_DirView();
PInterfaceInfo* interfaceInfo()const;
PDirLister* dirLister()const;
+ virtual QWidget* widget(QWidget*);
private:
bool m_cfg : 1;
bool m_recursive:1;
int m_recursive_depth;
mutable PDirLister* m_lister;
mutable PInterfaceInfo *m_info;
};
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
@@ -21,8 +21,15 @@ PInterfaceInfo* Doc_DirView::interfaceInfo()const{
return m_info;
}
PDirLister* Doc_DirView::dirLister()const{
if (!m_lister )
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
@@ -2,23 +2,25 @@
* GPLv2 only zecke@handhelds.org
*/
#ifndef DOC_DIR_VIEW_H
#define DOC_DIR_VIEW_H
#include <iface/dirview.h>
+class Doc_DirLister;
struct Doc_DirView : public PDirView {
Doc_DirView( const Config& );
~Doc_DirView();
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;
};
#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
@@ -7,26 +7,30 @@
#include <lib/slavemaster.h>
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
+#include <qtopia/private/categories.h>
+#include <qtopia/categoryselect.h>
+
using namespace Opie::Core;
/* QT */
#include <qdir.h>
#include <qfileinfo.h>
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()) );
connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)),
this, SLOT(slotThumbInfo(const QString&, const QString&)) );
connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
this, SLOT(slotFullInfo(const QString&, const QString&)) );
connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)),
@@ -35,24 +39,34 @@ Doc_DirLister::Doc_DirLister()
m_namemap.clear();
m_filemap.clear();
}
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()) {
DocLnkSet ds;
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();
}
}
return QString::null;
}
QString Doc_DirLister::currentPath()const {
@@ -142,8 +156,33 @@ QString Doc_DirLister::nameToFname(const QString&name)const
return QString::null;
}
return m_namemap[name];
}
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
@@ -6,16 +6,18 @@
#define DOC_LISTER_INTERFACE_LISTER_H
#include <iface/dirlister.h>
#include <qstring.h>
#include <qmap.h>
class Config;
+class AppLnk;
+
class Doc_DirLister : public PDirLister {
Q_OBJECT
public:
Doc_DirLister();
virtual ~Doc_DirLister(){}
QString defaultPath()const;
QString setStartPath( const QString& );
@@ -25,18 +27,23 @@ public:
void deleteImage( const QString& );
void thumbNail( const QString&, int, int );
QImage image( const QString&, Factor, int );
void imageInfo( const QString& );
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