summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp64
-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.cpp47
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h3
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_lister.cpp137
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_lister.h8
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
@@ -198,2 +198,3 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
m_customWidget = 0;
+ m_setDocCalled = false;
@@ -214,6 +215,3 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
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 );
@@ -229,20 +227,9 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
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;
}
@@ -443,2 +430,26 @@ void PIconView::resetView() {
+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)) );
+}
+
/*
@@ -531,5 +542,13 @@ void PIconView::addFiles( const QStringList& lst) {
}
+ QString s = "";
+ int pos;
for (it=lst.begin(); it!= lst.end(); ++it ) {
- m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize );
- _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize );
+ 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) {
@@ -537,5 +556,2 @@ void PIconView::addFiles( const QStringList& lst) {
_iv->setPixmap(QPixmap());
-
-
-
} 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:
+ void setDoccalled(bool);
+
signals:
@@ -47,2 +49,3 @@ public slots:
virtual bool slotShowFirst();
+ virtual void polish();
@@ -58,2 +61,3 @@ private:
void calculateGrid(QResizeEvent*e = 0);
+ bool m_setDocCalled:1;
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
m_hGroup = 0;
+ closeIfHide = false;
}
@@ -154,3 +155,15 @@ void ImageView::keyReleaseEvent(QKeyEvent * e)
}
- 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;
}
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:
void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup);
+ void setCloseIfHide(bool);
@@ -63,2 +64,3 @@ protected:
QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup;
+ bool closeIfHide:1;
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)
readConfig();
+ m_setDocCalled = false;
+ m_polishDone = false;
@@ -421,7 +423,9 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) {
*/
- if ( m_stack->visibleWidget() == m_info ||
- m_stack->visibleWidget() == m_disp ) {
- ev->ignore();
- raiseIconView();
- return;
+ if (!m_setDocCalled) {
+ if ( m_stack->visibleWidget() == m_info ||
+ m_stack->visibleWidget() == m_disp ) {
+ ev->ignore();
+ raiseIconView();
+ return;
+ }
}
@@ -438,4 +442,2 @@ void PMainWindow::setDocument( const QString& showImg )
{
- bool first_start = m_disp==0;
-
QString file = showImg;
@@ -445,5 +447,7 @@ void PMainWindow::setDocument( const QString& showImg )
slotDisplay( file );
- if (first_start && m_aFullScreen->isOn()) {
+#if 0
+ if (!m_polishDone) {
QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
}
+#endif
}
@@ -691,3 +695,2 @@ void PMainWindow::listviewselected(QAction*which)
int val = 1;
-// QString name;
@@ -695,9 +698,6 @@ void PMainWindow::listviewselected(QAction*which)
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";
}
@@ -710 +710,24 @@ void PMainWindow::readConfig()
}
+
+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
@@ -60,2 +60,3 @@ public slots:
virtual void slotFullScreenToggled(bool);
+ virtual void polish();
@@ -82,2 +83,4 @@ private:
bool autoSave;
+ bool m_setDocCalled:1;
+ bool m_polishDone:1;
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 @@
#include <qpe/applnk.h>
+#include <opie2/oglobal.h>
@@ -22,2 +23,3 @@ using namespace Opie::Core;
#include <qfileinfo.h>
+#include <qtopia/qcopenvelope_qws.h>
@@ -37,6 +39,10 @@ Doc_DirLister::Doc_DirLister()
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()
+{
}
@@ -47,3 +53,3 @@ QString Doc_DirLister::defaultPath()const {
-bool Doc_DirLister::matchCat(const AppLnk* app)
+bool Doc_DirLister::matchCat(const AppLnk* app)const
{
@@ -58,13 +64,5 @@ 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();
- }
+ if (!m_docreads) {
+ Global::findDocuments(&m_ds,Mtype_str);
+ m_docreads = true;
}
@@ -73,4 +71,5 @@ QString Doc_DirLister::setStartPath(const QString&) {
-QString Doc_DirLister::currentPath()const {
- return QString::null;
+QString Doc_DirLister::currentPath()const
+{
+ return QString::null;
}
@@ -84,5 +83,9 @@ 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);
}
@@ -95,16 +98,10 @@ 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 );
}
@@ -112,7 +109,3 @@ QImage Doc_DirLister::image( const QString& str, Factor f, int 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 );
}
@@ -120,7 +113,3 @@ void Doc_DirLister::imageInfo( const QString& 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);
}
@@ -129,7 +118,3 @@ 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);
}
@@ -138,7 +123,3 @@ 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);
}
@@ -147,7 +128,3 @@ 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);
}
@@ -156,6 +133,3 @@ 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;
}
@@ -184,3 +158,2 @@ void Doc_DirLister::showCategory(int which)
m_catFilter = which==-2?0:which;
- m_namemap.clear();
setStartPath("");
@@ -188 +161,41 @@ void Doc_DirLister::showCategory(int which)
}
+
+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
@@ -16,2 +16,3 @@ class Config;
class AppLnk;
+class QCopChannel;
@@ -21,3 +22,3 @@ public:
Doc_DirLister();
- virtual ~Doc_DirLister(){}
+ virtual ~Doc_DirLister();
@@ -39,5 +40,4 @@ public:
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;
@@ -50,2 +50,4 @@ protected slots:
virtual void showCategory(int);
+ void systemMsg(const QCString &, const QByteArray &);
+ QCopChannel *syschannel;
};