Data is a QVariantmap again
this means that DataEngines and the Storage Service are directly usable from QML2 again
This commit is contained in:
parent
465c202b9b
commit
08ed91d7e0
@ -224,7 +224,7 @@ void DataModel::dataUpdated(const QString &sourceName, const Plasma::DataEngine:
|
||||
} else if (m_keyRoleFilterRE.isValid()) {
|
||||
//try to match the key we want with a regular expression if set
|
||||
QVariantList list;
|
||||
QHash<QString, QVariant>::const_iterator i;
|
||||
QVariantMap::const_iterator i;
|
||||
for (i = data.constBegin(); i != data.constEnd(); ++i) {
|
||||
if (m_keyRoleFilterRE.exactMatch(i.key())) {
|
||||
list.append(i.value());
|
||||
|
@ -63,8 +63,7 @@ void StorageTest::retrieve()
|
||||
if (storageJob) {
|
||||
QVERIFY(storageJob->exec());
|
||||
QVERIFY(storageJob->result().type() != QVariant::Bool);
|
||||
QVariantHash h = storageJob->result().value<QVariantHash>();
|
||||
QCOMPARE(h, m_data);
|
||||
QCOMPARE(storageJob->data(), m_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ private Q_SLOTS:
|
||||
|
||||
|
||||
private:
|
||||
QVariantHash m_data;
|
||||
QVariantMap m_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -180,7 +180,7 @@ void DataEngine::setData(const QString &source, const QString &key, const QVaria
|
||||
d->scheduleSourcesUpdated();
|
||||
}
|
||||
|
||||
void DataEngine::setData(const QString &source, const QHash<QString, QVariant> &data)
|
||||
void DataEngine::setData(const QString &source, const QVariantMap &data)
|
||||
{
|
||||
DataContainer *s = d->source(source, false);
|
||||
bool isNew = !s;
|
||||
|
@ -61,8 +61,8 @@ class PLASMA_EXPORT DataEngine : public QObject
|
||||
|
||||
public:
|
||||
typedef QHash<QString, DataEngine*> Dict;
|
||||
typedef QHash<QString, QVariant> Data;
|
||||
typedef QHashIterator<QString, QVariant> DataIterator;
|
||||
typedef QMap<QString, QVariant> Data;
|
||||
typedef QMapIterator<QString, QVariant> DataIterator;
|
||||
typedef QHash<QString, DataContainer*> SourceDict;
|
||||
|
||||
/**
|
||||
@ -287,7 +287,7 @@ NoAlignment) const;
|
||||
* @param source the name of the data source
|
||||
* @param data the data to add to the source
|
||||
**/
|
||||
void setData(const QString &source, const QHash<QString, QVariant> &data);
|
||||
void setData(const QString &source, const QVariantMap &data);
|
||||
|
||||
/**
|
||||
* Removes all the data associated with a data source.
|
||||
|
@ -58,12 +58,12 @@ StorageJob::~StorageJob()
|
||||
{
|
||||
}
|
||||
|
||||
void StorageJob::setData(const QVariantHash &data)
|
||||
void StorageJob::setData(const QVariantMap &data)
|
||||
{
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
QVariantHash StorageJob::data() const
|
||||
QVariantMap StorageJob::data() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
@ -102,8 +102,8 @@ void StorageJob::start()
|
||||
void StorageJob::resultSlot(StorageJob *job, const QVariant &result)
|
||||
{
|
||||
if (job == this) {
|
||||
if (result.type() == QVariant::Hash) {
|
||||
m_data = result.toHash();
|
||||
if (result.type() == QVariant::Map) {
|
||||
m_data = result.toMap();
|
||||
}
|
||||
setResult(result);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
class StorageJob : public Plasma::ServiceJob
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVariantHash data READ data WRITE setData)
|
||||
Q_PROPERTY(QVariantMap data READ data WRITE setData)
|
||||
|
||||
public:
|
||||
StorageJob(const QString& destination,
|
||||
@ -40,8 +40,8 @@ public:
|
||||
const QVariantMap& parameters,
|
||||
QObject *parent = 0);
|
||||
~StorageJob();
|
||||
void setData(const QVariantHash &data);
|
||||
QVariantHash data() const;
|
||||
void setData(const QVariantMap &data);
|
||||
QVariantMap data() const;
|
||||
void start();
|
||||
QString clientName() const;
|
||||
|
||||
@ -50,7 +50,7 @@ protected Q_SLOTS:
|
||||
|
||||
private:
|
||||
QString m_clientName;
|
||||
QVariantHash m_data;
|
||||
QVariantMap m_data;
|
||||
};
|
||||
//End StorageJob
|
||||
|
||||
|
@ -113,7 +113,7 @@ void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap &pa
|
||||
caller->data().insert(params.value("key").toString(), params.value("data"));
|
||||
}
|
||||
|
||||
QHashIterator<QString, QVariant> it(caller->data());
|
||||
QMapIterator<QString, QVariant> it(caller->data());
|
||||
|
||||
QString ids;
|
||||
while (it.hasNext()) {
|
||||
@ -247,7 +247,7 @@ void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantMap
|
||||
const int floatColumn = rec.indexOf("float");
|
||||
const int binaryColumn = rec.indexOf("binary");
|
||||
|
||||
QVariantHash data;
|
||||
QVariantMap data;
|
||||
while (query.next()) {
|
||||
const QString key = query.value(keyColumn).toString();
|
||||
if (!query.value(textColumn).isNull()) {
|
||||
|
Loading…
Reference in New Issue
Block a user