summaryrefslogtreecommitdiffstats
path: root/lib/util/filetemplate.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
commitd6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch)
treed109539636691d7b03036ca1c0ed29dbae6577cf /lib/util/filetemplate.cpp
parent3331a47a9cad24795c7440ee8107143ce444ef34 (diff)
downloadtdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz
tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/util/filetemplate.cpp')
-rw-r--r--lib/util/filetemplate.cpp96
1 files changed, 48 insertions, 48 deletions
diff --git a/lib/util/filetemplate.cpp b/lib/util/filetemplate.cpp
index 78abf384..cbf4f8bb 100644
--- a/lib/util/filetemplate.cpp
+++ b/lib/util/filetemplate.cpp
@@ -19,11 +19,11 @@
#include "filetemplate.h"
-#include <qdatetime.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qtextstream.h>
+#include <tqdatetime.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
+#include <tqtextstream.h>
#include <kstandarddirs.h>
@@ -32,97 +32,97 @@
#include "domutil.h"
-bool FileTemplate::exists(KDevPlugin *part, const QString &name, Policy p)
+bool FileTemplate::exists(KDevPlugin *part, const TQString &name, Policy p)
{
- //QString fileName = (p == Default) ?
+ //TQString fileName = (p == Default) ?
// (part->project()->projectDirectory() + "/templates/" + name) : name;
- return QFile::exists( fullPathForName(part,name,p) );
+ return TQFile::exists( fullPathForName(part,name,p) );
}
-QString FileTemplate::read(KDevPlugin *part, const QString &name, Policy p)
+TQString FileTemplate::read(KDevPlugin *part, const TQString &name, Policy p)
{
//KDevProject *project = part->project();
- //QString fileName = (p == Default) ? (project->projectDirectory() +
+ //TQString fileName = (p == Default) ? (project->projectDirectory() +
// "/templates/" + name) : name;
return readFile(part, fullPathForName(part, name, p) );
}
-QString FileTemplate::readFile(KDevPlugin *part, const QString &fileName)
+TQString FileTemplate::readFile(KDevPlugin *part, const TQString &fileName)
{
- QDomDocument &dom = *part->projectDom();
+ TQDomDocument &dom = *part->projectDom();
- QFile f(fileName);
+ TQFile f(fileName);
if (!f.open(IO_ReadOnly))
- return QString::null;
- QTextStream stream(&f);
- QString str = stream.read();
+ return TQString::null;
+ TQTextStream stream(&f);
+ TQString str = stream.read();
return makeSubstitutions( dom, str );
}
-QString FileTemplate::makeSubstitutions( QDomDocument & dom, const QString & text )
+TQString FileTemplate::makeSubstitutions( TQDomDocument & dom, const TQString & text )
{
- QString author = DomUtil::readEntry(dom, "/general/author");
- QString email = DomUtil::readEntry(dom, "/general/email");
- QString version = DomUtil::readEntry(dom, "/general/version");
- QString appname = DomUtil::readEntry(dom, "/general/projectname");
- QString date = QDate::currentDate().toString();
- QString year = QString::number(QDate::currentDate().year());
-
- QString str = text;
- str.replace(QRegExp("\\$EMAIL\\$"),email);
- str.replace(QRegExp("\\$AUTHOR\\$"),author);
- str.replace(QRegExp("\\$VERSION\\$"),version);
- str.replace(QRegExp("\\$DATE\\$"),date);
- str.replace(QRegExp("\\$YEAR\\$"),year);
- str.replace(QRegExp("\\$APPNAME\\$"),appname);
- str.replace(QRegExp("\\$APPNAME\\$"),appname);
- str.replace(QRegExp("\\$APPNAMEUC\\$"),appname.upper());
- str.replace(QRegExp("\\$APPNAMELC\\$"),appname.lower());
+ TQString author = DomUtil::readEntry(dom, "/general/author");
+ TQString email = DomUtil::readEntry(dom, "/general/email");
+ TQString version = DomUtil::readEntry(dom, "/general/version");
+ TQString appname = DomUtil::readEntry(dom, "/general/projectname");
+ TQString date = TQDate::currentDate().toString();
+ TQString year = TQString::number(TQDate::currentDate().year());
+
+ TQString str = text;
+ str.replace(TQRegExp("\\$EMAIL\\$"),email);
+ str.replace(TQRegExp("\\$AUTHOR\\$"),author);
+ str.replace(TQRegExp("\\$VERSION\\$"),version);
+ str.replace(TQRegExp("\\$DATE\\$"),date);
+ str.replace(TQRegExp("\\$YEAR\\$"),year);
+ str.replace(TQRegExp("\\$APPNAME\\$"),appname);
+ str.replace(TQRegExp("\\$APPNAME\\$"),appname);
+ str.replace(TQRegExp("\\$APPNAMEUC\\$"),appname.upper());
+ str.replace(TQRegExp("\\$APPNAMELC\\$"),appname.lower());
return str;
}
-bool FileTemplate::copy(KDevPlugin *part, const QString &name,
- const QString &dest, Policy p)
+bool FileTemplate::copy(KDevPlugin *part, const TQString &name,
+ const TQString &dest, Policy p)
{
- QString text = read(part, name, p);
+ TQString text = read(part, name, p);
- QFile f(dest);
+ TQFile f(dest);
if (!f.open(IO_WriteOnly))
return false;
- QFileInfo fi(f);
- QString module = fi.baseName();
- QString basefilename = fi.baseName(true);
- text.replace(QRegExp("\\$MODULE\\$"),module);
- text.replace(QRegExp("\\$FILENAME\\$"),basefilename);
+ TQFileInfo fi(f);
+ TQString module = fi.baseName();
+ TQString basefilename = fi.baseName(true);
+ text.replace(TQRegExp("\\$MODULE\\$"),module);
+ text.replace(TQRegExp("\\$FILENAME\\$"),basefilename);
- QTextStream stream(&f);
+ TQTextStream stream(&f);
stream << text;
f.close();
return true;
}
-QString FileTemplate::fullPathForName(KDevPlugin *part, const QString &name,
+TQString FileTemplate::fullPathForName(KDevPlugin *part, const TQString &name,
Policy p) {
// if Policy is not default, full path is just the name
if (p!=Default) return name;
- QString fileName;
+ TQString fileName;
// first try project-specific
if (part->project())
{
fileName = (part->project()->projectDirectory() + "/templates/" + name);
- if (QFile::exists(fileName)) return fileName;
+ if (TQFile::exists(fileName)) return fileName;
}
// next try global
- QString globalName = ::locate("data", "kdevfilecreate/file-templates/" + name);
+ TQString globalName = ::locate("data", "kdevfilecreate/file-templates/" + name);
return globalName.isNull() ? fileName : globalName;
}