diff options
Diffstat (limited to 'src/translators/bibtexhandler.cpp')
-rw-r--r-- | src/translators/bibtexhandler.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/translators/bibtexhandler.cpp b/src/translators/bibtexhandler.cpp index 873dc27..1896f95 100644 --- a/src/translators/bibtexhandler.cpp +++ b/src/translators/bibtexhandler.cpp @@ -38,7 +38,7 @@ using Tellico::BibtexHandler; BibtexHandler::StringListMap* BibtexHandler::s_utf8LatexMap = 0; BibtexHandler::QuoteStyle BibtexHandler::s_quoteStyle = BibtexHandler::BRACES; -const TQRegExp BibtexHandler::s_badKeyChars(TQString::tqfromLatin1("[^0-9a-zA-Z-]")); +const TQRegExp BibtexHandler::s_badKeyChars(TQString::fromLatin1("[^0-9a-zA-Z-]")); TQStringList BibtexHandler::bibtexKeys(const Data::EntryVec& entries_) { TQStringList keys; @@ -57,7 +57,7 @@ TQString BibtexHandler::bibtexKey(Data::ConstEntryPtr entry_) { } const Data::BibtexCollection* c = static_cast<const Data::BibtexCollection*>(entry_->collection().data()); - Data::FieldPtr f = c->fieldByBibtexName(TQString::tqfromLatin1("key")); + Data::FieldPtr f = c->fieldByBibtexName(TQString::fromLatin1("key")); if(f) { TQString key = entry_->field(f->name()); if(!key.isEmpty()) { @@ -66,7 +66,7 @@ TQString BibtexHandler::bibtexKey(Data::ConstEntryPtr entry_) { } TQString author; - Data::FieldPtr authorField = c->fieldByBibtexName(TQString::tqfromLatin1("author")); + Data::FieldPtr authorField = c->fieldByBibtexName(TQString::fromLatin1("author")); if(authorField) { if(authorField->flags() & Data::Field::AllowMultiple) { // grab first author only; @@ -77,21 +77,21 @@ TQString BibtexHandler::bibtexKey(Data::ConstEntryPtr entry_) { } } - Data::FieldPtr titleField = c->fieldByBibtexName(TQString::tqfromLatin1("title")); + Data::FieldPtr titleField = c->fieldByBibtexName(TQString::fromLatin1("title")); TQString title; if(titleField) { title = entry_->field(titleField->name()); } - Data::FieldPtr yearField = c->fieldByBibtexName(TQString::tqfromLatin1("year")); + Data::FieldPtr yearField = c->fieldByBibtexName(TQString::fromLatin1("year")); TQString year; if(yearField) { year = entry_->field(yearField->name()); } if(year.isEmpty()) { - year = entry_->field(TQString::tqfromLatin1("pub_year")); + year = entry_->field(TQString::fromLatin1("pub_year")); if(year.isEmpty()) { - year = entry_->field(TQString::tqfromLatin1("cr_year")); + year = entry_->field(TQString::fromLatin1("cr_year")); } } year = year.section(';', 0, 0); @@ -120,7 +120,7 @@ TQString BibtexHandler::bibtexKey(const TQString& author_, const TQString& title } void BibtexHandler::loadTranslationMaps() { - TQString mapfile = locate("appdata", TQString::tqfromLatin1("bibtex-translation.xml")); + TQString mapfile = locate("appdata", TQString::fromLatin1("bibtex-translation.xml")); if(mapfile.isEmpty()) { return; } @@ -132,13 +132,13 @@ void BibtexHandler::loadTranslationMaps() { // no namespace processing TQDomDocument dom = FileHandler::readXMLFile(u, false); - TQDomNodeList keyList = dom.elementsByTagName(TQString::tqfromLatin1("key")); + TQDomNodeList keyList = dom.elementsByTagName(TQString::fromLatin1("key")); for(unsigned i = 0; i < keyList.count(); ++i) { - TQDomNodeList strList = keyList.item(i).toElement().elementsByTagName(TQString::tqfromLatin1("string")); + TQDomNodeList strList = keyList.item(i).toElement().elementsByTagName(TQString::fromLatin1("string")); // the strList might have more than one node since there are multiple ways // to represent a character in LaTex. - TQString s = keyList.item(i).toElement().attribute(TQString::tqfromLatin1("char")); + TQString s = keyList.item(i).toElement().attribute(TQString::fromLatin1("char")); for(unsigned j = 0; j < strList.count(); ++j) { (*s_utf8LatexMap)[s].append(strList.item(j).toElement().text()); // kdDebug() << "BibtexHandler::loadTranslationMaps - " @@ -164,9 +164,9 @@ TQString BibtexHandler::importText(char* text_) { // we need to lower-case any capitalized text after the first letter that is // NOT contained in braces - TQRegExp rx(TQString::tqfromLatin1("\\{([A-Z]+)\\}")); + TQRegExp rx(TQString::fromLatin1("\\{([A-Z]+)\\}")); rx.setMinimal(true); - str.replace(rx, TQString::tqfromLatin1("\\1")); + str.replace(rx, TQString::fromLatin1("\\1")); return str; } @@ -245,10 +245,10 @@ bool BibtexHandler::setFieldValue(Data::EntryPtr entry_, const TQString& bibtexF // special case, try to detect URLs // In qt 3.1, TQString::startsWith() is always case-sensitive if(bibtexField_ == Latin1Literal("url") - || vlower.startsWith(TQString::tqfromLatin1("http")) // may also be https - || vlower.startsWith(TQString::tqfromLatin1("ftp:/")) - || vlower.startsWith(TQString::tqfromLatin1("file:/")) - || vlower.startsWith(TQString::tqfromLatin1("/"))) { // assume this indicates a local path + || vlower.startsWith(TQString::fromLatin1("http")) // may also be https + || vlower.startsWith(TQString::fromLatin1("ftp:/")) + || vlower.startsWith(TQString::fromLatin1("file:/")) + || vlower.startsWith(TQString::fromLatin1("/"))) { // assume this indicates a local path myDebug() << "BibtexHandler::setFieldValue() - creating a URL field for " << bibtexField_ << endl; field = new Data::Field(bibtexField_, KStringHandler::capwords(bibtexField_), Data::Field::URL); } else { @@ -258,12 +258,12 @@ bool BibtexHandler::setFieldValue(Data::EntryPtr entry_, const TQString& bibtexF } else { field = new Data::Field(bibtexField_, KStringHandler::capwords(bibtexField_), Data::Field::Para); } - field->setProperty(TQString::tqfromLatin1("bibtex"), bibtexField_); + field->setProperty(TQString::fromLatin1("bibtex"), bibtexField_); c->addField(field); } // special case keywords, replace commas with semi-colons so they get separated TQString value = value_; - if(field->property(TQString::tqfromLatin1("bibtex")).startsWith(TQString::tqfromLatin1("keyword"))) { + if(field->property(TQString::fromLatin1("bibtex")).startsWith(TQString::fromLatin1("keyword"))) { value.replace(',', ';'); // special case refbase bibtex export, with multiple keywords fields TQString oValue = entry_->field(field); @@ -276,11 +276,11 @@ bool BibtexHandler::setFieldValue(Data::EntryPtr entry_, const TQString& bibtexF TQString& BibtexHandler::cleanText(TQString& text_) { // FIXME: need to improve this for removing all Latex entities -// TQRegExp rx(TQString::tqfromLatin1("(?=[^\\\\])\\\\.+\\{")); - TQRegExp rx(TQString::tqfromLatin1("\\\\.+\\{")); +// TQRegExp rx(TQString::fromLatin1("(?=[^\\\\])\\\\.+\\{")); + TQRegExp rx(TQString::fromLatin1("\\\\.+\\{")); rx.setMinimal(true); text_.replace(rx, TQString()); - text_.replace(TQRegExp(TQString::tqfromLatin1("[{}]")), TQString()); + text_.replace(TQRegExp(TQString::fromLatin1("[{}]")), TQString()); text_.replace('~', ' '); return text_; } |