Implemented QET::writeXmlFile() to handle every XML file generation in a single place.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1640 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-04-09 01:03:08 +00:00
parent 6ab83f3517
commit 318df55a37
8 changed files with 61 additions and 71 deletions

View File

@@ -126,12 +126,6 @@ bool TitleBlockTemplate::loadFromXmlElement(const QDomElement &xml_element) {
bool TitleBlockTemplate::saveToXmlFile(const QString &filepath) {
if (filepath.isEmpty()) return(false);
// open the file
QFile xml_file(filepath);
if (!xml_file.open(QIODevice::WriteOnly | QIODevice::Text)) {
return(false);
}
// generate the XML document
QDomDocument doc;
QDomElement e = doc.createElement("root");
@@ -139,13 +133,7 @@ bool TitleBlockTemplate::saveToXmlFile(const QString &filepath) {
if (!saving) return(false);
doc.appendChild(e);
// write the file
QTextStream out(&xml_file);
out.setCodec("UTF-8");
out << doc.toString(4);
xml_file.close();
return(true);
return(QET::writeXmlFile(doc, filepath));
}
/**