diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:39:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:39:55 +0000 |
commit | 0a6e0958c03e41c87b15557b6f407874f20c2f8d (patch) | |
tree | 2cdd58c4013b1be09cfcbb4ddae2b05712b9aeee /libkdeedu/kdeeduui | |
parent | 83f9dfafc157ff7823804b3ff457b43d021a5b4b (diff) | |
download | tdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.tar.gz tdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1157642 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdeedu/kdeeduui')
-rw-r--r-- | libkdeedu/kdeeduui/kdeeduglossary.cpp | 140 | ||||
-rw-r--r-- | libkdeedu/kdeeduui/kdeeduglossary.h | 74 |
2 files changed, 107 insertions, 107 deletions
diff --git a/libkdeedu/kdeeduui/kdeeduglossary.cpp b/libkdeedu/kdeeduui/kdeeduglossary.cpp index 5efb8a6d..1b0902b1 100644 --- a/libkdeedu/kdeeduui/kdeeduglossary.cpp +++ b/libkdeedu/kdeeduui/kdeeduglossary.cpp @@ -20,14 +20,14 @@ #include <kstandarddirs.h> #include <kactioncollection.h> -#include <qfile.h> -#include <qlabel.h> -#include <qheader.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qsplitter.h> -#include <qstringlist.h> -#include <qtoolbutton.h> +#include <tqfile.h> +#include <tqlabel.h> +#include <tqheader.h> +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqsplitter.h> +#include <tqstringlist.h> +#include <tqtoolbutton.h> Glossary::Glossary() { @@ -39,9 +39,9 @@ Glossary::~Glossary() { } -bool Glossary::loadLayout( QDomDocument &Document, const KURL& url ) +bool Glossary::loadLayout( TQDomDocument &Document, const KURL& url ) { - QFile layoutFile( url.path() ); + TQFile layoutFile( url.path() ); if (!layoutFile.exists()) { @@ -70,9 +70,9 @@ bool Glossary::isEmpty() const } -Glossary* Glossary::readFromXML( const KURL& url, const QString& path ) +Glossary* Glossary::readFromXML( const KURL& url, const TQString& path ) { - QDomDocument doc( "document" ); + TQDomDocument doc( "document" ); Glossary *glossary = new Glossary(); @@ -80,7 +80,7 @@ Glossary* Glossary::readFromXML( const KURL& url, const QString& path ) if ( glossary->loadLayout( doc, url ) ) { - QValueList<GlossaryItem*> itemList; + TQValueList<GlossaryItem*> itemList; itemList = glossary->readItems( doc ); glossary->setItemlist( itemList ); glossary->fixImagePath(); @@ -92,10 +92,10 @@ Glossary* Glossary::readFromXML( const KURL& url, const QString& path ) void Glossary::fixImagePath() { kdDebug() << "Glossary::fixImagePath()" << endl; - QValueList<GlossaryItem*>::iterator it = m_itemlist.begin(); - const QValueList<GlossaryItem*>::iterator itEnd = m_itemlist.end(); - QString path = m_picturepath; - QString firstpart = "<img src=\""; + TQValueList<GlossaryItem*>::iterator it = m_itemlist.begin(); + const TQValueList<GlossaryItem*>::iterator itEnd = m_itemlist.end(); + TQString path = m_picturepath; + TQString firstpart = "<img src=\""; firstpart += path; for ( ; it != itEnd ; ++it ) @@ -105,14 +105,14 @@ void Glossary::fixImagePath() } } -QValueList<GlossaryItem*> Glossary::readItems( QDomDocument &itemDocument ) +TQValueList<GlossaryItem*> Glossary::readItems( TQDomDocument &itemDocument ) { - QValueList<GlossaryItem*> list; + TQValueList<GlossaryItem*> list; - QDomNodeList itemList; - QDomNodeList refNodeList; - QDomElement itemElement; - QStringList reflist; + TQDomNodeList itemList; + TQDomNodeList refNodeList; + TQDomElement itemElement; + TQStringList reflist; itemList = itemDocument.elementsByTagName( "item" ); @@ -122,15 +122,15 @@ QValueList<GlossaryItem*> Glossary::readItems( QDomDocument &itemDocument ) reflist.clear(); GlossaryItem *item = new GlossaryItem(); - itemElement = ( const QDomElement& ) itemList.item( i ).toElement(); + itemElement = ( const TQDomElement& ) itemList.item( i ).toElement(); - QDomNode nameNode = itemElement.namedItem( "name" ); - QDomNode descNode = itemElement.namedItem( "desc" ); + TQDomNode nameNode = itemElement.namedItem( "name" ); + TQDomNode descNode = itemElement.namedItem( "desc" ); - QString picName = itemElement.namedItem( "picture" ).toElement().text(); - QDomElement refNode = ( const QDomElement& ) itemElement.namedItem( "references" ).toElement(); + TQString picName = itemElement.namedItem( "picture" ).toElement().text(); + TQDomElement refNode = ( const TQDomElement& ) itemElement.namedItem( "references" ).toElement(); - QString desc = i18n( descNode.toElement().text().utf8() ); + TQString desc = i18n( descNode.toElement().text().utf8() ); if ( !picName.isEmpty() ) desc.prepend("[img]"+picName +"[/img]" ); @@ -162,7 +162,7 @@ QValueList<GlossaryItem*> Glossary::readItems( QDomDocument &itemDocument ) -GlossaryDialog::GlossaryDialog( bool folded, QWidget *parent, const char *name) +GlossaryDialog::GlossaryDialog( bool folded, TQWidget *parent, const char *name) : KDialogBase( Plain, i18n( "Glossary" ), Close, NoDefault, parent, name, false ) { //this string will be used for all items. If a backgroundpicture should @@ -171,17 +171,17 @@ GlossaryDialog::GlossaryDialog( bool folded, QWidget *parent, const char *name) m_folded = folded; - QVBoxLayout *vbox = new QVBoxLayout( plainPage(), 0, KDialog::spacingHint() ); + TQVBoxLayout *vbox = new TQVBoxLayout( plainPage(), 0, KDialog::spacingHint() ); vbox->activate(); - QHBoxLayout *hbox = new QHBoxLayout( 0L, 0, KDialog::spacingHint() ); + TQHBoxLayout *hbox = new TQHBoxLayout( 0L, 0, KDialog::spacingHint() ); hbox->activate(); - QToolButton *clear = new QToolButton( plainPage() ); + TQToolButton *clear = new TQToolButton( plainPage() ); clear->setIconSet( SmallIconSet( "locationbar_erase" ) ); hbox->addWidget( clear ); - QLabel *lbl = new QLabel( plainPage() ); + TQLabel *lbl = new TQLabel( plainPage() ); lbl->setText( i18n( "Search:" ) ); hbox->addWidget( lbl ); @@ -190,7 +190,7 @@ GlossaryDialog::GlossaryDialog( bool folded, QWidget *parent, const char *name) vbox->addLayout( hbox ); setFocusProxy(m_search); - QSplitter *vs = new QSplitter( plainPage() ); + TQSplitter *vs = new TQSplitter( plainPage() ); vbox->addWidget( vs ); m_glosstree = new KListView( vs, "treeview" ); @@ -203,9 +203,9 @@ GlossaryDialog::GlossaryDialog( bool folded, QWidget *parent, const char *name) m_htmlpart = new KHTMLPart( vs, "html-part" ); - connect( m_htmlpart->browserExtension(), SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ), this, SLOT( displayItem( const KURL &, const KParts::URLArgs & ) ) ); - connect( m_glosstree, SIGNAL(clicked( QListViewItem * )), this, SLOT(slotClicked( QListViewItem * ))); - connect( clear, SIGNAL(clicked()), m_search, SLOT(clear())); + connect( m_htmlpart->browserExtension(), TQT_SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ), this, TQT_SLOT( displayItem( const KURL &, const KParts::URLArgs & ) ) ); + connect( m_glosstree, TQT_SIGNAL(clicked( TQListViewItem * )), this, TQT_SLOT(slotClicked( TQListViewItem * ))); + connect( clear, TQT_SIGNAL(clicked()), m_search, TQT_SLOT(clear())); resize( 600, 400 ); } @@ -214,7 +214,7 @@ GlossaryDialog::~GlossaryDialog() { } -void GlossaryDialog::keyPressEvent(QKeyEvent* e) +void GlossaryDialog::keyPressEvent(TQKeyEvent* e) { if (e->key() == Qt::Key_Return) { e->ignore(); @@ -225,12 +225,12 @@ void GlossaryDialog::keyPressEvent(QKeyEvent* e) void GlossaryDialog::displayItem( const KURL& url, const KParts::URLArgs& ) { // using the "host" part of a kurl as reference - QString myurl = url.host().lower(); + TQString myurl = url.host().lower(); m_search->setText( "" ); m_search->updateSearch( "" ); - QListViewItem *found = 0; - QListViewItemIterator it( m_glosstree ); - QListViewItem *item; + TQListViewItem *found = 0; + TQListViewItemIterator it( m_glosstree ); + TQListViewItem *item; while ( it.current() ) { item = it.current(); @@ -253,16 +253,16 @@ void GlossaryDialog::updateTree() { m_glosstree->clear(); - QValueList<Glossary*>::const_iterator itGl = m_glossaries.begin(); - const QValueList<Glossary*>::const_iterator itGlEnd = m_glossaries.end(); + TQValueList<Glossary*>::const_iterator itGl = m_glossaries.begin(); + const TQValueList<Glossary*>::const_iterator itGlEnd = m_glossaries.end(); for ( ; itGl != itGlEnd ; ++itGl ) { - QValueList<GlossaryItem*> items = ( *itGl )->itemlist(); - QValueList<GlossaryItem*>::iterator it = items.begin(); - const QValueList<GlossaryItem*>::iterator itEnd = items.end(); + TQValueList<GlossaryItem*> items = ( *itGl )->itemlist(); + TQValueList<GlossaryItem*>::iterator it = items.begin(); + const TQValueList<GlossaryItem*>::iterator itEnd = items.end(); - QListViewItem *main = new QListViewItem( m_glosstree, ( *itGl )->name() ); + TQListViewItem *main = new TQListViewItem( m_glosstree, ( *itGl )->name() ); main->setExpandable( true ); main->setSelectable( false ); //XXX TMP!!! @@ -272,18 +272,18 @@ void GlossaryDialog::updateTree() { if ( foldinsubtrees ) { - QChar thisletter = ( *it )->name().upper()[0]; - QListViewItem *thisletteritem = findTreeWithLetter( thisletter, main ); + TQChar thisletter = ( *it )->name().upper()[0]; + TQListViewItem *thisletteritem = findTreeWithLetter( thisletter, main ); if ( !thisletteritem ) { - thisletteritem = new QListViewItem( main, thisletter ); + thisletteritem = new TQListViewItem( main, thisletter ); thisletteritem->setExpandable( true ); thisletteritem->setSelectable( false ); } - new QListViewItem( thisletteritem, ( *it )->name() ); + new TQListViewItem( thisletteritem, ( *it )->name() ); } else - new QListViewItem( main, ( *it )->name() ); + new TQListViewItem( main, ( *it )->name() ); } main->sort(); } @@ -301,9 +301,9 @@ void GlossaryDialog::addGlossary( Glossary* newgloss ) updateTree(); } -QListViewItem* GlossaryDialog::findTreeWithLetter( const QChar& l, QListViewItem* i ) +TQListViewItem* GlossaryDialog::findTreeWithLetter( const TQChar& l, TQListViewItem* i ) { - QListViewItem *it = i->firstChild(); + TQListViewItem *it = i->firstChild(); while ( it ) { if ( it->text(0)[0] == l ) @@ -313,7 +313,7 @@ QListViewItem* GlossaryDialog::findTreeWithLetter( const QChar& l, QListViewItem return 0; } -void GlossaryDialog::slotClicked( QListViewItem *item ) +void GlossaryDialog::slotClicked( TQListViewItem *item ) { if ( !item ) return; @@ -323,18 +323,18 @@ void GlossaryDialog::slotClicked( QListViewItem *item ) * in the m_itemList. When it is found the HTML will be * generated */ - QValueList<Glossary*>::iterator itGl = m_glossaries.begin(); - const QValueList<Glossary*>::iterator itGlEnd = m_glossaries.end(); + TQValueList<Glossary*>::iterator itGl = m_glossaries.begin(); + const TQValueList<Glossary*>::iterator itGlEnd = m_glossaries.end(); bool found = false; GlossaryItem *i = 0; - QString bg_picture; + TQString bg_picture; while ( !found && itGl != itGlEnd ) { - QValueList<GlossaryItem*> items = ( *itGl )->itemlist(); - QValueList<GlossaryItem*>::const_iterator it = items.begin(); - const QValueList<GlossaryItem*>::const_iterator itEnd = items.end(); + TQValueList<GlossaryItem*> items = ( *itGl )->itemlist(); + TQValueList<GlossaryItem*>::const_iterator it = items.begin(); + const TQValueList<GlossaryItem*>::const_iterator itEnd = items.end(); while ( !found && it != itEnd ) { if ( ( *it )->name() == item->text( 0 ) ) @@ -349,7 +349,7 @@ void GlossaryDialog::slotClicked( QListViewItem *item ) } if ( found && i ) { - QString html; + TQString html; if ( !bg_picture.isEmpty() ) { html = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><body background=\"" ; @@ -373,21 +373,21 @@ void GlossaryDialog::slotClose() accept(); } -QString GlossaryItem::toHtml() const +TQString GlossaryItem::toHtml() const { - QString code = "<h1>" + m_name + "</h1>" + m_desc; + TQString code = "<h1>" + m_name + "</h1>" + m_desc; if ( !m_ref.isEmpty() ) { - QString refcode = parseReferences(); + TQString refcode = parseReferences(); code += refcode; } return code; } -QString GlossaryItem::parseReferences() const +TQString GlossaryItem::parseReferences() const { - QString htmlcode = "<h3>" + i18n( "References" ) + "</h3>"; + TQString htmlcode = "<h3>" + i18n( "References" ) + "</h3>"; bool first = true; for ( uint i = 0; i < m_ref.size(); i++ ) @@ -396,7 +396,7 @@ QString GlossaryItem::parseReferences() const htmlcode += "<br>"; else first = false; - htmlcode += QString( "<a href=\"item://%1\">%2</a>" ).arg( m_ref[i], m_ref[i] ); + htmlcode += TQString( "<a href=\"item://%1\">%2</a>" ).arg( m_ref[i], m_ref[i] ); } return htmlcode; diff --git a/libkdeedu/kdeeduui/kdeeduglossary.h b/libkdeedu/kdeeduui/kdeeduglossary.h index 418967f6..d6628d99 100644 --- a/libkdeedu/kdeeduui/kdeeduglossary.h +++ b/libkdeedu/kdeeduui/kdeeduglossary.h @@ -47,7 +47,7 @@ class Glossary m_itemlist.append( item ); } - QValueList<GlossaryItem*> itemlist()const{ + TQValueList<GlossaryItem*> itemlist()const{ return m_itemlist; } @@ -67,21 +67,21 @@ class Glossary * Every glossary can have a name. It will be * set to @p name */ - void setName( const QString& name ){ + void setName( const TQString& name ){ m_name = name; } /** * @returns the name of the glossary */ - QString name()const{ + TQString name()const{ return m_name; } /** * sets the internal list of items to @p list */ - void setItemlist( QValueList<GlossaryItem*> list ){ + void setItemlist( TQValueList<GlossaryItem*> list ){ m_itemlist = list; } @@ -94,18 +94,18 @@ class Glossary * @return a pointer to the loaded glossary. Even in case of * error, this won't return 0 but an empty Glossary. */ - static Glossary* readFromXML( const KURL& url, const QString& path = 0 ); + static Glossary* readFromXML( const KURL& url, const TQString& path = 0 ); /** * Every glossaryitem can show pictures. [img src="foo.png] * will look for the file foo.png in the path defined be * @p path */ - void setPicturePath( const QString& path ){ + void setPicturePath( const TQString& path ){ m_picturepath = path; } - QString picturePath()const{ + TQString picturePath()const{ return m_picturepath; } @@ -114,7 +114,7 @@ class Glossary * of the htmlview. The dialog * will use the file specifiec by the @p filename */ - void setBackgroundPicture( const QString& filename ){ + void setBackgroundPicture( const TQString& filename ){ m_backgroundpicture = filename; } @@ -122,7 +122,7 @@ class Glossary * @return the picuture used as the background in * this background */ - QString backgroundPicture()const{ + TQString backgroundPicture()const{ return m_backgroundpicture; } @@ -130,11 +130,11 @@ class Glossary /** * This methods parses the given xml-code. It will extract * the information of the items and return them as a - * QValueList<GlossaryItem*> + * TQValueList<GlossaryItem*> */ - virtual QValueList<GlossaryItem*> readItems( QDomDocument &itemDocument ); + virtual TQValueList<GlossaryItem*> readItems( TQDomDocument &itemDocument ); - QString m_backgroundpicture; + TQString m_backgroundpicture; /** * replaces the [img]-pseudocode with valid html. The path where @@ -145,26 +145,26 @@ class Glossary /** * the path in which pictures of the glossary will be searched */ - QString m_picturepath; + TQString m_picturepath; /** * Load the layout from an XML file. * - * @param doc The QDomDocument which will contain the read XML + * @param doc The TQDomDocument which will contain the read XML * contents. * @param url The path of the file to load * * @return a bool indicating whether the loading of the XML was * successfull or not */ - bool loadLayout( QDomDocument& doc, const KURL& url ); + bool loadLayout( TQDomDocument& doc, const KURL& url ); - QValueList<GlossaryItem*> m_itemlist; + TQValueList<GlossaryItem*> m_itemlist; /** * the name of the glossary */ - QString m_name; + TQString m_name; }; /** @@ -182,54 +182,54 @@ class GlossaryItem GlossaryItem(){} ~GlossaryItem(){} - void setName( const QString& s ){ + void setName( const TQString& s ){ m_name = s; } - void setDesc( const QString& s){ + void setDesc( const TQString& s){ m_desc = s; } - void setRef( const QStringList& s){ + void setRef( const TQStringList& s){ m_ref = s; } - void setPictures( const QString& s ){ + void setPictures( const TQString& s ){ m_pic = s; } - QString name() const { + TQString name() const { return m_name; } - QString desc() const { + TQString desc() const { return m_desc; } - QStringList ref() const { + TQStringList ref() const { return m_ref; } - QStringList pictures() const { + TQStringList pictures() const { return m_pic; } /** * @return the formated HTML code for current item. **/ - QString toHtml() const; + TQString toHtml() const; /** * This method parses the references. * @return the HTML code with the references as HTML links */ - QString parseReferences() const; + TQString parseReferences() const; private: - QString m_name; - QString m_desc; - QStringList m_ref; - QStringList m_pic; + TQString m_name; + TQString m_desc; + TQStringList m_ref; + TQStringList m_pic; }; /** @@ -242,10 +242,10 @@ class GlossaryDialog : public KDialogBase Q_OBJECT public: - GlossaryDialog( bool folded = true, QWidget *parent=0, const char *name=0); + GlossaryDialog( bool folded = true, TQWidget *parent=0, const char *name=0); ~GlossaryDialog(); - void keyPressEvent(QKeyEvent*); + void keyPressEvent(TQKeyEvent*); /** * add a new glossary @@ -255,7 +255,7 @@ class GlossaryDialog : public KDialogBase void addGlossary( Glossary* newgloss ); private: - QValueList<Glossary*> m_glossaries; + TQValueList<Glossary*> m_glossaries; /** * if true the items will be displayed folded @@ -266,16 +266,16 @@ class GlossaryDialog : public KDialogBase KHTMLPart *m_htmlpart; KListView *m_glosstree; - QString m_htmlbasestring; + TQString m_htmlbasestring; KActionCollection* m_actionCollection; - QListViewItem* findTreeWithLetter( const QChar&, QListViewItem* ); + TQListViewItem* findTreeWithLetter( const TQChar&, TQListViewItem* ); KListViewSearchLine *m_search; private slots: - void slotClicked( QListViewItem * ); + void slotClicked( TQListViewItem * ); /** * The user clicked on a href. Emit the corresponding item */ |