complete migration, storage test passes
results still have to be converted in qmaps
This commit is contained in:
parent
b0530820ec
commit
5b648e5a23
@ -63,7 +63,8 @@ void StorageTest::retrieve()
|
|||||||
if (storageJob) {
|
if (storageJob) {
|
||||||
QVERIFY(storageJob->exec());
|
QVERIFY(storageJob->exec());
|
||||||
QVERIFY(storageJob->result().type() != QVariant::Bool);
|
QVERIFY(storageJob->result().type() != QVariant::Bool);
|
||||||
QCOMPARE(storageJob->data(), m_data);
|
QVariantHash h = storageJob->result().value<QVariantHash>();
|
||||||
|
QCOMPARE(h, m_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ void StorageThread::initializeDb(StorageJob *caller)
|
|||||||
m_db.transaction();
|
m_db.transaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantHash ¶ms)
|
void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap ¶ms)
|
||||||
{
|
{
|
||||||
StorageJob *caller = wcaller.data();
|
StorageJob *caller = wcaller.data();
|
||||||
if (!caller) {
|
if (!caller) {
|
||||||
@ -198,7 +198,7 @@ void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantHash &p
|
|||||||
emit newResult(caller, true);
|
emit newResult(caller, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantHash ¶ms)
|
void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantMap ¶ms)
|
||||||
{
|
{
|
||||||
StorageJob *caller = wcaller.data();
|
StorageJob *caller = wcaller.data();
|
||||||
if (!caller) {
|
if (!caller) {
|
||||||
@ -263,7 +263,6 @@ void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantHas
|
|||||||
data.insert(key, v);
|
data.insert(key, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = data;
|
result = data;
|
||||||
} else {
|
} else {
|
||||||
result = false;
|
result = false;
|
||||||
@ -272,7 +271,7 @@ void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantHas
|
|||||||
emit newResult(caller, result);
|
emit newResult(caller, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StorageThread::deleteEntry(QWeakPointer<StorageJob> wcaller, const QVariantHash ¶ms)
|
void StorageThread::deleteEntry(QWeakPointer<StorageJob> wcaller, const QVariantMap ¶ms)
|
||||||
{
|
{
|
||||||
StorageJob *caller = wcaller.data();
|
StorageJob *caller = wcaller.data();
|
||||||
if (!caller) {
|
if (!caller) {
|
||||||
@ -302,7 +301,7 @@ void StorageThread::deleteEntry(QWeakPointer<StorageJob> wcaller, const QVariant
|
|||||||
emit newResult(caller, success);
|
emit newResult(caller, success);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StorageThread::expire(QWeakPointer<StorageJob> wcaller, const QVariantHash ¶ms)
|
void StorageThread::expire(QWeakPointer<StorageJob> wcaller, const QVariantMap ¶ms)
|
||||||
{
|
{
|
||||||
StorageJob *caller = wcaller.data();
|
StorageJob *caller = wcaller.data();
|
||||||
if (!caller) {
|
if (!caller) {
|
||||||
|
@ -44,10 +44,10 @@ public:
|
|||||||
void closeDb();
|
void closeDb();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void save(QWeakPointer<StorageJob> caller, const QVariantHash ¶meters);
|
void save(QWeakPointer<StorageJob> caller, const QVariantMap ¶meters);
|
||||||
void retrieve(QWeakPointer<StorageJob> caller, const QVariantHash ¶meters);
|
void retrieve(QWeakPointer<StorageJob> caller, const QVariantMap ¶meters);
|
||||||
void deleteEntry(QWeakPointer<StorageJob> caller, const QVariantHash ¶meters);
|
void deleteEntry(QWeakPointer<StorageJob> caller, const QVariantMap ¶meters);
|
||||||
void expire(QWeakPointer<StorageJob> caller, const QVariantHash ¶meters);
|
void expire(QWeakPointer<StorageJob> caller, const QVariantMap ¶meters);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void newResult(StorageJob* caller, const QVariant &result);
|
void newResult(StorageJob* caller, const QVariant &result);
|
||||||
|
@ -76,9 +76,9 @@ void ConfigLoaderHandlerMap::addItem()
|
|||||||
|
|
||||||
if (!m_groupsMap.contains(currentGroup())) {
|
if (!m_groupsMap.contains(currentGroup())) {
|
||||||
m_groupsMap[currentGroup()] = QVariantMap();
|
m_groupsMap[currentGroup()] = QVariantMap();
|
||||||
|
m_groupsMap[currentGroup()]["_name"] = currentGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (type() == "bool") {
|
if (type() == "bool") {
|
||||||
bool defaultVal = defaultValue().toLower() == "true";
|
bool defaultVal = defaultValue().toLower() == "true";
|
||||||
m_groupsMap[currentGroup()][key()] = defaultVal;
|
m_groupsMap[currentGroup()][key()] = defaultVal;
|
||||||
@ -201,7 +201,7 @@ QString Service::destination() const
|
|||||||
|
|
||||||
QStringList Service::operationNames() const
|
QStringList Service::operationNames() const
|
||||||
{
|
{
|
||||||
if (!d->operationsMap.keys().isEmpty()) {
|
if (d->operationsMap.keys().isEmpty()) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "No valid operations scheme has been registered";
|
kDebug() << "No valid operations scheme has been registered";
|
||||||
#endif
|
#endif
|
||||||
@ -213,7 +213,7 @@ QStringList Service::operationNames() const
|
|||||||
|
|
||||||
QVariantMap Service::operationDescription(const QString &operationName)
|
QVariantMap Service::operationDescription(const QString &operationName)
|
||||||
{
|
{
|
||||||
if (!d->operationsMap.keys().isEmpty()) {
|
if (d->operationsMap.keys().isEmpty()) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "No valid operations scheme has been registered";
|
kDebug() << "No valid operations scheme has been registered";
|
||||||
#endif
|
#endif
|
||||||
@ -225,32 +225,13 @@ QVariantMap Service::operationDescription(const QString &operationName)
|
|||||||
return d->operationsMap.value(operationName);
|
return d->operationsMap.value(operationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*QHash<QString, QVariant> Service::parametersFromDescription(const KConfigGroup &description)
|
|
||||||
{
|
|
||||||
QHash<QString, QVariant> params;
|
|
||||||
|
|
||||||
if (!d->operationsMap.keys().isEmpty() || !description.isValid()) {
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString op = description.name();
|
|
||||||
foreach (const QString &key, description.keyList()) {
|
|
||||||
KConfigSkeletonItem *item = d->config->findItem(op, key);
|
|
||||||
if (item) {
|
|
||||||
params.insert(key, description.readEntry(key, item->property()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return params;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
ServiceJob *Service::startOperationCall(const QVariantMap &description, QObject *parent)
|
ServiceJob *Service::startOperationCall(const QVariantMap &description, QObject *parent)
|
||||||
{
|
{
|
||||||
// TODO: nested groups?
|
// TODO: nested groups?
|
||||||
ServiceJob *job = 0;
|
ServiceJob *job = 0;
|
||||||
const QString op = !description.isEmpty() ? description.value("_name").toString() : QString();
|
const QString op = !description.isEmpty() ? description.value("_name").toString() : QString();
|
||||||
|
|
||||||
if (!d->operationsMap.keys().isEmpty()) {
|
if (d->operationsMap.keys().isEmpty()) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "No valid operations scheme has been registered";
|
kDebug() << "No valid operations scheme has been registered";
|
||||||
#endif
|
#endif
|
||||||
@ -325,7 +306,7 @@ void Service::setName(const QString &name)
|
|||||||
|
|
||||||
void Service::setOperationEnabled(const QString &operation, bool enable)
|
void Service::setOperationEnabled(const QString &operation, bool enable)
|
||||||
{
|
{
|
||||||
if (!d->operationsMap.keys().isEmpty() || !d->operationsMap.contains(operation)) {
|
if (d->operationsMap.keys().isEmpty() || !d->operationsMap.contains(operation)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user