summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/storage.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/sysinfo/storage.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/sysinfo/storage.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp
index c4474d5..4ef7122 100644
--- a/noncore/settings/sysinfo/storage.cpp
+++ b/noncore/settings/sysinfo/storage.cpp
@@ -49,44 +49,36 @@ FileSysInfo::FileSysInfo( QWidget *parent, const char *name )
vb = 0x0;
storage = new StorageInfo( this );
connect( storage, SIGNAL( disksChanged() ), this, SLOT( disksChanged() ) );
lines.setAutoDelete(TRUE);
rebuildDisks = TRUE;
updateMounts();
startTimer( 5000 );
}
+
void FileSysInfo::timerEvent(QTimerEvent*)
{
updateMounts();
}
void FileSysInfo::updateMounts()
{
storage->update();
if ( rebuildDisks )
{
- // Cannot auto delete QDict<MountInfo> disks because it seems to delete
- // the filesystem object as well causing a segfault
- MountInfo *mi;
- for ( QDictIterator<MountInfo> delit(disks); delit.current(); ++delit )
- {
- mi = delit.current();
- mi->fs = 0x0;
- delete mi;
- }
disks.clear();
lines.clear();
delete vb;
vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ );
bool frst=TRUE;
FileSystem *fs;
for ( QListIterator<FileSystem> it(storage->fileSystems()); it.current(); ++it )
{
fs = it.current();
@@ -154,25 +146,24 @@ MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name )
legend = new GraphLegend( this );
legend->setOrientation(Horizontal);
vb->addWidget( legend );
legend->setData( data );
updateData();
}
MountInfo::~MountInfo()
{
delete data;
- delete fs;
}
void MountInfo::updateData()
{
long mult = fs->blockSize() / 1024;
long div = 1024 / fs->blockSize();
if ( !mult ) mult = 1;
if ( !div ) div = 1;
long total = fs->totalBlocks() * mult / div;
long avail = fs->availBlocks() * mult / div;
long used = total - avail;
totalSize->setText( title + tr(" : %1 kB").arg( total ) );