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
@@ -150,102 +150,103 @@ namespace {
inline QPixmap* IconViewItem::pixmap()const {
// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y()
// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX()
// << " " << iconView()->contentsY() << oendl;
if (textOnly()&&!m_isDir) {
if (!_emptyPix) _emptyPix = new QPixmap(0,0,1);
return _emptyPix;
}
if ( m_isDir )
return _dirPix;
else{
if (!m_noInfo && !g_stringInf.contains( m_path ) ) {
g_stringInf.insert( m_path, const_cast<IconViewItem*>(this));
currentView()->dirLister()->imageInfo( m_path );
}
m_pix = PPixmapCache::self()->cachedImage( m_path, m_iconsize, m_iconsize );
if (!m_pix && !g_stringPix.contains( m_path )) {
check_pix();
g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
currentView()->dirLister()->thumbNail( m_path, m_iconsize, m_iconsize);
}
return m_pix ? m_pix : _cpyPix;
}
}
inline void IconViewItem::setText( const QString& str ) {
QString text = QIconViewItem::text()+"\n"+str;
m_noInfo = true;
QIconViewItem::setText( text );
}
}
/*
* Set up the GUI.. initialize the slave set up gui
* and also load a dir
*/
PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
: QVBox( wid ), m_cfg( cfg ), m_updatet( false )
{
{
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 );
m_mode = m_cfg->readNumEntry("ListViewMode", 1);
QString lastView = m_cfg->readEntry("LastView","");
if (m_mode < 1 || m_mode>3) m_mode = 1;
m_view->setItemTextPos( QIconView::Right );
if (m_mode >1) {
m_view->setResizeMode(QIconView::Adjust);
} else {
m_view->setResizeMode(QIconView::Fixed);
}
m_iconsize = m_cfg->readNumEntry("iconsize", 32);
if (m_iconsize<12)m_iconsize = 12;
if (m_iconsize>64)m_iconsize = 64;
calculateGrid();
initKeys();
loadViews();
int cc=0;
for (; cc<m_views->count();++cc) {
if (m_views->text(cc)==lastView) {
break;
}
}
if (cc<m_views->count()) {
m_views->setCurrentItem(cc);
slotViewChanged(cc);
} else {
slotViewChanged(m_views->currentItem());
}
connect( m_views, SIGNAL(activated(int)),
this, SLOT(slotViewChanged(int)) );
}
/*
* Unref the slave and save the keyboard manager
*/
@@ -404,127 +405,138 @@ void PIconView::slotTrash() {
/*
* see what views are available
*/
void PIconView::loadViews() {
ViewMap::Iterator it;
ViewMap* map = viewMap();
for ( it = map->begin(); it != map->end(); ++it )
m_views->insertItem( it.key() );
}
void PIconView::resetView() {
m_internalReset = true;
// Also invalidate the cache. We can't cancel the operations anyway
g_stringPix.clear();
g_stringInf.clear();
if (m_mode>1) {
int osize = m_iconsize;
m_iconsize = m_cfg->readNumEntry("iconsize", 32);
if (m_iconsize<12)m_iconsize = 12;
if (m_iconsize>64)m_iconsize = 64;
if (osize != m_iconsize) {
if (_dirPix){
delete _dirPix;
_dirPix = 0;
}
if (_cpyPix){
delete _cpyPix;
_cpyPix = 0;
}
calculateGrid();
}
} else {
m_iconsize = 64;
}
slotViewChanged(m_views->currentItem());
m_internalReset = false;
}
/*
*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()) {
owarn << "Key not found" << oendl;
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()));
}
void PIconView::slotReloadDir() {
slotChangeDir( m_path );
}
/*
* add files and folders
*/
void PIconView::addFolders( const QStringList& lst) {
QStringList::ConstIterator it;
IconViewItem * _iv;
for(it=lst.begin(); it != lst.end(); ++it ) {
_iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it),m_iconsize, true );
if (m_mode==3) _iv->setTextOnly(true);
}
}
void PIconView::addFiles( const QStringList& lst) {
QStringList::ConstIterator it;
IconViewItem * _iv;
QPixmap*m_pix = 0;
QString pre = "";
if (!m_path.isEmpty()) {
pre = m_path+"/";
}
for (it=lst.begin(); it!= lst.end(); ++it ) {
m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize );
_iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize );
if (m_mode==3) {
_iv->setTextOnly(true);
_iv->setPixmap(QPixmap());
} else {
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:
private:
void initKeys();
QString currentFileName(bool &isDir)const;
QString nextFileName(bool &isDir)const;
QString prevFileName(bool &isDir)const;
void loadViews();
void calculateGrid(QResizeEvent*e = 0);
private slots:
void slotDirUp();
void slotChangeDir(const QString&);
void slotTrash();
void slotViewChanged( int );
void slotReloadDir();
void slotRename();
void slotBeam();
void slotBeamDone( Ir* );
void slotShowImage();
void slotShowImage( const QString& );
void slotImageInfo();
void slotImageInfo( const QString& );
void slotStartSlide();
void slotStart();
void slotEnd();
/* for performance reasons make it inline in the future */
void addFolders( const QStringList& );
void addFiles( const QStringList& );
void slotClicked(QIconViewItem* );
void slotRetrun(QIconViewItem* );
/**/
void slotThumbInfo(const QString&, const QString&);
void slotThumbNail(const QString&, const QPixmap&);
void slotChangeMode( int );
private:
Opie::Core::OKeyConfigManager *m_viewManager;
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
@@ -1,52 +1,53 @@
/*
* GPLv2 zecke@handhelds.org
* No WArranty...
*/
#ifndef PHUNK_DIR_LISTER_H
#define PHUNK_DIR_LISTER_H
#include <qobject.h>
#include <qstring.h>
#include <qstringlist.h>
class PDirLister : public QObject {
Q_OBJECT
public:
enum Factor { Width, Height, None };
PDirLister( const char* name );
virtual QString defaultPath()const = 0;
virtual QString setStartPath( const QString& ) = 0;
virtual QString currentPath()const = 0;
virtual QStringList folders()const = 0;
virtual QStringList files()const = 0;
virtual QString nameToFname(const QString&name)const = 0;
virtual QString dirUp(const QString&)const ;
public slots:
virtual void deleteImage( const QString& ) = 0;
virtual void imageInfo( const QString&) = 0;
virtual void fullImageInfo( const QString& ) = 0;
virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0;
virtual QImage image( const QString&, Factor, int max = 0) = 0;
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
@@ -1,40 +1,42 @@
/*
* GPLv2 zecke@handhelds.org
* No WArranty...
*/
#ifndef PHUNK_DIR_VIEW_H
#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* );
#define PHUNK_VIEW_INTERFACE( NAME, IMPL ) \
static PDirView *create_ ## IMPL( const Config& cfg ) { \
return new IMPL( cfg ); \
} \
static ViewMap::Iterator dummy_ ## IMPL = viewMap()->insert( NAME, create_ ## IMPL );
#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 @@
#include "dcim_dirview.h"
#include "dcim_lister.h"
#include "dcim_ifaceinfo.h"
PHUNK_VIEW_INTERFACE( "Digital Camera", DCIM_DirView );
DCIM_DirView::DCIM_DirView( const Config& cfg )
: PDirView( cfg ), m_lister( 0l ), m_info( 0l )
{}
DCIM_DirView::~DCIM_DirView()
{}
PInterfaceInfo* DCIM_DirView::interfaceInfo()const {
if ( !m_info )
m_info = new DCIM_InterfaceInfo;
return m_info;
}
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
@@ -1,26 +1,26 @@
/*
* GPLv2 only zecke@handhelds.org
*/
#ifndef DCIM_DIR_VIEW_H
#define DCIM_DIR_VIEW_H
#include <iface/dirview.h>
/*
* Implementation for USB Host Digital Cameras
* 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
@@ -1,33 +1,38 @@
#include "dir_lister.h"
#include "dir_ifaceinfo.h"
#include "dir_dirview.h"
PHUNK_VIEW_INTERFACE("Dir View", Dir_DirView );
Dir_DirView::Dir_DirView( const Config& cfg)
: PDirView(cfg)
{
m_cfg = cfg.readBoolEntry( "Dir_Check_All_Files", false);
m_recursive = cfg.readBoolEntry( "Dir_Check_Recursive_Files", false);
m_recursive_depth = cfg.readNumEntry("Dir_Recursive_Files_Depth",10);
m_lister = 0;
m_info = 0;
}
Dir_DirView::~Dir_DirView() {
}
PInterfaceInfo* Dir_DirView::interfaceInfo()const{
if (!m_info ) {
m_info = new DirInterfaceInfo;
}
return m_info;
}
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
@@ -1,26 +1,27 @@
/*
* GPLv2 only zecke@handhelds.org
*/
#ifndef DIR_DIR_VIEW_H
#define DIR_DIR_VIEW_H
#include <iface/dirview.h>
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;
};
#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 @@
#include "doc_lister.h"
#include "doc_ifaceinfo.h"
#include "doc_dirview.h"
PHUNK_VIEW_INTERFACE("Document View", Doc_DirView );
Doc_DirView::Doc_DirView( const Config& cfg)
: PDirView(cfg)
{
m_lister = 0;
m_info = 0;
}
Doc_DirView::~Doc_DirView() {
}
PInterfaceInfo* Doc_DirView::interfaceInfo()const{
if (!m_info )
m_info =new DocInterfaceInfo;
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
@@ -1,24 +1,26 @@
/*
* 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
@@ -1,98 +1,112 @@
/*
* GPLv2 zecke@handhelds.org
*/
#include "doc_lister.h"
#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&)),
this, SLOT(slotThumbNail(const QString&, const QPixmap&)) );
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 {
return QString::null;
}
QStringList Doc_DirLister::folders()const {
return QStringList();
}
QStringList Doc_DirLister::files()const {
QStringList out;
QMap<QString,QString>::ConstIterator it;
for (it = m_namemap.begin();it != m_namemap.end();++it) {
out.append(it.key());
}
return out;
}
void Doc_DirLister::deleteImage( const QString& )
{
}
void Doc_DirLister::thumbNail( const QString& str, int w, int h) {
if (m_namemap.find(str)==m_namemap.end()) {
return;
}
QString fname = m_namemap[str];
SlaveMaster::self()->thumbNail( fname, w, h );
}
QImage Doc_DirLister::image( const QString& str, Factor f, int m) {
if (m_namemap.find(str)==m_namemap.end()) {
return QImage();
}
QString fname = m_namemap[str];
return SlaveMaster::self()->image( fname, f, m );
}
void Doc_DirLister::imageInfo( const QString& str) {
if (m_namemap.find(str)==m_namemap.end()) {
return;
@@ -102,48 +116,73 @@ void Doc_DirLister::imageInfo( const QString& str) {
}
void Doc_DirLister::fullImageInfo( const QString& str) {
if (m_namemap.find(str)==m_namemap.end()) {
return;
}
QString fname = m_namemap[str];
SlaveMaster::self()->imageInfo( fname );
}
void Doc_DirLister::slotFullInfo(const QString&f, const QString&t)
{
if (m_filemap.find(f)==m_filemap.end()) {
return;
}
QString name = m_filemap[f];
emit sig_fullInfo(name, t);
}
void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t)
{
if (m_filemap.find(f)==m_filemap.end()) {
return;
}
QString name = m_filemap[f];
emit sig_thumbInfo(name, t);
}
void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p)
{
if (m_filemap.find(f)==m_filemap.end()) {
return;
}
QString name = m_filemap[f];
emit sig_thumbNail(name, p);
}
QString Doc_DirLister::nameToFname(const QString&name)const
{
if (m_namemap.find(name)==m_namemap.end()) {
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
@@ -1,42 +1,49 @@
/*
* GPLv2 zecke@handhelds.org
*/
#ifndef DOC_LISTER_INTERFACE_LISTER_H
#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& );
QString currentPath()const;
QStringList folders()const;
QStringList files()const;
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