mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 16:50:53 +01:00
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:
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user