Commit 783c53fb authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Device: Simplify code a bit



Simplify the code a bit, now that Core::Id uses utf8 conversion from/to
QString. Also make sure to not trigger warnings on invalid data.

Change-Id: Iccc523161fbcb89148a76684353e96ac875c24c7
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 420fd035
......@@ -261,12 +261,15 @@ Core::Id IDevice::invalidId()
Core::Id IDevice::typeFromMap(const QVariantMap &map)
{
return Core::Id(map.value(QLatin1String(TypeKey)).toByteArray().constData());
const QString idStr = map.value(QLatin1String(TypeKey)).toString();
if (idStr.isEmpty())
return Core::Id();
return Core::Id(idStr);
}
Core::Id IDevice::idFromMap(const QVariantMap &map)
{
return Core::Id(map.value(QLatin1String(IdKey)).toByteArray().constData());
return Core::Id(map.value(QLatin1String(IdKey)).toString());
}
void IDevice::fromMap(const QVariantMap &map)
......@@ -293,7 +296,7 @@ QVariantMap IDevice::toMap() const
{
QVariantMap map;
map.insert(QLatin1String(DisplayNameKey), d->displayName);
map.insert(QLatin1String(TypeKey), d->type.name());
map.insert(QLatin1String(TypeKey), d->type.toString());
map.insert(QLatin1String(IdKey), d->id.name());
map.insert(QLatin1String(OriginKey), d->origin);
......
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