Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 18647 → Rev 18649

/trunk/Scribus/scribus/nftrcreader.cpp
79,7 → 79,7
enCat = attrs.value(i);
}
}
tmpTemplate = new nfttemplate(new QFile(currentFile), category); // create a new template
tmpTemplate = new nfttemplate(currentFile, category); // create a new template
tmpTemplate->enCategory = enCat;
}
 
138,8 → 138,15
{ // new template starts here
inTemplate = false;
if (tmpTemplate != NULL) // If we have a template already created
{
if (tmpTemplate->isValid()) // and the template really exists push
templates->push_back(tmpTemplate); // it to the templates vector and start a new one
else
{
delete tmpTemplate;
tmpTemplate = 0;
}
}
}
if (inTemplate) {
if (inName && name == "name")
/trunk/Scribus/scribus/nfttemplate.cpp
10,25 → 10,25
#include "nfttemplate.h"
#include <QFileInfo>
 
nfttemplate::nfttemplate(QFile* tmplXmlFile, const QString &tmplCategory)
nfttemplate::nfttemplate(QString tmplFilePath, const QString &tmplCategory)
: tmplXml(tmplFilePath)
{
tmplXml = tmplXmlFile;
templateCategory = tmplCategory;
isWritable = tmplXml->open(QIODevice::WriteOnly | QIODevice::ReadOnly);
tmplXml->close();
isWritable = tmplXml.open(QIODevice::WriteOnly | QIODevice::ReadOnly);
tmplXml.close();
isDeleted = false;
}
 
void nfttemplate::remove()
{
if (!tmplXml->exists())
if (!tmplXml.exists())
return;
 
QString newTmplXml = "";
QString tmp;
bool collect = false;
tmplXml->open(QIODevice::ReadOnly);
QTextStream stream(tmplXml);
tmplXml.open(QIODevice::ReadOnly);
QTextStream stream(&tmplXml);
stream.setCodec("UTF-8");
QString line = stream.readLine();
while (!line.isNull())
70,12 → 70,12
}
line = stream.readLine();
}
tmplXml->close();
tmplXml->open(QIODevice::WriteOnly);
QTextStream instream(tmplXml);
tmplXml.close();
tmplXml.open(QIODevice::WriteOnly);
QTextStream instream(&tmplXml);
instream.setCodec("UTF-8");
instream << newTmplXml;
tmplXml->close();
tmplXml.close();
}
 
bool nfttemplate::canWrite()
/trunk/Scribus/scribus/nfttemplate.h
16,9 → 16,9
 
class nfttemplate {
public:
nfttemplate(QFile* tmplXmlFile, const QString &tmplType);
nfttemplate(QString tmplFilePath, const QString &tmplType);
~nfttemplate();
QFile* tmplXml;
QFile tmplXml;
QString enCategory;
QString templateCategory;
QString name;