diff options
Diffstat (limited to 'src/translators/bibtexexporter.cpp')
-rw-r--r-- | src/translators/bibtexexporter.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/src/translators/bibtexexporter.cpp b/src/translators/bibtexexporter.cpp index 2706ac8..d1aa57b 100644 --- a/src/translators/bibtexexporter.cpp +++ b/src/translators/bibtexexporter.cpp @@ -28,13 +28,13 @@ #include <kconfig.h> #include <kcombobox.h> -#include <qregexp.h> -#include <qcheckbox.h> -#include <qlayout.h> -#include <qgroupbox.h> -#include <qwhatsthis.h> -#include <qlabel.h> -#include <qhbox.h> +#include <tqregexp.h> +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqgroupbox.h> +#include <tqwhatsthis.h> +#include <tqlabel.h> +#include <tqhbox.h> using Tellico::Export::BibtexExporter; @@ -45,12 +45,12 @@ BibtexExporter::BibtexExporter() : Tellico::Export::Exporter(), m_widget(0) { } -QString BibtexExporter::formatString() const { +TQString BibtexExporter::formatString() const { return i18n("Bibtex"); } -QString BibtexExporter::fileFilter() const { - return i18n("*.bib|Bibtex Files (*.bib)") + QChar('\n') + i18n("*|All Files"); +TQString BibtexExporter::fileFilter() const { + return i18n("*.bib|Bibtex Files (*.bib)") + TQChar('\n') + i18n("*|All Files"); } bool BibtexExporter::exec() { @@ -62,19 +62,19 @@ bool BibtexExporter::exec() { // there are some special attributes // the entry-type specifies the entry type - book, inproceedings, whatever - QString typeField; + TQString typeField; // the key specifies the cite-key - QString keyField; + TQString keyField; // the crossref bibtex field can reference another entry - QString crossRefField; + TQString crossRefField; bool hasCrossRefs = false; - const QString bibtex = QString::fromLatin1("bibtex"); + const TQString bibtex = TQString::tqfromLatin1("bibtex"); // keep a list of all the 'ordinary' fields to iterate through later Data::FieldVec fields; Data::FieldVec vec = coll->fields(); for(Data::FieldVec::Iterator it = vec.begin(); it != vec.end(); ++it) { - QString bibtexField = it->property(bibtex); + TQString bibtexField = it->property(bibtex); if(bibtexField == Latin1Literal("entry-type")) { typeField = it->name(); } else if(bibtexField == Latin1Literal("key")) { @@ -98,24 +98,24 @@ bool BibtexExporter::exec() { return false; } - QString text = QString::fromLatin1("@comment{Generated by Tellico ") - + QString::fromLatin1(VERSION) - + QString::fromLatin1("}\n\n"); + TQString text = TQString::tqfromLatin1("@comment{Generated by Tellico ") + + TQString::tqfromLatin1(VERSION) + + TQString::tqfromLatin1("}\n\n"); if(!coll->preamble().isEmpty()) { - text += QString::fromLatin1("@preamble{") + coll->preamble() + QString::fromLatin1("}\n\n"); + text += TQString::tqfromLatin1("@preamble{") + coll->preamble() + TQString::tqfromLatin1("}\n\n"); } - const QStringList macros = coll->macroList().keys(); + const TQStringList macros = coll->macroList().keys(); if(!m_expandMacros) { - QMap<QString, QString>::ConstIterator macroIt; + TQMap<TQString, TQString>::ConstIterator macroIt; for(macroIt = coll->macroList().constBegin(); macroIt != coll->macroList().constEnd(); ++macroIt) { if(!macroIt.data().isEmpty()) { - text += QString::fromLatin1("@string{") + text += TQString::tqfromLatin1("@string{") + macroIt.key() - + QString::fromLatin1("=") + + TQString::tqfromLatin1("=") + BibtexHandler::exportText(macroIt.data(), macros) - + QString::fromLatin1("}\n\n"); + + TQString::tqfromLatin1("}\n\n"); } } } @@ -132,7 +132,7 @@ bool BibtexExporter::exec() { StringSet usedKeys; Data::ConstEntryVec crossRefs; - QString type, key, newKey, value; + TQString type, key, newKey, value; for(Data::EntryVec::ConstIterator entryIt = entries().begin(); entryIt != entries().end(); ++entryIt) { type = entryIt->field(typeField); if(type.isEmpty()) { @@ -190,41 +190,41 @@ bool BibtexExporter::exec() { return FileHandler::writeTextURL(url(), text, options() & ExportUTF8, options() & Export::ExportForce); } -QWidget* BibtexExporter::widget(QWidget* parent_, const char* name_/*=0*/) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* BibtexExporter::widget(TQWidget* tqparent_, const char* name_/*=0*/) { + if(m_widget && TQT_BASE_OBJECT(m_widget->tqparent()) == TQT_BASE_OBJECT(tqparent_)) { return m_widget; } - m_widget = new QWidget(parent_, name_); - QVBoxLayout* l = new QVBoxLayout(m_widget); + m_widget = new TQWidget(tqparent_, name_); + TQVBoxLayout* l = new TQVBoxLayout(m_widget); - QGroupBox* box = new QGroupBox(1, Qt::Horizontal, i18n("Bibtex Options"), m_widget); + TQGroupBox* box = new TQGroupBox(1, Qt::Horizontal, i18n("Bibtex Options"), m_widget); l->addWidget(box); - m_checkExpandMacros = new QCheckBox(i18n("Expand string macros"), box); + m_checkExpandMacros = new TQCheckBox(i18n("Expand string macros"), box); m_checkExpandMacros->setChecked(m_expandMacros); - QWhatsThis::add(m_checkExpandMacros, i18n("If checked, the string macros will be expanded and no " + TQWhatsThis::add(m_checkExpandMacros, i18n("If checked, the string macros will be expanded and no " "@string{} entries will be written.")); - m_checkPackageURL = new QCheckBox(i18n("Use URL package"), box); + m_checkPackageURL = new TQCheckBox(i18n("Use URL package"), box); m_checkPackageURL->setChecked(m_packageURL); - QWhatsThis::add(m_checkPackageURL, i18n("If checked, any URL fields will be wrapped in a " + TQWhatsThis::add(m_checkPackageURL, i18n("If checked, any URL fields will be wrapped in a " "\\url declaration.")); - m_checkSkipEmpty = new QCheckBox(i18n("Skip entries with empty citation keys"), box); + m_checkSkipEmpty = new TQCheckBox(i18n("Skip entries with empty citation keys"), box); m_checkSkipEmpty->setChecked(m_skipEmptyKeys); - QWhatsThis::add(m_checkSkipEmpty, i18n("If checked, any entries without a bibtex citation key " + TQWhatsThis::add(m_checkSkipEmpty, i18n("If checked, any entries without a bibtex citation key " "will be skipped.")); - QHBox* hbox = new QHBox(box); - QLabel* l1 = new QLabel(i18n("Bibtex quotation style:") + ' ', hbox); // add a space for astheticss + TQHBox* hbox = new TQHBox(box); + TQLabel* l1 = new TQLabel(i18n("Bibtex quotation style:") + ' ', hbox); // add a space for astheticss m_cbBibtexStyle = new KComboBox(hbox); m_cbBibtexStyle->insertItem(i18n("Braces")); m_cbBibtexStyle->insertItem(i18n("Quotes")); - QString whats = i18n("<qt>The quotation style used when exporting bibtex. All field values will " + TQString whats = i18n("<qt>The quotation style used when exporting bibtex. All field values will " " be escaped with either braces or quotation marks.</qt>"); - QWhatsThis::add(l1, whats); - QWhatsThis::add(m_cbBibtexStyle, whats); + TQWhatsThis::add(l1, whats); + TQWhatsThis::add(m_cbBibtexStyle, whats); if(BibtexHandler::s_quoteStyle == BibtexHandler::BRACES) { m_cbBibtexStyle->setCurrentItem(i18n("Braces")); } else { @@ -236,7 +236,7 @@ QWidget* BibtexExporter::widget(QWidget* parent_, const char* name_/*=0*/) { } void BibtexExporter::readOptions(KConfig* config_) { - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_expandMacros = group.readBoolEntry("Expand Macros", m_expandMacros); m_packageURL = group.readBoolEntry("URL Package", m_packageURL); m_skipEmptyKeys = group.readBoolEntry("Skip Empty Keys", m_skipEmptyKeys); @@ -244,12 +244,12 @@ void BibtexExporter::readOptions(KConfig* config_) { if(group.readBoolEntry("Use Braces", true)) { BibtexHandler::s_quoteStyle = BibtexHandler::BRACES; } else { - BibtexHandler::s_quoteStyle = BibtexHandler::QUOTES; + BibtexHandler::s_quoteStyle = BibtexHandler::TQUOTES; } } void BibtexExporter::saveOptions(KConfig* config_) { - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_expandMacros = m_checkExpandMacros->isChecked(); group.writeEntry("Expand Macros", m_expandMacros); m_packageURL = m_checkPackageURL->isChecked(); @@ -262,19 +262,19 @@ void BibtexExporter::saveOptions(KConfig* config_) { if(useBraces) { BibtexHandler::s_quoteStyle = BibtexHandler::BRACES; } else { - BibtexHandler::s_quoteStyle = BibtexHandler::QUOTES; + BibtexHandler::s_quoteStyle = BibtexHandler::TQUOTES; } } -void BibtexExporter::writeEntryText(QString& text_, const Data::FieldVec& fields_, const Data::Entry& entry_, - const QString& type_, const QString& key_) { - const QStringList macros = static_cast<const Data::BibtexCollection*>(Data::Document::self()->collection().data())->macroList().keys(); - const QString bibtex = QString::fromLatin1("bibtex"); - const QString bibtexSep = QString::fromLatin1("bibtex-separator"); +void BibtexExporter::writeEntryText(TQString& text_, const Data::FieldVec& fields_, const Data::Entry& entry_, + const TQString& type_, const TQString& key_) { + const TQStringList macros = static_cast<const Data::BibtexCollection*>(Data::Document::self()->collection().data())->macroList().keys(); + const TQString bibtex = TQString::tqfromLatin1("bibtex"); + const TQString bibtexSep = TQString::tqfromLatin1("bibtex-separator"); text_ += '@' + type_ + '{' + key_; - QString value; + TQString value; Data::FieldVec::ConstIterator fIt, end = fields_.constEnd(); bool format = options() & Export::ExportFormatted; for(fIt = fields_.constBegin(); fIt != end; ++fIt) { @@ -287,40 +287,40 @@ void BibtexExporter::writeEntryText(QString& text_, const Data::FieldVec& fields // insert "and" in between them (e.g. author and editor) if(fIt->formatFlag() == Data::Field::FormatName && fIt->flags() & Data::Field::AllowMultiple) { - value.replace(Data::Field::delimiter(), QString::fromLatin1(" and ")); + value.tqreplace(Data::Field::delimiter(), TQString::tqfromLatin1(" and ")); } else if(fIt->flags() & Data::Field::AllowMultiple) { - QString bibsep = fIt->property(bibtexSep); + TQString bibsep = fIt->property(bibtexSep); if(!bibsep.isEmpty()) { - value.replace(Data::Field::delimiter(), bibsep); + value.tqreplace(Data::Field::delimiter(), bibsep); } } else if(fIt->type() == Data::Field::Para) { // strip HTML from bibtex export - QRegExp stripHTML(QString::fromLatin1("<.*>"), true); + TQRegExp stripHTML(TQString::tqfromLatin1("<.*>"), true); stripHTML.setMinimal(true); value.remove(stripHTML); } else if(fIt->property(bibtex) == Latin1Literal("pages")) { - QRegExp rx(QString::fromLatin1("(\\d)-(\\d)")); + TQRegExp rx(TQString::tqfromLatin1("(\\d)-(\\d)")); for(int pos = rx.search(value); pos > -1; pos = rx.search(value, pos+2)) { - value.replace(pos, 3, rx.cap(1)+"--"+rx.cap(2)); + value.tqreplace(pos, 3, rx.cap(1)+"--"+rx.cap(2)); } } if(m_packageURL && fIt->type() == Data::Field::URL) { bool b = BibtexHandler::s_quoteStyle == BibtexHandler::BRACES; - value = (b ? QChar('{') : QChar('"')) - + QString::fromLatin1("\\url{") + BibtexHandler::exportText(value, macros) + QChar('}') - + (b ? QChar('}') : QChar('"')); + value = (b ? TQChar('{') : TQChar('"')) + + TQString::tqfromLatin1("\\url{") + BibtexHandler::exportText(value, macros) + TQChar('}') + + (b ? TQChar('}') : TQChar('"')); } else if(fIt->type() != Data::Field::Number) { // numbers aren't escaped, nor will they have macros // if m_expandMacros is true, then macros is empty, so this is ok even then value = BibtexHandler::exportText(value, macros); } - text_ += QString::fromLatin1(",\n ") + text_ += TQString::tqfromLatin1(",\n ") + fIt->property(bibtex) - + QString::fromLatin1(" = ") + + TQString::tqfromLatin1(" = ") + value; } - text_ += QString::fromLatin1("\n}\n\n"); + text_ += TQString::tqfromLatin1("\n}\n\n"); } #include "bibtexexporter.moc" |