diff options
Diffstat (limited to 'keduca/libkeduca')
-rw-r--r-- | keduca/libkeduca/fileread.cpp | 146 | ||||
-rw-r--r-- | keduca/libkeduca/fileread.h | 72 | ||||
-rw-r--r-- | keduca/libkeduca/kgallerydialog.cpp | 62 | ||||
-rw-r--r-- | keduca/libkeduca/kgallerydialog.h | 6 |
4 files changed, 143 insertions, 143 deletions
diff --git a/keduca/libkeduca/fileread.cpp b/keduca/libkeduca/fileread.cpp index db8f56cb..7632b6fd 100644 --- a/keduca/libkeduca/fileread.cpp +++ b/keduca/libkeduca/fileread.cpp @@ -25,12 +25,12 @@ #include <kdebug.h> #include <ktempfile.h> -#include <qfileinfo.h> -#include <qpixmap.h> -#include <qbuffer.h> +#include <tqfileinfo.h> +#include <tqpixmap.h> +#include <tqbuffer.h> -FileRead::FileRead( QObject *parent, const char *name ) - :QObject(parent, name), +FileRead::FileRead( TQObject *parent, const char *name ) + :TQObject(parent, name), _changed(false), _tmpfile(0) { @@ -41,7 +41,7 @@ FileRead::~FileRead() } bool FileRead::openFile(const KURL &url) { - QString tmpFile; + TQString tmpFile; bool returnval=false; if( KIO::NetAccess::download( url, tmpFile, 0 ) ) { @@ -58,15 +58,15 @@ bool FileRead::openFile(const KURL &url) { return returnval; } -bool FileRead::loadFile(const QString &filename) +bool FileRead::loadFile(const TQString &filename) { - QDomDocument doc("document.xml"); + TQDomDocument doc("document.xml"); KMimeType::Ptr type = KMimeType::findByFileContent(filename); kdDebug() << "FileRead::loadFile(): MIME-Type is " << type->name() << endl; - QFile file(filename); + TQFile file(filename); if(!file.open(IO_ReadOnly)) { @@ -82,26 +82,26 @@ bool FileRead::loadFile(const QString &filename) doc.setContent(qUncompress(file.readAll())); } - QDomElement docElem = doc.documentElement(); + TQDomElement docElem = doc.documentElement(); if( (doc.doctype().isNull()) || (doc.doctype().name() != "educa") ) { file.close(); return false; } - QDomNode n = docElem.firstChild(); + TQDomNode n = docElem.firstChild(); - QDomNodeList dnList = n.childNodes(); + TQDomNodeList dnList = n.childNodes(); for( unsigned int i = 0; i < dnList.count(); ++i) { // ------------------- INFORMATION BODY ----------------------- - QDomElement element = dnList.item(i).toElement(); + TQDomElement element = dnList.item(i).toElement(); if( element.tagName() == "default" || element.tagName() == "author" ) { if( element.tagName() == "default" ) { _header.insert( "image", element.attribute( "image", "default.png" ) ); } if( element.tagName() == "author" ) { - QDomNodeList AuthordnList = element.childNodes(); + TQDomNodeList AuthordnList = element.childNodes(); for( unsigned int i = 0; i < AuthordnList.count(); ++i) { - QDomElement authorelement = AuthordnList.item(i).toElement(); + TQDomElement authorelement = AuthordnList.item(i).toElement(); _header.insert( authorelement.tagName(), authorelement.text() ); } } @@ -117,17 +117,17 @@ bool FileRead::loadFile(const QString &filename) { insertQuestion(); // --------------------- QUESTION ATTRIBUTE------------------------ - QDomElement elementNODE = dnList.item(i).toElement(); + TQDomElement elementNODE = dnList.item(i).toElement(); setQuestion( QF_TYPE, elementNODE.attribute( "type", "1" ).toInt() ); setQuestion( QF_PICTURE, elementNODE.attribute( "image", "" ) ); setQuestion( QF_TIME, elementNODE.attribute( "time", "0" ).toInt() ); setQuestion( QF_POINTS, elementNODE.attribute( "points", "0" ).toInt() ); - QDomNodeList quList = elementNODE.childNodes(); + TQDomNodeList quList = elementNODE.childNodes(); for( unsigned int x = 0; x < quList.count(); ++x) { // --------------------- QUESTION AND RESPONSES------------------ - QDomElement element = quList.item(x).toElement(); + TQDomElement element = quList.item(x).toElement(); if( element.tagName() == "text" ) setQuestion( QF_TEXT, element.text() ); if( element.tagName() == "true" ) setAnswer( element.text(), true, element.attribute( "points", "0" ).toInt() ); if( element.tagName() == "false" ) setAnswer( element.text(), false,element.attribute( "points", "0" ).toInt() ); @@ -146,7 +146,7 @@ bool FileRead::loadFile(const QString &filename) { insertResult(); // --------------------- QUESTION ATTRIBUTE------------------------ - QDomElement elementNODE = dnList.item(i).toElement(); + TQDomElement elementNODE = dnList.item(i).toElement(); setResult( RS_TEXT, elementNODE.text() ); setResult( RS_PICTURE, elementNODE.attribute( "image", "" ) ); setResult( RS_MIN, elementNODE.attribute( "min", "0" ).toInt() ); @@ -162,7 +162,7 @@ bool FileRead::loadFile(const QString &filename) return true; } -void FileRead::setQuestion( QuestionField field, const QString& text) +void FileRead::setQuestion( QuestionField field, const TQString& text) { // QF_text, QF_picture, QF_type, QF_time, QF_tip, QF_explain switch( field ) @@ -180,7 +180,7 @@ void FileRead::setQuestion( QuestionField field, const QString& text) (*_recordQuestions).explain = text; break; default: - kdDebug()<<"FileRead::setQuestion(QuestionField field, QString text) called for not handled field value "<<field <<endl; + kdDebug()<<"FileRead::setQuestion(QuestionField field, TQString text) called for not handled field value "<<field <<endl; break; } _changed=true; @@ -206,7 +206,7 @@ void FileRead::setQuestion( QuestionField field, int value ) _changed=true; } -void FileRead::setResult( ResultField field, const QString& text) +void FileRead::setResult( ResultField field, const TQString& text) { // RS_text, QF_picture switch( field ) @@ -218,7 +218,7 @@ void FileRead::setResult( ResultField field, const QString& text) (*_recordResults).picture = text; break; default: - kdDebug()<<"FileRead::setResult(ResultField field, QString text) called for not handled field value "<<field <<endl; + kdDebug()<<"FileRead::setResult(ResultField field, TQString text) called for not handled field value "<<field <<endl; break; } _changed=true; @@ -241,7 +241,7 @@ void FileRead::setResult( ResultField field, int value ) _changed=true; } -void FileRead::setAnswer( const QString& text, bool value, int points) +void FileRead::setAnswer( const TQString& text, bool value, int points) { Answers tmpAnswers; @@ -405,7 +405,7 @@ unsigned int FileRead::recordAnswerCount() return (*_recordQuestions).listAnswers.count(); } -QString FileRead::getQuestion( QuestionField field ) +TQString FileRead::getQuestion( QuestionField field ) { // QF_text, QF_picture, QF_type, QF_time, QF_tip, QF_explain switch( field ) @@ -418,10 +418,10 @@ QString FileRead::getQuestion( QuestionField field ) return( (*_recordQuestions).picture ); break; case QF_POINTS: - return QString().setNum( (*_recordQuestions).points ); + return TQString().setNum( (*_recordQuestions).points ); break; case QF_TIME: - return QString().setNum( (*_recordQuestions).time ); + return TQString().setNum( (*_recordQuestions).time ); break; case QF_TIP: return (*_recordQuestions).tip; @@ -455,7 +455,7 @@ int FileRead::getQuestionInt( QuestionField field ) } } -QString FileRead::getAnswer( AnswerField field ) +TQString FileRead::getAnswer( AnswerField field ) { // AField { AF_text, AF_value, AF_picture, AF_point }; switch( field ) @@ -467,7 +467,7 @@ QString FileRead::getAnswer( AnswerField field ) // (*(*_recordQuestions).RecordAnswers).Value ? return i18n("True") : return i18n("False"); // break; case AF_POINT: - return QString().setNum( (*(*_recordQuestions).recordAnswers).points ); + return TQString().setNum( (*(*_recordQuestions).recordAnswers).points ); break; default: kdDebug()<<"FileRead::getAnswer() called for not handled field value "<<field <<endl; @@ -485,7 +485,7 @@ int FileRead::getAnswerPoints() return (*(*_recordQuestions).recordAnswers).points; } -QString FileRead::getResult( ResultField field ) +TQString FileRead::getResult( ResultField field ) { switch( field ) { @@ -496,10 +496,10 @@ QString FileRead::getResult( ResultField field ) return( (*_recordResults).picture ); break; case RS_MIN: - return QString().setNum( (*_recordResults).min ); + return TQString().setNum( (*_recordResults).min ); break; case RS_MAX: - return QString().setNum( (*_recordResults).max ); + return TQString().setNum( (*_recordResults).max ); break; default: kdDebug()<<"FileRead::getResult() called for not handled field value "<<field <<endl; @@ -555,9 +555,9 @@ bool FileRead::recordAnswerBOF() return _fileAnswerBOF; } -QString FileRead::getPicture() +TQString FileRead::getPicture() { - QString picture; + TQString picture; if( !getQuestion(QF_PICTURE).isEmpty() ) picture = getQuestion(QF_PICTURE); @@ -568,7 +568,7 @@ QString FileRead::getPicture() if( _currentURL.isLocalFile() && !KURL(picture).isValid() ) { - if( !QFileInfo(picture).exists() ) + if( !TQFileInfo(picture).exists() ) picture = _currentURL.directory(false,true) + picture; } else if( !_currentURL.isLocalFile() && !KURL(picture).isValid() ) picture = _currentURL.protocol() + "://" + _currentURL.host() + _currentURL.directory(false,true) + picture; @@ -578,16 +578,16 @@ QString FileRead::getPicture() return picture; } -QPixmap FileRead::getPicturePixmap() +TQPixmap FileRead::getPicturePixmap() { KURL picture ( getPicture() ); - QPixmap pict; + TQPixmap pict; if( KIO::NetAccess::download( picture, _tmpfileImage, 0 ) ) { kdDebug()<<"... load successful: "<< _tmpfileImage <<endl; - pict = QPixmap( _tmpfileImage ); + pict = TQPixmap( _tmpfileImage ); KIO::NetAccess::removeTempFile( _tmpfileImage ); } else @@ -670,7 +670,7 @@ bool FileRead::saveFile( const KURL &url, bool copyimages, bool saveCompressed ) if( saveFile(_tmpfile->name(), copyimages, saveCompressed) ) { // upload the file KIO::Job * job = KIO::file_copy( KURL::fromPathOrURL( _tmpfile->name() ), _currentURL, -1, true /*overwrite*/ ); - connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotUploadFinished (KIO::Job *) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job * ) ), this, TQT_SLOT( slotUploadFinished (KIO::Job *) ) ); return true; } } @@ -679,15 +679,15 @@ bool FileRead::saveFile( const KURL &url, bool copyimages, bool saveCompressed ) return false; } -bool FileRead::saveFile( const QString &filename, bool copyimages, bool saveCompressed ) +bool FileRead::saveFile( const TQString &filename, bool copyimages, bool saveCompressed ) { - QDomDocument doc("document.xml"); - QTextStream stream; - QString line; - QByteArray data; - QBuffer buffer(data); - QFile file(filename); - QStringList copyJOB; + TQDomDocument doc("document.xml"); + TQTextStream stream; + TQString line; + TQByteArray data; + TQBuffer buffer(data); + TQFile file(filename); + TQStringList copyJOB; stream.setDevice(&buffer); @@ -705,13 +705,13 @@ bool FileRead::saveFile( const QString &filename, bool copyimages, bool saveComp } */ - QString head( "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><!DOCTYPE educa>" ); + TQString head( "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><!DOCTYPE educa>" ); doc.setContent( head ); - QDomElement Root = doc.createElement("Document"); + TQDomElement Root = doc.createElement("Document"); doc.appendChild( Root ); - QDomElement NodeInfo = doc.createElement("Info"); + TQDomElement NodeInfo = doc.createElement("Info"); Root.appendChild( NodeInfo ); insertXML( doc, NodeInfo, "title", _header["title"] ); @@ -722,12 +722,12 @@ bool FileRead::saveFile( const QString &filename, bool copyimages, bool saveComp if( !(_header["image"]).isEmpty() ) { - QDomElement Nodedefault = doc.createElement("default"); + TQDomElement Nodedefault = doc.createElement("default"); if( copyimages ) { copyJOB.append( _header["image"] ); - Nodedefault.setAttribute( "image", QFileInfo(_header["image"]).fileName() ); + Nodedefault.setAttribute( "image", TQFileInfo(_header["image"]).fileName() ); } else { Nodedefault.setAttribute( "image", _header["image"]); } @@ -736,26 +736,26 @@ bool FileRead::saveFile( const QString &filename, bool copyimages, bool saveComp if( !_header["name"].isEmpty() || !_header["email"].isEmpty() || !_header["www"].isEmpty() ) { - QDomElement Nodeauthor = doc.createElement("author"); + TQDomElement Nodeauthor = doc.createElement("author"); NodeInfo.appendChild( Nodeauthor ); if( !_header["name"].isEmpty() ) insertXML( doc, Nodeauthor, "name", _header["name"] ); if( !_header["email"].isEmpty() ) insertXML( doc, Nodeauthor, "email", _header["email"] ); if( !_header["www"].isEmpty() ) insertXML( doc, Nodeauthor, "www", _header["www"] ); } - QDomElement NodeData = doc.createElement("Data"); + TQDomElement NodeData = doc.createElement("Data"); Root.appendChild( NodeData ); recordFirst(); while ( !recordEOF() ) { - QDomElement question = doc.createElement("question"); + TQDomElement question = doc.createElement("question"); if( !getQuestion( QF_PICTURE ).isEmpty() ) { if( copyimages ) { copyJOB.append( getQuestion( QF_PICTURE ) ); - question.setAttribute("image", QFileInfo( getQuestion( QF_PICTURE ) ).fileName() ); + question.setAttribute("image", TQFileInfo( getQuestion( QF_PICTURE ) ).fileName() ); } else { question.setAttribute("image", getQuestion( QF_PICTURE ) ); } @@ -770,16 +770,16 @@ bool FileRead::saveFile( const QString &filename, bool copyimages, bool saveComp { if( getAnswerValue() ) { - QDomElement domELEMENT = doc.createElement( "true" ); + TQDomElement domELEMENT = doc.createElement( "true" ); if( getAnswerPoints() > 0 ) domELEMENT.setAttribute("points", getAnswerPoints() ); - QDomText DATAelement = doc.createTextNode( getAnswer( AF_TEXT ) ); + TQDomText DATAelement = doc.createTextNode( getAnswer( AF_TEXT ) ); question.appendChild( domELEMENT ); domELEMENT.appendChild( DATAelement ); } else { // insertXML( doc, question, "false", getAnswer( AF_text ) ); - QDomElement domELEMENT = doc.createElement( "false" ); + TQDomElement domELEMENT = doc.createElement( "false" ); if( getAnswerPoints() > 0 ) domELEMENT.setAttribute("points", getAnswerPoints() ); - QDomText DATAelement = doc.createTextNode( getAnswer( AF_TEXT ) ); + TQDomText DATAelement = doc.createTextNode( getAnswer( AF_TEXT ) ); question.appendChild( domELEMENT ); domELEMENT.appendChild( DATAelement ); } @@ -814,7 +814,7 @@ bool FileRead::saveFile( const QString &filename, bool copyimages, bool saveComp } /** Save results */ -bool FileRead::saveResults( const KURL &url, const QString &results ) +bool FileRead::saveResults( const KURL &url, const TQString &results ) { if (url.isValid()) { @@ -847,7 +847,7 @@ bool FileRead::saveResults( const KURL &url, const QString &results ) if( saveResults(_tmpfile->name(), results) ) { // upload the file KIO::Job * job = KIO::file_copy( KURL::fromPathOrURL( _tmpfile->name() ), _currentURL, -1, true /*overwrite*/ ); - connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotUploadFinished (KIO::Job *) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job * ) ), this, TQT_SLOT( slotUploadFinished (KIO::Job *) ) ); return true; } } @@ -856,11 +856,11 @@ bool FileRead::saveResults( const KURL &url, const QString &results ) return false; } -bool FileRead::saveResults( const QString &filename, const QString &results ) +bool FileRead::saveResults( const TQString &filename, const TQString &results ) { - QTextStream stream; - QFile file(filename); - QStringList copyJOB; + TQTextStream stream; + TQFile file(filename); + TQStringList copyJOB; stream.setDevice(&file); @@ -875,30 +875,30 @@ bool FileRead::saveResults( const QString &filename, const QString &results ) } /** Insert xml format data */ -void FileRead::insertXML( QDomDocument &doc, QDomElement &parent, const QString &tagName, const QString &data) +void FileRead::insertXML( TQDomDocument &doc, TQDomElement &parent, const TQString &tagName, const TQString &data) { - QDomElement domELEMENT = doc.createElement( tagName ); - QDomText DATAelement = doc.createTextNode( data ); + TQDomElement domELEMENT = doc.createElement( tagName ); + TQDomText DATAelement = doc.createTextNode( data ); parent.appendChild( domELEMENT ); domELEMENT.appendChild( DATAelement ); } /** Insert xml data format */ -void FileRead::insertXML( QDomDocument &doc, QDomElement &parent, const QString &data) +void FileRead::insertXML( TQDomDocument &doc, TQDomElement &parent, const TQString &data) { - QDomText DATAelement = doc.createTextNode( data ); + TQDomText DATAelement = doc.createTextNode( data ); parent.appendChild( DATAelement ); } /** Get Header */ -QString FileRead::getHeader(const QString &head) +TQString FileRead::getHeader(const TQString &head) { return _header[head]; } /** Set header data */ -void FileRead::setHeader( const QString field, const QString value) +void FileRead::setHeader( const TQString field, const TQString value) { _changed = _header[field]!=value; diff --git a/keduca/libkeduca/fileread.h b/keduca/libkeduca/fileread.h index 3dc82a0b..679d2cc5 100644 --- a/keduca/libkeduca/fileread.h +++ b/keduca/libkeduca/fileread.h @@ -20,7 +20,7 @@ #include <kio/job.h> -#include <qdom.h> +#include <tqdom.h> // forward declarations class KTempFile; @@ -32,11 +32,11 @@ class QFile; *@author Klas Kalass */ -class FileRead : public QObject { +class FileRead : public TQObject { Q_OBJECT public: - FileRead( QObject *parent=0, const char *name=0 ); + FileRead( TQObject *parent=0, const char *name=0 ); virtual ~FileRead(); enum QuestionField { QF_TEXT, QF_PICTURE, QF_POINTS, QF_TYPE, QF_TIME, QF_TIP, QF_EXPLAIN }; enum AnswerField { AF_TEXT, AF_VALUE, AF_POINT }; @@ -45,15 +45,15 @@ public: /** Open keduca file. This function can open a remote or local url. */ bool openFile( const KURL &url ); /** Set value to questions fields */ - void setQuestion( QuestionField field, const QString& text); + void setQuestion( QuestionField field, const TQString& text); /** Set value to questions fields */ void setQuestion( QuestionField field, int value ); /** Set value to results fields */ - void setResult( ResultField field, const QString& text); + void setResult( ResultField field, const TQString& text); /** Set value to results fields */ void setResult( ResultField field, int value ); /** Insert an answer field */ - void setAnswer( const QString& text, bool value, int points=0); + void setAnswer( const TQString& text, bool value, int points=0); /** Go to the Last Record */ void recordLast(); /** Go to the First record */ @@ -87,17 +87,17 @@ public: /** Record answer count */ unsigned int recordAnswerCount(); /** Get the value of the field question */ - QString getQuestion( QuestionField field ); + TQString getQuestion( QuestionField field ); /** Get the value of the field questions in integer */ int getQuestionInt( QuestionField field ); /** Get Answer field */ - QString getAnswer( AnswerField field ); + TQString getAnswer( AnswerField field ); /** Get answer field */ int getAnswerPoints(); /** Get Answer field */ bool getAnswerValue(); /** Get the value of the field result */ - QString getResult( ResultField field ); + TQString getResult( ResultField field ); /** Get the value of the field result */ int getResultInt( ResultField field ); /** Returns if this record is a begin of file */ @@ -121,15 +121,15 @@ public: /** Save file */ bool saveFile( const KURL &url = KURL(), bool copyimages = false, bool saveCompressed = true ); /** Save results */ - bool saveResults( const KURL &url, const QString &results ); + bool saveResults( const KURL &url, const TQString &results ); /** Get real picture */ - QString getPicture(); + TQString getPicture(); /** Get real picture */ - QPixmap getPicturePixmap(); + TQPixmap getPicturePixmap(); /** Set header data */ - void setHeader( const QString field, const QString value); + void setHeader( const TQString field, const TQString value); /** Get Header */ - QString getHeader(const QString &head); + TQString getHeader(const TQString &head); /** is Multi Answer */ bool isMultiAnswer(); /** is Result */ @@ -153,42 +153,42 @@ private: bool _changed; /** List of General Variables of the header */ - QMap<QString,QString> _header; + TQMap<TQString,TQString> _header; struct Answers { - QString text; + TQString text; bool value; int points; }; struct Results { - QString text; - QString picture; + TQString text; + TQString picture; int min; int max; }; struct Questions { - QString text; + TQString text; int type; - QString picture; + TQString picture; int time; int points; - QString tip; - QString explain; - QValueList<Answers> listAnswers; - QValueListIterator<Answers> recordAnswers; + TQString tip; + TQString explain; + TQValueList<Answers> listAnswers; + TQValueListIterator<Answers> recordAnswers; }; /** List to Data struct */ - QValueList<Questions> _listQuestions; - QValueListIterator<Questions> _recordQuestions; + TQValueList<Questions> _listQuestions; + TQValueListIterator<Questions> _recordQuestions; - QValueList<Results> _listResults; - QValueListIterator<Results> _recordResults; + TQValueList<Results> _listResults; + TQValueListIterator<Results> _recordResults; /** Returns if the database finds End Of File */ bool _fileEOF; @@ -207,7 +207,7 @@ private: /** the temporary file to which the document is saved, NULL if no temporary file is needed */ KTempFile *_tmpfile; /** the temporary image file */ - QString _tmpfileImage; + TQString _tmpfileImage; /** Total Questions */ uint _totalQuestions; /** Total Time */ @@ -218,17 +218,17 @@ private: // Private methods /** Insert xml format data */ - void insertXML( QDomDocument &doc, QDomElement &parent, const QString &tagName, const QString &data); + void insertXML( TQDomDocument &doc, TQDomElement &parent, const TQString &tagName, const TQString &data); /** Insert xml data format */ - void insertXML( QDomDocument &doc, QDomElement &parent, const QString &data); + void insertXML( TQDomDocument &doc, TQDomElement &parent, const TQString &data); protected: /** Open keduca file. This function does the actual work and expects a local filename . */ - bool loadFile( const QString &filename ); + bool loadFile( const TQString &filename ); /** Save KEduca file to the file*/ - bool saveFile( const QString &filename, bool copyimages, bool saveCompressed = true ); + bool saveFile( const TQString &filename, bool copyimages, bool saveCompressed = true ); /** Save Results file to the file */ - bool saveResults( const QString &filename, const QString &results ); + bool saveResults( const TQString &filename, const TQString &results ); protected slots: void slotUploadFinished( KIO::Job * job ); @@ -261,13 +261,13 @@ signals: /** * Emit this if loading is canceled by the user or by an error. **/ - void canceled( const QString &errMsg ); + void canceled( const TQString &errMsg ); /** * Emitted by the part, to set the caption of the window(s) * hosting this part */ - void setWindowCaption( const QString & caption ); + void setWindowCaption( const TQString & caption ); }; diff --git a/keduca/libkeduca/kgallerydialog.cpp b/keduca/libkeduca/kgallerydialog.cpp index 0ab2d126..b1ec43e2 100644 --- a/keduca/libkeduca/kgallerydialog.cpp +++ b/keduca/libkeduca/kgallerydialog.cpp @@ -24,13 +24,13 @@ #include <kmessagebox.h> #include <kio/netaccess.h> -#include <qlineedit.h> -#include <qlistview.h> -#include <qsplitter.h> -#include <qdom.h> -#include <qfileinfo.h> +#include <tqlineedit.h> +#include <tqlistview.h> +#include <tqsplitter.h> +#include <tqdom.h> +#include <tqfileinfo.h> -KGalleryDialog::KGalleryDialog(QWidget *parent, const char *name ) +KGalleryDialog::KGalleryDialog(TQWidget *parent, const char *name ) :KGalleryDialogBase(parent,name) { configRead(); @@ -42,7 +42,7 @@ KGalleryDialog::~KGalleryDialog() /** Open keduca file. This function can open a remote or local url. */ bool KGalleryDialog::openFile(const KURL &url) { - QString tmpFile; + TQString tmpFile; bool returnval=false; if( KIO::NetAccess::download( url, tmpFile, this ) ) { @@ -59,11 +59,11 @@ bool KGalleryDialog::openFile(const KURL &url) { return returnval; } -bool KGalleryDialog::loadFile( const QString &filename ) +bool KGalleryDialog::loadFile( const TQString &filename ) { - QDomDocument doc("document.xml"); + TQDomDocument doc("document.xml"); - QFile file(filename); + TQFile file(filename); if(!file.open(IO_ReadOnly)) { @@ -74,16 +74,16 @@ bool KGalleryDialog::loadFile( const QString &filename ) if( doc.doctype().name() != "educagallery" ) { return false; } - QDomElement docElem = doc.documentElement(); - QDomNode n = docElem.firstChild(); + TQDomElement docElem = doc.documentElement(); + TQDomNode n = docElem.firstChild(); kdDebug()<<"... load attributes: "<< docElem.tagName() <<endl; - QDomNodeList dnList = n.childNodes(); + TQDomNodeList dnList = n.childNodes(); for( unsigned int i = 0; i < dnList.count(); ++i) { - QListViewItem *newItem = new QListViewItem(listDocuments); - QDomElement serversNode = dnList.item(i).toElement(); + TQListViewItem *newItem = new TQListViewItem(listDocuments); + TQDomElement serversNode = dnList.item(i).toElement(); kdDebug()<<"... load attributes: "<< serversNode.text() <<endl; @@ -105,13 +105,13 @@ bool KGalleryDialog::loadFile( const QString &filename ) void KGalleryDialog::configRead() { KConfig *appconfig = KGlobal::config(); - QStringList servers; - QStringList ipservers; - QStringList::Iterator it_ipservers; + TQStringList servers; + TQStringList ipservers; + TQStringList::Iterator it_ipservers; appconfig->setGroup( "kgallerydialog" ); _split->setSizes( appconfig->readIntListEntry("Splitter_size") ); - QSize defaultSize(500,400); + TQSize defaultSize(500,400); resize( appconfig->readSizeEntry("Geometry", &defaultSize ) ); appconfig->setGroup("Galleries Servers"); @@ -125,9 +125,9 @@ void KGalleryDialog::configRead() } it_ipservers=ipservers.begin(); - for ( QStringList::Iterator it_servers = servers.begin(); it_servers != servers.end(); ++it_servers ) + for ( TQStringList::Iterator it_servers = servers.begin(); it_servers != servers.end(); ++it_servers ) { - QListViewItem *newItem = new QListViewItem(listServers); + TQListViewItem *newItem = new TQListViewItem(listServers); newItem->setText(0,*it_servers); newItem->setText(1,*it_ipservers); newItem->setSelected(false); @@ -138,8 +138,8 @@ void KGalleryDialog::configRead() /** Write servers lists */ void KGalleryDialog::configWrite() { - QStringList servers; - QStringList ipservers; + TQStringList servers; + TQStringList ipservers; KConfig *config = KGlobal::config(); config->setGroup( "kgallerydialog" ); @@ -148,7 +148,7 @@ void KGalleryDialog::configWrite() config->sync(); config->setGroup("Galleries Servers"); - QListViewItem *item = listServers->firstChild(); + TQListViewItem *item = listServers->firstChild(); while (item) { servers.append( item->text(0) ); ipservers.append( item->text(1) ); @@ -169,7 +169,7 @@ void KGalleryDialog::slotButtonAdd() return; } - QListViewItem *newItem = new QListViewItem(listServers); + TQListViewItem *newItem = new TQListViewItem(listServers); newItem->setText(0,lineName->text()); newItem->setText(1,lineAddress->text()); newItem->setSelected(false); @@ -185,11 +185,11 @@ void KGalleryDialog::accept() configWrite(); KGalleryDialogBase::accept(); } -// done( QDialog::Accepted ); +// done( TQDialog::Accepted ); } /** Select Server */ -void KGalleryDialog::slotServerSelected( QListViewItem *item ) +void KGalleryDialog::slotServerSelected( TQListViewItem *item ) { if (!item) return; @@ -203,16 +203,16 @@ void KGalleryDialog::slotServerSelected( QListViewItem *item ) /** Get keduca test url */ KURL KGalleryDialog::getURL() { - QListViewItem *item = listDocuments->currentItem(); + TQListViewItem *item = listDocuments->currentItem(); if (!item) return KURL(); - QString urlAddress = item->text(5); + TQString urlAddress = item->text(5); if( _currentURL.isLocalFile() && !KURL(urlAddress).isValid() ) { - if( !QFileInfo(urlAddress).exists() ) + if( !TQFileInfo(urlAddress).exists() ) urlAddress = _currentURL.directory(false,true) + urlAddress; kdDebug()<< "Imagen en local" <<endl; } else if( !_currentURL.isLocalFile() && !KURL(urlAddress).isValid() ) @@ -225,7 +225,7 @@ KURL KGalleryDialog::getURL() /** Add url */ void KGalleryDialog::putURL(const KURL &urlFile) { - QListViewItem *newItem = new QListViewItem(listServers); + TQListViewItem *newItem = new TQListViewItem(listServers); newItem->setText( 1, urlFile.url() ); newItem->setSelected(false); } diff --git a/keduca/libkeduca/kgallerydialog.h b/keduca/libkeduca/kgallerydialog.h index a662bde6..41383091 100644 --- a/keduca/libkeduca/kgallerydialog.h +++ b/keduca/libkeduca/kgallerydialog.h @@ -36,7 +36,7 @@ namespace KIO { class Job; } class KGalleryDialog : public KGalleryDialogBase { Q_OBJECT public: - KGalleryDialog(QWidget *parent=0, const char *name=0); + KGalleryDialog(TQWidget *parent=0, const char *name=0); ~KGalleryDialog(); /** Open keduca file. This function can open a remote or local url. */ bool openFile( const KURL &url ); @@ -50,10 +50,10 @@ protected slots: // Private slots /** Open selected document */ void accept(); /** Select Server */ - void slotServerSelected( QListViewItem *item ); + void slotServerSelected( TQListViewItem *item ); protected: /** Open keduca file. This function does the actual work and expects a local filename . */ - bool loadFile( const QString &filename ); + bool loadFile( const TQString &filename ); private: // Private attributes /** Current url */ KURL _currentURL; |