summaryrefslogtreecommitdiffstats
path: root/sigmodr/models/CoinListModel.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-09-16 06:36:17 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-09-16 06:36:17 +0000
commitb5e31868dc0d4d5094752ab2dba127311434e66f (patch)
tree9ffa57312ec216426059ec16d011865e4c1af72f /sigmodr/models/CoinListModel.cpp
parent0f0dbfb0395810c1c205a1dc10cf1f226669fd00 (diff)
downloadsigen-b5e31868dc0d4d5094752ab2dba127311434e66f.tar.gz
sigen-b5e31868dc0d4d5094752ab2dba127311434e66f.tar.xz
sigen-b5e31868dc0d4d5094752ab2dba127311434e66f.zip
[FIX] Refactored out some code to ObjectModel
[FIX] Drag and drop now accepts URLs [FIX] The main window can now accept drops git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@265 6ecfd1a5-f3ed-3746-8530-beee90d26b22
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();
}
}
}