[Openvas-commits] r10584 - in trunk/gsd: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Mar 18 14:53:40 CET 2011
Author: raimund
Date: 2011-03-18 14:53:39 +0100 (Fri, 18 Mar 2011)
New Revision: 10584
Modified:
trunk/gsd/ChangeLog
trunk/gsd/src/gsd_mw.cpp
Log:
Fixed a bug in the top 5 chart.
* src/gsd_mw.cpp (updateDashboard): Limit the string concatenation to the
number of tasks if its less than 5.
Modified: trunk/gsd/ChangeLog
===================================================================
--- trunk/gsd/ChangeLog 2011-03-18 11:56:58 UTC (rev 10583)
+++ trunk/gsd/ChangeLog 2011-03-18 13:53:39 UTC (rev 10584)
@@ -1,5 +1,12 @@
2011-03-18 Raimund Renkert <raimund.renkert at greenbone.net>
+ Fixed a bug in the top 5 chart.
+
+ * src/gsd_mw.cpp (updateDashboard): Limit the string concatenation to the
+ number of tasks if its less than 5.
+
+2011-03-18 Raimund Renkert <raimund.renkert at greenbone.net>
+
Retain the current performance chart on refresh.
* src/dock_performance.cpp (dock_performance): Initialize the current index
Modified: trunk/gsd/src/gsd_mw.cpp
===================================================================
--- trunk/gsd/src/gsd_mw.cpp 2011-03-18 11:56:58 UTC (rev 10583)
+++ trunk/gsd/src/gsd_mw.cpp 2011-03-18 13:53:39 UTC (rev 10584)
@@ -4388,7 +4388,7 @@
QStringList val;
QStringList name;
QStringList col;
- for (int ndx = 0; ndx < 5; ndx++)
+ for (int ndx = 0; ndx < 5 && ndx < tmp->rowCount (); ndx++)
{
if (tmp->getValue (top5.at (ndx), path).toInt (&ok, 10) > 0)
{
@@ -4421,16 +4421,23 @@
}
}
- QString data_top5_val = QString ("%1, %2, %3, %4, %5").arg (val[0])
- .arg (val[1])
- .arg (val[2])
- .arg (val[3])
- .arg (val[4]);
- QString data_top5_col = QString ("%1, %2, %3, %4, %5").arg (col[0])
- .arg (col[1])
- .arg (col[2])
- .arg (col[3])
- .arg (col[4]);
+ QString data_top5_val;
+ QString data_top5_col;
+ for (int ndx = 0; ndx < val.size (); ndx++)
+ {
+ if (ndx == val.size () - 1)
+ {
+ data_top5_val.append (QString ("%1").arg (val[ndx]));
+ data_top5_col.append (QString ("%1").arg (col[ndx]));
+ }
+ else
+ {
+ data_top5_val.append (QString ("%1, ").arg (val[ndx]));
+ data_top5_col.append (QString ("%1, ").arg (col[ndx]));
+ }
+ QString s = QString ("__name%1__").arg (ndx+1);
+ task_top5.replace (s, name[ndx]);
+ }
tasks.replace ("__data__", data_tasks);
tasks.replace ("__color__", color);
tasks.replace ("__labels__", label);
@@ -4441,11 +4448,6 @@
vulnerabilities.replace ("__color__", color_v);
vulnerabilities.replace ("__labels__", label_v);
task_top5.replace ("__data__", data_top5_val);
- task_top5.replace ("__name1__", name[0]);
- task_top5.replace ("__name2__", name[1]);
- task_top5.replace ("__name3__", name[2]);
- task_top5.replace ("__name4__", name[3]);
- task_top5.replace ("__name5__", name[4]);
task_top5.replace ("__color__", data_top5_col);
//Replace translated strings
More information about the Openvas-commits
mailing list