summaryrefslogtreecommitdiff
authoralwin <alwin>2004-11-12 15:57:59 (UTC)
committer alwin <alwin>2004-11-12 15:57:59 (UTC)
commite1ed329d0b8be10ac6e019d37b82afcf21990691 (patch) (unidiff)
tree0c84e2c4fd062487932de9add39a083da194cca0
parentde558d6f0bc31f58ffaa894a0236f0d9cb5d73e0 (diff)
downloadopie-e1ed329d0b8be10ac6e019d37b82afcf21990691.zip
opie-e1ed329d0b8be10ac6e019d37b82afcf21990691.tar.gz
opie-e1ed329d0b8be10ac6e019d37b82afcf21990691.tar.bz2
- fixed a bug in docview-lister: different files may have same docview
name. So mapping filenames to docname isn't usefull. - when opie-eye is started from doctab closing the imagewindow closes the application - when a doc-link is changed while opie-eye is running it get the changes, too.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp58
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h4
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp15
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h2
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp37
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h3
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_lister.cpp129
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_lister.h8
8 files changed, 166 insertions, 90 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 948477c..138e661 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -198,2 +198,3 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
198 m_customWidget = 0; 198 m_customWidget = 0;
199 m_setDocCalled = false;
199 200
@@ -214,6 +215,3 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
214 m_mode = m_cfg->readNumEntry("ListViewMode", 1); 215 m_mode = m_cfg->readNumEntry("ListViewMode", 1);
215 QString lastView = m_cfg->readEntry("LastView","");
216
217 if (m_mode < 1 || m_mode>3) m_mode = 1; 216 if (m_mode < 1 || m_mode>3) m_mode = 1;
218
219 m_view->setItemTextPos( QIconView::Right ); 217 m_view->setItemTextPos( QIconView::Right );
@@ -229,20 +227,9 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
229 calculateGrid(); 227 calculateGrid();
230
231 initKeys(); 228 initKeys();
232
233 loadViews(); 229 loadViews();
234 int cc=0;
235 for (; cc<m_views->count();++cc) {
236 if (m_views->text(cc)==lastView) {
237 break;
238 }
239 }
240 if (cc<m_views->count()) {
241 m_views->setCurrentItem(cc);
242 slotViewChanged(cc);
243 } else {
244 slotViewChanged(m_views->currentItem());
245 } 230 }
246 connect( m_views, SIGNAL(activated(int)), 231
247 this, SLOT(slotViewChanged(int)) ); 232void PIconView::setDoccalled(bool how)
233{
234 m_setDocCalled = how;
248} 235}
@@ -443,2 +430,26 @@ void PIconView::resetView() {
443 430
431void PIconView::polish()
432{
433 odebug << "===\n"
434 << "PIconView::polish()\n"
435 << "====" << oendl;
436 QVBox::polish();
437
438 QString lastView = m_cfg->readEntry("LastView","");
439 int cc=0;
440 for (; cc<m_views->count();++cc) {
441 if (m_views->text(cc)==lastView) {
442 break;
443 }
444 }
445 if (cc<m_views->count()) {
446 m_views->setCurrentItem(cc);
447 slotViewChanged(cc);
448 } else {
449 slotViewChanged(m_views->currentItem());
450 }
451 connect( m_views, SIGNAL(activated(int)),
452 this, SLOT(slotViewChanged(int)) );
453}
454
444/* 455/*
@@ -531,5 +542,13 @@ void PIconView::addFiles( const QStringList& lst) {
531 } 542 }
543 QString s = "";
544 int pos;
532 for (it=lst.begin(); it!= lst.end(); ++it ) { 545 for (it=lst.begin(); it!= lst.end(); ++it ) {
546 s = (*it);
547 pos = s.find(char(0));
533 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize ); 548 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize );
549 if (pos>-1) {
550 _iv = new IconViewItem( m_view, s.mid(pos+1), s.left(pos),m_iconsize );
551 } else {
534 _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize ); 552 _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize );
553 }
535 if (m_mode==3) { 554 if (m_mode==3) {
@@ -537,5 +556,2 @@ void PIconView::addFiles( const QStringList& lst) {
537 _iv->setPixmap(QPixmap()); 556 _iv->setPixmap(QPixmap());
538
539
540
541 } else { 557 } else {
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index 78dda58..6e08fd8 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -37,2 +37,4 @@ public:
37 37
38 void setDoccalled(bool);
39
38signals: 40signals:
@@ -47,2 +49,3 @@ public slots:
47 virtual bool slotShowFirst(); 49 virtual bool slotShowFirst();
50 virtual void polish();
48 51
@@ -58,2 +61,3 @@ private:
58 void calculateGrid(QResizeEvent*e = 0); 61 void calculateGrid(QResizeEvent*e = 0);
62 bool m_setDocCalled:1;
59 63
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index ebdfc60..ac6474c 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -29,2 +29,3 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name
29 m_hGroup = 0; 29 m_hGroup = 0;
30 closeIfHide = false;
30} 31}
@@ -154,3 +155,15 @@ void ImageView::keyReleaseEvent(QKeyEvent * e)
154 } 155 }
155 if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); 156 if (e->key()==Qt::Key_Escape) {
157 if (fullScreen()) {
158 emit hideMe();
159 }
160 if (closeIfHide) {
161 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
162 }
163 }
164}
165
166void ImageView::setCloseIfHide(bool how)
167{
168 closeIfHide = how;
156} 169}
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index 2408211..f1067bb 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -41,2 +41,3 @@ public:
41 void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); 41 void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup);
42 void setCloseIfHide(bool);
42 43
@@ -63,2 +64,3 @@ protected:
63 QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; 64 QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup;
65 bool closeIfHide:1;
64 66
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index f443ccb..295f93f 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -48,2 +48,4 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
48 readConfig(); 48 readConfig();
49 m_setDocCalled = false;
50 m_polishDone = false;
49 51
@@ -421,2 +423,3 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) {
421 */ 423 */
424 if (!m_setDocCalled) {
422 if ( m_stack->visibleWidget() == m_info || 425 if ( m_stack->visibleWidget() == m_info ||
@@ -427,2 +430,3 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) {
427 } 430 }
431 }
428 if (m_disp && m_disp->fullScreen()) { 432 if (m_disp && m_disp->fullScreen()) {
@@ -438,4 +442,2 @@ void PMainWindow::setDocument( const QString& showImg )
438{ 442{
439 bool first_start = m_disp==0;
440
441 QString file = showImg; 443 QString file = showImg;
@@ -445,5 +447,7 @@ void PMainWindow::setDocument( const QString& showImg )
445 slotDisplay( file ); 447 slotDisplay( file );
446 if (first_start && m_aFullScreen->isOn()) { 448#if 0
449 if (!m_polishDone) {
447 QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); 450 QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
448 } 451 }
452#endif
449} 453}
@@ -691,3 +695,2 @@ void PMainWindow::listviewselected(QAction*which)
691 int val = 1; 695 int val = 1;
692// QString name;
693 696
@@ -695,9 +698,6 @@ void PMainWindow::listviewselected(QAction*which)
695 val = 3; 698 val = 3;
696// name = "opie-eye/opie-eye-textview";
697 } else if (which==m_aDirShort) { 699 } else if (which==m_aDirShort) {
698 val = 2; 700 val = 2;
699// name = "opie-eye/opie-eye-thumbonly";
700 } else if (which==m_aDirLong) { 701 } else if (which==m_aDirLong) {
701 val = 1; 702 val = 1;
702// name = "opie-eye/opie-eye-thumb";
703 } 703 }
@@ -710 +710,24 @@ void PMainWindow::readConfig()
710} 710}
711
712void PMainWindow::polish()
713{
714 if (m_disp) {
715 odebug << "======================\n"
716 << "Called via setdocument\n"
717 << "======================" << oendl;
718 m_setDocCalled = true;
719 m_view->setDoccalled(true);
720 m_disp->setCloseIfHide(true);
721 } else {
722 m_setDocCalled = false;
723 m_view->setDoccalled(false);
724 }
725 m_polishDone = true;
726 QMainWindow::polish();
727 if (m_setDocCalled) {
728 if (m_aFullScreen->isOn()) {
729 QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
730 } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
731 }
732 }
733}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 465e352..2f54090 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -60,2 +60,3 @@ public slots:
60 virtual void slotFullScreenToggled(bool); 60 virtual void slotFullScreenToggled(bool);
61 virtual void polish();
61 62
@@ -82,2 +83,4 @@ private:
82 bool autoSave; 83 bool autoSave;
84 bool m_setDocCalled:1;
85 bool m_polishDone:1;
83 QToolButton*fsButton; 86 QToolButton*fsButton;
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
46Doc_DirLister::~Doc_DirLister()
47{
42} 48}
@@ -47,3 +53,3 @@ QString Doc_DirLister::defaultPath()const {
47 53
48bool Doc_DirLister::matchCat(const AppLnk* app) 54bool 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
74QString Doc_DirLister::currentPath()const { 72QString 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
96void Doc_DirLister::thumbNail( const QString& str, int w, int h) { 99void 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
104QImage Doc_DirLister::image( const QString& str, Factor f, int m) { 104QImage 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) {
112void Doc_DirLister::imageInfo( const QString& str) { 109void 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) {
120void Doc_DirLister::fullImageInfo( const QString& str) { 113void 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
163void 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;
16class AppLnk; 16class AppLnk;
17class 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:
39private: 40private:
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};