Diffstat (limited to 'noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp index 147eb9c..d4f9943 100644 --- a/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp | |||
@@ -73,104 +73,101 @@ QStringList DCIM_DirLister::folders()const { | |||
73 | lst = findAlbums(); | 73 | lst = findAlbums(); |
74 | break; | 74 | break; |
75 | case ListingFiles: | 75 | case ListingFiles: |
76 | default: | 76 | default: |
77 | break; | 77 | break; |
78 | } | 78 | } |
79 | 79 | ||
80 | return lst; | 80 | return lst; |
81 | } | 81 | } |
82 | 82 | ||
83 | QStringList DCIM_DirLister::files()const { | 83 | QStringList DCIM_DirLister::files()const { |
84 | if ( m_mode != ListingFiles ) | 84 | if ( m_mode != ListingFiles ) |
85 | return QStringList(); | 85 | return QStringList(); |
86 | else | 86 | else |
87 | return findImages(); | 87 | return findImages(); |
88 | } | 88 | } |
89 | 89 | ||
90 | QString DCIM_DirLister::dirUp( const QString& p )const { | 90 | QString DCIM_DirLister::dirUp( const QString& p )const { |
91 | QString str; | 91 | QString str; |
92 | 92 | ||
93 | switch( m_mode ) { | 93 | switch( m_mode ) { |
94 | case ListingFiles: | 94 | case ListingFiles: |
95 | m_mode = ListingReFolder; | 95 | m_mode = ListingReFolder; |
96 | str = PDirLister::dirUp( p ); | 96 | str = PDirLister::dirUp( p ); |
97 | break; | 97 | break; |
98 | case ListingFolder: | 98 | case ListingFolder: |
99 | m_mode = ListingStart; | 99 | m_mode = ListingStart; |
100 | break; | 100 | break; |
101 | case ListingUnknown: | 101 | case ListingUnknown: |
102 | case ListingStart: | 102 | case ListingStart: |
103 | default: | 103 | default: |
104 | break; | 104 | break; |
105 | } | 105 | } |
106 | 106 | ||
107 | /* down cases */ | 107 | /* down cases */ |
108 | owarn << " New String " << str << " old path " << m_mode << oendl; | 108 | owarn << " New String " << str << " old path " << m_mode << oendl; |
109 | m_path = str; | 109 | m_path = str; |
110 | return str; | 110 | return str; |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | QStringList DCIM_DirLister::findCameras()const { | 114 | QStringList DCIM_DirLister::findCameras()const { |
115 | QStringList lst; | 115 | QStringList lst; |
116 | StorageInfo inf; | 116 | StorageInfo inf; |
117 | 117 | ||
118 | m_map.clear(); | 118 | m_map.clear(); |
119 | 119 | ||
120 | const QList<FileSystem> &list = inf.fileSystems(); | 120 | const QList<FileSystem> &list = inf.fileSystems(); |
121 | QListIterator<FileSystem> it( list ); | ||
122 | 121 | ||
123 | 122 | for ( QListIterator<FileSystem> it( list ); it.current()!=0 ; ++it ) | |
124 | FileSystem *sys; | 123 | if ( QFileInfo( it.current()->path() + "/dcim/" ).exists() ) { |
125 | for ( sys = it.current(); (sys=it.current())!=0 ; ++it ) | 124 | lst << it.current()->name(); |
126 | if ( QFileInfo( sys->path() + "/dcim/" ).exists() ) { | 125 | m_map.insert( it.current()->name(), it.current()->path() ); |
127 | lst << sys->name(); | ||
128 | m_map.insert( sys->name(), sys->path() ); | ||
129 | } | 126 | } |
130 | 127 | ||
131 | if ( lst.isEmpty() ) { | 128 | if ( lst.isEmpty() ) { |
132 | m_mode = ListingUnknown; | 129 | m_mode = ListingUnknown; |
133 | lst << QObject::tr("Error no Camera Dir found"); | 130 | lst << QObject::tr("Error no Camera Dir found"); |
134 | }else | 131 | }else |
135 | m_mode = ListingStart; | 132 | m_mode = ListingStart; |
136 | 133 | ||
137 | return lst; | 134 | return lst; |
138 | } | 135 | } |
139 | 136 | ||
140 | QStringList DCIM_DirLister::findAlbums()const { | 137 | QStringList DCIM_DirLister::findAlbums()const { |
141 | QStringList lst = QDir( m_path ).entryList( QDir::Dirs ); | 138 | QStringList lst = QDir( m_path ).entryList( QDir::Dirs ); |
142 | lst.remove( "." ); | 139 | lst.remove( "." ); |
143 | lst.remove( ".." ); | 140 | lst.remove( ".." ); |
144 | 141 | ||
145 | return lst; | 142 | return lst; |
146 | } | 143 | } |
147 | 144 | ||
148 | QStringList DCIM_DirLister::findImages()const { | 145 | QStringList DCIM_DirLister::findImages()const { |
149 | return QDir( m_path ).entryList("*.jpg *.jpeg *.png", QDir::Files ); | 146 | return QDir( m_path ).entryList("*.jpg *.jpeg *.png", QDir::Files ); |
150 | } | 147 | } |
151 | 148 | ||
152 | void DCIM_DirLister::deleteImage( const QString& fl ) { | 149 | void DCIM_DirLister::deleteImage( const QString& fl ) { |
153 | QFileInfo inf( fl ); | 150 | QFileInfo inf( fl ); |
154 | QFile::remove( fl ); | 151 | QFile::remove( fl ); |
155 | QFile::remove( inf.dirPath ()+"/preview/"+ | 152 | QFile::remove( inf.dirPath ()+"/preview/"+ |
156 | inf.fileName() ); | 153 | inf.fileName() ); |
157 | } | 154 | } |
158 | 155 | ||
159 | void DCIM_DirLister::thumbNail( const QString& _str, int w, int h ) { | 156 | void DCIM_DirLister::thumbNail( const QString& _str, int w, int h ) { |
160 | QFileInfo inf( _str ); | 157 | QFileInfo inf( _str ); |
161 | QString str = QFileInfo( inf.dirPath()+"/preview"+ inf.fileName() ).exists() ? | 158 | QString str = QFileInfo( inf.dirPath()+"/preview"+ inf.fileName() ).exists() ? |
162 | inf.dirPath()+"/preview"+ inf.fileName() : _str; | 159 | inf.dirPath()+"/preview"+ inf.fileName() : _str; |
163 | 160 | ||
164 | SlaveMaster::self()->thumbNail( str, w, h ); | 161 | SlaveMaster::self()->thumbNail( str, w, h ); |
165 | } | 162 | } |
166 | 163 | ||
167 | QImage DCIM_DirLister::image( const QString& str, Factor f, int m ) { | 164 | QImage DCIM_DirLister::image( const QString& str, Factor f, int m ) { |
168 | return SlaveMaster::self()->image( str, f, m ); | 165 | return SlaveMaster::self()->image( str, f, m ); |
169 | } | 166 | } |
170 | 167 | ||
171 | void DCIM_DirLister::imageInfo( const QString& str ) { | 168 | void DCIM_DirLister::imageInfo( const QString& str ) { |
172 | SlaveMaster::self()->thumbInfo( str ); | 169 | SlaveMaster::self()->thumbInfo( str ); |
173 | } | 170 | } |
174 | 171 | ||
175 | void DCIM_DirLister::fullImageInfo( const QString& str ) { | 172 | void DCIM_DirLister::fullImageInfo( const QString& str ) { |
176 | SlaveMaster::self()->imageInfo( str ); | 173 | SlaveMaster::self()->imageInfo( str ); |