From 5f5e7c5455d52826b0bd50f64fcffb7695ce970d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sat, 29 Jun 2013 12:56:53 +0200 Subject: Initial TQt conversion --- src/fileimporterbibutils.cpp | 104 +++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'src/fileimporterbibutils.cpp') diff --git a/src/fileimporterbibutils.cpp b/src/fileimporterbibutils.cpp index bd2b622..52195b3 100644 --- a/src/fileimporterbibutils.cpp +++ b/src/fileimporterbibutils.cpp @@ -19,13 +19,13 @@ ***************************************************************************/ #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -37,7 +37,7 @@ namespace BibTeX FileImporterBibUtils::FileImporterBibUtils( BibTeX::File::FileFormat inputFormat ) : FileImporter(), m_workingDir( createTempDir() ), m_inputFormat( inputFormat ), m_bibTeXImporter( new FileImporterBibTeX( false, "utf-8" ) ) { - m_processBuffer = new QBuffer(); + m_processBuffer = new TQBuffer(); } FileImporterBibUtils::~FileImporterBibUtils() @@ -47,17 +47,17 @@ namespace BibTeX delete m_bibTeXImporter; } - File* FileImporterBibUtils::load( QIODevice *iodevice ) + File* FileImporterBibUtils::load( TQIODevice *iodevice ) { m_cancelFlag = false; if ( !iodevice->isReadable() ) { - qDebug( "iodevice is not readable" ); + tqDebug( "iodevice is not readable" ); return NULL; } if ( !iodevice->isOpen() ) { - qDebug( "iodevice is not open" ); + tqDebug( "iodevice is not open" ); return NULL; } @@ -67,12 +67,12 @@ namespace BibTeX return xmlBufferToBibTeXFile(); } - bool FileImporterBibUtils::guessCanDecode( const QString & text ) + bool FileImporterBibUtils::guessCanDecode( const TQString & text ) { return guessInputFormat( text ) != BibTeX::File::formatUndefined; } - File::FileFormat FileImporterBibUtils::guessInputFormat( const QString &text ) + File::FileFormat FileImporterBibUtils::guessInputFormat( const TQString &text ) { if ( text.find( "TY - " ) >= 0 ) return BibTeX::File::formatRIS; @@ -90,37 +90,37 @@ namespace BibTeX m_cancelFlag = true; } - bool FileImporterBibUtils::iodeviceToXMLbuffer( QIODevice *iodevice ) + bool FileImporterBibUtils::iodeviceToXMLbuffer( TQIODevice *iodevice ) { - QWaitCondition wc; + TQWaitCondition wc; m_processBuffer->open( IO_WriteOnly ); m_process = NULL; switch ( m_inputFormat ) { case BibTeX::File::formatISI: - m_process = new QProcess( QStringList::split( ' ', "isi2xml -i utf8 -u" ) ); + m_process = new TQProcess( TQStringList::split( ' ', "isi2xml -i utf8 -u" ) ); break; case BibTeX::File::formatWordBib: - m_process = new QProcess( QStringList::split( ' ', "wordbib2xml -i utf8 -u" ) ); + m_process = new TQProcess( TQStringList::split( ' ', "wordbib2xml -i utf8 -u" ) ); break; case BibTeX::File::formatAds: - m_process = new QProcess( QStringList::split( ' ', "ads2xml -i utf8 -u" ) ); + m_process = new TQProcess( TQStringList::split( ' ', "ads2xml -i utf8 -u" ) ); break; case BibTeX::File::formatEndNote: - m_process = new QProcess( QStringList::split( ' ', "end2xml -i utf8 -u" ) ); + m_process = new TQProcess( TQStringList::split( ' ', "end2xml -i utf8 -u" ) ); break; case BibTeX::File::formatEndNoteXML: - m_process = new QProcess( QStringList::split( ' ', "endx2xml -i utf8 -u" ) ); + m_process = new TQProcess( TQStringList::split( ' ', "endx2xml -i utf8 -u" ) ); break; case BibTeX::File::formatRIS: - m_process = new QProcess( QStringList::split( ' ', "ris2xml -i utf8 -u" ) ); + m_process = new TQProcess( TQStringList::split( ' ', "ris2xml -i utf8 -u" ) ); break; case BibTeX::File::formatMODS: /* m_process = NULL; */ break; default: - qDebug( "Cannot handle input format %i", m_inputFormat ); + tqDebug( "Cannot handle input format %i", m_inputFormat ); return false; } @@ -134,16 +134,16 @@ namespace BibTeX m_process->start(); if ( m_process->isRunning() ) { - QByteArray inData = iodevice->readAll(); + TQByteArray inData = iodevice->readAll(); m_process->writeToStdin( inData ); - qApp->processEvents(); + tqApp->processEvents(); m_process->closeStdin(); int nothingHappens = 20; while ( m_waiting ) { wc.wait( 250 ); - qApp->processEvents(); + tqApp->processEvents(); --nothingHappens; } @@ -152,14 +152,14 @@ namespace BibTeX if ( !m_process->normalExit() ) { - qDebug( "%s did not exit in a clean fashion", m_process->arguments()[0].latin1() ); + tqDebug( "%s did not exit in a clean fashion", m_process->arguments()[0].latin1() ); delete m_process; return false; } } else { - qDebug( "%s did not start", m_process->arguments()[0].latin1() ); + tqDebug( "%s did not start", m_process->arguments()[0].latin1() ); delete m_process; return false; } @@ -177,22 +177,22 @@ namespace BibTeX BibTeX::File* FileImporterBibUtils::xmlBufferToBibTeXFile() { - QWaitCondition wc; + TQWaitCondition wc; m_waiting = true; - m_process = new QProcess( QStringList::split( ' ', "xml2bib -i utf8 -o utf8 -sk" ) ); + m_process = new TQProcess( TQStringList::split( ' ', "xml2bib -i utf8 -o utf8 -sk" ) ); connect( m_process, SIGNAL( processExited() ), this, SLOT( wakeUp() ) ); connect( m_process, SIGNAL( readyReadStdout() ), this, SLOT( slotReadyStdout() ) ); connect( m_process, SIGNAL( readyReadStderr() ), this, SLOT( slotReadyStderr() ) ); if ( m_process->start() ) { - QBuffer *tempBuffer = m_processBuffer; - m_processBuffer = new QBuffer(); + TQBuffer *tempBuffer = m_processBuffer; + m_processBuffer = new TQBuffer(); tempBuffer->open( IO_ReadOnly ); m_process->writeToStdin( tempBuffer->readAll() ); - qApp->processEvents(); + tqApp->processEvents(); m_process->closeStdin(); tempBuffer->close(); @@ -201,7 +201,7 @@ namespace BibTeX while ( m_waiting ) { wc.wait( 250 ); - qApp->processEvents(); + tqApp->processEvents(); --nothingHappens; } m_processBuffer->close(); @@ -234,20 +234,20 @@ namespace BibTeX return NULL; } - QString FileImporterBibUtils::createTempDir() + TQString FileImporterBibUtils::createTempDir() { - QString result = QString::null; - QFile *devrandom = new QFile( "/dev/random" ); + TQString result = TQString::null; + TQFile *devrandom = new TQFile( "/dev/random" ); if ( devrandom->open( IO_ReadOnly ) ) { - Q_UINT32 randomNumber; + TQ_UINT32 randomNumber; if ( devrandom->readBlock(( char* ) & randomNumber, sizeof( randomNumber ) ) > 0 ) { randomNumber |= 0x10000000; - result = QString( "/tmp/bibtex-%1" ).arg( randomNumber, sizeof( randomNumber ) * 2, 16 ); - if ( !QDir().mkdir( result ) ) - result = QString::null; + result = TQString( "/tmp/bibtex-%1" ).arg( randomNumber, sizeof( randomNumber ) * 2, 16 ); + if ( !TQDir().mkdir( result ) ) + result = TQString::null; } devrandom->close(); } @@ -257,20 +257,20 @@ namespace BibTeX return result; } - void FileImporterBibUtils::deleteTempDir( const QString& directory ) + void FileImporterBibUtils::deleteTempDir( const TQString& directory ) { - QDir dir = QDir( directory ); - QStringList subDirs = dir.entryList( QDir::Dirs ); - for ( QStringList::Iterator it = subDirs.begin(); it != subDirs.end(); it++ ) + TQDir dir = TQDir( directory ); + TQStringList subDirs = dir.entryList( TQDir::Dirs ); + for ( TQStringList::Iterator it = subDirs.begin(); it != subDirs.end(); it++ ) { - if (( QString::compare( *it, "." ) != 0 ) && ( QString::compare( *it, ".." ) != 0 ) ) + if (( TQString::compare( *it, "." ) != 0 ) && ( TQString::compare( *it, ".." ) != 0 ) ) deleteTempDir( *it ); } - QStringList allEntries = dir.entryList( QDir::All ); - for ( QStringList::Iterator it = allEntries.begin(); it != allEntries.end(); it++ ) + TQStringList allEntries = dir.entryList( TQDir::All ); + for ( TQStringList::Iterator it = allEntries.begin(); it != allEntries.end(); it++ ) dir.remove( *it ); - QDir().rmdir( directory ); + TQDir().rmdir( directory ); } void FileImporterBibUtils::wakeUp() @@ -285,10 +285,10 @@ namespace BibTeX void FileImporterBibUtils::slotReadyStderr() { - QByteArray ba = m_process->readStderr(); - QTextStream bats( ba, IO_ReadOnly ); - bats.setEncoding( QTextStream::UnicodeUTF8 ); - qDebug( "%s", bats.read().latin1() ); + TQByteArray ba = m_process->readStderr(); + TQTextStream bats( ba, IO_ReadOnly ); + bats.setEncoding( TQTextStream::UnicodeUTF8 ); + tqDebug( "%s", bats.read().latin1() ); } } -- cgit v1.2.3