summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-21 23:16:47 (UTC)
committer alwin <alwin>2004-04-21 23:16:47 (UTC)
commita0952719afc122e5a16d81253a9de86ee7e608b8 (patch) (unidiff)
tree27adc7b1f02de96ade6dd07be0f48e6dda868bf9
parent9230c9dd6bef33603cef1727be95dafc8065f66c (diff)
downloadopie-a0952719afc122e5a16d81253a9de86ee7e608b8.zip
opie-a0952719afc122e5a16d81253a9de86ee7e608b8.tar.gz
opie-a0952719afc122e5a16d81253a9de86ee7e608b8.tar.bz2
only adds valid doc-links to list
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_lister.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp
index 73b2863..8066472 100644
--- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp
+++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp
@@ -1,145 +1,145 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 */ 3 */
4 4
5#include "doc_lister.h" 5#include "doc_lister.h"
6 6
7#include <lib/slavemaster.h> 7#include <lib/slavemaster.h>
8 8
9/* OPIE */ 9/* OPIE */
10#include <opie2/odebug.h> 10#include <opie2/odebug.h>
11#include <qpe/config.h> 11#include <qpe/config.h>
12#include <qpe/qpeapplication.h> 12#include <qpe/qpeapplication.h>
13#include <qpe/applnk.h> 13#include <qpe/applnk.h>
14 14
15using namespace Opie::Core; 15using namespace Opie::Core;
16 16
17/* QT */ 17/* QT */
18#include <qdir.h> 18#include <qdir.h>
19#include <qfileinfo.h> 19#include <qfileinfo.h>
20 20
21Doc_DirLister::Doc_DirLister() 21Doc_DirLister::Doc_DirLister()
22 : PDirLister( "doc_dir_lister" ) 22 : PDirLister( "doc_dir_lister" )
23{ 23{
24 SlaveMaster* master = SlaveMaster::self(); 24 SlaveMaster* master = SlaveMaster::self();
25 connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); 25 connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) );
26 connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); 26 connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) );
27 connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), 27 connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)),
28 this, SLOT(slotThumbInfo(const QString&, const QString&)) ); 28 this, SLOT(slotThumbInfo(const QString&, const QString&)) );
29 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), 29 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
30 this, SLOT(slotFullInfo(const QString&, const QString&)) ); 30 this, SLOT(slotFullInfo(const QString&, const QString&)) );
31 connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), 31 connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)),
32 this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); 32 this, SLOT(slotThumbNail(const QString&, const QPixmap&)) );
33 33
34 m_namemap.clear(); 34 m_namemap.clear();
35 m_filemap.clear(); 35 m_filemap.clear();
36} 36}
37 37
38QString Doc_DirLister::defaultPath()const { 38QString Doc_DirLister::defaultPath()const {
39 return ""; QPEApplication::documentDir(); 39 return ""; QPEApplication::documentDir();
40} 40}
41 41
42QString Doc_DirLister::setStartPath(const QString&) { 42QString Doc_DirLister::setStartPath(const QString&) {
43 static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); 43 static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png");
44 if (m_namemap.isEmpty()) { 44 if (m_namemap.isEmpty()) {
45 DocLnkSet ds; 45 DocLnkSet ds;
46 Global::findDocuments(&ds,Mtype_str); 46 Global::findDocuments(&ds,Mtype_str);
47 QListIterator<DocLnk> dit(ds.children()); 47 QListIterator<DocLnk> dit(ds.children());
48 for( ; dit.current(); ++dit) { 48 for( ; dit.current(); ++dit) {
49 owarn << (*dit)->file() << oendl; 49 if (! (*dit)->isValid()) continue;
50 m_namemap[(*dit)->name()]=(*dit)->file(); 50 m_namemap[(*dit)->name()]=(*dit)->file();
51 m_filemap[(*dit)->file()]=(*dit)->name(); 51 m_filemap[(*dit)->file()]=(*dit)->name();
52 } 52 }
53 } 53 }
54 return QString::null; 54 return QString::null;
55} 55}
56 56
57QString Doc_DirLister::currentPath()const { 57QString Doc_DirLister::currentPath()const {
58 return QString::null; 58 return QString::null;
59} 59}
60 60
61 61
62QStringList Doc_DirLister::folders()const { 62QStringList Doc_DirLister::folders()const {
63 return QStringList(); 63 return QStringList();
64} 64}
65 65
66QStringList Doc_DirLister::files()const { 66QStringList Doc_DirLister::files()const {
67 QStringList out; 67 QStringList out;
68 QMap<QString,QString>::ConstIterator it; 68 QMap<QString,QString>::ConstIterator it;
69 for (it = m_namemap.begin();it != m_namemap.end();++it) { 69 for (it = m_namemap.begin();it != m_namemap.end();++it) {
70 out.append(it.key()); 70 out.append(it.key());
71 } 71 }
72 return out; 72 return out;
73} 73}
74 74
75void Doc_DirLister::deleteImage( const QString& ) 75void Doc_DirLister::deleteImage( const QString& )
76{ 76{
77} 77}
78 78
79void Doc_DirLister::thumbNail( const QString& str, int w, int h) { 79void Doc_DirLister::thumbNail( const QString& str, int w, int h) {
80 if (m_namemap.find(str)==m_namemap.end()) { 80 if (m_namemap.find(str)==m_namemap.end()) {
81 owarn << "Item " << str << " not found" << oendl; 81 owarn << "Item " << str << " not found" << oendl;
82 return; 82 return;
83 } 83 }
84 QString fname = m_namemap[str]; 84 QString fname = m_namemap[str];
85 SlaveMaster::self()->thumbNail( fname, w, h ); 85 SlaveMaster::self()->thumbNail( fname, w, h );
86} 86}
87 87
88QImage Doc_DirLister::image( const QString& str, Factor f, int m) { 88QImage Doc_DirLister::image( const QString& str, Factor f, int m) {
89 if (m_namemap.find(str)==m_namemap.end()) { 89 if (m_namemap.find(str)==m_namemap.end()) {
90 owarn << "Item " << str << " not found" << oendl; 90 owarn << "Item " << str << " not found" << oendl;
91 return QImage(); 91 return QImage();
92 } 92 }
93 QString fname = m_namemap[str]; 93 QString fname = m_namemap[str];
94 return SlaveMaster::self()->image( fname, f, m ); 94 return SlaveMaster::self()->image( fname, f, m );
95} 95}
96 96
97void Doc_DirLister::imageInfo( const QString& str) { 97void Doc_DirLister::imageInfo( const QString& str) {
98 if (m_namemap.find(str)==m_namemap.end()) { 98 if (m_namemap.find(str)==m_namemap.end()) {
99 owarn << "Item " << str << " not found" << oendl; 99 owarn << "Item " << str << " not found" << oendl;
100 return; 100 return;
101 } 101 }
102 QString fname = m_namemap[str]; 102 QString fname = m_namemap[str];
103 SlaveMaster::self()->thumbInfo( fname ); 103 SlaveMaster::self()->thumbInfo( fname );
104} 104}
105 105
106void Doc_DirLister::fullImageInfo( const QString& str) { 106void Doc_DirLister::fullImageInfo( const QString& str) {
107 if (m_namemap.find(str)==m_namemap.end()) { 107 if (m_namemap.find(str)==m_namemap.end()) {
108 owarn << "Item " << str << " not found" << oendl; 108 owarn << "Item " << str << " not found" << oendl;
109 return; 109 return;
110 } 110 }
111 QString fname = m_namemap[str]; 111 QString fname = m_namemap[str];
112 SlaveMaster::self()->imageInfo( fname ); 112 SlaveMaster::self()->imageInfo( fname );
113} 113}
114 114
115void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) 115void Doc_DirLister::slotFullInfo(const QString&f, const QString&t)
116{ 116{
117 if (m_filemap.find(f)==m_filemap.end()) { 117 if (m_filemap.find(f)==m_filemap.end()) {
118 owarn << "Item " << f << " not found" << oendl; 118 owarn << "Item " << f << " not found" << oendl;
119 return; 119 return;
120 } 120 }
121 QString name = m_filemap[f]; 121 QString name = m_filemap[f];
122 emit sig_fullInfo(name, t); 122 emit sig_fullInfo(name, t);
123} 123}
124 124
125void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) 125void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t)
126{ 126{
127 if (m_filemap.find(f)==m_filemap.end()) { 127 if (m_filemap.find(f)==m_filemap.end()) {
128 owarn << "Item " << f << " not found" << oendl; 128 owarn << "Item " << f << " not found" << oendl;
129 return; 129 return;
130 } 130 }
131 QString name = m_filemap[f]; 131 QString name = m_filemap[f];
132 emit sig_thumbInfo(name, t); 132 emit sig_thumbInfo(name, t);
133} 133}
134 134
135void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) 135void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p)
136{ 136{
137 if (m_filemap.find(f)==m_filemap.end()) { 137 if (m_filemap.find(f)==m_filemap.end()) {
138 owarn << "Item " << f << " not found" << oendl; 138 owarn << "Item " << f << " not found" << oendl;
139 return; 139 return;
140 } 140 }
141 QString name = m_filemap[f]; 141 QString name = m_filemap[f];
142 emit sig_thumbNail(name, p); 142 emit sig_thumbNail(name, p);
143} 143}
144 144
145QString Doc_DirLister::nameToFname(const QString&name)const 145QString Doc_DirLister::nameToFname(const QString&name)const