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 | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp index d4d1831..722fb95 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |||
@@ -12,40 +12,41 @@ | |||
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | #include <qpe/applnk.h> | 13 | #include <qpe/applnk.h> |
14 | 14 | ||
15 | using namespace Opie::Core; | 15 | using 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 | ||
21 | Doc_DirLister::Doc_DirLister() | 21 | Doc_DirLister::Doc_DirLister() |
22 | : PDirLister( "doc_dir_lister" ) | 22 | : PDirLister( "doc_dir_lister" ) |
23 | { | 23 | { |
24 | /* connect the signals */ | ||
24 | SlaveMaster* master = SlaveMaster::self(); | 25 | SlaveMaster* master = SlaveMaster::self(); |
25 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
26 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
27 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
28 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | 29 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); |
29 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 30 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
30 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | 31 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); |
31 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | 32 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
32 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | 33 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); |
33 | 34 | ||
34 | m_namemap.clear(); | 35 | m_namemap.clear(); |
35 | m_filemap.clear(); | 36 | m_filemap.clear(); |
36 | } | 37 | } |
37 | 38 | ||
38 | QString Doc_DirLister::defaultPath()const { | 39 | QString Doc_DirLister::defaultPath()const { |
39 | return ""; QPEApplication::documentDir(); | 40 | return QString::null; |
40 | } | 41 | } |
41 | 42 | ||
42 | QString Doc_DirLister::setStartPath(const QString&) { | 43 | QString Doc_DirLister::setStartPath(const QString&) { |
43 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | 44 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); |
44 | if (m_namemap.isEmpty()) { | 45 | if (m_namemap.isEmpty()) { |
45 | DocLnkSet ds; | 46 | DocLnkSet ds; |
46 | Global::findDocuments(&ds,Mtype_str); | 47 | Global::findDocuments(&ds,Mtype_str); |
47 | QListIterator<DocLnk> dit(ds.children()); | 48 | QListIterator<DocLnk> dit(ds.children()); |
48 | for( ; dit.current(); ++dit) { | 49 | for( ; dit.current(); ++dit) { |
49 | // if (! (*dit)->isValid()) continue; | 50 | // if (! (*dit)->isValid()) continue; |
50 | m_namemap[(*dit)->name()]=(*dit)->file(); | 51 | m_namemap[(*dit)->name()]=(*dit)->file(); |
51 | m_filemap[(*dit)->file()]=(*dit)->name(); | 52 | m_filemap[(*dit)->file()]=(*dit)->name(); |
@@ -69,84 +70,80 @@ QStringList Doc_DirLister::files()const { | |||
69 | for (it = m_namemap.begin();it != m_namemap.end();++it) { | 70 | for (it = m_namemap.begin();it != m_namemap.end();++it) { |
70 | out.append(it.key()); | 71 | out.append(it.key()); |
71 | } | 72 | } |
72 | return out; | 73 | return out; |
73 | } | 74 | } |
74 | 75 | ||
75 | void Doc_DirLister::deleteImage( const QString& ) | 76 | void Doc_DirLister::deleteImage( const QString& ) |
76 | { | 77 | { |
77 | } | 78 | } |
78 | 79 | ||
79 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { | 80 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { |
80 | if (m_namemap.find(str)==m_namemap.end()) { | 81 | if (m_namemap.find(str)==m_namemap.end()) { |
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 | ||
88 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | 88 | QImage 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; | ||
91 | return QImage(); | 90 | return QImage(); |
92 | } | 91 | } |
93 | QString fname = m_namemap[str]; | 92 | QString fname = m_namemap[str]; |
94 | return SlaveMaster::self()->image( fname, f, m ); | 93 | return SlaveMaster::self()->image( fname, f, m ); |
95 | } | 94 | } |
96 | 95 | ||
97 | void Doc_DirLister::imageInfo( const QString& str) { | 96 | void Doc_DirLister::imageInfo( const QString& str) { |
98 | if (m_namemap.find(str)==m_namemap.end()) { | 97 | if (m_namemap.find(str)==m_namemap.end()) { |
99 | owarn << "Item " << str << " not found" << oendl; | ||
100 | return; | 98 | return; |
101 | } | 99 | } |
102 | QString fname = m_namemap[str]; | 100 | QString fname = m_namemap[str]; |
103 | SlaveMaster::self()->thumbInfo( fname ); | 101 | SlaveMaster::self()->thumbInfo( fname ); |
104 | } | 102 | } |
105 | 103 | ||
106 | void Doc_DirLister::fullImageInfo( const QString& str) { | 104 | void Doc_DirLister::fullImageInfo( const QString& str) { |
107 | if (m_namemap.find(str)==m_namemap.end()) { | 105 | if (m_namemap.find(str)==m_namemap.end()) { |
108 | owarn << "Item " << str << " not found" << oendl; | ||
109 | return; | 106 | return; |
110 | } | 107 | } |
111 | QString fname = m_namemap[str]; | 108 | QString fname = m_namemap[str]; |
112 | SlaveMaster::self()->imageInfo( fname ); | 109 | SlaveMaster::self()->imageInfo( fname ); |
113 | } | 110 | } |
114 | 111 | ||
115 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) | 112 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) |
116 | { | 113 | { |
117 | if (m_filemap.find(f)==m_filemap.end()) { | 114 | if (m_filemap.find(f)==m_filemap.end()) { |
118 | owarn << "Item " << f << " not found" << oendl; | ||
119 | return; | 115 | return; |
120 | } | 116 | } |
121 | QString name = m_filemap[f]; | 117 | QString name = m_filemap[f]; |
122 | emit sig_fullInfo(name, t); | 118 | emit sig_fullInfo(name, t); |
123 | } | 119 | } |
124 | 120 | ||
125 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) | 121 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) |
126 | { | 122 | { |
127 | if (m_filemap.find(f)==m_filemap.end()) { | 123 | if (m_filemap.find(f)==m_filemap.end()) { |
128 | owarn << "Item " << f << " not found" << oendl; | ||
129 | return; | 124 | return; |
130 | } | 125 | } |
131 | QString name = m_filemap[f]; | 126 | QString name = m_filemap[f]; |
132 | emit sig_thumbInfo(name, t); | 127 | emit sig_thumbInfo(name, t); |
133 | } | 128 | } |
134 | 129 | ||
135 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | 130 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) |
136 | { | 131 | { |
137 | if (m_filemap.find(f)==m_filemap.end()) { | 132 | if (m_filemap.find(f)==m_filemap.end()) { |
138 | owarn << "Item " << f << " not found" << oendl; | ||
139 | return; | 133 | return; |
140 | } | 134 | } |
141 | QString name = m_filemap[f]; | 135 | QString name = m_filemap[f]; |
142 | emit sig_thumbNail(name, p); | 136 | emit sig_thumbNail(name, p); |
143 | } | 137 | } |
144 | 138 | ||
145 | QString Doc_DirLister::nameToFname(const QString&name)const | 139 | QString Doc_DirLister::nameToFname(const QString&name)const |
146 | { | 140 | { |
147 | if (m_namemap.find(name)==m_namemap.end()) { | 141 | if (m_namemap.find(name)==m_namemap.end()) { |
148 | owarn << "Item " << name << " not found" << oendl; | ||
149 | return QString::null; | 142 | return QString::null; |
150 | } | 143 | } |
151 | return m_namemap[name]; | 144 | return m_namemap[name]; |
152 | } | 145 | } |
146 | |||
147 | QString Doc_DirLister::dirUp( const QString& p ) const{ | ||
148 | return p; | ||
149 | } | ||