summaryrefslogtreecommitdiff
path: root/library/storage.cpp
Side-by-side diff
Diffstat (limited to 'library/storage.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/storage.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/storage.cpp b/library/storage.cpp
index 0ea465b..fcee689 100644
--- a/library/storage.cpp
+++ b/library/storage.cpp
@@ -50,98 +50,98 @@ static bool isCF(const QString& m)
#ifndef Q_OS_MACX
FILE* f = fopen("/var/run/stab", "r");
if (!f) f = fopen("/var/state/pcmcia/stab", "r");
if (!f) f = fopen("/var/lib/pcmcia/stab", "r");
if ( f )
{
char line[1024];
char devtype[80];
char devname[80];
while ( fgets( line, 1024, f ) )
{
// 0 ide ide-cs 0 hda 3 0
if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 )
{
if ( QString(devtype) == "ide" && m.find(devname)>0 )
{
fclose(f);
return TRUE;
}
}
}
fclose(f);
}
#endif /* Q_OS_MACX */
return FALSE;
}
/*! \class StorageInfo storage.h
\brief The StorageInfo class describes the disks mounted on the file system.
This class provides access to the mount information for the Linux
filesystem. Each mount point is represented by the FileSystem class.
To ensure this class has the most up to date size information, call
the update() method. Note that this will automatically be signaled
by the operating system when a disk has been mounted or unmounted.
\ingroup qtopiaemb
*/
/*! Constructor that determines the current mount points of the filesystem.
The standard \a parent parameters is passed on to QObject.
*/
StorageInfo::StorageInfo( QObject *parent )
: QObject( parent )
{
mFileSystems.setAutoDelete( TRUE );
channel = new QCopChannel( "QPE/Card", this );
- connect( channel, SIGNAL(received(const QCString &, const QByteArray &)),
- this, SLOT(cardMessage( const QCString &, const QByteArray &)) );
+ connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
+ this, SLOT(cardMessage(const QCString&,const QByteArray&)) );
update();
}
/*! Returns the longest matching FileSystem that starts with the
same prefix as \a filename as its mount point.
*/
const FileSystem *StorageInfo::fileSystemOf( const QString &filename )
{
for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i)
{
if ( filename.startsWith( (*i)->path() ) )
return (*i);
}
return 0;
}
void StorageInfo::cardMessage( const QCString& msg, const QByteArray& )
{
if ( msg == "mtabChanged()" )
update();
}
/*! Updates the mount and free space available information for each mount
point. This method is automatically called when a disk is mounted or
unmounted.
*/
// cause of the lack of a d pointer we need
// to store informations in a config file :(
void StorageInfo::update()
{
//qDebug("StorageInfo::updating");
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
struct mntent *me;
FILE *mntfp = setmntent( "/etc/mtab", "r" );
QStringList curdisks;
QStringList curopts;
QStringList curfs;
bool rebuild = FALSE;
int n=0;
if ( mntfp )
{
while ( (me = getmntent( mntfp )) != 0 )
{
QString fs = me->mnt_fsname;
if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd"