diff options
author | Lukáš Lalinský <lalinsky@gmail.com> | 2009-07-20 10:33:14 +0200 |
---|---|---|
committer | Lukáš Lalinský <lalinsky@gmail.com> | 2009-07-20 10:33:14 +0200 |
commit | ee4e0002025099edd716bbd5b5c4f21b467ac7ab (patch) | |
tree | 3babf8ecd41dc93eac4aeae04c522114e908e1ca /src/diagramdocument.cpp | |
parent | 043cf094f6494039cc5b8ba6c0a95406702c2ed4 (diff) | |
download | dbmodel-ee4e0002025099edd716bbd5b5c4f21b467ac7ab.tar.xz |
Open file passed on the command line
Diffstat (limited to 'src/diagramdocument.cpp')
-rw-r--r-- | src/diagramdocument.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/diagramdocument.cpp b/src/diagramdocument.cpp index a697bc7..a541d7a 100644 --- a/src/diagramdocument.cpp +++ b/src/diagramdocument.cpp @@ -432,15 +432,20 @@ DiagramDocument::save(const QString &fileName) #include "diagramitemfactory.h" -void +bool DiagramDocument::load(const QString &fileName) { QDomDocument doc; QFile file(fileName); if (file.open(QIODevice::ReadOnly)) { - doc.setContent(&file); + if (!doc.setContent(&file)) { + return false; + } file.close(); } + else { + return false; + } setFileName(fileName); QDomElement root = doc.firstChildElement("diagram"); @@ -460,6 +465,7 @@ DiagramDocument::load(const QString &fileName) } itemElement = itemElement.nextSiblingElement("item"); } + return true; } DiagramItem * |