summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/storage.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/library/storage.cpp b/library/storage.cpp
index 9549ff3..e657573 100644
--- a/library/storage.cpp
+++ b/library/storage.cpp
@@ -159,99 +159,100 @@ void StorageInfo::update()
159 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) 159 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i)
160 { 160 {
161 if ( (*i)->disk() == fs ) 161 if ( (*i)->disk() == fs )
162 { 162 {
163 found = TRUE; 163 found = TRUE;
164 break; 164 break;
165 } 165 }
166 } 166 }
167 if ( !found ) 167 if ( !found )
168 rebuild = TRUE; 168 rebuild = TRUE;
169 } 169 }
170 } 170 }
171 endmntent( mntfp ); 171 endmntent( mntfp );
172 } 172 }
173 if ( rebuild || n != (int)mFileSystems.count() ) 173 if ( rebuild || n != (int)mFileSystems.count() )
174 { 174 {
175 mFileSystems.clear(); 175 mFileSystems.clear();
176 QStringList::ConstIterator it=curdisks.begin(); 176 QStringList::ConstIterator it=curdisks.begin();
177 QStringList::ConstIterator fsit=curfs.begin(); 177 QStringList::ConstIterator fsit=curfs.begin();
178 QStringList::ConstIterator optsIt=curopts.begin(); 178 QStringList::ConstIterator optsIt=curopts.begin();
179 for (; it!=curdisks.end(); ++it, ++fsit, ++optsIt) 179 for (; it!=curdisks.end(); ++it, ++fsit, ++optsIt)
180 { 180 {
181 QString opts = *optsIt; 181 QString opts = *optsIt;
182 182
183 QString disk = *it; 183 QString disk = *it;
184 QString humanname; 184 QString humanname;
185 bool removable = FALSE; 185 bool removable = FALSE;
186 if ( isCF(disk) ) 186 if ( isCF(disk) )
187 { 187 {
188 humanname = tr("CF Card"); 188 humanname = tr("CF Card");
189 removable = TRUE; 189 removable = TRUE;
190 } 190 }
191 else if ( disk == "/dev/hda1" ) 191 else if ( disk == "/dev/hda1" )
192 { 192 {
193 humanname = tr("Hard Disk"); 193 humanname = tr("Hard Disk");
194 } 194 }
195 else if ( disk.left(9) == "/dev/mmcd" ) 195 else if ( disk.left(9) == "/dev/mmcd" )
196 { 196 {
197 humanname = tr("SD Card"); 197 humanname = tr("SD Card");
198 removable = TRUE; 198 removable = TRUE;
199 } 199 }
200 else if ( disk.left( 14 ) == "/dev/mmc/part1" || disk.left(11) == "/dev/mmcblk" ) 200 else if ( disk.left( 14 ) == "/dev/mmc/part1" || disk.left(11) == "/dev/mmcblk" )
201 { 201 {
202 humanname = tr("MMC Card"); 202 humanname = tr("MMC Card");
203 removable = TRUE; 203 removable = TRUE;
204 } 204 }
205 else if ( disk.left(7) == "/dev/hd" ) 205 else if ( disk.left(7) == "/dev/hd" )
206 humanname = tr("Hard Disk") + " " + disk; 206 humanname = tr("Hard Disk") + " " + disk;
207 else if ( disk.left(7) == "/dev/sd" ) 207 else if ( disk.left(7) == "/dev/sd" ) {
208 humanname = tr("SCSI Hard Disk") + " " + disk; 208 humanname = tr("SCSI Hard Disk") + " " + disk;
209 else if ( disk.left(14) == "/dev/mtdblock6" ) //openzaurus ramfs 209 removable = TRUE;
210 } else if ( disk.left(14) == "/dev/mtdblock6" ) //openzaurus ramfs
210 humanname = tr("Internal Memory"); 211 humanname = tr("Internal Memory");
211 else if ( disk == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) 212 else if ( disk == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" )
212 humanname = tr("Internal Storage"); 213 humanname = tr("Internal Storage");
213 else if ( disk.left(14) == "/dev/mtdblock/" ) 214 else if ( disk.left(14) == "/dev/mtdblock/" )
214 humanname = tr("Internal Storage") + " " + disk; 215 humanname = tr("Internal Storage") + " " + disk;
215 else if ( disk.left(13) == "/dev/mtdblock" ) 216 else if ( disk.left(13) == "/dev/mtdblock" )
216 humanname = tr("Internal Storage") + " " + disk; 217 humanname = tr("Internal Storage") + " " + disk;
217 else if ( disk.left(9) == "/dev/root" ) 218 else if ( disk.left(9) == "/dev/root" )
218 humanname = tr("Internal Storage") + " " + disk; 219 humanname = tr("Internal Storage") + " " + disk;
219 else if ( disk.left(5) == "tmpfs" ) //ipaqs /mnt/ramfs 220 else if ( disk.left(5) == "tmpfs" ) //ipaqs /mnt/ramfs
220 humanname = tr("Internal Memory"); 221 humanname = tr("Internal Memory");
221 FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts ); 222 FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts );
222 mFileSystems.append( fs ); 223 mFileSystems.append( fs );
223 } 224 }
224 emit disksChanged(); 225 emit disksChanged();
225 } 226 }
226 else 227 else
227 { 228 {
228 // just update them 229 // just update them
229 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) 230 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i)
230 i.current()->update(); 231 i.current()->update();
231 } 232 }
232#endif 233#endif
233} 234}
234 235
235bool deviceTab( const char *device) 236bool deviceTab( const char *device)
236{ 237{
237 QString name = device; 238 QString name = device;
238 bool hasDevice=false; 239 bool hasDevice=false;
239 240
240#ifdef Q_OS_MACX 241#ifdef Q_OS_MACX
241 // Darwin (MacOS X) 242 // Darwin (MacOS X)
242 struct statfs** mntbufp; 243 struct statfs** mntbufp;
243 int count = 0; 244 int count = 0;
244 if ( ( count = getmntinfo( mntbufp, MNT_WAIT ) ) == 0 ) 245 if ( ( count = getmntinfo( mntbufp, MNT_WAIT ) ) == 0 )
245 { 246 {
246 qWarning("deviceTab: Error in getmntinfo(): %s",strerror( errno ) ); 247 qWarning("deviceTab: Error in getmntinfo(): %s",strerror( errno ) );
247 hasDevice = false; 248 hasDevice = false;
248 } 249 }
249 for( int i = 0; i < count; i++ ) 250 for( int i = 0; i < count; i++ )
250 { 251 {
251 QString deviceName = mntbufp[i]->f_mntfromname; 252 QString deviceName = mntbufp[i]->f_mntfromname;
252 qDebug(deviceName); 253 qDebug(deviceName);
253 if( deviceName.left( name.length() ) == name ) 254 if( deviceName.left( name.length() ) == name )
254 hasDevice = true; 255 hasDevice = true;
255 } 256 }
256#else 257#else
257 // Linux 258 // Linux