summaryrefslogtreecommitdiffstats
path: root/src/translators/bibteximporter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/translators/bibteximporter.cpp')
-rw-r--r--src/translators/bibteximporter.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/translators/bibteximporter.cpp b/src/translators/bibteximporter.cpp
index 2e514d3..8394f6a 100644
--- a/src/translators/bibteximporter.cpp
+++ b/src/translators/bibteximporter.cpp
@@ -23,13 +23,13 @@
#include <kapplication.h>
#include <kconfig.h>
-#include <qptrlist.h>
-#include <qregexp.h>
-#include <qlayout.h>
-#include <qvbuttongroup.h>
-#include <qradiobutton.h>
-#include <qwhatsthis.h>
-#include <qtextcodec.h>
+#include <tqptrlist.h>
+#include <tqregexp.h>
+#include <tqlayout.h>
+#include <tqvbuttongroup.h>
+#include <tqradiobutton.h>
+#include <tqwhatsthis.h>
+#include <tqtextcodec.h>
using Tellico::Import::BibtexImporter;
@@ -38,7 +38,7 @@ BibtexImporter::BibtexImporter(const KURL::List& urls_) : Importer(urls_)
bt_initialize();
}
-BibtexImporter::BibtexImporter(const QString& text_) : Importer(text_)
+BibtexImporter::BibtexImporter(const TQString& text_) : Importer(text_)
, m_coll(0), m_widget(0), m_readUTF8(0), m_readLocale(0), m_cancelled(false) {
bt_initialize();
}
@@ -62,7 +62,7 @@ Tellico::Data::CollPtr BibtexImporter::collection() {
ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true);
item.setTotalSteps(urls().count() * 100);
- connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel()));
+ connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel()));
ProgressItem::Done done(this);
bool useUTF8 = m_widget && m_readUTF8->isChecked();
@@ -72,7 +72,7 @@ Tellico::Data::CollPtr BibtexImporter::collection() {
int count = 0;
// might be importing text only
if(!text().isEmpty()) {
- QString text = this->text();
+ TQString text = this->text();
Data::CollPtr coll = readCollection(text, count);
if(!coll || coll->entryCount() == 0) {
setStatusMessage(i18n("No valid bibtex entries were found"));
@@ -89,13 +89,13 @@ Tellico::Data::CollPtr BibtexImporter::collection() {
if(!(*it).isValid()) {
continue;
}
- QString text = FileHandler::readTextFile(*it, false, useUTF8);
+ TQString text = FileHandler::readTextFile(*it, false, useUTF8);
if(text.isEmpty()) {
continue;
}
Data::CollPtr coll = readCollection(text, count);
if(!coll || coll->entryCount() == 0) {
- setStatusMessage(i18n("No valid bibtex entries were found in file - %1").arg(url().fileName()));
+ setStatusMessage(i18n("No valid bibtex entries were found in file - %1").tqarg(url().fileName()));
continue;
}
m_coll->addEntries(coll->entries());
@@ -108,7 +108,7 @@ Tellico::Data::CollPtr BibtexImporter::collection() {
return m_coll;
}
-Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n) {
+Tellico::Data::CollPtr BibtexImporter::readCollection(const TQString& text, int n) {
if(text.isEmpty()) {
myDebug() << "BibtexImporter::readCollection() - no text" << endl;
return 0;
@@ -125,9 +125,9 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n
return 0;
}
- QString str;
+ TQString str;
const uint count = m_nodes.count();
- const uint stepSize = QMAX(s_stepSize, count/100);
+ const uint stepSize = TQMAX(s_stepSize, count/100);
const bool showProgress = options() & ImportProgress;
uint j = 0;
@@ -136,7 +136,7 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n
if(bt_entry_metatype(it.current()) == BTE_PREAMBLE) {
char* preamble = bt_get_text(it.current());
if(preamble) {
- c->setPreamble(QString::fromUtf8(preamble));
+ c->setPreamble(TQString::fromUtf8(preamble));
}
continue;
}
@@ -146,7 +146,7 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n
(void) bt_next_field(it.current(), 0, &macro);
// FIXME: replace macros within macro definitions!
// lookup lowercase macro in map
- c->addMacro(m_macros[QString::fromUtf8(macro)], QString::fromUtf8(bt_macro_text(macro, 0, 0)));
+ c->addMacro(m_macros[TQString::fromUtf8(macro)], TQString::fromUtf8(bt_macro_text(macro, 0, 0)));
continue;
}
@@ -157,20 +157,20 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n
// now we're parsing a regular entry
Data::EntryPtr entry = new Data::Entry(ptr);
- str = QString::fromUtf8(bt_entry_type(it.current()));
+ str = TQString::fromUtf8(bt_entry_type(it.current()));
// kdDebug() << "entry type: " << str << endl;
// text is automatically put into lower-case by btparse
- BibtexHandler::setFieldValue(entry, QString::fromLatin1("entry-type"), str);
+ BibtexHandler::setFieldValue(entry, TQString::tqfromLatin1("entry-type"), str);
- str = QString::fromUtf8(bt_entry_key(it.current()));
+ str = TQString::fromUtf8(bt_entry_key(it.current()));
// kdDebug() << "entry key: " << str << endl;
- BibtexHandler::setFieldValue(entry, QString::fromLatin1("key"), str);
+ BibtexHandler::setFieldValue(entry, TQString::tqfromLatin1("key"), str);
char* name;
AST* field = 0;
while((field = bt_next_field(it.current(), field, &name))) {
// kdDebug() << "\tfound: " << name << endl;
-// str = QString::fromLatin1(bt_get_text(field));
+// str = TQString::tqfromLatin1(bt_get_text(field));
str.truncate(0);
AST* value = 0;
bt_nodetype type;
@@ -184,7 +184,7 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n
end_macro = false;
break;
case BTAST_MACRO:
- str += QString::fromUtf8(svalue) + '#';
+ str += TQString::fromUtf8(svalue) + '#';
end_macro = true;
break;
default:
@@ -195,9 +195,9 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n
// remove last character '#'
str.truncate(str.length() - 1);
}
- QString fieldName = QString::fromUtf8(name);
+ TQString fieldName = TQString::fromUtf8(name);
if(fieldName == Latin1Literal("author") || fieldName == Latin1Literal("editor")) {
- str.replace(QRegExp(QString::fromLatin1("\\sand\\s")), QString::fromLatin1("; "));
+ str.tqreplace(TQRegExp(TQString::tqfromLatin1("\\sand\\s")), TQString::tqfromLatin1("; "));
}
BibtexHandler::setFieldValue(entry, fieldName, str);
}
@@ -222,7 +222,7 @@ Tellico::Data::CollPtr BibtexImporter::readCollection(const QString& text, int n
return ptr;
}
-void BibtexImporter::parseText(const QString& text) {
+void BibtexImporter::parseText(const TQString& text) {
m_nodes.clear();
m_macros.clear();
@@ -234,15 +234,15 @@ void BibtexImporter::parseText(const QString& text) {
bt_set_stringopts(BTE_MACRODEF, 0);
// bt_set_stringopts(BTE_PREAMBLE, BTO_CONVERT | BTO_EXPAND);
- QString entry;
- QRegExp rx(QString::fromLatin1("[{}]"));
- QRegExp macroName(QString::fromLatin1("@string\\s*\\{\\s*(.*)="), false /*case sensitive*/);
+ TQString entry;
+ TQRegExp rx(TQString::tqfromLatin1("[{}]"));
+ TQRegExp macroName(TQString::tqfromLatin1("@string\\s*\\{\\s*(.*)="), false /*case sensitive*/);
macroName.setMinimal(true);
bool needsCleanup = false;
int brace = 0;
int startpos = 0;
- int pos = text.find(rx, 0);
+ int pos = text.tqfind(rx, 0);
while(pos > 0 && !m_cancelled) {
if(text[pos] == '{') {
++brace;
@@ -259,14 +259,14 @@ void BibtexImporter::parseText(const QString& text) {
if(bt_entry_metatype(node) == BTE_MACRODEF && macroName.search(entry) > -1) {
char* macro;
(void) bt_next_field(node, 0, &macro);
- m_macros.insert(QString::fromUtf8(macro), macroName.cap(1).stripWhiteSpace());
+ m_macros.insert(TQString::fromUtf8(macro), macroName.cap(1).stripWhiteSpace());
}
m_nodes.append(node);
needsCleanup = true;
}
startpos = pos+1;
}
- pos = text.find(rx, pos+1);
+ pos = text.tqfind(rx, pos+1);
}
if(needsCleanup) {
// clean up some structures
@@ -278,22 +278,22 @@ void BibtexImporter::slotCancel() {
m_cancelled = true;
}
-QWidget* BibtexImporter::widget(QWidget* parent_, const char* name_/*=0*/) {
+TQWidget* BibtexImporter::widget(TQWidget* tqparent_, const char* name_/*=0*/) {
if(m_widget) {
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);
- QButtonGroup* box = new QVButtonGroup(i18n("Bibtex Options"), m_widget);
- m_readUTF8 = new QRadioButton(i18n("Use Unicode (UTF-8) encoding"), box);
- QWhatsThis::add(m_readUTF8, i18n("Read the imported file in Unicode (UTF-8)."));
- QString localStr = i18n("Use user locale (%1) encoding").arg(
- QString::fromLatin1(QTextCodec::codecForLocale()->name()));
- m_readLocale = new QRadioButton(localStr, box);
+ TQButtonGroup* box = new TQVButtonGroup(i18n("Bibtex Options"), m_widget);
+ m_readUTF8 = new TQRadioButton(i18n("Use Unicode (UTF-8) encoding"), box);
+ TQWhatsThis::add(m_readUTF8, i18n("Read the imported file in Unicode (UTF-8)."));
+ TQString localStr = i18n("Use user locale (%1) encoding").tqarg(
+ TQString::tqfromLatin1(TQTextCodec::codecForLocale()->name()));
+ m_readLocale = new TQRadioButton(localStr, box);
m_readLocale->setChecked(true);
- QWhatsThis::add(m_readLocale, i18n("Read the imported file in the local encoding."));
+ TQWhatsThis::add(m_readLocale, i18n("Read the imported file in the local encoding."));
KConfigGroup config(kapp->config(), "Import Options");
bool useUTF8 = config.readBoolEntry("Bibtex UTF8", false);