summaryrefslogtreecommitdiffstats
path: root/src/fileexporterbibtex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileexporterbibtex.cpp')
-rw-r--r--src/fileexporterbibtex.cpp108
1 files changed, 54 insertions, 54 deletions
diff --git a/src/fileexporterbibtex.cpp b/src/fileexporterbibtex.cpp
index 240754d..03ed618 100644
--- a/src/fileexporterbibtex.cpp
+++ b/src/fileexporterbibtex.cpp
@@ -42,7 +42,7 @@ namespace BibTeX
delete[] m_iconvBuffer;
}
- bool FileExporterBibTeX::save( QIODevice* iodevice, const File* bibtexfile, QStringList * /*errorLog*/ )
+ bool FileExporterBibTeX::save( TQIODevice* iodevice, const File* bibtexfile, TQStringList * /*errorLog*/ )
{
m_mutex.lock();
bool result = TRUE;
@@ -53,11 +53,11 @@ namespace BibTeX
* in the correct order.
*/
- QValueList<Comment*> parameterCommentsList;
- QValueList<Preamble*> preambleList;
- QValueList<Macro*> macroList;
- QValueList<Entry*> crossRefingEntryList;
- QValueList<Element*> remainingList;
+ TQValueList<Comment*> parameterCommentsList;
+ TQValueList<Preamble*> preambleList;
+ TQValueList<Macro*> macroList;
+ TQValueList<Entry*> crossRefingEntryList;
+ TQValueList<Element*> remainingList;
for ( File::ElementList::const_iterator it = bibtexfile->elements.begin(); it != bibtexfile->elements.end() && result && !cancelFlag; it++ )
{
@@ -77,12 +77,12 @@ namespace BibTeX
else
{
Comment *comment = dynamic_cast<Comment*>( *it );
- QString commentText = QString::null;
+ TQString commentText = TQString::null;
/** check if this file requests a special encoding */
if ( comment != NULL && comment->useCommand() && (( commentText = comment->text().lower() ) ).startsWith( "x-kbibtex-encoding=" ) )
{
m_encoding = commentText.mid( 19 );
- qDebug( "Switching encoding to <%s>", m_encoding.latin1() );
+ tqDebug( "Switching encoding to <%s>", m_encoding.latin1() );
parameterCommentsList.append( comment );
}
else
@@ -99,34 +99,34 @@ namespace BibTeX
m_iconvHandle = iconv_open( encodingTo, "utf-8" );
/** before anything else, write parameter comments */
- for ( QValueList<Comment*>::iterator it = parameterCommentsList.begin(); it != parameterCommentsList.end() && result && !cancelFlag; it++ )
+ for ( TQValueList<Comment*>::iterator it = parameterCommentsList.begin(); it != parameterCommentsList.end() && result && !cancelFlag; it++ )
{
result &= writeComment( *iodevice, *it );
emit progress( ++currentPos, totalElements );
}
/** first, write preambles and strings (macros) at the beginning */
- for ( QValueList<Preamble*>::iterator it = preambleList.begin(); it != preambleList.end() && result && !cancelFlag; it++ )
+ for ( TQValueList<Preamble*>::iterator it = preambleList.begin(); it != preambleList.end() && result && !cancelFlag; it++ )
{
result &= writePreamble( *iodevice, *it );
emit progress( ++currentPos, totalElements );
}
- for ( QValueList<Macro*>::iterator it = macroList.begin(); it != macroList.end() && result && !cancelFlag; it++ )
+ for ( TQValueList<Macro*>::iterator it = macroList.begin(); it != macroList.end() && result && !cancelFlag; it++ )
{
result &= writeMacro( *iodevice, *it );
emit progress( ++currentPos, totalElements );
}
/** second, write cross-referencing elements */
- for ( QValueList<Entry*>::iterator it = crossRefingEntryList.begin(); it != crossRefingEntryList.end() && result && !cancelFlag; it++ )
+ for ( TQValueList<Entry*>::iterator it = crossRefingEntryList.begin(); it != crossRefingEntryList.end() && result && !cancelFlag; it++ )
{
result &= writeEntry( *iodevice, *it );
emit progress( ++currentPos, totalElements );
}
/** third, write remaining elements */
- for ( QValueList<Element*>::iterator it = remainingList.begin(); it != remainingList.end() && result && !cancelFlag; it++ )
+ for ( TQValueList<Element*>::iterator it = remainingList.begin(); it != remainingList.end() && result && !cancelFlag; it++ )
{
Entry *entry = dynamic_cast<Entry*>( *it );
if ( entry != NULL )
@@ -145,7 +145,7 @@ namespace BibTeX
return result && !cancelFlag;
}
- bool FileExporterBibTeX::save( QIODevice* iodevice, const Element* element, QStringList * /*errorLog*/ )
+ bool FileExporterBibTeX::save( TQIODevice* iodevice, const Element* element, TQStringList * /*errorLog*/ )
{
m_mutex.lock();
bool result = FALSE;
@@ -185,44 +185,44 @@ namespace BibTeX
cancelFlag = TRUE;
}
- bool FileExporterBibTeX::writeEntry( QIODevice &device, const Entry* entry )
+ bool FileExporterBibTeX::writeEntry( TQIODevice &device, const Entry* entry )
{
- writeString( device, QString( "@%1{ %2" ).arg( applyKeywordCasing( entry->entryTypeString() ) ).arg( entry->id() ) );
+ writeString( device, TQString( "@%1{ %2" ).arg( applyKeywordCasing( entry->entryTypeString() ) ).arg( entry->id() ) );
for ( Entry::EntryFields::ConstIterator it = entry->begin(); it != entry->end(); ++it )
{
EntryField *field = *it;
- QString text = valueToString( field->value(), field->fieldType(), field->fieldTypeName() );
+ TQString text = valueToString( field->value(), field->fieldType(), field->fieldTypeName() );
if ( m_protectCasing && dynamic_cast<BibTeX::PlainText*>( field->value()->items.first() ) != NULL && ( field->fieldType() == EntryField::ftTitle || field->fieldType() == EntryField::ftBookTitle || field->fieldType() == EntryField::ftSeries ) )
addProtectiveCasing( text );
- writeString( device, QString( ",\n\t%1 = %2" ).arg( field->fieldTypeName() ).arg( text ) );
+ writeString( device, TQString( ",\n\t%1 = %2" ).arg( field->fieldTypeName() ).arg( text ) );
}
writeString( device, "\n}\n\n" );
return TRUE;
}
- bool FileExporterBibTeX::writeMacro( QIODevice &device, const Macro *macro )
+ bool FileExporterBibTeX::writeMacro( TQIODevice &device, const Macro *macro )
{
- QString text = valueToString( macro->value() );
+ TQString text = valueToString( macro->value() );
if ( m_protectCasing )
addProtectiveCasing( text );
- writeString( device, QString( "@%1{ %2 = %3 }\n\n" ).arg( applyKeywordCasing( "String" ) ).arg( macro->key() ).arg( text ) );
+ writeString( device, TQString( "@%1{ %2 = %3 }\n\n" ).arg( applyKeywordCasing( "String" ) ).arg( macro->key() ).arg( text ) );
return TRUE;
}
- bool FileExporterBibTeX::writeComment( QIODevice &device, const Comment *comment )
+ bool FileExporterBibTeX::writeComment( TQIODevice &device, const Comment *comment )
{
if ( !comment->useCommand() )
{
- QString text = comment->text() ;
+ TQString text = comment->text() ;
if ( m_encoding == "latex" )
text = EncoderLaTeX::currentEncoderLaTeX() ->encode( text );
- QStringList commentLines = QStringList::split( '\n', text );
- for ( QStringList::Iterator it = commentLines.begin(); it != commentLines.end(); it++ )
+ TQStringList commentLines = TQStringList::split( '\n', text );
+ for ( TQStringList::Iterator it = commentLines.begin(); it != commentLines.end(); it++ )
{
writeString( device, ( *it ).append( "\n" ) );
}
@@ -230,27 +230,27 @@ namespace BibTeX
}
else
{
- QString text = comment->text() ;
+ TQString text = comment->text() ;
if ( m_encoding == "latex" )
text = EncoderLaTeX::currentEncoderLaTeX() ->encode( text );
- writeString( device, QString( "@%1{%2}\n\n" ).arg( applyKeywordCasing( "Comment" ) ).arg( text ) );
+ writeString( device, TQString( "@%1{%2}\n\n" ).arg( applyKeywordCasing( "Comment" ) ).arg( text ) );
}
return TRUE;
}
- bool FileExporterBibTeX::writePreamble( QIODevice &device, const Preamble* preamble )
+ bool FileExporterBibTeX::writePreamble( TQIODevice &device, const Preamble* preamble )
{
- writeString( device, QString( "@%1{%2}\n\n" ).arg( applyKeywordCasing( "Preamble" ) ).arg( valueToString( preamble->value() ) ) );
+ writeString( device, TQString( "@%1{%2}\n\n" ).arg( applyKeywordCasing( "Preamble" ) ).arg( valueToString( preamble->value() ) ) );
return TRUE;
}
- bool FileExporterBibTeX::writeString( QIODevice &device, const QString& text )
+ bool FileExporterBibTeX::writeString( TQIODevice &device, const TQString& text )
{
size_t utf8datasize = 1;
- QCString utf8 = text.utf8();
+ TQCString utf8 = text.utf8();
char *utf8data = utf8.data();
utf8datasize = utf8.length();
char *outputdata = m_iconvBuffer;
@@ -259,20 +259,20 @@ namespace BibTeX
size_t result = iconv( m_iconvHandle, &utf8data, &utf8datasize, &outputdata, &outputdatasize );
if ( result != 0 )
{
- qWarning( "Cannot convert string using iconv" );
+ tqWarning( "Cannot convert string using iconv" );
return false;
}
if ( device.writeBlock( m_iconvBuffer, m_iconvBufferSize - outputdatasize ) != ( int )( m_iconvBufferSize - outputdatasize ) )
{
- qWarning( "Cannot write string to device" );
+ tqWarning( "Cannot write string to device" );
return false;
}
return true;
}
- void FileExporterBibTeX::setStringDelimiter( const QChar& stringOpenDelimiter, const QChar& stringCloseDelimiter )
+ void FileExporterBibTeX::setStringDelimiter( const TQChar& stringOpenDelimiter, const TQChar& stringCloseDelimiter )
{
m_stringOpenDelimiter = stringOpenDelimiter;
m_stringCloseDelimiter = stringCloseDelimiter;
@@ -283,7 +283,7 @@ namespace BibTeX
m_keywordCasing = keywordCasing;
}
- void FileExporterBibTeX::setEncoding( const QString& encoding )
+ void FileExporterBibTeX::setEncoding( const TQString& encoding )
{
m_encoding = encoding;
}
@@ -293,16 +293,16 @@ namespace BibTeX
m_protectCasing = protectCasing;
}
- QString FileExporterBibTeX::valueToString( const Value *value, const EntryField::FieldType fieldType, const QString &fieldTypeName )
+ TQString FileExporterBibTeX::valueToString( const Value *value, const EntryField::FieldType fieldType, const TQString &fieldTypeName )
{
if ( value == NULL )
return "";
- QString result;
+ TQString result;
bool isFirst = TRUE;
EncoderLaTeX *encoder = EncoderLaTeX::currentEncoderLaTeX();
- for ( QValueList<ValueItem*>::ConstIterator it = value->items.begin(); it != value->items.end(); ++it )
+ for ( TQValueList<ValueItem*>::ConstIterator it = value->items.begin(); it != value->items.end(); ++it )
{
if ( !isFirst )
result.append( " # " );
@@ -314,7 +314,7 @@ namespace BibTeX
result.append( macroKey->text() );
else
{
- QString text;
+ TQString text;
BibTeX::PersonContainer *personContainer = dynamic_cast<BibTeX::PersonContainer*>( *it );
BibTeX::PlainText *plainText = dynamic_cast<BibTeX::PlainText*>( *it );
BibTeX::KeywordContainer *keywordContainer = dynamic_cast<BibTeX::KeywordContainer*>( *it );
@@ -324,7 +324,7 @@ namespace BibTeX
else if ( keywordContainer != NULL )
{
bool first = TRUE;
- for ( QValueList<Keyword*>::Iterator it = keywordContainer->keywords.begin(); it != keywordContainer->keywords.end(); ++it )
+ for ( TQValueList<Keyword*>::Iterator it = keywordContainer->keywords.begin(); it != keywordContainer->keywords.end(); ++it )
{
if ( !first )
text.append( ", " );
@@ -336,14 +336,14 @@ namespace BibTeX
else if ( personContainer != NULL )
{
bool first = TRUE;
- for ( QValueList<Person*>::Iterator it = personContainer->persons.begin(); it != personContainer->persons.end(); ++it )
+ for ( TQValueList<Person*>::Iterator it = personContainer->persons.begin(); it != personContainer->persons.end(); ++it )
{
if ( !first )
text.append( " and " );
else
first = FALSE;
- QString v = ( *it )->firstName();
+ TQString v = ( *it )->firstName();
if ( !v.isEmpty() )
{
bool requiresQuoting = requiresPersonQuoting( v, FALSE );
@@ -367,12 +367,12 @@ namespace BibTeX
* Thus we split the von-Parts from the surname (= everything after the first upcase char).
* FIXME: Make the personContainer aware of von-Parts and jr-Parts, instead.
*/
- QStringList list = QStringList::split( " ", v );
- QString von;
- for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
+ TQStringList list = TQStringList::split( " ", v );
+ TQString von;
+ for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it )
{
- QString str = *it;
- if ( str != "others" && str[0].category() == QChar::Letter_Lowercase )
+ TQString str = *it;
+ if ( str != "others" && str[0].category() == TQChar::Letter_Lowercase )
{
von += *it;
von += " ";
@@ -404,8 +404,8 @@ namespace BibTeX
* as quote chars as string delimiters would result
* in parser failures
*/
- QChar stringOpenDelimiter = m_stringOpenDelimiter;
- QChar stringCloseDelimiter = m_stringCloseDelimiter;
+ TQChar stringOpenDelimiter = m_stringOpenDelimiter;
+ TQChar stringCloseDelimiter = m_stringCloseDelimiter;
if ( text.contains( '"' ) && ( m_stringOpenDelimiter == '"' || m_stringCloseDelimiter == '"' ) )
{
stringOpenDelimiter = '{';
@@ -419,12 +419,12 @@ namespace BibTeX
return result;
}
- void FileExporterBibTeX::removeBackslashQuoting( QString &text )
+ void FileExporterBibTeX::removeBackslashQuoting( TQString &text )
{
text.replace( "\\&", "&" ).replace( "\\#", "#" ).replace( "\\_", "_" ).replace( "\\%", "%" );
}
- QString FileExporterBibTeX::applyKeywordCasing( const QString &keyword )
+ TQString FileExporterBibTeX::applyKeywordCasing( const TQString &keyword )
{
switch ( m_keywordCasing )
{
@@ -435,12 +435,12 @@ namespace BibTeX
}
}
- bool FileExporterBibTeX::requiresPersonQuoting( const QString &text, bool isLastName )
+ bool FileExporterBibTeX::requiresPersonQuoting( const TQString &text, bool isLastName )
{
if ( isLastName && !text.contains( " " ) )
/** Last name contains NO spaces, no quoting necessary */
return FALSE;
- else if ( isLastName && text[0].category() == QChar::Letter_Lowercase )
+ else if ( isLastName && text[0].category() == TQChar::Letter_Lowercase )
/** Last name starts with lower case character (e.g. as in "van der Linden") */
return FALSE;
else if ( !isLastName && !text.contains( " and " ) )
@@ -464,7 +464,7 @@ namespace BibTeX
return FALSE;
}
- void FileExporterBibTeX::addProtectiveCasing( QString &text )
+ void FileExporterBibTeX::addProtectiveCasing( TQString &text )
{
if (( text[0] != '"' || text[text.length()-1] != '"' ) && ( text[0] != '{' || text[text.length()-1] != '}' ) )
{