author | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
commit | 81cd1a4a916fb00b6c8867bdc1d945db155b12c0 (patch) (side-by-side diff) | |
tree | ce302c254c8c2160a86ffc0a5abe6cfd51fd33b3 /noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |
parent | ac414fa3802b471857bc84ecdd0d37200541b0a7 (diff) | |
download | opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.zip opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.tar.gz opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.tar.bz2 |
- added DocView mode
- fixed a bug in iconview and some small fixes more
Diffstat (limited to 'noncore/graphics/opie-eye/impl/doc/doc_lister.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp new file mode 100644 index 0000000..f695a76 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp @@ -0,0 +1,148 @@ +/* + * 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> + +using namespace Opie::Core; + +/* QT */ +#include <qdir.h> +#include <qfileinfo.h> + +Doc_DirLister::Doc_DirLister() + : PDirLister( "doc_dir_lister" ) +{ + 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&)) ); + +} + +QString Doc_DirLister::defaultPath()const { + return ""; QPEApplication::documentDir(); +} + +QString Doc_DirLister::setStartPath( const QString& path ) { + m_namemap.clear(); + m_out.clear(); + static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); + owarn << "Set start path" << oendl; + DocLnkSet ds; + Global::findDocuments(&ds,Mtype_str); + QListIterator<DocLnk> dit(ds.children()); + for( ; dit.current(); ++dit) { + owarn << (*dit)->file() << oendl; + m_namemap[(*dit)->name()]=(*dit)->file(); + m_filemap[(*dit)->file()]=(*dit)->name(); + m_out.append((*dit)->name()); + } + owarn << "Set start path end" << oendl; + return ""; +} + +QString Doc_DirLister::currentPath()const { + return ""; +} + + +QStringList Doc_DirLister::folders()const { + return QStringList(); +} + +QStringList Doc_DirLister::files()const { + return m_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()) { + owarn << "Item " << str << " not found" << oendl; + 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()) { + owarn << "Item " << str << " not found" << oendl; + 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()) { + owarn << "Item " << str << " not found" << oendl; + return; + } + QString fname = m_namemap[str]; + owarn << "Image info: " << fname << oendl; + SlaveMaster::self()->thumbInfo( fname ); +} + +void Doc_DirLister::fullImageInfo( const QString& str) { + if (m_namemap.find(str)==m_namemap.end()) { + owarn << "Item " << str << " not found" << oendl; + 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()) { + owarn << "Item " << f << " not found" << oendl; + 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()) { + owarn << "Item " << f << " not found" << oendl; + 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()) { + owarn << "Item " << f << " not found" << oendl; + 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()) { + owarn << "Item " << name << " not found" << oendl; + return QString::null; + } + return m_namemap[name]; +} |