-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 64 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 15 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 47 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 137 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 8 |
8 files changed, 178 insertions, 102 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 | |||
@@ -187,73 +187,60 @@ namespace { | |||
187 | */ | 187 | */ |
188 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | 188 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) |
189 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) | 189 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) |
190 | { | 190 | { |
191 | { | 191 | { |
192 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 192 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
193 | } | 193 | } |
194 | m_path = QDir::homeDirPath(); | 194 | m_path = QDir::homeDirPath(); |
195 | m_mode = 0; | 195 | m_mode = 0; |
196 | m_iconsize = 32; | 196 | m_iconsize = 32; |
197 | m_internalReset = false; | 197 | m_internalReset = false; |
198 | m_customWidget = 0; | 198 | m_customWidget = 0; |
199 | m_setDocCalled = false; | ||
199 | 200 | ||
200 | m_hbox = new QHBox( this ); | 201 | m_hbox = new QHBox( this ); |
201 | QLabel* lbl = new QLabel( m_hbox ); | 202 | QLabel* lbl = new QLabel( m_hbox ); |
202 | lbl->setText( tr("View as" ) ); | 203 | lbl->setText( tr("View as" ) ); |
203 | 204 | ||
204 | m_views = new QComboBox( m_hbox, "View As" ); | 205 | m_views = new QComboBox( m_hbox, "View As" ); |
205 | 206 | ||
206 | m_view= new QIconView( this ); | 207 | m_view= new QIconView( this ); |
207 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 208 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
208 | this, SLOT(slotClicked(QIconViewItem*)) ); | 209 | this, SLOT(slotClicked(QIconViewItem*)) ); |
209 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), | 210 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), |
210 | this, SLOT(slotClicked(QIconViewItem*)) ); | 211 | this, SLOT(slotClicked(QIconViewItem*)) ); |
211 | 212 | ||
212 | m_view->setArrangement( QIconView::LeftToRight ); | 213 | m_view->setArrangement( QIconView::LeftToRight ); |
213 | 214 | ||
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 ); |
220 | if (m_mode >1) { | 218 | if (m_mode >1) { |
221 | m_view->setResizeMode(QIconView::Adjust); | 219 | m_view->setResizeMode(QIconView::Adjust); |
222 | } else { | 220 | } else { |
223 | m_view->setResizeMode(QIconView::Fixed); | 221 | m_view->setResizeMode(QIconView::Fixed); |
224 | } | 222 | } |
225 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); | 223 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); |
226 | if (m_iconsize<12)m_iconsize = 12; | 224 | if (m_iconsize<12)m_iconsize = 12; |
227 | if (m_iconsize>64)m_iconsize = 64; | 225 | if (m_iconsize>64)m_iconsize = 64; |
228 | 226 | ||
229 | calculateGrid(); | 227 | calculateGrid(); |
230 | |||
231 | initKeys(); | 228 | initKeys(); |
232 | |||
233 | loadViews(); | 229 | loadViews(); |
234 | int cc=0; | 230 | } |
235 | for (; cc<m_views->count();++cc) { | 231 | |
236 | if (m_views->text(cc)==lastView) { | 232 | void PIconView::setDoccalled(bool how) |
237 | break; | 233 | { |
238 | } | 234 | m_setDocCalled = how; |
239 | } | ||
240 | if (cc<m_views->count()) { | ||
241 | m_views->setCurrentItem(cc); | ||
242 | slotViewChanged(cc); | ||
243 | } else { | ||
244 | slotViewChanged(m_views->currentItem()); | ||
245 | } | ||
246 | connect( m_views, SIGNAL(activated(int)), | ||
247 | this, SLOT(slotViewChanged(int)) ); | ||
248 | } | 235 | } |
249 | 236 | ||
250 | /* | 237 | /* |
251 | * Unref the slave and save the keyboard manager | 238 | * Unref the slave and save the keyboard manager |
252 | */ | 239 | */ |
253 | PIconView::~PIconView() { | 240 | PIconView::~PIconView() { |
254 | { | 241 | { |
255 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 242 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
256 | } | 243 | } |
257 | m_viewManager->save(); | 244 | m_viewManager->save(); |
258 | delete m_viewManager; | 245 | delete m_viewManager; |
259 | } | 246 | } |
@@ -432,24 +419,48 @@ void PIconView::resetView() { | |||
432 | delete _cpyPix; | 419 | delete _cpyPix; |
433 | _cpyPix = 0; | 420 | _cpyPix = 0; |
434 | } | 421 | } |
435 | calculateGrid(); | 422 | calculateGrid(); |
436 | } | 423 | } |
437 | } else { | 424 | } else { |
438 | m_iconsize = 64; | 425 | m_iconsize = 64; |
439 | } | 426 | } |
440 | slotViewChanged(m_views->currentItem()); | 427 | slotViewChanged(m_views->currentItem()); |
441 | m_internalReset = false; | 428 | m_internalReset = false; |
442 | } | 429 | } |
443 | 430 | ||
431 | void 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 | /* |
445 | *swicth view reloadDir and connect signals | 456 | *swicth view reloadDir and connect signals |
446 | */ | 457 | */ |
447 | void PIconView::slotViewChanged( int i) { | 458 | void PIconView::slotViewChanged( int i) { |
448 | if (!m_views->count() ) { | 459 | if (!m_views->count() ) { |
449 | setCurrentView( 0l); | 460 | setCurrentView( 0l); |
450 | return; | 461 | return; |
451 | } | 462 | } |
452 | 463 | ||
453 | if (m_customWidget) { | 464 | if (m_customWidget) { |
454 | delete m_customWidget; | 465 | delete m_customWidget; |
455 | m_customWidget = 0; | 466 | m_customWidget = 0; |
@@ -520,33 +531,38 @@ void PIconView::addFolders( const QStringList& lst) { | |||
520 | if (m_mode==3) _iv->setTextOnly(true); | 531 | if (m_mode==3) _iv->setTextOnly(true); |
521 | } | 532 | } |
522 | } | 533 | } |
523 | 534 | ||
524 | void PIconView::addFiles( const QStringList& lst) { | 535 | void PIconView::addFiles( const QStringList& lst) { |
525 | QStringList::ConstIterator it; | 536 | QStringList::ConstIterator it; |
526 | IconViewItem * _iv; | 537 | IconViewItem * _iv; |
527 | QPixmap*m_pix = 0; | 538 | QPixmap*m_pix = 0; |
528 | QString pre = ""; | 539 | QString pre = ""; |
529 | if (!m_path.isEmpty()) { | 540 | if (!m_path.isEmpty()) { |
530 | pre = m_path+"/"; | 541 | pre = m_path+"/"; |
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 ) { |
533 | m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize ); | 546 | s = (*it); |
534 | _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize ); | 547 | pos = s.find(char(0)); |
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 { | ||
552 | _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize ); | ||
553 | } | ||
535 | if (m_mode==3) { | 554 | if (m_mode==3) { |
536 | _iv->setTextOnly(true); | 555 | _iv->setTextOnly(true); |
537 | _iv->setPixmap(QPixmap()); | 556 | _iv->setPixmap(QPixmap()); |
538 | |||
539 | |||
540 | |||
541 | } else { | 557 | } else { |
542 | if (m_pix) _iv->setPixmap(*m_pix); | 558 | if (m_pix) _iv->setPixmap(*m_pix); |
543 | } | 559 | } |
544 | } | 560 | } |
545 | 561 | ||
546 | } | 562 | } |
547 | 563 | ||
548 | /* | 564 | /* |
549 | * user clicked on the item. Change dir or view | 565 | * user clicked on the item. Change dir or view |
550 | */ | 566 | */ |
551 | void PIconView::slotClicked(QIconViewItem* _it) { | 567 | void PIconView::slotClicked(QIconViewItem* _it) { |
552 | if(!_it ) | 568 | if(!_it ) |
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 | |||
@@ -26,45 +26,49 @@ namespace Core{ | |||
26 | class PIconView : public QVBox { | 26 | class PIconView : public QVBox { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | friend class PIconViewItem; | 28 | friend class PIconViewItem; |
29 | enum ActionIds { | 29 | enum ActionIds { |
30 | BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem | 30 | BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem |
31 | }; | 31 | }; |
32 | public: | 32 | public: |
33 | PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); | 33 | PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); |
34 | ~PIconView(); | 34 | ~PIconView(); |
35 | void resetView(); | 35 | void resetView(); |
36 | Opie::Core::OKeyConfigManager* manager(); | 36 | Opie::Core::OKeyConfigManager* manager(); |
37 | 37 | ||
38 | void setDoccalled(bool); | ||
39 | |||
38 | signals: | 40 | signals: |
39 | void sig_showInfo( const QString& ); | 41 | void sig_showInfo( const QString& ); |
40 | void sig_display(const QString&); | 42 | void sig_display(const QString&); |
41 | void sig_startslide(int timeout); | 43 | void sig_startslide(int timeout); |
42 | 44 | ||
43 | public slots: | 45 | public slots: |
44 | virtual void slotShowNext(); | 46 | virtual void slotShowNext(); |
45 | virtual void slotShowPrev(); | 47 | virtual void slotShowPrev(); |
46 | virtual void slotShowLast(); | 48 | virtual void slotShowLast(); |
47 | virtual bool slotShowFirst(); | 49 | virtual bool slotShowFirst(); |
50 | virtual void polish(); | ||
48 | 51 | ||
49 | protected: | 52 | protected: |
50 | void resizeEvent( QResizeEvent* ); | 53 | void resizeEvent( QResizeEvent* ); |
51 | 54 | ||
52 | private: | 55 | private: |
53 | void initKeys(); | 56 | void initKeys(); |
54 | QString currentFileName(bool &isDir)const; | 57 | QString currentFileName(bool &isDir)const; |
55 | QString nextFileName(bool &isDir)const; | 58 | QString nextFileName(bool &isDir)const; |
56 | QString prevFileName(bool &isDir)const; | 59 | QString prevFileName(bool &isDir)const; |
57 | void loadViews(); | 60 | void loadViews(); |
58 | void calculateGrid(QResizeEvent*e = 0); | 61 | void calculateGrid(QResizeEvent*e = 0); |
62 | bool m_setDocCalled:1; | ||
59 | 63 | ||
60 | private slots: | 64 | private slots: |
61 | void slotDirUp(); | 65 | void slotDirUp(); |
62 | void slotChangeDir(const QString&); | 66 | void slotChangeDir(const QString&); |
63 | void slotTrash(); | 67 | void slotTrash(); |
64 | void slotViewChanged( int ); | 68 | void slotViewChanged( int ); |
65 | void slotReloadDir(); | 69 | void slotReloadDir(); |
66 | void slotRename(); | 70 | void slotRename(); |
67 | void slotBeam(); | 71 | void slotBeam(); |
68 | void slotBeamDone( Ir* ); | 72 | void slotBeamDone( Ir* ); |
69 | 73 | ||
70 | void slotShowImage(); | 74 | void slotShowImage(); |
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 | |||
@@ -18,24 +18,25 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name | |||
18 | m_viewManager = 0; | 18 | m_viewManager = 0; |
19 | focus_in_count = 0; | 19 | focus_in_count = 0; |
20 | m_cfg = cfg; | 20 | m_cfg = cfg; |
21 | m_isFullScreen = false; | 21 | m_isFullScreen = false; |
22 | m_ignore_next_in = false; | 22 | m_ignore_next_in = false; |
23 | m_slideTimer = 0; | 23 | m_slideTimer = 0; |
24 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); | 24 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); |
25 | initKeys(); | 25 | initKeys(); |
26 | m_slideValue = 5; | 26 | m_slideValue = 5; |
27 | m_gDisplayType = 0; | 27 | m_gDisplayType = 0; |
28 | m_gPrevNext = 0; | 28 | m_gPrevNext = 0; |
29 | m_hGroup = 0; | 29 | m_hGroup = 0; |
30 | closeIfHide = false; | ||
30 | } | 31 | } |
31 | 32 | ||
32 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) | 33 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) |
33 | { | 34 | { |
34 | m_gDisplayType = disptypeGroup; | 35 | m_gDisplayType = disptypeGroup; |
35 | m_gPrevNext = nextprevGroup; | 36 | m_gPrevNext = nextprevGroup; |
36 | m_hGroup = hGroup; | 37 | m_hGroup = hGroup; |
37 | } | 38 | } |
38 | 39 | ||
39 | ImageView::~ImageView() | 40 | ImageView::~ImageView() |
40 | { | 41 | { |
41 | odebug << "Destructor imageview" << oendl; | 42 | odebug << "Destructor imageview" << oendl; |
@@ -143,25 +144,37 @@ void ImageView::initKeys() | |||
143 | Resource::loadPixmap("mag"), Zoomer, | 144 | Resource::loadPixmap("mag"), Zoomer, |
144 | Opie::Core::OKeyPair(Qt::Key_T,0), | 145 | Opie::Core::OKeyPair(Qt::Key_T,0), |
145 | this, SIGNAL(toggleZoomer()))); | 146 | this, SIGNAL(toggleZoomer()))); |
146 | m_viewManager->handleWidget( this ); | 147 | m_viewManager->handleWidget( this ); |
147 | m_viewManager->load(); | 148 | m_viewManager->load(); |
148 | } | 149 | } |
149 | 150 | ||
150 | void ImageView::keyReleaseEvent(QKeyEvent * e) | 151 | void ImageView::keyReleaseEvent(QKeyEvent * e) |
151 | { | 152 | { |
152 | if (!e || e->state()!=0) { | 153 | if (!e || e->state()!=0) { |
153 | return; | 154 | return; |
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 | |||
166 | void ImageView::setCloseIfHide(bool how) | ||
167 | { | ||
168 | closeIfHide = how; | ||
156 | } | 169 | } |
157 | 170 | ||
158 | void ImageView::slotShowImageInfo() | 171 | void ImageView::slotShowImageInfo() |
159 | { | 172 | { |
160 | emit dispImageInfo(m_lastName); | 173 | emit dispImageInfo(m_lastName); |
161 | } | 174 | } |
162 | 175 | ||
163 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) | 176 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) |
164 | { | 177 | { |
165 | if (e->button()==1) { | 178 | if (e->button()==1) { |
166 | return OImageScrollView::contentsMousePressEvent(e); | 179 | return OImageScrollView::contentsMousePressEvent(e); |
167 | } | 180 | } |
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 | |||
@@ -30,46 +30,48 @@ class ImageView:public Opie::MM::OImageScrollView | |||
30 | Autoscale | 30 | Autoscale |
31 | }; | 31 | }; |
32 | 32 | ||
33 | public: | 33 | public: |
34 | ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 ); | 34 | ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 ); |
35 | virtual ~ImageView(); | 35 | virtual ~ImageView(); |
36 | Opie::Core::OKeyConfigManager* manager(); | 36 | Opie::Core::OKeyConfigManager* manager(); |
37 | void setFullScreen(bool how,bool force=true); | 37 | void setFullScreen(bool how,bool force=true); |
38 | bool fullScreen(){return m_isFullScreen;} | 38 | bool fullScreen(){return m_isFullScreen;} |
39 | virtual void enableFullscreen(); | 39 | virtual void enableFullscreen(); |
40 | void stopSlide(); | 40 | void stopSlide(); |
41 | void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); | 41 | void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); |
42 | void setCloseIfHide(bool); | ||
42 | 43 | ||
43 | signals: | 44 | signals: |
44 | void dispImageInfo(const QString&); | 45 | void dispImageInfo(const QString&); |
45 | void dispNext(); | 46 | void dispNext(); |
46 | void dispPrev(); | 47 | void dispPrev(); |
47 | void toggleFullScreen(); | 48 | void toggleFullScreen(); |
48 | void hideMe(); | 49 | void hideMe(); |
49 | void toggleZoomer(); | 50 | void toggleZoomer(); |
50 | void toggleAutoscale(); | 51 | void toggleAutoscale(); |
51 | void toggleAutorotate(); | 52 | void toggleAutorotate(); |
52 | 53 | ||
53 | protected: | 54 | protected: |
54 | Opie::Core::OConfig * m_cfg; | 55 | Opie::Core::OConfig * m_cfg; |
55 | Opie::Core::OKeyConfigManager*m_viewManager; | 56 | Opie::Core::OKeyConfigManager*m_viewManager; |
56 | void initKeys(); | 57 | void initKeys(); |
57 | bool m_isFullScreen:1; | 58 | bool m_isFullScreen:1; |
58 | bool m_ignore_next_in:1; | 59 | bool m_ignore_next_in:1; |
59 | int focus_in_count; | 60 | int focus_in_count; |
60 | QTimer*m_slideTimer; | 61 | QTimer*m_slideTimer; |
61 | int m_slideValue; | 62 | int m_slideValue; |
62 | virtual void focusInEvent ( QFocusEvent * ); | 63 | virtual void focusInEvent ( QFocusEvent * ); |
63 | QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; | 64 | QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; |
65 | bool closeIfHide:1; | ||
64 | 66 | ||
65 | public slots: | 67 | public slots: |
66 | virtual void hide(); | 68 | virtual void hide(); |
67 | virtual void startSlide(int); | 69 | virtual void startSlide(int); |
68 | virtual void nextSlide(); | 70 | virtual void nextSlide(); |
69 | 71 | ||
70 | protected slots: | 72 | protected slots: |
71 | virtual void slotShowImageInfo(); | 73 | virtual void slotShowImageInfo(); |
72 | virtual void keyReleaseEvent(QKeyEvent * e); | 74 | virtual void keyReleaseEvent(QKeyEvent * e); |
73 | virtual void contentsMousePressEvent ( QMouseEvent * e); | 75 | virtual void contentsMousePressEvent ( QMouseEvent * e); |
74 | }; | 76 | }; |
75 | 77 | ||
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 | |||
@@ -37,24 +37,26 @@ | |||
37 | #include <qaction.h> | 37 | #include <qaction.h> |
38 | 38 | ||
39 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 39 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
40 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | 40 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) |
41 | 41 | ||
42 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 42 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
43 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 43 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
44 | { | 44 | { |
45 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 45 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
46 | m_cfg = new Opie::Core::OConfig("opie-eye"); | 46 | m_cfg = new Opie::Core::OConfig("opie-eye"); |
47 | m_cfg->setGroup("main" ); | 47 | m_cfg->setGroup("main" ); |
48 | readConfig(); | 48 | readConfig(); |
49 | m_setDocCalled = false; | ||
50 | m_polishDone = false; | ||
49 | 51 | ||
50 | m_storage = new StorageInfo(); | 52 | m_storage = new StorageInfo(); |
51 | connect(m_storage, SIGNAL(disksChanged() ), | 53 | connect(m_storage, SIGNAL(disksChanged() ), |
52 | this, SLOT( dirChanged() ) ); | 54 | this, SLOT( dirChanged() ) ); |
53 | 55 | ||
54 | m_stack = new Opie::Ui::OWidgetStack( this ); | 56 | m_stack = new Opie::Ui::OWidgetStack( this ); |
55 | setCentralWidget( m_stack ); | 57 | setCentralWidget( m_stack ); |
56 | 58 | ||
57 | m_view = new PIconView( m_stack, m_cfg ); | 59 | m_view = new PIconView( m_stack, m_cfg ); |
58 | m_stack->addWidget( m_view, IconView ); | 60 | m_stack->addWidget( m_view, IconView ); |
59 | m_stack->raiseWidget( IconView ); | 61 | m_stack->raiseWidget( IconView ); |
60 | 62 | ||
@@ -410,51 +412,53 @@ void PMainWindow::raiseIconView() { | |||
410 | } | 412 | } |
411 | 413 | ||
412 | void PMainWindow::slotReturn() { | 414 | void PMainWindow::slotReturn() { |
413 | raiseIconView(); | 415 | raiseIconView(); |
414 | } | 416 | } |
415 | 417 | ||
416 | 418 | ||
417 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 419 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
418 | /* | 420 | /* |
419 | * return from view | 421 | * return from view |
420 | * or properly quit | 422 | * or properly quit |
421 | */ | 423 | */ |
422 | if ( m_stack->visibleWidget() == m_info || | 424 | if (!m_setDocCalled) { |
423 | m_stack->visibleWidget() == m_disp ) { | 425 | if ( m_stack->visibleWidget() == m_info || |
424 | ev->ignore(); | 426 | m_stack->visibleWidget() == m_disp ) { |
425 | raiseIconView(); | 427 | ev->ignore(); |
426 | return; | 428 | raiseIconView(); |
429 | return; | ||
430 | } | ||
427 | } | 431 | } |
428 | if (m_disp && m_disp->fullScreen()) { | 432 | if (m_disp && m_disp->fullScreen()) { |
429 | /* otherwise opie-eye crashes in bigscreen mode! */ | 433 | /* otherwise opie-eye crashes in bigscreen mode! */ |
430 | m_disp->reparent(0,QPoint(0,0)); | 434 | m_disp->reparent(0,QPoint(0,0)); |
431 | m_stack->addWidget(m_disp,ImageDisplay); | 435 | m_stack->addWidget(m_disp,ImageDisplay); |
432 | } | 436 | } |
433 | ev->accept(); | 437 | ev->accept(); |
434 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 438 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
435 | } | 439 | } |
436 | 440 | ||
437 | void PMainWindow::setDocument( const QString& showImg ) | 441 | void PMainWindow::setDocument( const QString& showImg ) |
438 | { | 442 | { |
439 | bool first_start = m_disp==0; | ||
440 | |||
441 | QString file = showImg; | 443 | QString file = showImg; |
442 | DocLnk lnk(showImg); | 444 | DocLnk lnk(showImg); |
443 | if (lnk.isValid() ) | 445 | if (lnk.isValid() ) |
444 | file = lnk.file(); | 446 | file = lnk.file(); |
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 | } |
450 | 454 | ||
451 | void PMainWindow::check_view_fullscreen() | 455 | void PMainWindow::check_view_fullscreen() |
452 | { | 456 | { |
453 | if (!m_view) return; | 457 | if (!m_view) return; |
454 | if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { | 458 | if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { |
455 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 459 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
456 | } | 460 | } |
457 | } | 461 | } |
458 | 462 | ||
459 | void PMainWindow::slotSelectDir(int id) | 463 | void PMainWindow::slotSelectDir(int id) |
460 | { | 464 | { |
@@ -680,31 +684,50 @@ void PMainWindow::setupMenu() | |||
680 | m_gDisplayType->addTo(dispMenu); | 684 | m_gDisplayType->addTo(dispMenu); |
681 | dispMenu->insertSeparator(); | 685 | dispMenu->insertSeparator(); |
682 | m_gPrevNext->addTo(dispMenu); | 686 | m_gPrevNext->addTo(dispMenu); |
683 | 687 | ||
684 | m_aSetup->addTo(settingsMenu); | 688 | m_aSetup->addTo(settingsMenu); |
685 | m_aHideToolbar->addTo(settingsMenu); | 689 | m_aHideToolbar->addTo(settingsMenu); |
686 | } | 690 | } |
687 | 691 | ||
688 | void PMainWindow::listviewselected(QAction*which) | 692 | void PMainWindow::listviewselected(QAction*which) |
689 | { | 693 | { |
690 | if (!which || which->isOn()==false) return; | 694 | if (!which || which->isOn()==false) return; |
691 | int val = 1; | 695 | int val = 1; |
692 | // QString name; | ||
693 | 696 | ||
694 | if (which==m_aDirName) { | 697 | if (which==m_aDirName) { |
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 | } |
704 | emit changeListMode(val); | 704 | emit changeListMode(val); |
705 | } | 705 | } |
706 | 706 | ||
707 | void PMainWindow::readConfig() | 707 | void PMainWindow::readConfig() |
708 | { | 708 | { |
709 | autoSave =m_cfg->readBoolEntry("savestatus",true); | 709 | autoSave =m_cfg->readBoolEntry("savestatus",true); |
710 | } | 710 | } |
711 | |||
712 | void 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 | |||
@@ -49,46 +49,49 @@ public slots: | |||
49 | void slotShowInfo( const QString& inf ); | 49 | void slotShowInfo( const QString& inf ); |
50 | void slotDisplay( const QString& inf ); | 50 | void slotDisplay( const QString& inf ); |
51 | void slotReturn(); | 51 | void slotReturn(); |
52 | void slotRotateToggled(bool); | 52 | void slotRotateToggled(bool); |
53 | void slotScaleToggled(bool); | 53 | void slotScaleToggled(bool); |
54 | void slotZoomerToggled(bool); | 54 | void slotZoomerToggled(bool); |
55 | void slotToggleZoomer(); | 55 | void slotToggleZoomer(); |
56 | void slotToggleAutorotate(); | 56 | void slotToggleAutorotate(); |
57 | void slotToggleAutoscale(); | 57 | void slotToggleAutoscale(); |
58 | void setDocument( const QString& ); | 58 | void setDocument( const QString& ); |
59 | virtual void slotToggleFullScreen(); | 59 | virtual void slotToggleFullScreen(); |
60 | virtual void slotFullScreenToggled(bool); | 60 | virtual void slotFullScreenToggled(bool); |
61 | virtual void polish(); | ||
61 | 62 | ||
62 | protected slots: | 63 | protected slots: |
63 | void raiseIconView(); | 64 | void raiseIconView(); |
64 | void closeEvent( QCloseEvent* ); | 65 | void closeEvent( QCloseEvent* ); |
65 | void showToolbar(bool); | 66 | void showToolbar(bool); |
66 | void listviewselected(QAction*); | 67 | void listviewselected(QAction*); |
67 | void slotFullScreenButton(bool); | 68 | void slotFullScreenButton(bool); |
68 | void check_view_fullscreen(); | 69 | void check_view_fullscreen(); |
69 | 70 | ||
70 | private: | 71 | private: |
71 | template<class T> void initT( const char* name, T**, int ); | 72 | template<class T> void initT( const char* name, T**, int ); |
72 | void initInfo(); | 73 | void initInfo(); |
73 | void initDisp(); | 74 | void initDisp(); |
74 | void setupViewWindow(bool full, bool forceDisplay); | 75 | void setupViewWindow(bool full, bool forceDisplay); |
75 | 76 | ||
76 | private: | 77 | private: |
77 | Opie::Core::OConfig *m_cfg; | 78 | Opie::Core::OConfig *m_cfg; |
78 | Opie::Ui::OWidgetStack *m_stack; | 79 | Opie::Ui::OWidgetStack *m_stack; |
79 | PIconView* m_view; | 80 | PIconView* m_view; |
80 | imageinfo *m_info; | 81 | imageinfo *m_info; |
81 | ImageView *m_disp; | 82 | ImageView *m_disp; |
82 | bool autoSave; | 83 | bool autoSave; |
84 | bool m_setDocCalled:1; | ||
85 | bool m_polishDone:1; | ||
83 | QToolButton*fsButton; | 86 | QToolButton*fsButton; |
84 | QToolBar *toolBar; | 87 | QToolBar *toolBar; |
85 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; | 88 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; |
86 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; | 89 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; |
87 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; | 90 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; |
88 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; | 91 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; |
89 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; | 92 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; |
90 | QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer; | 93 | QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer; |
91 | 94 | ||
92 | /* init funs */ | 95 | /* init funs */ |
93 | void readConfig(); | 96 | void readConfig(); |
94 | void setupActions(); | 97 | void setupActions(); |
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 | |||
@@ -2,187 +2,200 @@ | |||
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 | #include <opie2/oglobal.h> | ||
14 | 15 | ||
15 | #include <qtopia/private/categories.h> | 16 | #include <qtopia/private/categories.h> |
16 | #include <qtopia/categoryselect.h> | 17 | #include <qtopia/categoryselect.h> |
17 | 18 | ||
18 | using namespace Opie::Core; | 19 | using namespace Opie::Core; |
19 | 20 | ||
20 | /* QT */ | 21 | /* QT */ |
21 | #include <qdir.h> | 22 | #include <qdir.h> |
22 | #include <qfileinfo.h> | 23 | #include <qfileinfo.h> |
24 | #include <qtopia/qcopenvelope_qws.h> | ||
23 | 25 | ||
24 | Doc_DirLister::Doc_DirLister() | 26 | Doc_DirLister::Doc_DirLister() |
25 | : PDirLister( "doc_dir_lister" ) | 27 | : PDirLister( "doc_dir_lister" ) |
26 | { | 28 | { |
27 | /* connect the signals */ | 29 | /* connect the signals */ |
28 | m_catFilter = 0; | 30 | m_catFilter = 0; |
29 | SlaveMaster* master = SlaveMaster::self(); | 31 | SlaveMaster* master = SlaveMaster::self(); |
30 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 32 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
31 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 33 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
32 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 34 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
33 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | 35 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); |
34 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 36 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
35 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | 37 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); |
36 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | 38 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
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 | } |
43 | 49 | ||
44 | QString Doc_DirLister::defaultPath()const { | 50 | QString Doc_DirLister::defaultPath()const { |
45 | return QString::null; | 51 | return QString::null; |
46 | } | 52 | } |
47 | 53 | ||
48 | bool Doc_DirLister::matchCat(const AppLnk* app) | 54 | bool Doc_DirLister::matchCat(const AppLnk* app)const |
49 | { | 55 | { |
50 | if (!app) return false; | 56 | if (!app) return false; |
51 | if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) { | 57 | if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) { |
52 | return true; | 58 | return true; |
53 | } | 59 | } |
54 | return false; | 60 | return false; |
55 | } | 61 | } |
56 | 62 | ||
57 | QString Doc_DirLister::setStartPath(const QString&) { | 63 | 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()) { | 65 | if (!m_docreads) { |
60 | if (!m_docreads) { | 66 | Global::findDocuments(&m_ds,Mtype_str); |
61 | Global::findDocuments(&m_ds,Mtype_str); | 67 | m_docreads = true; |
62 | m_docreads = true; | ||
63 | } | ||
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 | } | 68 | } |
71 | return QString::null; | 69 | return QString::null; |
72 | } | 70 | } |
73 | 71 | ||
74 | QString Doc_DirLister::currentPath()const { | 72 | QString Doc_DirLister::currentPath()const |
75 | return QString::null; | 73 | { |
74 | return QString::null; | ||
76 | } | 75 | } |
77 | 76 | ||
78 | 77 | ||
79 | QStringList Doc_DirLister::folders()const { | 78 | QStringList Doc_DirLister::folders()const { |
80 | return QStringList(); | 79 | return QStringList(); |
81 | } | 80 | } |
82 | 81 | ||
83 | QStringList Doc_DirLister::files()const { | 82 | 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 | } |
89 | return out; | 92 | return out; |
90 | } | 93 | } |
91 | 94 | ||
92 | void Doc_DirLister::deleteImage( const QString& ) | 95 | void Doc_DirLister::deleteImage( const QString& ) |
93 | { | 96 | { |
94 | } | 97 | } |
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 | } |
111 | 108 | ||
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 | } |
119 | 112 | ||
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 | } |
127 | 116 | ||
128 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) | 117 | 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 | } |
136 | 121 | ||
137 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) | 122 | 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 | } |
145 | 126 | ||
146 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | 127 | 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 | } |
154 | 131 | ||
155 | QString Doc_DirLister::nameToFname(const QString&name)const | 132 | 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 | } |
162 | 136 | ||
163 | QString Doc_DirLister::dirUp( const QString& p ) const{ | 137 | QString Doc_DirLister::dirUp( const QString& p ) const{ |
164 | return p; | 138 | return p; |
165 | } | 139 | } |
166 | 140 | ||
167 | QWidget* Doc_DirLister::widget(QWidget*parent) | 141 | QWidget* Doc_DirLister::widget(QWidget*parent) |
168 | { | 142 | { |
169 | CategorySelect * catmb = new CategorySelect(parent); | 143 | CategorySelect * catmb = new CategorySelect(parent); |
170 | Categories cats( 0 ); | 144 | Categories cats( 0 ); |
171 | cats.load( categoryFileName() ); | 145 | cats.load( categoryFileName() ); |
172 | QArray<int> vl( 0 ); | 146 | QArray<int> vl( 0 ); |
173 | catmb->setCategories( vl, "Document View", // No tr | 147 | catmb->setCategories( vl, "Document View", // No tr |
174 | "Document View" ); | 148 | "Document View" ); |
175 | catmb->setRemoveCategoryEdit( TRUE ); | 149 | catmb->setRemoveCategoryEdit( TRUE ); |
176 | catmb->setAllCategories( TRUE ); | 150 | catmb->setAllCategories( TRUE ); |
177 | connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); | 151 | connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); |
178 | catmb->setCurrentCategory(-2); | 152 | catmb->setCurrentCategory(-2); |
179 | return catmb; | 153 | return catmb; |
180 | } | 154 | } |
181 | 155 | ||
182 | void Doc_DirLister::showCategory(int which) | 156 | void Doc_DirLister::showCategory(int which) |
183 | { | 157 | { |
184 | m_catFilter = which==-2?0:which; | 158 | m_catFilter = which==-2?0:which; |
185 | m_namemap.clear(); | ||
186 | setStartPath(""); | 159 | setStartPath(""); |
187 | emit sig_reloadDir(); | 160 | emit sig_reloadDir(); |
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 | |||
@@ -5,49 +5,51 @@ | |||
5 | #ifndef DOC_LISTER_INTERFACE_LISTER_H | 5 | #ifndef DOC_LISTER_INTERFACE_LISTER_H |
6 | #define DOC_LISTER_INTERFACE_LISTER_H | 6 | #define DOC_LISTER_INTERFACE_LISTER_H |
7 | 7 | ||
8 | #include <iface/dirlister.h> | 8 | #include <iface/dirlister.h> |
9 | 9 | ||
10 | #include <qpe/applnk.h> | 10 | #include <qpe/applnk.h> |
11 | 11 | ||
12 | #include <qstring.h> | 12 | #include <qstring.h> |
13 | #include <qmap.h> | 13 | #include <qmap.h> |
14 | 14 | ||
15 | class Config; | 15 | class Config; |
16 | class AppLnk; | 16 | class AppLnk; |
17 | class QCopChannel; | ||
17 | 18 | ||
18 | class Doc_DirLister : public PDirLister { | 19 | class Doc_DirLister : public PDirLister { |
19 | Q_OBJECT | 20 | Q_OBJECT |
20 | public: | 21 | public: |
21 | Doc_DirLister(); | 22 | Doc_DirLister(); |
22 | virtual ~Doc_DirLister(){} | 23 | virtual ~Doc_DirLister(); |
23 | 24 | ||
24 | QString defaultPath()const; | 25 | QString defaultPath()const; |
25 | QString setStartPath( const QString& ); | 26 | QString setStartPath( const QString& ); |
26 | QString currentPath()const; | 27 | QString currentPath()const; |
27 | QStringList folders()const; | 28 | QStringList folders()const; |
28 | QStringList files()const; | 29 | QStringList files()const; |
29 | 30 | ||
30 | void deleteImage( const QString& ); | 31 | void deleteImage( const QString& ); |
31 | void thumbNail( const QString&, int, int ); | 32 | void thumbNail( const QString&, int, int ); |
32 | QImage image( const QString&, Factor, int ); | 33 | QImage image( const QString&, Factor, int ); |
33 | void imageInfo( const QString& ); | 34 | void imageInfo( const QString& ); |
34 | void fullImageInfo( const QString& ); | 35 | void fullImageInfo( const QString& ); |
35 | virtual QString nameToFname(const QString&name)const; | 36 | virtual QString nameToFname(const QString&name)const; |
36 | QString dirUp( const QString& )const; | 37 | QString dirUp( const QString& )const; |
37 | QWidget* widget(QWidget*parent); | 38 | QWidget* widget(QWidget*parent); |
38 | 39 | ||
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; |
44 | DocLnkSet m_ds; | 44 | DocLnkSet m_ds; |
45 | 45 | ||
46 | protected slots: | 46 | protected slots: |
47 | virtual void slotFullInfo(const QString&, const QString&); | 47 | virtual void slotFullInfo(const QString&, const QString&); |
48 | virtual void slotThumbInfo(const QString&, const QString&); | 48 | virtual void slotThumbInfo(const QString&, const QString&); |
49 | virtual void slotThumbNail(const QString&, const QPixmap&); | 49 | virtual void slotThumbNail(const QString&, const QPixmap&); |
50 | virtual void showCategory(int); | 50 | virtual void showCategory(int); |
51 | void systemMsg(const QCString &, const QByteArray &); | ||
52 | QCopChannel *syschannel; | ||
51 | }; | 53 | }; |
52 | 54 | ||
53 | #endif | 55 | #endif |