Diffstat (limited to 'noncore/graphics/opie-eye/impl') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 129 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 8 |
2 files changed, 76 insertions, 61 deletions
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp index f5c711a..8bcf01d 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |||
@@ -13,2 +13,3 @@ | |||
13 | #include <qpe/applnk.h> | 13 | #include <qpe/applnk.h> |
14 | #include <opie2/oglobal.h> | ||
14 | 15 | ||
@@ -22,2 +23,3 @@ using namespace Opie::Core; | |||
22 | #include <qfileinfo.h> | 23 | #include <qfileinfo.h> |
24 | #include <qtopia/qcopenvelope_qws.h> | ||
23 | 25 | ||
@@ -37,6 +39,10 @@ Doc_DirLister::Doc_DirLister() | |||
37 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | 39 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); |
38 | |||
39 | m_namemap.clear(); | ||
40 | m_filemap.clear(); | ||
41 | m_docreads = false; | 40 | m_docreads = false; |
41 | syschannel = new QCopChannel("QPE/System", this); | ||
42 | connect(syschannel, SIGNAL(received(const QCString&,const QByteArray&)), | ||
43 | this, SLOT(systemMsg(const QCString&,const QByteArray&)) ); | ||
44 | } | ||
45 | |||
46 | Doc_DirLister::~Doc_DirLister() | ||
47 | { | ||
42 | } | 48 | } |
@@ -47,3 +53,3 @@ QString Doc_DirLister::defaultPath()const { | |||
47 | 53 | ||
48 | bool Doc_DirLister::matchCat(const AppLnk* app) | 54 | bool Doc_DirLister::matchCat(const AppLnk* app)const |
49 | { | 55 | { |
@@ -58,3 +64,2 @@ QString Doc_DirLister::setStartPath(const QString&) { | |||
58 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | 64 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); |
59 | if (m_namemap.isEmpty()) { | ||
60 | if (!m_docreads) { | 65 | if (!m_docreads) { |
@@ -63,9 +68,2 @@ QString Doc_DirLister::setStartPath(const QString&) { | |||
63 | } | 68 | } |
64 | QListIterator<DocLnk> dit(m_ds.children()); | ||
65 | for( ; dit.current(); ++dit) { | ||
66 | if (!matchCat((*dit))) continue; | ||
67 | m_namemap[(*dit)->name()]=(*dit)->file(); | ||
68 | m_filemap[(*dit)->file()]=(*dit)->name(); | ||
69 | } | ||
70 | } | ||
71 | return QString::null; | 69 | return QString::null; |
@@ -73,3 +71,4 @@ QString Doc_DirLister::setStartPath(const QString&) { | |||
73 | 71 | ||
74 | QString Doc_DirLister::currentPath()const { | 72 | QString Doc_DirLister::currentPath()const |
73 | { | ||
75 | return QString::null; | 74 | return QString::null; |
@@ -84,5 +83,9 @@ QStringList Doc_DirLister::files()const { | |||
84 | QStringList out; | 83 | QStringList out; |
85 | QMap<QString,QString>::ConstIterator it; | 84 | QListIterator<DocLnk> dit(m_ds.children()); |
86 | for (it = m_namemap.begin();it != m_namemap.end();++it) { | 85 | for( ; dit.current(); ++dit) { |
87 | out.append(it.key()); | 86 | if (!matchCat((*dit))) continue; |
87 | QString s = (*dit)->name(); | ||
88 | s+=char(0); | ||
89 | s+=(*dit)->file(); | ||
90 | out.append(s); | ||
88 | } | 91 | } |
@@ -95,16 +98,10 @@ void Doc_DirLister::deleteImage( const QString& ) | |||
95 | 98 | ||
96 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { | 99 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) |
97 | if (m_namemap.find(str)==m_namemap.end()) { | 100 | { |
98 | return; | 101 | SlaveMaster::self()->thumbNail( str, w, h ); |
99 | } | ||
100 | QString fname = m_namemap[str]; | ||
101 | SlaveMaster::self()->thumbNail( fname, w, h ); | ||
102 | } | 102 | } |
103 | 103 | ||
104 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | 104 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) |
105 | if (m_namemap.find(str)==m_namemap.end()) { | 105 | { |
106 | return QImage(); | 106 | return SlaveMaster::self()->image(str, f, m ); |
107 | } | ||
108 | QString fname = m_namemap[str]; | ||
109 | return SlaveMaster::self()->image( fname, f, m ); | ||
110 | } | 107 | } |
@@ -112,7 +109,3 @@ QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | |||
112 | void Doc_DirLister::imageInfo( const QString& str) { | 109 | void Doc_DirLister::imageInfo( const QString& str) { |
113 | if (m_namemap.find(str)==m_namemap.end()) { | 110 | SlaveMaster::self()->thumbInfo( str ); |
114 | return; | ||
115 | } | ||
116 | QString fname = m_namemap[str]; | ||
117 | SlaveMaster::self()->thumbInfo( fname ); | ||
118 | } | 111 | } |
@@ -120,7 +113,3 @@ void Doc_DirLister::imageInfo( const QString& str) { | |||
120 | void Doc_DirLister::fullImageInfo( const QString& str) { | 113 | void Doc_DirLister::fullImageInfo( const QString& str) { |
121 | if (m_namemap.find(str)==m_namemap.end()) { | 114 | SlaveMaster::self()->imageInfo(str); |
122 | return; | ||
123 | } | ||
124 | QString fname = m_namemap[str]; | ||
125 | SlaveMaster::self()->imageInfo( fname ); | ||
126 | } | 115 | } |
@@ -129,7 +118,3 @@ void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) | |||
129 | { | 118 | { |
130 | if (m_filemap.find(f)==m_filemap.end()) { | 119 | emit sig_fullInfo(f, t); |
131 | return; | ||
132 | } | ||
133 | QString name = m_filemap[f]; | ||
134 | emit sig_fullInfo(name, t); | ||
135 | } | 120 | } |
@@ -138,7 +123,3 @@ void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) | |||
138 | { | 123 | { |
139 | if (m_filemap.find(f)==m_filemap.end()) { | 124 | emit sig_thumbInfo(f, t); |
140 | return; | ||
141 | } | ||
142 | QString name = m_filemap[f]; | ||
143 | emit sig_thumbInfo(name, t); | ||
144 | } | 125 | } |
@@ -147,7 +128,3 @@ void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | |||
147 | { | 128 | { |
148 | if (m_filemap.find(f)==m_filemap.end()) { | 129 | emit sig_thumbNail(f, p); |
149 | return; | ||
150 | } | ||
151 | QString name = m_filemap[f]; | ||
152 | emit sig_thumbNail(name, p); | ||
153 | } | 130 | } |
@@ -156,6 +133,3 @@ QString Doc_DirLister::nameToFname(const QString&name)const | |||
156 | { | 133 | { |
157 | if (m_namemap.find(name)==m_namemap.end()) { | 134 | return name; |
158 | return QString::null; | ||
159 | } | ||
160 | return m_namemap[name]; | ||
161 | } | 135 | } |
@@ -184,3 +158,2 @@ void Doc_DirLister::showCategory(int which) | |||
184 | m_catFilter = which==-2?0:which; | 158 | m_catFilter = which==-2?0:which; |
185 | m_namemap.clear(); | ||
186 | setStartPath(""); | 159 | setStartPath(""); |
@@ -188 +161,41 @@ void Doc_DirLister::showCategory(int which) | |||
188 | } | 161 | } |
162 | |||
163 | void Doc_DirLister::systemMsg(const QCString &msg, const QByteArray &data) | ||
164 | { | ||
165 | if ( msg != "linkChanged(QString)"||!m_docreads) { | ||
166 | return; | ||
167 | } | ||
168 | QString link; | ||
169 | QDataStream stream( data, IO_ReadOnly ); | ||
170 | stream >> link; | ||
171 | odebug << "Doc_DirLister systemMsg -> linkchanged( " << link << " )" << oendl; | ||
172 | if ( link.isNull() || OGlobal::isAppLnkFileName(link) ) { | ||
173 | return; | ||
174 | } | ||
175 | QListIterator<DocLnk> dit(m_ds.children()); | ||
176 | bool must_reload = false; | ||
177 | bool found = false; | ||
178 | while ( dit.current() ) { | ||
179 | DocLnk *doc = dit.current(); | ||
180 | ++dit; | ||
181 | if (doc->linkFile() == link) { | ||
182 | found = true; | ||
183 | DocLnk* dl = new DocLnk(link); | ||
184 | if (dl->fileKnown()) { | ||
185 | // changing | ||
186 | m_ds.add(dl); | ||
187 | } else { | ||
188 | delete dl; | ||
189 | } | ||
190 | if (matchCat(doc) || matchCat(dl)) { | ||
191 | must_reload = true; | ||
192 | } | ||
193 | m_ds.remove( doc ); // remove old link from docLnkSet | ||
194 | delete doc; | ||
195 | } | ||
196 | } | ||
197 | if (must_reload) { | ||
198 | setStartPath(""); | ||
199 | emit sig_reloadDir(); | ||
200 | } | ||
201 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h index 403241c..3f8825f 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.h +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h | |||
@@ -16,2 +16,3 @@ class Config; | |||
16 | class AppLnk; | 16 | class AppLnk; |
17 | class QCopChannel; | ||
17 | 18 | ||
@@ -21,3 +22,3 @@ public: | |||
21 | Doc_DirLister(); | 22 | Doc_DirLister(); |
22 | virtual ~Doc_DirLister(){} | 23 | virtual ~Doc_DirLister(); |
23 | 24 | ||
@@ -39,5 +40,4 @@ public: | |||
39 | private: | 40 | private: |
40 | QMap<QString,QString> m_namemap,m_filemap; | ||
41 | int m_catFilter; | 41 | int m_catFilter; |
42 | bool matchCat(const AppLnk* app); | 42 | bool matchCat(const AppLnk* app)const; |
43 | bool m_docreads; | 43 | bool m_docreads; |
@@ -50,2 +50,4 @@ protected slots: | |||
50 | virtual void showCategory(int); | 50 | virtual void showCategory(int); |
51 | void systemMsg(const QCString &, const QByteArray &); | ||
52 | QCopChannel *syschannel; | ||
51 | }; | 53 | }; |