summaryrefslogtreecommitdiffstats
path: root/sigmodr/models/CoinListModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmodr/models/CoinListModel.cpp')
-rw-r--r--sigmodr/models/CoinListModel.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/sigmodr/models/CoinListModel.cpp b/sigmodr/models/CoinListModel.cpp
index 9452e5b4..0c6264f8 100644
--- a/sigmodr/models/CoinListModel.cpp
+++ b/sigmodr/models/CoinListModel.cpp
@@ -32,9 +32,6 @@
// KDE includes
#include <KMenu>
-// Qt includes
-#include <QtCore/QFile>
-
Sigmodr::CoinListModel::CoinListModel(BaseModel* parent, Sigmod::CoinList* coinList) :
GroupObjectModel(parent, coinList)
{
@@ -76,11 +73,11 @@ bool Sigmodr::CoinListModel::setData(const QVariant& value, int role)
{
if (role == Sigmodr::BaseModel::XmlRole)
{
- if (value.canConvert<QString>())
+ QString data = value.toString();
+ if (!data.isEmpty())
{
- QFile file(value.toString());
QDomDocument xml;
- if ((file.open(QIODevice::ReadOnly) && xml.setContent(&file)) || xml.setContent(value.toString()))
+ if (loadFromData(data, &xml))
{
if (xml.doctype().name() == m_object->className())
{
@@ -94,7 +91,6 @@ bool Sigmodr::CoinListModel::setData(const QVariant& value, int role)
addObject(qobject_cast<Sigmod::CoinList*>(m_object)->newObject(xml.documentElement()));
return true;
}
- file.close();
}
}
}