Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions | Public Attributes
nfttemplate Class Reference

#include <nfttemplate.h>

List of all members.

Public Member Functions

 nfttemplate (QFile *tmplXmlFile, const QString &tmplType)
 ~nfttemplate ()
void remove ()
bool canWrite ()
bool isValid ()

Public Attributes

QFile * tmplXml
QString enCategory
QString templateCategory
QString name
QString file
QString tnail
QString img
QString psize
QString color
QString descr
QString usage
QString scribusVersion
QString date
QString author
QString email
bool isWritable
bool isDeleted

Detailed Description

Definition at line 17 of file nfttemplate.h.


Constructor & Destructor Documentation

nfttemplate::nfttemplate ( QFile *  tmplXmlFile,
const QString &  tmplType 
)

Definition at line 13 of file nfttemplate.cpp.

{
       tmplXml = tmplXmlFile;
       templateCategory = tmplCategory;
       isWritable = tmplXml->open(IO_WriteOnly | IO_ReadOnly);
       tmplXml->close();
       isDeleted = false;
}

Definition at line 107 of file nfttemplate.cpp.

{
       if (isDeleted)
              remove();
}

Member Function Documentation

Definition at line 80 of file nfttemplate.cpp.

{
       return isWritable;
}

Here is the caller graph for this function:

Definition at line 85 of file nfttemplate.cpp.

{
       bool ret = true;
       
       QFileInfo *fi = new QFileInfo(file);
       if (!fi->exists())
              ret = false;
       delete fi;
       
       fi = new QFileInfo(tnail);
       if (!fi->exists())
              ret = false;
       delete fi;
       
       fi = new QFileInfo(img);
       if (!fi->exists())
              ret = false;
       delete fi;
       
       return ret;   
}

Definition at line 22 of file nfttemplate.cpp.

{
       if (tmplXml->exists())
       {
              QString newTmplXml = "";
              QString tmp;
              bool collect = false;
              tmplXml->open(IO_ReadOnly);
              QTextStream stream(tmplXml);
              QString line = stream.readLine();
              while (line != NULL)
              {
                     if ((line.find(enCategory) != -1) || collect)
                     {
                            collect = true;
                            line += "\n";
                            tmp += line;
                            if (line.find("name") != -1)
                            {
                                   if (line.find(name) == -1)
                                   {
                                          collect = false;
                                          newTmplXml += tmp;
                                          tmp = "";
                                   }
                            } 
                            else if (line.find("file") != -1)
                            {
                                   QString shortFile = file.right(file.length() - file.findRev("/") -1);
                                   if (line.find(shortFile) == -1)
                                   {
                                          collect = false;
                                          newTmplXml += tmp;
                                          tmp = "";
                                   }
                            } 
                            else if (line.find("</template>") != -1)
                            {
                                   collect = false;
                                   tmp = "";
                            }
                     }
                     else
                     {
                            line += "\n";
                            newTmplXml += line;
                     }
                     line = stream.readLine();
              }
              tmplXml->close();
              tmplXml->open(IO_WriteOnly);
              QTextStream instream(tmplXml);
              instream.setEncoding(QTextStream::UnicodeUTF8);
              instream << newTmplXml;
              tmplXml->close();
       }
}

Member Data Documentation

Definition at line 34 of file nfttemplate.h.

Definition at line 29 of file nfttemplate.h.

Definition at line 33 of file nfttemplate.h.

Definition at line 30 of file nfttemplate.h.

Definition at line 35 of file nfttemplate.h.

Definition at line 22 of file nfttemplate.h.

Definition at line 25 of file nfttemplate.h.

Definition at line 27 of file nfttemplate.h.

Definition at line 37 of file nfttemplate.h.

Definition at line 36 of file nfttemplate.h.

Definition at line 24 of file nfttemplate.h.

Definition at line 28 of file nfttemplate.h.

Definition at line 32 of file nfttemplate.h.

Definition at line 23 of file nfttemplate.h.

Definition at line 21 of file nfttemplate.h.

Definition at line 26 of file nfttemplate.h.

Definition at line 31 of file nfttemplate.h.


The documentation for this class was generated from the following files: