DataQualityDataQueryDecorator.cpp Example File
listdecorators/src/DataQualityDataQueryDecorator.cpp
#include "DataQualityDataQueryDecorator.hpp"
DataQualityDataQueryDecorator::DataQualityDataQueryDecorator(QObject* parent) :
bb::cascades::datamanager::DataQueryDecorator(parent) {
}
DataQualityDataQueryDecorator::~DataQualityDataQueryDecorator() {
}
void DataQualityDataQueryDecorator::processResults(
QList<bb::cascades::datamanager::DataItem>* results) {
QList<bb::cascades::datamanager::DataItem> *newResults = new QList<
bb::cascades::datamanager::DataItem>;
int count = results->size();
for (int i = 0; i < count; i++) {
QVariantMap map = (*results)[i].payload().toMap();
QString dataQuality = map["data_quality"].toString();
if (dataQuality == "Correct" || dataQuality == "Complete and Correct") {
map["dataQualityImage"] = "data_correct.png";
} else {
map["dataQualityImage"] = "data_incorrect.png";
}
(*results)[i].setPayload(map);
newResults->append((*results)[i]);
}
results = newResults;
}