~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to solid/networkmanager-0.7/nmpropertyhelper.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "nmpropertyhelper.h"
 
2
 
 
3
NMPropertyHelper::NMPropertyHelper(QObject *master) : mMaster(master)
 
4
{
 
5
}
 
6
 
 
7
NMPropertyHelper::~NMPropertyHelper()
 
8
{
 
9
}
 
10
 
 
11
void NMPropertyHelper::registerProperty(const QString & nmPropertyName, QPair<char*, char*> propSpec)
 
12
{
 
13
    mRegisteredProperties.insert(nmPropertyName, propSpec);
 
14
}
 
15
 
 
16
void NMPropertyHelper::deserializeProperties(const QVariantMap& propertiesMap)
 
17
{
 
18
    QMapIterator<QString,QVariant> i(propertiesMap);
 
19
    while (i.hasNext()) {
 
20
        i.next();
 
21
        if (mRegisteredProperties.contains(i.key())) {
 
22
            QPair<char*,char*> spec = mRegisteredProperties[i.key()];
 
23
            mMaster->setProperty(spec.first, i.value());
 
24
            //spec.deserializer->deserialize( spec.propertyName, i.value(), mMaster);
 
25
            // emit signal if one was registered
 
26
            if ( spec.second != 0 )
 
27
                QMetaObject::invokeMethod( mMaster, spec.second );
 
28
        }
 
29
    }
 
30
}
 
31
 
 
32
NMPropertyDeserializer::~NMPropertyDeserializer()
 
33
{
 
34
}
 
35
 
 
36
void GenericDeserializer::deserialize(const QString & propertyName, const QVariant & value, QObject * recipient)
 
37
{
 
38
    /*
 
39
    recipient->setProperty(propertyName, value);
 
40
        QMetaObject::invokeMethod(recipient, signalName);
 
41
    emit recipient->propertyChanged(propertyName);*/
 
42
}