summaryrefslogtreecommitdiffstats
path: root/pokemodr/models/CoinListObjectModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr/models/CoinListObjectModel.cpp')
-rw-r--r--pokemodr/models/CoinListObjectModel.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/pokemodr/models/CoinListObjectModel.cpp b/pokemodr/models/CoinListObjectModel.cpp
index c2af381a..086eb700 100644
--- a/pokemodr/models/CoinListObjectModel.cpp
+++ b/pokemodr/models/CoinListObjectModel.cpp
@@ -61,34 +61,18 @@ bool CoinListObjectModel::setData(const QVariant& value, int role)
{
if (role == Qt::UserRole)
{
- if (value.canConvert<void*>())
- {
- *static_cast<CoinListObject*>(m_object) = *static_cast<CoinListObject*>(value.value<void*>());
- return true;
- }
- else if (value.canConvert<QString>())
+ if (value.canConvert<QString>())
{
QFile file(value.toString());
QDomDocument xml;
- if (file.open(QIODevice::ReadOnly))
- {
- if (xml.setContent(&file))
- {
- if (xml.doctype().name() == m_object->className())
- {
- m_object->load(xml.documentElement());
- return true;
- }
- }
- file.close();
- }
- else if (xml.setContent(value.toString()))
+ if ((file.open(QIODevice::ReadOnly) && xml.setContent(&file)) || xml.setContent(value.toString()))
{
if (xml.doctype().name() == m_object->className())
{
m_object->load(xml.documentElement());
return true;
}
+ file.close();
}
}
}