summaryrefslogtreecommitdiffstats
path: root/khelpcenter/toc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'khelpcenter/toc.cpp')
-rw-r--r--khelpcenter/toc.cpp108
1 files changed, 54 insertions, 54 deletions
diff --git a/khelpcenter/toc.cpp b/khelpcenter/toc.cpp
index 6b2beadc9..7bda95b8c 100644
--- a/khelpcenter/toc.cpp
+++ b/khelpcenter/toc.cpp
@@ -27,8 +27,8 @@
#include <kstandarddirs.h>
#include <kdebug.h>
-#include <qdir.h>
-#include <qfileinfo.h>
+#include <tqdir.h>
+#include <tqfileinfo.h>
#include <sys/stat.h>
@@ -37,7 +37,7 @@ using namespace KHC;
class TOCItem : public NavigatorItem
{
public:
- TOCItem( TOC *parent, QListViewItem *parentItem, QListViewItem *after, const QString &text );
+ TOCItem( TOC *parent, TQListViewItem *parentItem, TQListViewItem *after, const TQString &text );
const TOC *toc() const { return m_toc; }
@@ -48,25 +48,25 @@ class TOCItem : public NavigatorItem
class TOCChapterItem : public TOCItem
{
public:
- TOCChapterItem( TOC *toc, NavigatorItem *parent, QListViewItem *after, const QString &title,
- const QString &name );
+ TOCChapterItem( TOC *toc, NavigatorItem *parent, TQListViewItem *after, const TQString &title,
+ const TQString &name );
- virtual QString url();
+ virtual TQString url();
private:
- QString m_name;
+ TQString m_name;
};
class TOCSectionItem : public TOCItem
{
public:
- TOCSectionItem( TOC *toc, TOCChapterItem *parent, QListViewItem *after, const QString &title,
- const QString &name );
+ TOCSectionItem( TOC *toc, TOCChapterItem *parent, TQListViewItem *after, const TQString &title,
+ const TQString &name );
- virtual QString url();
+ virtual TQString url();
private:
- QString m_name;
+ TQString m_name;
};
TOC::TOC( NavigatorItem *parentItem )
@@ -74,13 +74,13 @@ TOC::TOC( NavigatorItem *parentItem )
m_parentItem = parentItem;
}
-void TOC::build( const QString &file )
+void TOC::build( const TQString &file )
{
- QFileInfo fileInfo( file );
- QString fileName = fileInfo.absFilePath();
- const QStringList resourceDirs = KGlobal::dirs()->resourceDirs( "html" );
- QStringList::ConstIterator it = resourceDirs.begin();
- QStringList::ConstIterator end = resourceDirs.end();
+ TQFileInfo fileInfo( file );
+ TQString fileName = fileInfo.absFilePath();
+ const TQStringList resourceDirs = KGlobal::dirs()->resourceDirs( "html" );
+ TQStringList::ConstIterator it = resourceDirs.begin();
+ TQStringList::ConstIterator end = resourceDirs.end();
for ( ; it != end; ++it ) {
if ( fileName.startsWith( *it ) ) {
fileName.remove( 0, ( *it ).length() );
@@ -88,7 +88,7 @@ void TOC::build( const QString &file )
}
}
- QString cacheFile = fileName.replace( QDir::separator(), "__" );
+ TQString cacheFile = fileName.replace( TQDir::separator(), "__" );
m_cacheFile = locateLocal( "cache", "help/" + cacheFile );
m_sourceFile = file;
@@ -100,7 +100,7 @@ void TOC::build( const QString &file )
TOC::CacheStatus TOC::cacheStatus() const
{
- if ( !QFile::exists( m_cacheFile ) ||
+ if ( !TQFile::exists( m_cacheFile ) ||
sourceFileCTime() != cachedCTime() )
return NeedRebuild;
@@ -110,22 +110,22 @@ TOC::CacheStatus TOC::cacheStatus() const
int TOC::sourceFileCTime() const
{
struct stat stat_buf;
- stat( QFile::encodeName( m_sourceFile ).data(), &stat_buf );
+ stat( TQFile::encodeName( m_sourceFile ).data(), &stat_buf );
return stat_buf.st_ctime;
}
int TOC::cachedCTime() const
{
- QFile f( m_cacheFile );
+ TQFile f( m_cacheFile );
if ( !f.open( IO_ReadOnly ) )
return 0;
- QDomDocument doc;
+ TQDomDocument doc;
if ( !doc.setContent( &f ) )
return 0;
- QDomComment timestamp = doc.documentElement().lastChild().toComment();
+ TQDomComment timestamp = doc.documentElement().lastChild().toComment();
return timestamp.data().stripWhiteSpace().toInt();
}
@@ -133,8 +133,8 @@ int TOC::cachedCTime() const
void TOC::buildCache()
{
KProcess *meinproc = new KProcess;
- connect( meinproc, SIGNAL( processExited( KProcess * ) ),
- this, SLOT( meinprocExited( KProcess * ) ) );
+ connect( meinproc, TQT_SIGNAL( processExited( KProcess * ) ),
+ this, TQT_SLOT( meinprocExited( KProcess * ) ) );
*meinproc << locate( "exe", "meinproc" );
*meinproc << "--stylesheet" << locate( "data", "khelpcenter/table-of-contents.xslt" );
@@ -153,20 +153,20 @@ void TOC::meinprocExited( KProcess *meinproc )
delete meinproc;
- QFile f( m_cacheFile );
+ TQFile f( m_cacheFile );
if ( !f.open( IO_ReadWrite ) )
return;
- QDomDocument doc;
+ TQDomDocument doc;
if ( !doc.setContent( &f ) )
return;
- QDomComment timestamp = doc.createComment( QString::number( sourceFileCTime() ) );
+ TQDomComment timestamp = doc.createComment( TQString::number( sourceFileCTime() ) );
doc.documentElement().appendChild( timestamp );
f.at( 0 );
- QTextStream stream( &f );
- stream.setEncoding( QTextStream::UnicodeUTF8 );
+ TQTextStream stream( &f );
+ stream.setEncoding( TQTextStream::UnicodeUTF8 );
stream << doc.toString();
f.close();
@@ -176,33 +176,33 @@ void TOC::meinprocExited( KProcess *meinproc )
void TOC::fillTree()
{
- QFile f( m_cacheFile );
+ TQFile f( m_cacheFile );
if ( !f.open( IO_ReadOnly ) )
return;
- QDomDocument doc;
+ TQDomDocument doc;
if ( !doc.setContent( &f ) )
return;
TOCChapterItem *chapItem = 0;
- QDomNodeList chapters = doc.documentElement().elementsByTagName( "chapter" );
+ TQDomNodeList chapters = doc.documentElement().elementsByTagName( "chapter" );
for ( unsigned int chapterCount = 0; chapterCount < chapters.count(); chapterCount++ ) {
- QDomElement chapElem = chapters.item( chapterCount ).toElement();
- QDomElement chapTitleElem = childElement( chapElem, QString::fromLatin1( "title" ) );
- QString chapTitle = chapTitleElem.text().simplifyWhiteSpace();
- QDomElement chapRefElem = childElement( chapElem, QString::fromLatin1( "anchor" ) );
- QString chapRef = chapRefElem.text().stripWhiteSpace();
+ TQDomElement chapElem = chapters.item( chapterCount ).toElement();
+ TQDomElement chapTitleElem = childElement( chapElem, TQString::fromLatin1( "title" ) );
+ TQString chapTitle = chapTitleElem.text().simplifyWhiteSpace();
+ TQDomElement chapRefElem = childElement( chapElem, TQString::fromLatin1( "anchor" ) );
+ TQString chapRef = chapRefElem.text().stripWhiteSpace();
chapItem = new TOCChapterItem( this, m_parentItem, chapItem, chapTitle, chapRef );
TOCSectionItem *sectItem = 0;
- QDomNodeList sections = chapElem.elementsByTagName( "section" );
+ TQDomNodeList sections = chapElem.elementsByTagName( "section" );
for ( unsigned int sectCount = 0; sectCount < sections.count(); sectCount++ ) {
- QDomElement sectElem = sections.item( sectCount ).toElement();
- QDomElement sectTitleElem = childElement( sectElem, QString::fromLatin1( "title" ) );
- QString sectTitle = sectTitleElem.text().simplifyWhiteSpace();
- QDomElement sectRefElem = childElement( sectElem, QString::fromLatin1( "anchor" ) );
- QString sectRef = sectRefElem.text().stripWhiteSpace();
+ TQDomElement sectElem = sections.item( sectCount ).toElement();
+ TQDomElement sectTitleElem = childElement( sectElem, TQString::fromLatin1( "title" ) );
+ TQString sectTitle = sectTitleElem.text().simplifyWhiteSpace();
+ TQDomElement sectRefElem = childElement( sectElem, TQString::fromLatin1( "anchor" ) );
+ TQString sectRef = sectRefElem.text().stripWhiteSpace();
sectItem = new TOCSectionItem( this, chapItem, sectItem, sectTitle, sectRef );
}
@@ -211,16 +211,16 @@ void TOC::fillTree()
m_parentItem->setOpen( true );
}
-QDomElement TOC::childElement( const QDomElement &element, const QString &name )
+TQDomElement TOC::childElement( const TQDomElement &element, const TQString &name )
{
- QDomElement e;
+ TQDomElement e;
for ( e = element.firstChild().toElement(); !e.isNull(); e = e.nextSibling().toElement() )
if ( e.tagName() == name )
break;
return e;
}
-void TOC::slotItemSelected( QListViewItem *item )
+void TOC::slotItemSelected( TQListViewItem *item )
{
TOCItem *tocItem;
if ( ( tocItem = dynamic_cast<TOCItem *>( item ) ) )
@@ -229,15 +229,15 @@ void TOC::slotItemSelected( QListViewItem *item )
item->setOpen( !item->isOpen() );
}
-TOCItem::TOCItem( TOC *toc, QListViewItem *parentItem, QListViewItem *after, const QString &text )
+TOCItem::TOCItem( TOC *toc, TQListViewItem *parentItem, TQListViewItem *after, const TQString &text )
: NavigatorItem( new DocEntry( text ), parentItem, after )
{
setAutoDeleteDocEntry( true );
m_toc = toc;
}
-TOCChapterItem::TOCChapterItem( TOC *toc, NavigatorItem *parent, QListViewItem *after,
- const QString &title, const QString &name )
+TOCChapterItem::TOCChapterItem( TOC *toc, NavigatorItem *parent, TQListViewItem *after,
+ const TQString &title, const TQString &name )
: TOCItem( toc, parent, after, title ),
m_name( name )
{
@@ -245,13 +245,13 @@ TOCChapterItem::TOCChapterItem( TOC *toc, NavigatorItem *parent, QListViewItem *
entry()->setUrl(url());
}
-QString TOCChapterItem::url()
+TQString TOCChapterItem::url()
{
return "help:" + toc()->application() + "/" + m_name + ".html";
}
-TOCSectionItem::TOCSectionItem( TOC *toc, TOCChapterItem *parent, QListViewItem *after,
- const QString &title, const QString &name )
+TOCSectionItem::TOCSectionItem( TOC *toc, TOCChapterItem *parent, TQListViewItem *after,
+ const TQString &title, const TQString &name )
: TOCItem( toc, parent, after, title ),
m_name( name )
{
@@ -259,7 +259,7 @@ TOCSectionItem::TOCSectionItem( TOC *toc, TOCChapterItem *parent, QListViewItem
entry()->setUrl(url());
}
-QString TOCSectionItem::url()
+TQString TOCSectionItem::url()
{
if ( static_cast<TOCSectionItem *>( parent()->firstChild() ) == this )
return static_cast<TOCChapterItem *>( parent() )->url() + "#" + m_name;