summaryrefslogtreecommitdiffstats
path: root/kpilot/conduits/docconduit/DOC-converter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kpilot/conduits/docconduit/DOC-converter.cc')
-rw-r--r--kpilot/conduits/docconduit/DOC-converter.cc88
1 files changed, 44 insertions, 44 deletions
diff --git a/kpilot/conduits/docconduit/DOC-converter.cc b/kpilot/conduits/docconduit/DOC-converter.cc
index c8d7ac02d..6502fe54e 100644
--- a/kpilot/conduits/docconduit/DOC-converter.cc
+++ b/kpilot/conduits/docconduit/DOC-converter.cc
@@ -30,10 +30,10 @@
#include "options.h"
#include "DOC-converter.moc"
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qsortedlist.h>
+#include <tqdir.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
+#include <tqsortedlist.h>
#include <pilotDatabase.h>
#include <pilotLocalDatabase.h>
@@ -50,7 +50,7 @@
/****************************************************************************************************
- * various bookmark classes. Most important is the bmkList findMatches(QString) function,
+ * various bookmark classes. Most important is the bmkList findMatches(TQString) function,
* which needs to return a list of all bookmarks found for the given bookmark expression.
* A bookmark usually consists of a bookmark text and an offset into the text document.
****************************************************************************************************/
@@ -70,7 +70,7 @@ bool operator== ( const docBookmark &s1, const docBookmark &s2)
}
-int docMatchBookmark::findMatches(QString doctext, bmkList &fBookmarks) {
+int docMatchBookmark::findMatches(TQString doctext, bmkList &fBookmarks) {
FUNCTIONSETUP;
// bmkList res;
int pos = 0, nr=0, found=0;
@@ -99,11 +99,11 @@ int docMatchBookmark::findMatches(QString doctext, bmkList &fBookmarks) {
-int docRegExpBookmark::findMatches(QString doctext, bmkList &fBookmarks)
+int docRegExpBookmark::findMatches(TQString doctext, bmkList &fBookmarks)
{
FUNCTIONSETUP;
// bmkList res;
- QRegExp rx(pattern);
+ TQRegExp rx(pattern);
int pos = 0, nr=0, found=0;
while (pos>=0 && found<=to) {
@@ -118,7 +118,7 @@ int docRegExpBookmark::findMatches(QString doctext, bmkList &fBookmarks)
fBookmarks.append(new docBookmark(/*bmkName.left(16)*/rx.cap(capSubexpression), pos));
} else {
// TODO: use the subexpressions from the regexp for the bmk name ($1..$9) (given as separate regexp)
- QString bmkText(bmkName);
+ TQString bmkText(bmkName);
for (int i=0; i<=rx.numCaptures(); ++i) {
bmkText.replace(CSL1("$%1").arg(i), rx.cap(i));
bmkText.replace(CSL1("\\%1").arg(i), rx.cap(i));
@@ -145,7 +145,7 @@ int docRegExpBookmark::findMatches(QString doctext, bmkList &fBookmarks)
*********************************************************************/
-DOCConverter::DOCConverter(QObject *parent, const char *name):QObject(parent,name) {
+DOCConverter::DOCConverter(TQObject *parent, const char *name):TQObject(parent,name) {
FUNCTIONSETUP;
docdb=0L;
eSortBookmarks=eSortNone;
@@ -168,16 +168,16 @@ DOCConverter::~DOCConverter() {
-void DOCConverter::setTXTpath(QString path, QString file) {
- QDir dr(path);
- QFileInfo pth(dr, file);
+void DOCConverter::setTXTpath(TQString path, TQString file) {
+ TQDir dr(path);
+ TQFileInfo pth(dr, file);
if (!file.isEmpty())
txtfilename = pth.absFilePath();
}
-void DOCConverter::setTXTpath(QString filename) {
+void DOCConverter::setTXTpath(TQString filename) {
if (!filename.isEmpty()) txtfilename = filename;
}
@@ -189,26 +189,26 @@ void DOCConverter::setPDB(PilotDatabase * dbi) {
-QString DOCConverter::readText() {
+TQString DOCConverter::readText() {
FUNCTIONSETUP;
- if (txtfilename.isEmpty()) return QString();
- QFile docfile(txtfilename);
+ if (txtfilename.isEmpty()) return TQString();
+ TQFile docfile(txtfilename);
if (!docfile.open(IO_ReadOnly))
{
emit logError(i18n("Unable to open text file %1 for reading.").arg(txtfilename));
- return QString();
+ return TQString();
}
- QTextStream docstream(&docfile);
+ TQTextStream docstream(&docfile);
- QString doc = docstream.read();
+ TQString doc = docstream.read();
docfile.close();
return doc;
}
-int DOCConverter::findBmkEndtags(QString &text, bmkList&fBmks) {
+int DOCConverter::findBmkEndtags(TQString &text, bmkList&fBmks) {
FUNCTIONSETUP;
// Start from the end of the text
int pos = text.length() - 1, nr=0;
@@ -256,11 +256,11 @@ int DOCConverter::findBmkEndtags(QString &text, bmkList&fBmks) {
return nr;
}
-int DOCConverter::findBmkInline(QString &text, bmkList &fBmks) {
+int DOCConverter::findBmkInline(TQString &text, bmkList &fBmks) {
FUNCTIONSETUP;
// bmkList res;
int nr=0;
- QRegExp rx(CSL1("<\\*(.*)\\*>"));
+ TQRegExp rx(CSL1("<\\*(.*)\\*>"));
rx.setMinimal(TRUE);
int pos = 0;
@@ -275,17 +275,17 @@ int DOCConverter::findBmkInline(QString &text, bmkList &fBmks) {
return nr;
}
-int DOCConverter::findBmkFile(QString &, bmkList &fBmks) {
+int DOCConverter::findBmkFile(TQString &, bmkList &fBmks) {
FUNCTIONSETUP;
int nr=0;
- QString bmkfilename = txtfilename;
+ TQString bmkfilename = txtfilename;
if (bmkfilename.endsWith(CSL1(".txt"))){
bmkfilename.remove(bmkfilename.length()-4, 4);
}
- QString oldbmkfilename=bmkfilename;
+ TQString oldbmkfilename=bmkfilename;
bmkfilename+=CSL1(BMK_SUFFIX);
- QFile bmkfile(bmkfilename);
+ TQFile bmkfile(bmkfilename);
if (!bmkfile.open(IO_ReadOnly)) {
bmkfilename=oldbmkfilename+CSL1(PDBBMK_SUFFIX);
bmkfile.setName(bmkfilename);
@@ -297,11 +297,11 @@ int DOCConverter::findBmkFile(QString &, bmkList &fBmks) {
DEBUGKPILOT<<"Bookmark file: "<<bmkfilename<<endl;
- QTextStream bmkstream(&bmkfile);
- QString line;
+ TQTextStream bmkstream(&bmkfile);
+ TQString line;
while ( !(line=bmkstream.readLine()).isEmpty() ) {
if (!line.isEmpty() && !line.startsWith(CSL1("#")) ) {
- QStringList bmkinfo=QStringList::split(CSL1(","), line);
+ TQStringList bmkinfo=TQStringList::split(CSL1(","), line);
int fieldnr=bmkinfo.count();
// We use the same syntax for the entries as MakeDocJ bookmark files:
// <bookmark>,<string-to-search>,<bookmark-name-string>,<starting-bookmark>,<ending-bookmark>
@@ -309,19 +309,19 @@ int DOCConverter::findBmkFile(QString &, bmkList &fBmks) {
if (fieldnr>0){
DEBUGKPILOT<<"Working on bookmark \""<<line<<"\""<<endl;
docMatchBookmark*bmk=0L;
- QString bookmark=bmkinfo[0];
+ TQString bookmark=bmkinfo[0];
bool ok;
int pos=bookmark.toInt(&ok);
if (ok) {
if (fieldnr>1) {
- QString name(bmkinfo[1]);
+ TQString name(bmkinfo[1]);
DEBUGKPILOT<<"Bookmark \""<<name<<"\" set at position "<<pos<<endl;
fBmks.append(new docBookmark(name, pos));
}
} else if (bookmark==CSL1("-") || bookmark==CSL1("+")) {
if (fieldnr>1) {
- QString patt(bmkinfo[1]);
- QString name(patt);
+ TQString patt(bmkinfo[1]);
+ TQString name(patt);
if (fieldnr>2) {
int cap=bmkinfo[2].toInt(&ok);
if (ok) {
@@ -359,7 +359,7 @@ int DOCConverter::findBmkFile(QString &, bmkList &fBmks) {
DEBUGKPILOT<<"RegExp bookmark found with no other information (no bookmark pattern nor name)"<<endl;
}
} else {
- QString pattern(bookmark);
+ TQString pattern(bookmark);
if (fieldnr>1) pattern=bmkinfo[1];
if (fieldnr>2) bookmark=bmkinfo[2];
DEBUGKPILOT<<"RegExp Bookmark, pattern="<<pattern<<", name="<<bookmark<<endl;
@@ -384,7 +384,7 @@ bool DOCConverter::convertTXTtoPDB() {
return false;
}
- QString text = readText();
+ TQString text = readText();
if (fBmkTypes & eBmkEndtags) {
findBmkEndtags(text, fBookmarks);
@@ -537,14 +537,14 @@ bool DOCConverter::convertPDBtoTXT()
<<" version="<<header.version<<endl;
// next come the header.numRecords real document records (might be compressed, see the version flag in the header)
- QFile docfile(txtfilename);
+ TQFile docfile(txtfilename);
if (!docfile.open(IO_WriteOnly))
{
emit logError(i18n("Unable to open output file %1.").arg(txtfilename));
KPILOT_DELETE(docdb);
return false;
}
- QString doctext;
+ TQString doctext;
for (int i=1; i<header.numRecords+1; ++i)
{
PilotRecord*rec=docdb->readRecordByIndex(i);
@@ -570,7 +570,7 @@ bool DOCConverter::convertPDBtoTXT()
if (rec)
{
PilotDOCBookmark bookie(rec);
- docBookmark*bmk=new docBookmark(QString::fromLatin1(bookie.bookmarkName), bookie.pos);
+ docBookmark*bmk=new docBookmark(TQString::fromLatin1(bookie.bookmarkName), bookie.pos);
bmks.append(bmk);
KPILOT_DELETE(rec);
} else {
@@ -583,12 +583,12 @@ bool DOCConverter::convertPDBtoTXT()
if ((fBmkTypes & eBmkFile) && (bmks.count()>0))
{
- QString bmkfilename = docfile.name();
+ TQString bmkfilename = docfile.name();
if (bmkfilename.endsWith(CSL1(".txt"))){
bmkfilename.remove(bmkfilename.length()-4, 4);
}
bmkfilename+=CSL1(PDBBMK_SUFFIX);
- QFile bmkfile(bmkfilename);
+ TQFile bmkfile(bmkfilename);
if (!bmkfile.open(IO_WriteOnly))
{
emit logError(i18n("Unable to open file %1 for the bookmarks of %2.")
@@ -598,7 +598,7 @@ bool DOCConverter::convertPDBtoTXT()
{
DEBUGKPILOT<<"Writing "<<upperBmkRec-header.numRecords<<
"("<<upperBmkRec<<") bookmarks to file "<<bmkfilename<<endl;
- QTextStream bmkstream(&bmkfile);
+ TQTextStream bmkstream(&bmkfile);
for (docBookmark*bmk=bmks.first(); bmk; bmk=bmks.next())
{
bmkstream<<bmk->position<<", "<<bmk->bmkName<<endl;
@@ -611,14 +611,14 @@ bool DOCConverter::convertPDBtoTXT()
{
for (docBookmark*bmk=bmks.last(); bmk; bmk=bmks.prev())
{
- doctext.insert(bmk->position, QString(CSL1("<*") +
+ doctext.insert(bmk->position, TQString(CSL1("<*") +
bmk->bmkName +
CSL1("*>")));
}
}
// Finally, write the actual text out to the file.
- QTextStream docstream(&docfile);
+ TQTextStream docstream(&docfile);
docstream<<doctext;
//docstream.close();
docfile.close();