-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp index 0a5cff4..16758d7 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | |||
@@ -7,90 +7,91 @@ | |||
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 ) | 19 | Dir_DirLister::Dir_DirLister( bool list ) |
20 | : PDirLister( "dir_dir_lister" ) | 20 | : PDirLister( "dir_dir_lister" ) |
21 | { | 21 | { |
22 | m_allFiles = list; | 22 | m_allFiles = list; |
23 | owarn << "All Files " << m_allFiles << "" << oendl; | 23 | owarn << "All Files " << m_allFiles << "" << oendl; |
24 | 24 | ||
25 | SlaveMaster* master = SlaveMaster::self(); | 25 | SlaveMaster* master = SlaveMaster::self(); |
26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
29 | this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); | 29 | this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); |
30 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 30 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
31 | this, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); | 31 | this, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); |
32 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | 32 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
33 | this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); | 33 | this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); |
34 | 34 | ||
35 | } | 35 | } |
36 | 36 | ||
37 | QString Dir_DirLister::defaultPath()const { | 37 | QString Dir_DirLister::defaultPath()const { |
38 | return QPEApplication::documentDir(); | 38 | return QPEApplication::documentDir(); |
39 | } | 39 | } |
40 | 40 | ||
41 | QString Dir_DirLister::setStartPath( const QString& path ) { | 41 | QString Dir_DirLister::setStartPath( const QString& path ) { |
42 | m_currentDir.cd( path ); | 42 | m_currentDir.cd( path ); |
43 | if (!m_currentDir.exists() ) | 43 | if (!m_currentDir.exists() ) |
44 | m_currentDir.cd(defaultPath()); | 44 | m_currentDir.cd(defaultPath()); |
45 | 45 | ||
46 | 46 | ||
47 | return m_currentDir.absPath(); | 47 | return m_currentDir.absPath(); |
48 | } | 48 | } |
49 | 49 | ||
50 | QString Dir_DirLister::currentPath()const { | 50 | QString Dir_DirLister::currentPath()const { |
51 | return m_currentDir.absPath(); | 51 | return m_currentDir.absPath(); |
52 | } | 52 | } |
53 | 53 | ||
54 | 54 | ||
55 | QStringList Dir_DirLister::folders()const { | 55 | QStringList Dir_DirLister::folders()const { |
56 | return m_currentDir.entryList( QDir::Dirs ); | 56 | return m_currentDir.entryList( QDir::Dirs ); |
57 | } | 57 | } |
58 | 58 | ||
59 | QStringList Dir_DirLister::files()const { | 59 | QStringList Dir_DirLister::files()const { |
60 | if ( m_allFiles ) | 60 | if ( m_allFiles ) |
61 | return m_currentDir.entryList( QDir::Files ); | 61 | return m_currentDir.entryList( QDir::Files ); |
62 | else { | 62 | else { |
63 | QStringList out; | 63 | QStringList out; |
64 | QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); | 64 | QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); |
65 | for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { | 65 | for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { |
66 | QFileInfo inf( *it ); | 66 | QFileInfo inf( *it ); |
67 | QString ext = inf.extension(false).lower(); | 67 | QString ext = inf.extension(false).lower(); |
68 | if( ext == QString::fromLatin1("jpg") || | 68 | if( ext == QString::fromLatin1("jpg") || |
69 | ext == QString::fromLatin1("jpeg" ) || | 69 | ext == QString::fromLatin1("jpeg" ) || |
70 | ext == QString::fromLatin1("png" ) || | 70 | ext == QString::fromLatin1("png" ) || |
71 | ext == QString::fromLatin1("bmp" ) || | ||
71 | ext == QString::fromLatin1("gif" ) ) | 72 | ext == QString::fromLatin1("gif" ) ) |
72 | out.append( *it ); | 73 | out.append( *it ); |
73 | } | 74 | } |
74 | return out; | 75 | return out; |
75 | } | 76 | } |
76 | } | 77 | } |
77 | 78 | ||
78 | void Dir_DirLister::deleteImage( const QString& fl) { | 79 | void Dir_DirLister::deleteImage( const QString& fl) { |
79 | QFile::remove( fl ); | 80 | QFile::remove( fl ); |
80 | } | 81 | } |
81 | 82 | ||
82 | void Dir_DirLister::thumbNail( const QString& str, int w, int h) { | 83 | void Dir_DirLister::thumbNail( const QString& str, int w, int h) { |
83 | SlaveMaster::self()->thumbNail( str, w, h ); | 84 | SlaveMaster::self()->thumbNail( str, w, h ); |
84 | } | 85 | } |
85 | 86 | ||
86 | QImage Dir_DirLister::image( const QString& str, Factor f, int m) { | 87 | QImage Dir_DirLister::image( const QString& str, Factor f, int m) { |
87 | return SlaveMaster::self()->image( str, f, m ); | 88 | return SlaveMaster::self()->image( str, f, m ); |
88 | } | 89 | } |
89 | 90 | ||
90 | void Dir_DirLister::imageInfo( const QString& str) { | 91 | void Dir_DirLister::imageInfo( const QString& str) { |
91 | SlaveMaster::self()->thumbInfo( str ); | 92 | SlaveMaster::self()->thumbInfo( str ); |
92 | } | 93 | } |
93 | 94 | ||
94 | void Dir_DirLister::fullImageInfo( const QString& str) { | 95 | void Dir_DirLister::fullImageInfo( const QString& str) { |
95 | SlaveMaster::self()->imageInfo( str ); | 96 | SlaveMaster::self()->imageInfo( str ); |
96 | } | 97 | } |