summaryrefslogtreecommitdiffstats
path: root/examples/sysinfo/dialog.cpp
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2011-02-22 13:26:18 +1000
committerLorn Potter <lorn.potter@nokia.com>2011-02-22 13:26:18 +1000
commit61727c2c0ec68757ea0994f4ef710b2e7208fdb9 (patch)
tree216cfbc27041e4efce65d08181c62b2cdb601dba /examples/sysinfo/dialog.cpp
parent12725b15a2af32457ba6a8946ac364b31ff9623a (diff)
fix storageStateChanged on linux.
Task-number: MOBILITY-2599
Diffstat (limited to 'examples/sysinfo/dialog.cpp')
-rw-r--r--examples/sysinfo/dialog.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/sysinfo/dialog.cpp b/examples/sysinfo/dialog.cpp
index 0d3ccba4c5..0acc3d3ed4 100644
--- a/examples/sysinfo/dialog.cpp
+++ b/examples/sysinfo/dialog.cpp
@@ -271,6 +271,9 @@ void Dialog::setupStorage()
connect(sti,SIGNAL(logicalDriveChanged(bool,const QString &)),
this,SLOT(storageChanged(bool ,const QString &)));
}
+ connect(sti,SIGNAL(storageStateChanged(const QString &,QSystemStorageInfo::StorageState)),
+ this,SLOT(storageStateChanged(const QString &, QSystemStorageInfo::StorageState)));
+
updateStorage();
}
@@ -307,6 +310,8 @@ void Dialog::updateStorage()
items << QString::number(sti->totalDiskSpace(volName));
items << QString::number(sti->availableDiskSpace(volName));
items << sti->uriForDrive(volName);
+ items << storageStateToString(sti->getStorageState(volName));
+
QTreeWidgetItem *item = new QTreeWidgetItem(items);
storageTreeWidget->addTopLevelItem(item);
}
@@ -985,3 +990,25 @@ void Dialog::keyboardFlipped(bool on)
{
keyboardFlipRadioButton->setChecked(on);
}
+
+void Dialog::storageStateChanged(const QString &vol, QSystemStorageInfo::StorageState state)
+{
+ QList<QTreeWidgetItem *>item = storageTreeWidget->findItems(vol,Qt::MatchExactly,0);
+ item.at(0)->setText(3,QString::number(sti->availableDiskSpace(item.at(0)->text(0))));
+ item.at(0)->setText(5,storageStateToString(state));
+}
+
+QString Dialog::storageStateToString(QSystemStorageInfo::StorageState state)
+{
+ QString str;
+ if (state == QSystemStorageInfo::CriticalStorageState) {
+ str = "Critical";
+ } else if (state == QSystemStorageInfo::VeryLowStorageState) {
+ str = "Very Low";
+ } else if (state == QSystemStorageInfo::LowStorageState) {
+ str = "Low";
+ } else {
+ str = "Normal";
+ }
+ return str;
+}