summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp10
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h1
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp2
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp14
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_dirview.h2
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp32
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_lister.cpp53
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_lister.h12
8 files changed, 96 insertions, 30 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 7c8c88d..eafff1d 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -153,6 +153,7 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
153 } 153 }
154 m_path = QDir::homeDirPath(); 154 m_path = QDir::homeDirPath();
155 m_mode = 0; 155 m_mode = 0;
156 m_internalReset = false;
156 157
157 QHBox *hbox = new QHBox( this ); 158 QHBox *hbox = new QHBox( this );
158 QLabel* lbl = new QLabel( hbox ); 159 QLabel* lbl = new QLabel( hbox );
@@ -363,7 +364,9 @@ void PIconView::loadViews() {
363} 364}
364 365
365void PIconView::resetView() { 366void PIconView::resetView() {
367 m_internalReset = true;
366 slotViewChanged(m_views->currentItem()); 368 slotViewChanged(m_views->currentItem());
369 m_internalReset = false;
367} 370}
368 371
369/* 372/*
@@ -407,8 +410,11 @@ void PIconView::slotViewChanged( int i) {
407 this, SLOT(slotEnd()) ); 410 this, SLOT(slotEnd()) );
408 411
409 412
410 /* reload now with default Path*/ 413 /* reload now with default Path
411 m_path = lis->defaultPath(); 414 * but only if it isn't a reset like from setupdlg
415 */
416 if (!m_internalReset)
417 m_path = lis->defaultPath();
412 QTimer::singleShot( 0, this, SLOT(slotReloadDir())); 418 QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
413} 419}
414 420
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index dff55ed..bea35c2 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -95,6 +95,7 @@ private:
95 QString m_path; 95 QString m_path;
96 bool m_updatet : 1; 96 bool m_updatet : 1;
97 int m_mode; 97 int m_mode;
98 bool m_internalReset:1;
98}; 99};
99 100
100#endif 101#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 6660eb2..30c9bf1 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -173,6 +173,7 @@ void PMainWindow::slotConfig() {
173 if ( !m_info ) { 173 if ( !m_info ) {
174 reminfo = true; 174 reminfo = true;
175 initInfo(); 175 initInfo();
176 m_info->hide();
176 } 177 }
177 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 178 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
178 179
@@ -180,6 +181,7 @@ void PMainWindow::slotConfig() {
180 if ( !m_disp ) { 181 if ( !m_disp ) {
181 remdisp = true; 182 remdisp = true;
182 initDisp(); 183 initDisp();
184 m_disp->hide();
183 } 185 }
184 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 186 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
185 187
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
index 97e3dcb..fc502d4 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
@@ -8,7 +8,9 @@ PHUNK_VIEW_INTERFACE("Dir View", Dir_DirView );
8Dir_DirView::Dir_DirView( const Config& cfg) 8Dir_DirView::Dir_DirView( const Config& cfg)
9 : PDirView(cfg) 9 : PDirView(cfg)
10{ 10{
11 m_cfg = cfg.readBoolEntry( "Dir_Check_All_Files", true); 11 m_cfg = cfg.readBoolEntry( "Dir_Check_All_Files", false);
12 m_recursive = cfg.readBoolEntry( "Dir_Check_Recursive_Files", false);
13 m_recursive_depth = cfg.readNumEntry("Dir_Recursive_Files_Depth",10);
12 m_lister = 0; 14 m_lister = 0;
13 m_info = 0; 15 m_info = 0;
14} 16}
@@ -17,13 +19,15 @@ Dir_DirView::~Dir_DirView() {
17} 19}
18 20
19PInterfaceInfo* Dir_DirView::interfaceInfo()const{ 21PInterfaceInfo* Dir_DirView::interfaceInfo()const{
20 if (!m_info ) 22 if (!m_info ) {
21 m_info =new DirInterfaceInfo; 23 m_info = new DirInterfaceInfo;
24 }
22 return m_info; 25 return m_info;
23} 26}
24 27
25PDirLister* Dir_DirView::dirLister()const{ 28PDirLister* Dir_DirView::dirLister()const{
26 if (!m_lister ) 29 if (!m_lister ) {
27 m_lister = new Dir_DirLister(m_cfg); 30 m_lister = new Dir_DirLister(m_cfg,m_recursive,m_recursive_depth);
31 }
28 return m_lister; 32 return m_lister;
29} 33}
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
index 3b9b7a6..89cf6c9 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
+++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
@@ -16,6 +16,8 @@ struct Dir_DirView : public PDirView {
16 PDirLister* dirLister()const; 16 PDirLister* dirLister()const;
17private: 17private:
18 bool m_cfg : 1; 18 bool m_cfg : 1;
19 bool m_recursive:1;
20 int m_recursive_depth;
19 mutable PDirLister* m_lister; 21 mutable PDirLister* m_lister;
20 mutable PInterfaceInfo *m_info; 22 mutable PInterfaceInfo *m_info;
21}; 23};
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
index 9c69ce5..1e4ec40 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
@@ -16,6 +16,7 @@
16#include <qhbox.h> 16#include <qhbox.h>
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qlayout.h> 18#include <qlayout.h>
19#include <qspinbox.h>
19 20
20namespace { 21namespace {
21 class DirImageWidget : public QFrame { 22 class DirImageWidget : public QFrame {
@@ -23,14 +24,34 @@ namespace {
23 DirImageWidget(): QFrame() { 24 DirImageWidget(): QFrame() {
24 setFrameStyle(Box|Raised); 25 setFrameStyle(Box|Raised);
25 QVBoxLayout *m_MainLayout = new QVBoxLayout( this, 6, 2, "m_MainLayout"); 26 QVBoxLayout *m_MainLayout = new QVBoxLayout( this, 6, 2, "m_MainLayout");
27 QGridLayout*RecDepthLayout = new QGridLayout( 0, 1, 1, 0, 6, "RecDepthLayout");
28
26 chkbox = new QCheckBox( QObject::tr("Show all files"), this ); 29 chkbox = new QCheckBox( QObject::tr("Show all files"), this );
27 m_MainLayout->addWidget(chkbox); 30 m_MainLayout->addWidget(chkbox);
31 recWarningLabel = new QLabel(this);
32 recWarningLabel->setText(QObject::tr("<center><b>Be carefull with the following options!</b></center>"));
33 m_MainLayout->addWidget(recWarningLabel);
34 recBox = new QCheckBox( QObject::tr("Show files recursive"),this);
35 m_MainLayout->addWidget(recBox);
36 recDepthLabel = new QLabel(this);
37 recDepthLabel->setText(QObject::tr("Recursion depth:"));
38 RecDepthLayout->addWidget(recDepthLabel,0,0);
39 recDepth = new QSpinBox(this);
40 recDepth->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
41 recDepth->setMaxValue(10);
42 recDepth->setMinValue(1);
43 recDepth->setSuffix(QObject::tr(" directories"));
44 RecDepthLayout->addWidget(recDepth,0,1);
45 m_MainLayout->addLayout(RecDepthLayout);
28 QSpacerItem *spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); 46 QSpacerItem *spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
29 m_MainLayout->addItem( spacer1 ); 47 m_MainLayout->addItem( spacer1 );
30 48
31 } 49 }
32 ~DirImageWidget() {} 50 ~DirImageWidget() {}
33 QCheckBox* chkbox; 51 QCheckBox* chkbox,*recBox;
52 QSpinBox * recDepth;
53 QLabel* recDepthLabel,*recWarningLabel;
54
34 }; 55 };
35} 56}
36 57
@@ -46,13 +67,16 @@ QString DirInterfaceInfo::name()const {
46 67
47QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { 68QWidget* DirInterfaceInfo::configWidget(const Config& cfg) {
48 DirImageWidget* wid = new DirImageWidget(); 69 DirImageWidget* wid = new DirImageWidget();
49 wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); 70 wid->chkbox->setChecked(cfg.readBoolEntry("Dir_Check_All_Files",false));
50 71 wid->recBox->setChecked(cfg.readBoolEntry("Dir_Check_Recursive_Files",false));
72 wid->recDepth->setValue(cfg.readNumEntry("Dir_Recursive_Files_Depth",10));
51 return wid; 73 return wid;
52} 74}
53 75
54void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { 76void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) {
55 owarn << "Write Config" << oendl; 77 owarn << "Write Config" << oendl;
56 DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); 78 DirImageWidget* wid = static_cast<DirImageWidget*>(_wid);
57 cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); 79 cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked());
80 cfg.writeEntry("Dir_Check_Recursive_Files", wid->recBox->isChecked());
81 cfg.writeEntry("Dir_Recursive_Files_Depth",wid->recDepth->value());
58} 82}
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
index d8b332a..ff33cf2 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
@@ -16,12 +16,17 @@ using namespace Opie::Core;
16#include <qdir.h> 16#include <qdir.h>
17#include <qfileinfo.h> 17#include <qfileinfo.h>
18 18
19Dir_DirLister::Dir_DirLister( bool list ) 19Dir_DirLister::Dir_DirLister( bool list,bool rec,int recdepth )
20 : PDirLister( "dir_dir_lister" ) 20 : PDirLister( "dir_dir_lister" )
21{ 21{
22 m_allFiles = list; 22 m_allFiles = list;
23 m_recursive = rec;
24 m_recDepth = recdepth;
25 if (m_recDepth<1) m_recDepth = 1;
26 if (m_recDepth>10) m_recDepth = 10;
23 owarn << "All Files " << m_allFiles << "" << oendl; 27 owarn << "All Files " << m_allFiles << "" << oendl;
24 SlaveHelper::slaveConnectSignals( this ); 28 SlaveHelper::slaveConnectSignals( this );
29 m_Filter = (m_allFiles?"*":"*.jpg;*.jpeg;*.JPG;*.PNG;*.GIF;*.BMP;*.png;*.bmp;*.gif");
25} 30}
26 31
27QString Dir_DirLister::defaultPath()const { 32QString Dir_DirLister::defaultPath()const {
@@ -46,24 +51,38 @@ QStringList Dir_DirLister::folders()const {
46 return m_currentDir.entryList( QDir::Dirs ); 51 return m_currentDir.entryList( QDir::Dirs );
47} 52}
48 53
49QStringList Dir_DirLister::files()const { 54QStringList Dir_DirLister::recFiles(const QString&aPath,int currentDepth)const
50 if ( m_allFiles ) 55{
51 return m_currentDir.entryList( QDir::Files ); 56 QStringList all;
52 else { 57 if (currentDepth>m_recDepth) return all;
53 QStringList out; 58
54 QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); 59 QString subPath;
55 for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { 60 subPath = aPath;
56 QFileInfo inf( *it ); 61 if (subPath.length()==0) {
57 QString ext = inf.extension(false).lower(); 62 subPath=".";
58 if( ext == QString::fromLatin1("jpg") || 63 }
59 ext == QString::fromLatin1("jpeg" ) || 64 QDir checkDir(currentPath()+"/"+aPath);
60 ext == QString::fromLatin1("png" ) || 65
61 ext == QString::fromLatin1("bmp" ) || 66 QStringList p = checkDir.entryList( QDir::Dirs );
62 ext == QString::fromLatin1("gif" ) ) 67 all+=checkDir.entryList(m_Filter,QDir::Files|QDir::Readable);
63 out.append( *it ); 68 QStringList tmp;
69 for (unsigned i = 0; i < p.count();++i) {
70 if (p[i]=="." || p[i]=="..") continue;
71 tmp =recFiles(subPath+"/"+p[i],currentDepth+1);
72 for (unsigned j = 0; j < tmp.count();++j) {
73 all.append(p[i]+"/"+tmp[j]);
64 } 74 }
65 return out;
66 } 75 }
76 return all;
77}
78
79QStringList Dir_DirLister::files()const
80{
81 if (m_recursive) {
82 odebug << "Startpfad: "<<m_currentDir.absPath()<<oendl;
83 return recFiles("",0);
84 }
85 return m_currentDir.entryList(m_Filter,QDir::Files|QDir::Readable);
67} 86}
68 87
69void Dir_DirLister::deleteImage( const QString& fl) { 88void Dir_DirLister::deleteImage( const QString& fl) {
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.h b/noncore/graphics/opie-eye/impl/dir/dir_lister.h
index d6ca6c0..445adbf 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_lister.h
+++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.h
@@ -13,7 +13,7 @@ class Config;
13class Dir_DirLister : public PDirLister { 13class Dir_DirLister : public PDirLister {
14 Q_OBJECT 14 Q_OBJECT
15public: 15public:
16 Dir_DirLister( bool ); 16 Dir_DirLister(bool,bool,int);
17 virtual ~Dir_DirLister(){} 17 virtual ~Dir_DirLister(){}
18 18
19 QString defaultPath()const; 19 QString defaultPath()const;
@@ -30,8 +30,16 @@ public:
30 virtual QString nameToFname(const QString&name)const; 30 virtual QString nameToFname(const QString&name)const;
31 31
32private: 32private:
33 bool m_allFiles; 33 bool m_allFiles:1;
34 bool m_recursive:1;
35 int m_recDepth;
34 QDir m_currentDir; 36 QDir m_currentDir;
37 //! recursive listing.
38 /*!
39 * \param path this is the offset to the current path. eg. when currentDepth = 0 then it MUST empty
40 */
41 QStringList recFiles(const QString&path,int currentDepth)const;
42 QString m_Filter;
35}; 43};
36 44
37#endif 45#endif