summaryrefslogtreecommitdiffstats
path: root/parts/documentation/protocols/chm/chm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parts/documentation/protocols/chm/chm.cpp')
-rw-r--r--parts/documentation/protocols/chm/chm.cpp88
1 files changed, 44 insertions, 44 deletions
diff --git a/parts/documentation/protocols/chm/chm.cpp b/parts/documentation/protocols/chm/chm.cpp
index 4f9ecf73..1d7543c3 100644
--- a/parts/documentation/protocols/chm/chm.cpp
+++ b/parts/documentation/protocols/chm/chm.cpp
@@ -14,10 +14,10 @@
Boston, MA 02110-1301, USA.
*/
-#include <qcstring.h>
-#include <qbitarray.h>
-#include <qfile.h>
-#include <qregexp.h>
+#include <tqcstring.h>
+#include <tqbitarray.h>
+#include <tqfile.h>
+#include <tqregexp.h>
#include <stack>
#include <stdlib.h>
@@ -58,7 +58,7 @@ extern "C"
}
}
-ChmProtocol::ChmProtocol(const QCString &pool_socket, const QCString &app_socket)
+ChmProtocol::ChmProtocol(const TQCString &pool_socket, const TQCString &app_socket)
: SlaveBase("kio_chm", pool_socket, app_socket)
{
kdDebug() << "ChmProtocol::ChmProtocol()" << endl;
@@ -84,21 +84,21 @@ void ChmProtocol::get( const KURL& url )
bool catalog = false;
bool contents = false;
- QString bigpath = url.path();
+ TQString bigpath = url.path();
if(bigpath.endsWith(":catalog")) {
catalog = true;
- int len = QString(":catalog").length();
+ int len = TQString(":catalog").length();
bigpath.remove(bigpath.length() - len, len); ///strip :catalog from the end
}
if(bigpath.endsWith(":contents")) {
contents = true;
- int len = QString(":contents").length();
+ int len = TQString(":contents").length();
bigpath.remove(bigpath.length() - len, len); ///strip :catalog from the end
}
- QString path;
+ TQString path;
if ( !checkNewFile( bigpath, path ) ) {
error( KIO::ERR_DOES_NOT_EXIST, url.prettyURL() );
return;
@@ -110,23 +110,23 @@ void ChmProtocol::get( const KURL& url )
return;
}
- QByteArray theData;
+ TQByteArray theData;
//init..
//added by lucida lucida@users.sf.net
- QString fname = QString();
- QString chmpath = QString();
+ TQString fname = TQString();
+ TQString chmpath = TQString();
KTempFile f("",".html");
fname = f.name();
- QTextStream *t = f.textStream();
- QString firstPage = QString("");
- QString m_strIndex = QString("");
- QString tmpstr = QString("");
+ TQTextStream *t = f.textStream();
+ TQString firstPage = TQString("");
+ TQString m_strIndex = TQString("");
+ TQString tmpstr = TQString("");
bool m_bIndex = 0;
if(contents) {
- QString output;
+ TQString output;
KURL u = url;
ChmDirectoryMap::Iterator it;
@@ -163,19 +163,19 @@ void ChmProtocol::get( const KURL& url )
int offset = m_dirMap["/@contents"].offset;
int length = m_dirMap["/@contents"].length;
theData.setRawData(&m_contents[offset], length);
- QString s(theData);
- QString output;
+ TQString s(theData);
+ TQString output;
- QRegExp object("<OBJECT type=\"text/sitemap\">(.*)</OBJECT>", false);
+ TQRegExp object("<OBJECT type=\"text/sitemap\">(.*)</OBJECT>", false);
object.setMinimal(true);
- QRegExp nameParam("<param name=\"Name\" value=\"(.*)\">", false);
+ TQRegExp nameParam("<param name=\"Name\" value=\"(.*)\">", false);
nameParam.setMinimal(true);
- QRegExp localParam("<param name=\"Local\" value=\"(.*)\">", false);
+ TQRegExp localParam("<param name=\"Local\" value=\"(.*)\">", false);
localParam.setMinimal(true);
- QRegExp mergeParam("<param name=\"Merge\" value=\"(.*)\">", false);
+ TQRegExp mergeParam("<param name=\"Merge\" value=\"(.*)\">", false);
mergeParam.setMinimal(true);
std::stack<int> parents;
@@ -186,8 +186,8 @@ void ChmProtocol::get( const KURL& url )
while ((pos = s.find(object, pos)) != -1) {
if(htmlOutput) output += s.mid(old, pos - old);
if(catalog) {
- QRegExp ex("<UL>|</UL>", false); ex.setMinimal(true);
- QString ms = s.mid(old, pos - old);
+ TQRegExp ex("<UL>|</UL>", false); ex.setMinimal(true);
+ TQString ms = s.mid(old, pos - old);
int pos = 0;
while( (pos = ms.find(ex, pos)) != -1) {
if(ms.mid(pos, 4) == "<UL>") {
@@ -204,8 +204,8 @@ void ChmProtocol::get( const KURL& url )
}
pos += object.matchedLength();
old = pos;
- QString obj = object.cap(1);
- QString name, local;
+ TQString obj = object.cap(1);
+ TQString name, local;
if (obj.find(nameParam) != -1) {
name = nameParam.cap(1);
if (obj.find(localParam) != -1) {
@@ -220,12 +220,12 @@ void ChmProtocol::get( const KURL& url )
++counter;
KURL u = url;
u.setPath(bigpath + local);
- QString str;
+ TQString str;
output += str.sprintf("%i\n%i\n", parents.top(), current);
output += name + "\n" + u.prettyURL() + "\n";
}
m_bIndex = 1;
- if (firstPage == "") firstPage = url.url()+QString::fromLocal8Bit(local.latin1());
+ if (firstPage == "") firstPage = url.url()+TQString::fromLocal8Bit(local.latin1());
}
else
if(htmlOutput) output += name;
@@ -234,43 +234,43 @@ void ChmProtocol::get( const KURL& url )
}
}
if (obj.find(mergeParam) != -1 && htmlOutput) {
- QString link = mergeParam.cap(1);
- QString href = link.left(link.find("::"));
- QString path = m_chmFile.left(m_chmFile.findRev("/") + 1);
+ TQString link = mergeParam.cap(1);
+ TQString href = link.left(link.find("::"));
+ TQString path = m_chmFile.left(m_chmFile.findRev("/") + 1);
//output += " (<a href=\"" + path + href + "\">link</a>)";
m_bIndex = 1;
output += " (<a target=\"browse\" href=\"" + url.url() + path + href + "\">link</a>)";
- if (firstPage == "") firstPage = url.url()+QString::fromLocal8Bit(local.latin1());
+ if (firstPage == "") firstPage = url.url()+TQString::fromLocal8Bit(local.latin1());
}
}
if(htmlOutput) output += s.mid(old);
//set left pane
//added by lucida, lucida@users.sf.net
- QString lframe = QString("</HEAD><FRAMESET COLS=\"25%,*\">\n");
+ TQString lframe = TQString("</HEAD><FRAMESET COLS=\"25%,*\">\n");
lframe += "<FRAME NAME=\"index\" src=\"file:"+ fname+"\"" + " marginwidth=\"0\"></FRAME>\n";
if (!m_bIndex) {
lframe = "</HEAD><FRAMESET>";
- firstPage = url.url() + QString::fromLocal8Bit(m_strIndex.latin1());
+ firstPage = url.url() + TQString::fromLocal8Bit(m_strIndex.latin1());
}
theData.resetRawData(&m_contents[offset], length);
//KMimeMagicResult * result = KMimeMagic::self()->findBufferFileType( output, path );
//kdDebug() << "Emitting mimetype " << result->mimeType() << endl;
//mimeType( result->mimeType() );
-/* QCString output1 = (QCString)(output.latin1());
+/* TQCString output1 = (TQCString)(output.latin1());
data(output1);
processedSize(output1.length());*/
//construct the frame
//added by lucida lucida@users.sf.net
- QString framestr = QString("<HTML><HEAD>\n");
+ TQString framestr = TQString("<HTML><HEAD>\n");
framestr += lframe;
framestr += "<FRAME NAME=\"browse\" src=\"" + firstPage + "\">\n";
framestr += "</FRAME>\n";
framestr += "</FRAMESET></HTML>";
//write index file
//added by lucida lucida@users.sf.net
- *t << QString::fromLocal8Bit(output.latin1()) << endl;
+ *t << TQString::fromLocal8Bit(output.latin1()) << endl;
if(catalog) {
data(output.local8Bit());
@@ -297,11 +297,11 @@ void ChmProtocol::get( const KURL& url )
}
/* --------------------------------------------------------------------------- */
-bool ChmProtocol::checkNewFile( QString fullPath, QString& path )
+bool ChmProtocol::checkNewFile( TQString fullPath, TQString& path )
{
//kdDebug() << "ChmProtocol::checkNewFile " << fullPath << endl;
- fullPath = fullPath.replace(QRegExp("::"), "");
+ fullPath = fullPath.replace(TQRegExp("::"), "");
// Are we already looking at that file ?
if ( !m_chmFile.isEmpty() && fullPath.startsWith(m_chmFile) )
@@ -316,7 +316,7 @@ bool ChmProtocol::checkNewFile( QString fullPath, QString& path )
// Find where the chm file is in the full path
int pos = 0;
- QString chmFile;
+ TQString chmFile;
path = "";
int len = fullPath.length();
@@ -326,10 +326,10 @@ bool ChmProtocol::checkNewFile( QString fullPath, QString& path )
//kdDebug() << "the full path is " << fullPath << endl;
while ( (pos=fullPath.find( '/', pos+1 )) != -1 )
{
- QString tryPath = fullPath.left( pos );
+ TQString tryPath = fullPath.left( pos );
//kdDebug() << fullPath << " trying " << tryPath << endl;
struct stat statbuf;
- if ( ::stat( QFile::encodeName(tryPath), &statbuf ) == 0 && !S_ISDIR(statbuf.st_mode) )
+ if ( ::stat( TQFile::encodeName(tryPath), &statbuf ) == 0 && !S_ISDIR(statbuf.st_mode) )
{
chmFile = tryPath;
path = fullPath.mid( pos ).lower();
@@ -342,7 +342,7 @@ bool ChmProtocol::checkNewFile( QString fullPath, QString& path )
}
else
{
- path = QString::fromLatin1("/");
+ path = TQString::fromLatin1("/");
}
kdDebug() << "Found. chmFile=" << chmFile << " path=" << path << endl;
break;