author | alwin <alwin> | 2004-11-11 23:08:31 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-11 23:08:31 (UTC) |
commit | ee67d61c20b6840f3fb353e314d16a90c0438e7c (patch) (unidiff) | |
tree | 0b49d946120d3bf93c1a5158f5635c496a43ce8c | |
parent | b81a7aeacda23d4407cd88ee017b67ea48344a94 (diff) | |
download | opie-ee67d61c20b6840f3fb353e314d16a90c0438e7c.zip opie-ee67d61c20b6840f3fb353e314d16a90c0438e7c.tar.gz opie-ee67d61c20b6840f3fb353e314d16a90c0438e7c.tar.bz2 |
removed some useless code
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp index e43baed..f5c711a 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |||
@@ -1,191 +1,188 @@ | |||
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 | ||
15 | #include <qtopia/private/categories.h> | 15 | #include <qtopia/private/categories.h> |
16 | #include <qtopia/categoryselect.h> | 16 | #include <qtopia/categoryselect.h> |
17 | 17 | ||
18 | using namespace Opie::Core; | 18 | using namespace Opie::Core; |
19 | 19 | ||
20 | /* QT */ | 20 | /* QT */ |
21 | #include <qdir.h> | 21 | #include <qdir.h> |
22 | #include <qfileinfo.h> | 22 | #include <qfileinfo.h> |
23 | 23 | ||
24 | Doc_DirLister::Doc_DirLister() | 24 | Doc_DirLister::Doc_DirLister() |
25 | : PDirLister( "doc_dir_lister" ) | 25 | : PDirLister( "doc_dir_lister" ) |
26 | { | 26 | { |
27 | /* connect the signals */ | 27 | /* connect the signals */ |
28 | m_catFilter = 0; | 28 | m_catFilter = 0; |
29 | SlaveMaster* master = SlaveMaster::self(); | 29 | SlaveMaster* master = SlaveMaster::self(); |
30 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 30 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
31 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 31 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
32 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 32 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
33 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | 33 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); |
34 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 34 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
35 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | 35 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); |
36 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | 36 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
37 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | 37 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); |
38 | 38 | ||
39 | m_namemap.clear(); | 39 | m_namemap.clear(); |
40 | m_filemap.clear(); | 40 | m_filemap.clear(); |
41 | m_docreads = false; | 41 | m_docreads = false; |
42 | } | 42 | } |
43 | 43 | ||
44 | QString Doc_DirLister::defaultPath()const { | 44 | QString Doc_DirLister::defaultPath()const { |
45 | return QString::null; | 45 | return QString::null; |
46 | } | 46 | } |
47 | 47 | ||
48 | bool Doc_DirLister::matchCat(const AppLnk* app) | 48 | bool Doc_DirLister::matchCat(const AppLnk* app) |
49 | { | 49 | { |
50 | if (!app) return false; | 50 | if (!app) return false; |
51 | if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) { | 51 | if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) { |
52 | return true; | 52 | return true; |
53 | } | 53 | } |
54 | return false; | 54 | return false; |
55 | } | 55 | } |
56 | 56 | ||
57 | QString Doc_DirLister::setStartPath(const QString&) { | 57 | QString Doc_DirLister::setStartPath(const QString&) { |
58 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | 58 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); |
59 | if (m_namemap.isEmpty()) { | 59 | if (m_namemap.isEmpty()) { |
60 | if (!m_docreads) { | 60 | if (!m_docreads) { |
61 | Global::findDocuments(&m_ds,Mtype_str); | 61 | Global::findDocuments(&m_ds,Mtype_str); |
62 | m_docreads = true; | 62 | m_docreads = true; |
63 | } | 63 | } |
64 | QListIterator<DocLnk> dit(m_ds.children()); | 64 | QListIterator<DocLnk> dit(m_ds.children()); |
65 | for( ; dit.current(); ++dit) { | 65 | for( ; dit.current(); ++dit) { |
66 | // if (! (*dit)->isValid()) continue; | ||
67 | if (!matchCat((*dit))) continue; | 66 | if (!matchCat((*dit))) continue; |
68 | m_namemap[(*dit)->name()]=(*dit)->file(); | 67 | m_namemap[(*dit)->name()]=(*dit)->file(); |
69 | m_filemap[(*dit)->file()]=(*dit)->name(); | 68 | m_filemap[(*dit)->file()]=(*dit)->name(); |
70 | } | 69 | } |
71 | } | 70 | } |
72 | return QString::null; | 71 | return QString::null; |
73 | } | 72 | } |
74 | 73 | ||
75 | QString Doc_DirLister::currentPath()const { | 74 | QString Doc_DirLister::currentPath()const { |
76 | return QString::null; | 75 | return QString::null; |
77 | } | 76 | } |
78 | 77 | ||
79 | 78 | ||
80 | QStringList Doc_DirLister::folders()const { | 79 | QStringList Doc_DirLister::folders()const { |
81 | return QStringList(); | 80 | return QStringList(); |
82 | } | 81 | } |
83 | 82 | ||
84 | QStringList Doc_DirLister::files()const { | 83 | QStringList Doc_DirLister::files()const { |
85 | QStringList out; | 84 | QStringList out; |
86 | QMap<QString,QString>::ConstIterator it; | 85 | QMap<QString,QString>::ConstIterator it; |
87 | for (it = m_namemap.begin();it != m_namemap.end();++it) { | 86 | for (it = m_namemap.begin();it != m_namemap.end();++it) { |
88 | out.append(it.key()); | 87 | out.append(it.key()); |
89 | } | 88 | } |
90 | return out; | 89 | return out; |
91 | } | 90 | } |
92 | 91 | ||
93 | void Doc_DirLister::deleteImage( const QString& ) | 92 | void Doc_DirLister::deleteImage( const QString& ) |
94 | { | 93 | { |
95 | } | 94 | } |
96 | 95 | ||
97 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { | 96 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { |
98 | if (m_namemap.find(str)==m_namemap.end()) { | 97 | if (m_namemap.find(str)==m_namemap.end()) { |
99 | return; | 98 | return; |
100 | } | 99 | } |
101 | QString fname = m_namemap[str]; | 100 | QString fname = m_namemap[str]; |
102 | SlaveMaster::self()->thumbNail( fname, w, h ); | 101 | SlaveMaster::self()->thumbNail( fname, w, h ); |
103 | } | 102 | } |
104 | 103 | ||
105 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | 104 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { |
106 | if (m_namemap.find(str)==m_namemap.end()) { | 105 | if (m_namemap.find(str)==m_namemap.end()) { |
107 | return QImage(); | 106 | return QImage(); |
108 | } | 107 | } |
109 | QString fname = m_namemap[str]; | 108 | QString fname = m_namemap[str]; |
110 | return SlaveMaster::self()->image( fname, f, m ); | 109 | return SlaveMaster::self()->image( fname, f, m ); |
111 | } | 110 | } |
112 | 111 | ||
113 | void Doc_DirLister::imageInfo( const QString& str) { | 112 | void Doc_DirLister::imageInfo( const QString& str) { |
114 | if (m_namemap.find(str)==m_namemap.end()) { | 113 | if (m_namemap.find(str)==m_namemap.end()) { |
115 | return; | 114 | return; |
116 | } | 115 | } |
117 | QString fname = m_namemap[str]; | 116 | QString fname = m_namemap[str]; |
118 | SlaveMaster::self()->thumbInfo( fname ); | 117 | SlaveMaster::self()->thumbInfo( fname ); |
119 | } | 118 | } |
120 | 119 | ||
121 | void Doc_DirLister::fullImageInfo( const QString& str) { | 120 | void Doc_DirLister::fullImageInfo( const QString& str) { |
122 | if (m_namemap.find(str)==m_namemap.end()) { | 121 | if (m_namemap.find(str)==m_namemap.end()) { |
123 | return; | 122 | return; |
124 | } | 123 | } |
125 | QString fname = m_namemap[str]; | 124 | QString fname = m_namemap[str]; |
126 | SlaveMaster::self()->imageInfo( fname ); | 125 | SlaveMaster::self()->imageInfo( fname ); |
127 | } | 126 | } |
128 | 127 | ||
129 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) | 128 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) |
130 | { | 129 | { |
131 | if (m_filemap.find(f)==m_filemap.end()) { | 130 | if (m_filemap.find(f)==m_filemap.end()) { |
132 | return; | 131 | return; |
133 | } | 132 | } |
134 | QString name = m_filemap[f]; | 133 | QString name = m_filemap[f]; |
135 | emit sig_fullInfo(name, t); | 134 | emit sig_fullInfo(name, t); |
136 | } | 135 | } |
137 | 136 | ||
138 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) | 137 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) |
139 | { | 138 | { |
140 | if (m_filemap.find(f)==m_filemap.end()) { | 139 | if (m_filemap.find(f)==m_filemap.end()) { |
141 | return; | 140 | return; |
142 | } | 141 | } |
143 | QString name = m_filemap[f]; | 142 | QString name = m_filemap[f]; |
144 | emit sig_thumbInfo(name, t); | 143 | emit sig_thumbInfo(name, t); |
145 | } | 144 | } |
146 | 145 | ||
147 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | 146 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) |
148 | { | 147 | { |
149 | if (m_filemap.find(f)==m_filemap.end()) { | 148 | if (m_filemap.find(f)==m_filemap.end()) { |
150 | return; | 149 | return; |
151 | } | 150 | } |
152 | QString name = m_filemap[f]; | 151 | QString name = m_filemap[f]; |
153 | emit sig_thumbNail(name, p); | 152 | emit sig_thumbNail(name, p); |
154 | } | 153 | } |
155 | 154 | ||
156 | QString Doc_DirLister::nameToFname(const QString&name)const | 155 | QString Doc_DirLister::nameToFname(const QString&name)const |
157 | { | 156 | { |
158 | if (m_namemap.find(name)==m_namemap.end()) { | 157 | if (m_namemap.find(name)==m_namemap.end()) { |
159 | return QString::null; | 158 | return QString::null; |
160 | } | 159 | } |
161 | return m_namemap[name]; | 160 | return m_namemap[name]; |
162 | } | 161 | } |
163 | 162 | ||
164 | QString Doc_DirLister::dirUp( const QString& p ) const{ | 163 | QString Doc_DirLister::dirUp( const QString& p ) const{ |
165 | return p; | 164 | return p; |
166 | } | 165 | } |
167 | 166 | ||
168 | QWidget* Doc_DirLister::widget(QWidget*parent) | 167 | QWidget* Doc_DirLister::widget(QWidget*parent) |
169 | { | 168 | { |
170 | CategorySelect * catmb = new CategorySelect(parent); | 169 | CategorySelect * catmb = new CategorySelect(parent); |
171 | Categories cats( 0 ); | 170 | Categories cats( 0 ); |
172 | cats.load( categoryFileName() ); | 171 | cats.load( categoryFileName() ); |
173 | QArray<int> vl( 0 ); | 172 | QArray<int> vl( 0 ); |
174 | catmb->setCategories( vl, "Document View", // No tr | 173 | catmb->setCategories( vl, "Document View", // No tr |
175 | "Document View" ); | 174 | "Document View" ); |
176 | catmb->setRemoveCategoryEdit( TRUE ); | 175 | catmb->setRemoveCategoryEdit( TRUE ); |
177 | catmb->setAllCategories( TRUE ); | 176 | catmb->setAllCategories( TRUE ); |
178 | connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); | 177 | connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); |
179 | catmb->setCurrentCategory(-2); | 178 | catmb->setCurrentCategory(-2); |
180 | return catmb; | 179 | return catmb; |
181 | } | 180 | } |
182 | 181 | ||
183 | void Doc_DirLister::showCategory(int which) | 182 | void Doc_DirLister::showCategory(int which) |
184 | { | 183 | { |
185 | Categories cat; | ||
186 | cat.load( categoryFileName() ); | ||
187 | m_catFilter = which==-2?0:which; | 184 | m_catFilter = which==-2?0:which; |
188 | m_namemap.clear(); | 185 | m_namemap.clear(); |
189 | setStartPath(""); | 186 | setStartPath(""); |
190 | emit sig_reloadDir(); | 187 | emit sig_reloadDir(); |
191 | } | 188 | } |