Commit 7fbf021e authored by Volker Krause's avatar Volker Krause
Browse files

Add more properties needed by the JavaScript-based data extractors

parent b621cffb
......@@ -522,4 +522,17 @@ QVariantList Pass::barcodesVariant() const
return toVariantList(barcodes());
}
QVariantList Pass::locationsVariant() const
{
return toVariantList(locations());
}
QVariantMap Pass::fieldsVariantMap() const
{
QVariantMap m;
const auto elems = fields();
std::for_each(elems.begin(), elems.end(), [&m](const Field &f) { m.insert(f.key(), QVariant::fromValue(f)); });
return m;
}
#include "moc_pass.cpp"
......@@ -72,6 +72,8 @@ class KPKPASS_EXPORT Pass : public QObject
Q_PROPERTY(QVariantList headerFields READ headerFieldsVariant CONSTANT)
Q_PROPERTY(QVariantList primaryFields READ primaryFieldsVariant CONSTANT)
Q_PROPERTY(QVariantList secondaryFields READ secondaryFieldsVariant CONSTANT)
Q_PROPERTY(QVariantList locations READ locationsVariant CONSTANT)
Q_PROPERTY(QVariantMap field READ fieldsVariantMap CONSTANT)
public:
virtual ~Pass();
......@@ -163,6 +165,8 @@ private:
QVariantList primaryFieldsVariant() const;
QVariantList secondaryFieldsVariant() const;
QVariantList barcodesVariant() const;
QVariantList locationsVariant() const;
QVariantMap fieldsVariantMap() const;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment