author | skyhusker <skyhusker> | 2005-03-06 19:31:56 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-03-06 19:31:56 (UTC) |
commit | 578cc81bc489015320351efd4fabcbed3355ac23 (patch) (unidiff) | |
tree | f40c155e58a993759b662e09b56051d8eb93cb49 | |
parent | a81251b503cba26ad326ac6c68a80a2930bef896 (diff) | |
download | opie-578cc81bc489015320351efd4fabcbed3355ac23.zip opie-578cc81bc489015320351efd4fabcbed3355ac23.tar.gz opie-578cc81bc489015320351efd4fabcbed3355ac23.tar.bz2 |
Fix bug 1600: Removing . from directory listing
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp index ff33cf2..5706598 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | |||
@@ -1,111 +1,114 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include "dir_lister.h" | 5 | #include "dir_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 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
14 | 14 | ||
15 | /* QT */ | 15 | /* QT */ |
16 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include <qfileinfo.h> | 17 | #include <qfileinfo.h> |
18 | 18 | ||
19 | Dir_DirLister::Dir_DirLister( bool list,bool rec,int recdepth ) | 19 | Dir_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; | 23 | m_recursive = rec; |
24 | m_recDepth = recdepth; | 24 | m_recDepth = recdepth; |
25 | if (m_recDepth<1) m_recDepth = 1; | 25 | if (m_recDepth<1) m_recDepth = 1; |
26 | if (m_recDepth>10) m_recDepth = 10; | 26 | if (m_recDepth>10) m_recDepth = 10; |
27 | owarn << "All Files " << m_allFiles << "" << oendl; | 27 | owarn << "All Files " << m_allFiles << "" << oendl; |
28 | SlaveHelper::slaveConnectSignals( this ); | 28 | SlaveHelper::slaveConnectSignals( this ); |
29 | m_Filter = (m_allFiles?"*":"*.jpg;*.jpeg;*.JPG;*.PNG;*.GIF;*.BMP;*.png;*.bmp;*.gif"); | 29 | m_Filter = (m_allFiles?"*":"*.jpg;*.jpeg;*.JPG;*.PNG;*.GIF;*.BMP;*.png;*.bmp;*.gif"); |
30 | } | 30 | } |
31 | 31 | ||
32 | QString Dir_DirLister::defaultPath()const { | 32 | QString Dir_DirLister::defaultPath()const { |
33 | return QPEApplication::documentDir(); | 33 | return QPEApplication::documentDir(); |
34 | } | 34 | } |
35 | 35 | ||
36 | QString Dir_DirLister::setStartPath( const QString& path ) { | 36 | QString Dir_DirLister::setStartPath( const QString& path ) { |
37 | m_currentDir.cd( path ); | 37 | m_currentDir.cd( path ); |
38 | if (!m_currentDir.exists() ) | 38 | if (!m_currentDir.exists() ) |
39 | m_currentDir.cd(defaultPath()); | 39 | m_currentDir.cd(defaultPath()); |
40 | 40 | ||
41 | 41 | ||
42 | return m_currentDir.absPath(); | 42 | return m_currentDir.absPath(); |
43 | } | 43 | } |
44 | 44 | ||
45 | QString Dir_DirLister::currentPath()const { | 45 | QString Dir_DirLister::currentPath()const { |
46 | return m_currentDir.absPath(); | 46 | return m_currentDir.absPath(); |
47 | } | 47 | } |
48 | 48 | ||
49 | 49 | ||
50 | QStringList Dir_DirLister::folders()const { | 50 | QStringList Dir_DirLister::folders()const { |
51 | return m_currentDir.entryList( QDir::Dirs ); | 51 | QStringList dirs = m_currentDir.entryList( QDir::Dirs ); |
52 | dirs.remove("."); | ||
53 | |||
54 | return dirs; | ||
52 | } | 55 | } |
53 | 56 | ||
54 | QStringList Dir_DirLister::recFiles(const QString&aPath,int currentDepth)const | 57 | QStringList Dir_DirLister::recFiles(const QString&aPath,int currentDepth)const |
55 | { | 58 | { |
56 | QStringList all; | 59 | QStringList all; |
57 | if (currentDepth>m_recDepth) return all; | 60 | if (currentDepth>m_recDepth) return all; |
58 | 61 | ||
59 | QString subPath; | 62 | QString subPath; |
60 | subPath = aPath; | 63 | subPath = aPath; |
61 | if (subPath.length()==0) { | 64 | if (subPath.length()==0) { |
62 | subPath="."; | 65 | subPath="."; |
63 | } | 66 | } |
64 | QDir checkDir(currentPath()+"/"+aPath); | 67 | QDir checkDir(currentPath()+"/"+aPath); |
65 | 68 | ||
66 | QStringList p = checkDir.entryList( QDir::Dirs ); | 69 | QStringList p = checkDir.entryList( QDir::Dirs ); |
67 | all+=checkDir.entryList(m_Filter,QDir::Files|QDir::Readable); | 70 | all+=checkDir.entryList(m_Filter,QDir::Files|QDir::Readable); |
68 | QStringList tmp; | 71 | QStringList tmp; |
69 | for (unsigned i = 0; i < p.count();++i) { | 72 | for (unsigned i = 0; i < p.count();++i) { |
70 | if (p[i]=="." || p[i]=="..") continue; | 73 | if (p[i]=="." || p[i]=="..") continue; |
71 | tmp =recFiles(subPath+"/"+p[i],currentDepth+1); | 74 | tmp =recFiles(subPath+"/"+p[i],currentDepth+1); |
72 | for (unsigned j = 0; j < tmp.count();++j) { | 75 | for (unsigned j = 0; j < tmp.count();++j) { |
73 | all.append(p[i]+"/"+tmp[j]); | 76 | all.append(p[i]+"/"+tmp[j]); |
74 | } | 77 | } |
75 | } | 78 | } |
76 | return all; | 79 | return all; |
77 | } | 80 | } |
78 | 81 | ||
79 | QStringList Dir_DirLister::files()const | 82 | QStringList Dir_DirLister::files()const |
80 | { | 83 | { |
81 | if (m_recursive) { | 84 | if (m_recursive) { |
82 | odebug << "Startpfad: "<<m_currentDir.absPath()<<oendl; | 85 | odebug << "Startpfad: "<<m_currentDir.absPath()<<oendl; |
83 | return recFiles("",0); | 86 | return recFiles("",0); |
84 | } | 87 | } |
85 | return m_currentDir.entryList(m_Filter,QDir::Files|QDir::Readable); | 88 | return m_currentDir.entryList(m_Filter,QDir::Files|QDir::Readable); |
86 | } | 89 | } |
87 | 90 | ||
88 | void Dir_DirLister::deleteImage( const QString& fl) { | 91 | void Dir_DirLister::deleteImage( const QString& fl) { |
89 | QFile::remove( fl ); | 92 | QFile::remove( fl ); |
90 | } | 93 | } |
91 | 94 | ||
92 | void Dir_DirLister::thumbNail( const QString& str, int w, int h) { | 95 | void Dir_DirLister::thumbNail( const QString& str, int w, int h) { |
93 | SlaveMaster::self()->thumbNail( str, w, h ); | 96 | SlaveMaster::self()->thumbNail( str, w, h ); |
94 | } | 97 | } |
95 | 98 | ||
96 | QImage Dir_DirLister::image( const QString& str, Factor f, int m) { | 99 | QImage Dir_DirLister::image( const QString& str, Factor f, int m) { |
97 | return SlaveMaster::self()->image( str, f, m ); | 100 | return SlaveMaster::self()->image( str, f, m ); |
98 | } | 101 | } |
99 | 102 | ||
100 | void Dir_DirLister::imageInfo( const QString& str) { | 103 | void Dir_DirLister::imageInfo( const QString& str) { |
101 | SlaveMaster::self()->thumbInfo( str ); | 104 | SlaveMaster::self()->thumbInfo( str ); |
102 | } | 105 | } |
103 | 106 | ||
104 | void Dir_DirLister::fullImageInfo( const QString& str) { | 107 | void Dir_DirLister::fullImageInfo( const QString& str) { |
105 | SlaveMaster::self()->imageInfo( str ); | 108 | SlaveMaster::self()->imageInfo( str ); |
106 | } | 109 | } |
107 | 110 | ||
108 | QString Dir_DirLister::nameToFname(const QString&name)const | 111 | QString Dir_DirLister::nameToFname(const QString&name)const |
109 | { | 112 | { |
110 | return name; | 113 | return name; |
111 | } | 114 | } |