author | alwin <alwin> | 2004-11-12 15:57:59 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-12 15:57:59 (UTC) |
commit | e1ed329d0b8be10ac6e019d37b82afcf21990691 (patch) (side-by-side diff) | |
tree | 0c84e2c4fd062487932de9add39a083da194cca0 | |
parent | de558d6f0bc31f58ffaa894a0236f0d9cb5d73e0 (diff) | |
download | opie-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.
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 58 | ||||
-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 | 37 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 3 | ||||
-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 |
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 @@ -187,73 +187,60 @@ namespace { */ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); } m_path = QDir::homeDirPath(); m_mode = 0; m_iconsize = 32; m_internalReset = false; m_customWidget = 0; + m_setDocCalled = false; m_hbox = new QHBox( this ); QLabel* lbl = new QLabel( m_hbox ); lbl->setText( tr("View as" ) ); m_views = new QComboBox( m_hbox, "View As" ); m_view= new QIconView( this ); connect(m_view, SIGNAL(clicked(QIconViewItem*) ), this, SLOT(slotClicked(QIconViewItem*)) ); connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), this, SLOT(slotClicked(QIconViewItem*)) ); m_view->setArrangement( QIconView::LeftToRight ); m_mode = m_cfg->readNumEntry("ListViewMode", 1); - QString lastView = m_cfg->readEntry("LastView",""); - if (m_mode < 1 || m_mode>3) m_mode = 1; - m_view->setItemTextPos( QIconView::Right ); if (m_mode >1) { m_view->setResizeMode(QIconView::Adjust); } else { m_view->setResizeMode(QIconView::Fixed); } m_iconsize = m_cfg->readNumEntry("iconsize", 32); if (m_iconsize<12)m_iconsize = 12; if (m_iconsize>64)m_iconsize = 64; calculateGrid(); - initKeys(); - loadViews(); - int cc=0; - for (; cc<m_views->count();++cc) { - if (m_views->text(cc)==lastView) { - break; - } - } - if (cc<m_views->count()) { - m_views->setCurrentItem(cc); - slotViewChanged(cc); - } else { - slotViewChanged(m_views->currentItem()); } - connect( m_views, SIGNAL(activated(int)), - this, SLOT(slotViewChanged(int)) ); + +void PIconView::setDoccalled(bool how) +{ + m_setDocCalled = how; } /* * Unref the slave and save the keyboard manager */ PIconView::~PIconView() { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); } m_viewManager->save(); delete m_viewManager; } @@ -432,24 +419,48 @@ void PIconView::resetView() { delete _cpyPix; _cpyPix = 0; } calculateGrid(); } } else { m_iconsize = 64; } slotViewChanged(m_views->currentItem()); m_internalReset = false; } +void PIconView::polish() +{ + odebug << "===\n" + << "PIconView::polish()\n" + << "====" << oendl; + QVBox::polish(); + + QString lastView = m_cfg->readEntry("LastView",""); + int cc=0; + for (; cc<m_views->count();++cc) { + if (m_views->text(cc)==lastView) { + break; + } + } + if (cc<m_views->count()) { + m_views->setCurrentItem(cc); + slotViewChanged(cc); + } else { + slotViewChanged(m_views->currentItem()); + } + connect( m_views, SIGNAL(activated(int)), + this, SLOT(slotViewChanged(int)) ); +} + /* *swicth view reloadDir and connect signals */ void PIconView::slotViewChanged( int i) { if (!m_views->count() ) { setCurrentView( 0l); return; } if (m_customWidget) { delete m_customWidget; m_customWidget = 0; @@ -520,33 +531,38 @@ void PIconView::addFolders( const QStringList& lst) { if (m_mode==3) _iv->setTextOnly(true); } } void PIconView::addFiles( const QStringList& lst) { QStringList::ConstIterator it; IconViewItem * _iv; QPixmap*m_pix = 0; QString pre = ""; if (!m_path.isEmpty()) { pre = m_path+"/"; } + QString s = ""; + int pos; for (it=lst.begin(); it!= lst.end(); ++it ) { + s = (*it); + pos = s.find(char(0)); m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize ); + if (pos>-1) { + _iv = new IconViewItem( m_view, s.mid(pos+1), s.left(pos),m_iconsize ); + } else { _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize ); + } if (m_mode==3) { _iv->setTextOnly(true); _iv->setPixmap(QPixmap()); - - - } else { if (m_pix) _iv->setPixmap(*m_pix); } } } /* * user clicked on the item. Change dir or view */ void PIconView::slotClicked(QIconViewItem* _it) { 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{ class PIconView : public QVBox { Q_OBJECT friend class PIconViewItem; enum ActionIds { BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem }; public: PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); ~PIconView(); void resetView(); Opie::Core::OKeyConfigManager* manager(); + void setDoccalled(bool); + signals: void sig_showInfo( const QString& ); void sig_display(const QString&); void sig_startslide(int timeout); public slots: virtual void slotShowNext(); virtual void slotShowPrev(); virtual void slotShowLast(); virtual bool slotShowFirst(); + virtual void polish(); protected: void resizeEvent( QResizeEvent* ); private: void initKeys(); QString currentFileName(bool &isDir)const; QString nextFileName(bool &isDir)const; QString prevFileName(bool &isDir)const; void loadViews(); void calculateGrid(QResizeEvent*e = 0); + bool m_setDocCalled:1; private slots: void slotDirUp(); void slotChangeDir(const QString&); void slotTrash(); void slotViewChanged( int ); void slotReloadDir(); void slotRename(); void slotBeam(); void slotBeamDone( Ir* ); 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 m_viewManager = 0; focus_in_count = 0; m_cfg = cfg; m_isFullScreen = false; m_ignore_next_in = false; m_slideTimer = 0; QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); initKeys(); m_slideValue = 5; m_gDisplayType = 0; m_gPrevNext = 0; m_hGroup = 0; + closeIfHide = false; } void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) { m_gDisplayType = disptypeGroup; m_gPrevNext = nextprevGroup; m_hGroup = hGroup; } ImageView::~ImageView() { odebug << "Destructor imageview" << oendl; @@ -143,25 +144,37 @@ void ImageView::initKeys() Resource::loadPixmap("mag"), Zoomer, Opie::Core::OKeyPair(Qt::Key_T,0), this, SIGNAL(toggleZoomer()))); m_viewManager->handleWidget( this ); m_viewManager->load(); } void ImageView::keyReleaseEvent(QKeyEvent * e) { if (!e || e->state()!=0) { return; } - if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); + if (e->key()==Qt::Key_Escape) { + if (fullScreen()) { + emit hideMe(); + } + if (closeIfHide) { + QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); + } + } +} + +void ImageView::setCloseIfHide(bool how) +{ + closeIfHide = how; } void ImageView::slotShowImageInfo() { emit dispImageInfo(m_lastName); } void ImageView::contentsMousePressEvent ( QMouseEvent * e) { if (e->button()==1) { return OImageScrollView::contentsMousePressEvent(e); } 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 Autoscale }; public: ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 ); virtual ~ImageView(); Opie::Core::OKeyConfigManager* manager(); void setFullScreen(bool how,bool force=true); bool fullScreen(){return m_isFullScreen;} virtual void enableFullscreen(); void stopSlide(); void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); + void setCloseIfHide(bool); signals: void dispImageInfo(const QString&); void dispNext(); void dispPrev(); void toggleFullScreen(); void hideMe(); void toggleZoomer(); void toggleAutoscale(); void toggleAutorotate(); protected: Opie::Core::OConfig * m_cfg; Opie::Core::OKeyConfigManager*m_viewManager; void initKeys(); bool m_isFullScreen:1; bool m_ignore_next_in:1; int focus_in_count; QTimer*m_slideTimer; int m_slideValue; virtual void focusInEvent ( QFocusEvent * ); QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; + bool closeIfHide:1; public slots: virtual void hide(); virtual void startSlide(int); virtual void nextSlide(); protected slots: virtual void slotShowImageInfo(); virtual void keyReleaseEvent(QKeyEvent * e); virtual void contentsMousePressEvent ( QMouseEvent * e); }; 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 @@ #include <qaction.h> //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) { setCaption( QObject::tr("Opie Eye Caramba" ) ); m_cfg = new Opie::Core::OConfig("opie-eye"); m_cfg->setGroup("main" ); readConfig(); + m_setDocCalled = false; + m_polishDone = false; m_storage = new StorageInfo(); connect(m_storage, SIGNAL(disksChanged() ), this, SLOT( dirChanged() ) ); m_stack = new Opie::Ui::OWidgetStack( this ); setCentralWidget( m_stack ); m_view = new PIconView( m_stack, m_cfg ); m_stack->addWidget( m_view, IconView ); m_stack->raiseWidget( IconView ); @@ -410,51 +412,53 @@ void PMainWindow::raiseIconView() { } void PMainWindow::slotReturn() { raiseIconView(); } void PMainWindow::closeEvent( QCloseEvent* ev ) { /* * return from view * or properly quit */ + if (!m_setDocCalled) { if ( m_stack->visibleWidget() == m_info || m_stack->visibleWidget() == m_disp ) { ev->ignore(); raiseIconView(); return; } + } if (m_disp && m_disp->fullScreen()) { /* otherwise opie-eye crashes in bigscreen mode! */ m_disp->reparent(0,QPoint(0,0)); m_stack->addWidget(m_disp,ImageDisplay); } ev->accept(); QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); } void PMainWindow::setDocument( const QString& showImg ) { - bool first_start = m_disp==0; - QString file = showImg; DocLnk lnk(showImg); if (lnk.isValid() ) file = lnk.file(); slotDisplay( file ); - if (first_start && m_aFullScreen->isOn()) { +#if 0 + if (!m_polishDone) { QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); } +#endif } void PMainWindow::check_view_fullscreen() { if (!m_view) return; if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { qwsDisplay()->requestFocus( m_disp->winId(), TRUE); } } void PMainWindow::slotSelectDir(int id) { @@ -680,31 +684,50 @@ void PMainWindow::setupMenu() m_gDisplayType->addTo(dispMenu); dispMenu->insertSeparator(); m_gPrevNext->addTo(dispMenu); m_aSetup->addTo(settingsMenu); m_aHideToolbar->addTo(settingsMenu); } void PMainWindow::listviewselected(QAction*which) { if (!which || which->isOn()==false) return; int val = 1; -// QString name; if (which==m_aDirName) { val = 3; -// name = "opie-eye/opie-eye-textview"; } else if (which==m_aDirShort) { val = 2; -// name = "opie-eye/opie-eye-thumbonly"; } else if (which==m_aDirLong) { val = 1; -// name = "opie-eye/opie-eye-thumb"; } emit changeListMode(val); } void PMainWindow::readConfig() { autoSave =m_cfg->readBoolEntry("savestatus",true); } + +void PMainWindow::polish() +{ + if (m_disp) { + odebug << "======================\n" + << "Called via setdocument\n" + << "======================" << oendl; + m_setDocCalled = true; + m_view->setDoccalled(true); + m_disp->setCloseIfHide(true); + } else { + m_setDocCalled = false; + m_view->setDoccalled(false); + } + m_polishDone = true; + QMainWindow::polish(); + if (m_setDocCalled) { + if (m_aFullScreen->isOn()) { + QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); + } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { + } + } +} 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: void slotShowInfo( const QString& inf ); void slotDisplay( const QString& inf ); void slotReturn(); void slotRotateToggled(bool); void slotScaleToggled(bool); void slotZoomerToggled(bool); void slotToggleZoomer(); void slotToggleAutorotate(); void slotToggleAutoscale(); void setDocument( const QString& ); virtual void slotToggleFullScreen(); virtual void slotFullScreenToggled(bool); + virtual void polish(); protected slots: void raiseIconView(); void closeEvent( QCloseEvent* ); void showToolbar(bool); void listviewselected(QAction*); void slotFullScreenButton(bool); void check_view_fullscreen(); private: template<class T> void initT( const char* name, T**, int ); void initInfo(); void initDisp(); void setupViewWindow(bool full, bool forceDisplay); private: Opie::Core::OConfig *m_cfg; Opie::Ui::OWidgetStack *m_stack; PIconView* m_view; imageinfo *m_info; ImageView *m_disp; bool autoSave; + bool m_setDocCalled:1; + bool m_polishDone:1; QToolButton*fsButton; QToolBar *toolBar; QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; QAction *m_aNext,*m_aPrevious,*m_aFullScreen; QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer; /* init funs */ void readConfig(); 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 @@ * GPLv2 zecke@handhelds.org */ #include "doc_lister.h" #include <lib/slavemaster.h> /* OPIE */ #include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> #include <qpe/applnk.h> +#include <opie2/oglobal.h> #include <qtopia/private/categories.h> #include <qtopia/categoryselect.h> using namespace Opie::Core; /* QT */ #include <qdir.h> #include <qfileinfo.h> +#include <qtopia/qcopenvelope_qws.h> Doc_DirLister::Doc_DirLister() : PDirLister( "doc_dir_lister" ) { /* connect the signals */ m_catFilter = 0; SlaveMaster* master = SlaveMaster::self(); connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), this, SLOT(slotThumbInfo(const QString&, const QString&)) ); connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), this, SLOT(slotFullInfo(const QString&, const QString&)) ); connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); - - m_namemap.clear(); - m_filemap.clear(); m_docreads = false; + syschannel = new QCopChannel("QPE/System", this); + connect(syschannel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(systemMsg(const QCString&,const QByteArray&)) ); +} + +Doc_DirLister::~Doc_DirLister() +{ } QString Doc_DirLister::defaultPath()const { return QString::null; } -bool Doc_DirLister::matchCat(const AppLnk* app) +bool Doc_DirLister::matchCat(const AppLnk* app)const { if (!app) return false; if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) { return true; } return false; } QString Doc_DirLister::setStartPath(const QString&) { static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); - if (m_namemap.isEmpty()) { if (!m_docreads) { Global::findDocuments(&m_ds,Mtype_str); m_docreads = true; } - QListIterator<DocLnk> dit(m_ds.children()); - for( ; dit.current(); ++dit) { - if (!matchCat((*dit))) continue; - m_namemap[(*dit)->name()]=(*dit)->file(); - m_filemap[(*dit)->file()]=(*dit)->name(); - } - } return QString::null; } -QString Doc_DirLister::currentPath()const { +QString Doc_DirLister::currentPath()const +{ return QString::null; } QStringList Doc_DirLister::folders()const { return QStringList(); } QStringList Doc_DirLister::files()const { QStringList out; - QMap<QString,QString>::ConstIterator it; - for (it = m_namemap.begin();it != m_namemap.end();++it) { - out.append(it.key()); + QListIterator<DocLnk> dit(m_ds.children()); + for( ; dit.current(); ++dit) { + if (!matchCat((*dit))) continue; + QString s = (*dit)->name(); + s+=char(0); + s+=(*dit)->file(); + out.append(s); } return out; } void Doc_DirLister::deleteImage( const QString& ) { } -void Doc_DirLister::thumbNail( const QString& str, int w, int h) { - if (m_namemap.find(str)==m_namemap.end()) { - return; - } - QString fname = m_namemap[str]; - SlaveMaster::self()->thumbNail( fname, w, h ); +void Doc_DirLister::thumbNail( const QString& str, int w, int h) +{ + SlaveMaster::self()->thumbNail( str, w, h ); } -QImage Doc_DirLister::image( const QString& str, Factor f, int m) { - if (m_namemap.find(str)==m_namemap.end()) { - return QImage(); - } - QString fname = m_namemap[str]; - return SlaveMaster::self()->image( fname, f, m ); +QImage Doc_DirLister::image( const QString& str, Factor f, int m) +{ + return SlaveMaster::self()->image(str, f, m ); } void Doc_DirLister::imageInfo( const QString& str) { - if (m_namemap.find(str)==m_namemap.end()) { - return; - } - QString fname = m_namemap[str]; - SlaveMaster::self()->thumbInfo( fname ); + SlaveMaster::self()->thumbInfo( str ); } void Doc_DirLister::fullImageInfo( const QString& str) { - if (m_namemap.find(str)==m_namemap.end()) { - return; - } - QString fname = m_namemap[str]; - SlaveMaster::self()->imageInfo( fname ); + SlaveMaster::self()->imageInfo(str); } void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) { - if (m_filemap.find(f)==m_filemap.end()) { - return; - } - QString name = m_filemap[f]; - emit sig_fullInfo(name, t); + emit sig_fullInfo(f, t); } void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) { - if (m_filemap.find(f)==m_filemap.end()) { - return; - } - QString name = m_filemap[f]; - emit sig_thumbInfo(name, t); + emit sig_thumbInfo(f, t); } void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) { - if (m_filemap.find(f)==m_filemap.end()) { - return; - } - QString name = m_filemap[f]; - emit sig_thumbNail(name, p); + emit sig_thumbNail(f, p); } QString Doc_DirLister::nameToFname(const QString&name)const { - if (m_namemap.find(name)==m_namemap.end()) { - return QString::null; - } - return m_namemap[name]; + return name; } QString Doc_DirLister::dirUp( const QString& p ) const{ return p; } QWidget* Doc_DirLister::widget(QWidget*parent) { CategorySelect * catmb = new CategorySelect(parent); Categories cats( 0 ); cats.load( categoryFileName() ); QArray<int> vl( 0 ); catmb->setCategories( vl, "Document View", // No tr "Document View" ); catmb->setRemoveCategoryEdit( TRUE ); catmb->setAllCategories( TRUE ); connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); catmb->setCurrentCategory(-2); return catmb; } void Doc_DirLister::showCategory(int which) { m_catFilter = which==-2?0:which; - m_namemap.clear(); setStartPath(""); emit sig_reloadDir(); } + +void Doc_DirLister::systemMsg(const QCString &msg, const QByteArray &data) +{ + if ( msg != "linkChanged(QString)"||!m_docreads) { + return; + } + QString link; + QDataStream stream( data, IO_ReadOnly ); + stream >> link; + odebug << "Doc_DirLister systemMsg -> linkchanged( " << link << " )" << oendl; + if ( link.isNull() || OGlobal::isAppLnkFileName(link) ) { + return; + } + QListIterator<DocLnk> dit(m_ds.children()); + bool must_reload = false; + bool found = false; + while ( dit.current() ) { + DocLnk *doc = dit.current(); + ++dit; + if (doc->linkFile() == link) { + found = true; + DocLnk* dl = new DocLnk(link); + if (dl->fileKnown()) { + // changing + m_ds.add(dl); + } else { + delete dl; + } + if (matchCat(doc) || matchCat(dl)) { + must_reload = true; + } + m_ds.remove( doc ); // remove old link from docLnkSet + delete doc; + } + } + if (must_reload) { + setStartPath(""); + emit sig_reloadDir(); + } +} 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 @@ #ifndef DOC_LISTER_INTERFACE_LISTER_H #define DOC_LISTER_INTERFACE_LISTER_H #include <iface/dirlister.h> #include <qpe/applnk.h> #include <qstring.h> #include <qmap.h> class Config; class AppLnk; +class QCopChannel; class Doc_DirLister : public PDirLister { Q_OBJECT public: Doc_DirLister(); - virtual ~Doc_DirLister(){} + virtual ~Doc_DirLister(); QString defaultPath()const; QString setStartPath( const QString& ); QString currentPath()const; QStringList folders()const; QStringList files()const; void deleteImage( const QString& ); void thumbNail( const QString&, int, int ); QImage image( const QString&, Factor, int ); void imageInfo( const QString& ); void fullImageInfo( const QString& ); virtual QString nameToFname(const QString&name)const; QString dirUp( const QString& )const; QWidget* widget(QWidget*parent); private: - QMap<QString,QString> m_namemap,m_filemap; int m_catFilter; - bool matchCat(const AppLnk* app); + bool matchCat(const AppLnk* app)const; bool m_docreads; DocLnkSet m_ds; protected slots: virtual void slotFullInfo(const QString&, const QString&); virtual void slotThumbInfo(const QString&, const QString&); virtual void slotThumbNail(const QString&, const QPixmap&); virtual void showCategory(int); + void systemMsg(const QCString &, const QByteArray &); + QCopChannel *syschannel; }; #endif |