1114 | | os << " Disk Usage:<br />\r\n"; |
| 1114 | // Loop once until we find id == "total". This should be first, but a loop |
| 1115 | // separate from the per-filesystem details loop ensures total is first, |
| 1116 | // regardless. |
| 1117 | while (!node.isNull()) |
| 1118 | { |
| 1119 | QDomElement g = node.toElement(); |
| 1120 | |
| 1121 | if (!g.isNull() && g.tagName() == "Group") |
| 1122 | { |
| 1123 | QString id = g.attribute("id", "" ); |
| 1124 | |
| 1125 | if (id == "total") |
| 1126 | { |
| 1127 | int nFree = g.attribute("free" , "0" ).toInt(); |
| 1128 | int nTotal = g.attribute("total", "0" ).toInt(); |
| 1129 | int nUsed = g.attribute("used" , "0" ).toInt(); |
| 1130 | QString nDir = g.attribute("dir" , "" ); |
| 1131 | |
| 1132 | nDir.replace(QRegExp(","), ", "); |
| 1133 | |
| 1134 | os << " Disk Usage Summary:<br />\r\n"; |
| 1135 | os << " <ul>\r\n"; |
| 1136 | |
| 1137 | os << " <li>Total Disk Space:</li>\r\n" |
| 1138 | << " <ul>\r\n"; |
| 1139 | QLocale c(QLocale::C); |
| 1140 | |
| 1141 | os << " <li>Total Space: "; |
| 1142 | sRep = c.toString(nTotal) + " MB"; |
| 1143 | os << sRep << "</li>\r\n"; |
| 1144 | |
| 1145 | os << " <li>Space Used: "; |
| 1146 | sRep = c.toString(nUsed) + " MB"; |
| 1147 | os << sRep << "</li>\r\n"; |
| 1148 | |
| 1149 | os << " <li>Space Free: "; |
| 1150 | sRep = c.toString(nFree) + " MB"; |
| 1151 | os << sRep << "</li>\r\n"; |
| 1152 | |
| 1153 | os << " </ul>\r\n" |
| 1154 | << " </li>\r\n"; |
| 1155 | |
| 1156 | os << " </ul>\r\n"; |
| 1157 | break; |
| 1158 | } |
| 1159 | } |
| 1160 | |
| 1161 | node = node.nextSibling(); |
| 1162 | } |
| 1163 | |
| 1164 | // Loop again to handle per-filesystem details. |
| 1165 | node = storage.firstChild(); |
| 1166 | |
| 1167 | os << " Disk Usage Details:<br />\r\n"; |
1154 | | os << " <li>Total Space: "; |
1155 | | sRep = c.toString(nTotal) + " MB"; |
1156 | | os << sRep << "</li>\r\n"; |
1157 | | |
1158 | | os << " <li>Space Used: "; |
1159 | | sRep = c.toString(nUsed) + " MB"; |
1160 | | os << sRep << "</li>\r\n"; |
1161 | | |
1162 | | os << " <li>Space Free: "; |
1163 | | sRep = c.toString(nFree) + " MB"; |
1164 | | os << sRep << "</li>\r\n"; |
| 1202 | os << " <li>Total Space: "; |
| 1203 | sRep = c.toString(nTotal) + " MB"; |
| 1204 | os << sRep << "</li>\r\n"; |
| 1205 | |
| 1206 | os << " <li>Space Used: "; |
| 1207 | sRep = c.toString(nUsed) + " MB"; |
| 1208 | os << sRep << "</li>\r\n"; |
| 1209 | |
| 1210 | os << " <li>Space Free: "; |
| 1211 | sRep = c.toString(nFree) + " MB"; |
| 1212 | os << sRep << "</li>\r\n"; |