diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /parts/documentation/protocols | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-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 'parts/documentation/protocols')
-rw-r--r-- | parts/documentation/protocols/chm/chm.cpp | 88 | ||||
-rw-r--r-- | parts/documentation/protocols/chm/chm.h | 12 | ||||
-rw-r--r-- | parts/documentation/protocols/chm/chmfile.cpp | 20 | ||||
-rw-r--r-- | parts/documentation/protocols/chm/chmfile.h | 18 | ||||
-rw-r--r-- | parts/documentation/protocols/chm/kchmpart.cpp | 20 | ||||
-rw-r--r-- | parts/documentation/protocols/chm/kchmpart.h | 16 |
6 files changed, 87 insertions, 87 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; diff --git a/parts/documentation/protocols/chm/chm.h b/parts/documentation/protocols/chm/chm.h index ff4bb391..1a1e80ba 100644 --- a/parts/documentation/protocols/chm/chm.h +++ b/parts/documentation/protocols/chm/chm.h @@ -17,8 +17,8 @@ #ifndef __chm_h__ #define __chm_h__ -#include <qstring.h> -#include <qcstring.h> +#include <tqstring.h> +#include <tqcstring.h> #include <kurl.h> #include <kio/global.h> #include <kio/slavebase.h> @@ -29,16 +29,16 @@ class QCString; class ChmProtocol : public KIO::SlaveBase { public: - ChmProtocol( const QCString&, const QCString& ); + ChmProtocol( const TQCString&, const TQCString& ); ~ChmProtocol(); void get( const KURL& ); private: - bool checkNewFile( QString, QString& ); + bool checkNewFile( TQString, TQString& ); ChmDirectoryMap m_dirMap; - QByteArray m_contents; - QString m_chmFile; + TQByteArray m_contents; + TQString m_chmFile; Chm m_chm; }; diff --git a/parts/documentation/protocols/chm/chmfile.cpp b/parts/documentation/protocols/chm/chmfile.cpp index 6106d83d..43ae8877 100644 --- a/parts/documentation/protocols/chm/chmfile.cpp +++ b/parts/documentation/protocols/chm/chmfile.cpp @@ -14,11 +14,11 @@ Boston, MA 02110-1301, USA. */ -#include <qfile.h> +#include <tqfile.h> #include "chmfile.h" #include "decompress.h" -uint Chm::getEncInt(QFile& f, uint &value) const +uint Chm::getEncInt(TQFile& f, uint &value) const { int c; uint result = 0; @@ -36,32 +36,32 @@ uint Chm::getEncInt(QFile& f, uint &value) const return count; } -uint Chm::getName(QFile& f, QString& name) const +uint Chm::getName(TQFile& f, TQString& name) const { int len = f.getch(); char *buf = new char[len]; f.readBlock(buf, len); - name = QString::fromUtf8(buf, len); + name = TQString::fromUtf8(buf, len); if (name.startsWith("/")) name = name.lower(); delete [] buf; return len + 1; } -uint Chm::getIntel32(QFile& f) const +uint Chm::getIntel32(TQFile& f) const { uint value = f.getch() | f.getch() << 8 | f.getch() << 16 | f.getch() << 24; return value; } -uint Chm::getIntel64(QFile& f) const +uint Chm::getIntel64(TQFile& f) const { uint value = getIntel32(f); f.at(f.at() + 4); return value; } -bool Chm::getChunk(QFile& f, uint chunkSize, ChmDirectoryMap& directoryMap) const +bool Chm::getChunk(TQFile& f, uint chunkSize, ChmDirectoryMap& directoryMap) const { char tag[4]; if (f.readBlock(tag, 4) != 4) return false; @@ -75,7 +75,7 @@ bool Chm::getChunk(QFile& f, uint chunkSize, ChmDirectoryMap& directoryMap) cons while (pos < chunkSize - quickref_length) { uint section, offset, length; - QString name; + TQString name; pos += getName(f, name); pos += getEncInt(f, section); pos += getEncInt(f, offset); @@ -98,9 +98,9 @@ bool Chm::getChunk(QFile& f, uint chunkSize, ChmDirectoryMap& directoryMap) cons } } -bool Chm::read(const QString& fileSpec, ChmDirectoryMap& dirMap, QByteArray& contents) const +bool Chm::read(const TQString& fileSpec, ChmDirectoryMap& dirMap, TQByteArray& contents) const { - QFile f(fileSpec); + TQFile f(fileSpec); if (!f.open(IO_ReadOnly)) return false; // read CHM file header diff --git a/parts/documentation/protocols/chm/chmfile.h b/parts/documentation/protocols/chm/chmfile.h index af89f55a..20e0ea67 100644 --- a/parts/documentation/protocols/chm/chmfile.h +++ b/parts/documentation/protocols/chm/chmfile.h @@ -18,8 +18,8 @@ #define __chmfile_h__ #include <cstdio> -#include <qmap.h> -#include <qstring.h> +#include <tqmap.h> +#include <tqstring.h> class QFile; @@ -34,19 +34,19 @@ struct ChmDirTableEntry uint length; }; -typedef QMap<QString, ChmDirTableEntry> ChmDirectoryMap; +typedef TQMap<TQString, ChmDirTableEntry> ChmDirectoryMap; class Chm { public: - bool read( const QString&, ChmDirectoryMap&, QByteArray& ) const; + bool read( const TQString&, ChmDirectoryMap&, TQByteArray& ) const; private: - bool getChunk( QFile&, uint, ChmDirectoryMap& ) const; - uint getEncInt( QFile&, uint& ) const; - uint getName( QFile&, QString& ) const; - uint getIntel32( QFile& ) const; - uint getIntel64( QFile& ) const; + bool getChunk( TQFile&, uint, ChmDirectoryMap& ) const; + uint getEncInt( TQFile&, uint& ) const; + uint getName( TQFile&, TQString& ) const; + uint getIntel32( TQFile& ) const; + uint getIntel64( TQFile& ) const; }; #endif // __chmfile_h__ diff --git a/parts/documentation/protocols/chm/kchmpart.cpp b/parts/documentation/protocols/chm/kchmpart.cpp index ff6dc9ba..b1d9d166 100644 --- a/parts/documentation/protocols/chm/kchmpart.cpp +++ b/parts/documentation/protocols/chm/kchmpart.cpp @@ -15,7 +15,7 @@ */ #include "kchmpart.h" -#include <qstring.h> +#include <tqstring.h> #include <kinstance.h> #include <kglobal.h> @@ -35,7 +35,7 @@ extern "C" KInstance* KChmPartFactory::s_instance = 0L; KAboutData* KChmPartFactory::s_about = 0L; -KChmPartFactory::KChmPartFactory( QObject* parent, const char* name ) +KChmPartFactory::KChmPartFactory( TQObject* parent, const char* name ) : KParts::Factory( parent, name ) { } @@ -47,8 +47,8 @@ KChmPartFactory::~KChmPartFactory() delete s_about; } -KParts::Part* KChmPartFactory::createPartObject( QWidget *parentWidget, const char *, QObject *, - const char *name, const char *, const QStringList & ) +KParts::Part* KChmPartFactory::createPartObject( TQWidget *parentWidget, const char *, TQObject *, + const char *name, const char *, const TQStringList & ) { KChmPart* part = new KChmPart( parentWidget, name ); return part; @@ -66,7 +66,7 @@ KInstance* KChmPartFactory::instance() } -KChmPart::KChmPart( QWidget * parent, const char * name ) +KChmPart::KChmPart( TQWidget * parent, const char * name ) : KDevHTMLPart( ), m_job(0) { KInstance * instance = new KInstance( "kchmpart" ); @@ -100,13 +100,13 @@ bool KChmPart::openFile() m_htmlData.truncate(0); - m_job = KIO::get( QString("chm:")+m_file+"/", true, false ); - connect( m_job, SIGNAL( data( KIO::Job *, const QByteArray &) ), SLOT( readData( KIO::Job *, const QByteArray &) ) ); - connect( m_job, SIGNAL( result( KIO::Job * ) ), SLOT( jobDone( KIO::Job * ) ) ); + m_job = KIO::get( TQString("chm:")+m_file+"/", true, false ); + connect( m_job, TQT_SIGNAL( data( KIO::Job *, const TQByteArray &) ), TQT_SLOT( readData( KIO::Job *, const TQByteArray &) ) ); + connect( m_job, TQT_SIGNAL( result( KIO::Job * ) ), TQT_SLOT( jobDone( KIO::Job * ) ) ); return true; } -void KChmPart::readData(KIO::Job * , const QByteArray & data) +void KChmPart::readData(KIO::Job * , const TQByteArray & data) { m_htmlData += data; } @@ -115,7 +115,7 @@ void KChmPart::jobDone( KIO::Job *) { m_job=0; begin(); - write(QString::fromLocal8Bit(m_htmlData)); + write(TQString::fromLocal8Bit(m_htmlData)); end(); } */ diff --git a/parts/documentation/protocols/chm/kchmpart.h b/parts/documentation/protocols/chm/kchmpart.h index 28041bc3..023f8ed9 100644 --- a/parts/documentation/protocols/chm/kchmpart.h +++ b/parts/documentation/protocols/chm/kchmpart.h @@ -25,7 +25,7 @@ #include <kio/jobclasses.h> #include <kdevhtmlpart.h> -#include <qcstring.h> +#include <tqcstring.h> class KInstance; class KAboutData; @@ -34,13 +34,13 @@ class KChmPartFactory: public KParts::Factory { Q_OBJECT public: - KChmPartFactory( QObject *parent = 0, const char *name = 0 ); + KChmPartFactory( TQObject *parent = 0, const char *name = 0 ); virtual ~KChmPartFactory(); virtual KParts::Part* createPartObject( - QWidget *parentWidget, const char *widgetName, - QObject *parent, const char *name, - const char *classname, const QStringList &args ); + TQWidget *parentWidget, const char *widgetName, + TQObject *parent, const char *name, + const char *classname, const TQStringList &args ); static KInstance *instance(); @@ -55,14 +55,14 @@ class KChmPart : public KDevHTMLPart { Q_OBJECT public: - KChmPart( QWidget *, const char * = 0 ); + KChmPart( TQWidget *, const char * = 0 ); KParts::BrowserExtension * extension() { return m_extension; } public slots: virtual bool openURL( const KURL & ); /* protected slots: - void readData(KIO::Job * , const QByteArray & data); + void readData(KIO::Job * , const TQByteArray & data); void jobDone( KIO::Job *); */ protected: @@ -70,7 +70,7 @@ class KChmPart : public KDevHTMLPart KInstance *m_instance; KParts::BrowserExtension *m_extension; KIO::TransferJob *m_job; - QCString m_htmlData; + TQCString m_htmlData; protected slots: virtual void slotDuplicate(); |