diff options
Diffstat (limited to 'src/translators/tellicoimporter.cpp')
-rw-r--r-- | src/translators/tellicoimporter.cpp | 226 |
1 files changed, 113 insertions, 113 deletions
diff --git a/src/translators/tellicoimporter.cpp b/src/translators/tellicoimporter.cpp index 5dfc933..c7ac869 100644 --- a/src/translators/tellicoimporter.cpp +++ b/src/translators/tellicoimporter.cpp @@ -109,11 +109,11 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { TQString errorMsg; int errorLine, errorColumn; if(!dom.setContent(data_, true, &errorMsg, &errorLine, &errorColumn)) { - TQString str = i18n(errorLoad).arg(url().fileName()) + TQChar('\n'); - str += i18n("There is an XML parsing error in line %1, column %2.").arg(errorLine).arg(errorColumn); - str += TQString::fromLatin1("\n"); + TQString str = i18n(errorLoad).tqarg(url().fileName()) + TQChar('\n'); + str += i18n("There is an XML parsing error in line %1, column %2.").tqarg(errorLine).tqarg(errorColumn); + str += TQString::tqfromLatin1("\n"); str += i18n("The error message from TQt is:"); - str += TQString::fromLatin1("\n\t") + errorMsg; + str += TQString::tqfromLatin1("\n\t") + errorMsg; myDebug() << str << endl; setStatusMessage(str); m_format = Error; @@ -124,13 +124,13 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { // the syntax version field name changed from "version" to "syntaxVersion" in version 3 uint syntaxVersion; - if(root.hasAttribute(TQString::fromLatin1("syntaxVersion"))) { - syntaxVersion = root.attribute(TQString::fromLatin1("syntaxVersion")).toInt(); - } else if (root.hasAttribute(TQString::fromLatin1("version"))) { - syntaxVersion = root.attribute(TQString::fromLatin1("version")).toInt(); + if(root.hasAttribute(TQString::tqfromLatin1("syntaxVersion"))) { + syntaxVersion = root.attribute(TQString::tqfromLatin1("syntaxVersion")).toInt(); + } else if (root.hasAttribute(TQString::tqfromLatin1("version"))) { + syntaxVersion = root.attribute(TQString::tqfromLatin1("version")).toInt(); } else { if(!url().isEmpty()) { - setStatusMessage(i18n(errorLoad).arg(url().fileName())); + setStatusMessage(i18n(errorLoad).tqarg(url().fileName())); } m_format = Error; return; @@ -140,7 +140,7 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { if((syntaxVersion > 6 && root.tagName() != Latin1Literal("tellico")) || (syntaxVersion < 7 && root.tagName() != Latin1Literal("bookcase"))) { if(!url().isEmpty()) { - setStatusMessage(i18n(errorLoad).arg(url().fileName())); + setStatusMessage(i18n(errorLoad).tqarg(url().fileName())); } m_format = Error; return; @@ -148,7 +148,7 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { if(syntaxVersion > XML::syntaxVersion) { if(!url().isEmpty()) { - TQString str = i18n(errorLoad).arg(url().fileName()) + TQChar('\n'); + TQString str = i18n(errorLoad).tqarg(url().fileName()) + TQChar('\n'); str += i18n("It is from a future version of Tellico."); myDebug() << str << endl; setStatusMessage(str); @@ -185,7 +185,7 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { return; } - TQString title = collelem.attribute(TQString::fromLatin1("title")); + TQString title = collelem.attribute(TQString::tqfromLatin1("title")); // be careful not to have element name collision // for fields, each true field element is a child of a fields element @@ -198,8 +198,8 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { if((syntaxVersion > 3 && n.localName() == Latin1Literal("fields")) || (syntaxVersion < 4 && n.localName() == Latin1Literal("attributes"))) { TQDomElement e = n.toElement(); - fieldelems = e.elementsByTagNameNS(m_namespace, (syntaxVersion > 3) ? TQString::fromLatin1("field") - : TQString::fromLatin1("attribute")); + fieldelems = e.elementsByTagNameNS(m_namespace, (syntaxVersion > 3) ? TQString::tqfromLatin1("field") + : TQString::tqfromLatin1("attribute")); break; } } @@ -209,9 +209,9 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { // if there are no attributes or if the first one has the special name of _default bool addFields = (fieldelems.count() == 0); if(!addFields) { - TQString name = fieldelems.item(0).toElement().attribute(TQString::fromLatin1("name")); + TQString name = fieldelems.item(0).toElement().attribute(TQString::tqfromLatin1("name")); addFields = (name == Latin1Literal("_default")); - // removeChild only works for immediate children + // removeChild only works for immediate tqchildren // remove _default field if(addFields) { fieldelems.item(0).parentNode().removeChild(fieldelems.item(0)); @@ -223,12 +223,12 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { // on the entryName of the collection. A type field was added to the collection element // to specify what type of collection it is. if(syntaxVersion > 3) { - entryName = TQString::fromLatin1("entry"); - TQString typeStr = collelem.attribute(TQString::fromLatin1("type")); + entryName = TQString::tqfromLatin1("entry"); + TQString typeStr = collelem.attribute(TQString::tqfromLatin1("type")); Data::Collection::Type type = static_cast<Data::Collection::Type>(typeStr.toInt()); m_coll = CollectionFactory::collection(type, addFields); } else { - entryName = collelem.attribute(TQString::fromLatin1("unit")); + entryName = collelem.attribute(TQString::tqfromLatin1("unit")); m_coll = CollectionFactory::collection(entryName, addFields); } @@ -248,14 +248,14 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { continue; } if(n.localName() == Latin1Literal("macros")) { - macroelems = n.toElement().elementsByTagNameNS(m_namespace, TQString::fromLatin1("macro")); + macroelems = n.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("macro")); break; } } // myDebug() << "TellicoImporter::loadXMLData() - found " << macroelems.count() << " macros" << endl; for(uint j = 0; c && j < macroelems.count(); ++j) { TQDomElement elem = macroelems.item(j).toElement(); - c->addMacro(elem.attribute(TQString::fromLatin1("name")), elem.text()); + c->addMacro(elem.attribute(TQString::tqfromLatin1("name")), elem.text()); } for(TQDomNode n = collelem.firstChild(); !n.isNull(); n = n.nextSibling()) { @@ -276,7 +276,7 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { // as a special case, for old book collections with a bibtex-id field, convert to Bibtex if(syntaxVersion < 4 && m_coll->type() == Data::Collection::Book - && m_coll->hasField(TQString::fromLatin1("bibtex-id"))) { + && m_coll->hasField(TQString::tqfromLatin1("bibtex-id"))) { m_coll = Data::BibtexCollection::convertBookCollection(m_coll); } @@ -295,7 +295,7 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { continue; } if(n.localName() == Latin1Literal("images")) { - imgelems = n.toElement().elementsByTagNameNS(m_namespace, TQString::fromLatin1("image")); + imgelems = n.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("image")); break; } } @@ -337,12 +337,12 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { continue; } if(n.localName() == Latin1Literal("borrowers")) { - TQDomNodeList borrowerElems = n.toElement().elementsByTagNameNS(m_namespace, TQString::fromLatin1("borrower")); + TQDomNodeList borrowerElems = n.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("borrower")); for(uint j = 0; j < borrowerElems.count(); ++j) { readBorrower(borrowerElems.item(j).toElement()); } } else if(n.localName() == Latin1Literal("filters")) { - TQDomNodeList filterElems = n.toElement().elementsByTagNameNS(m_namespace, TQString::fromLatin1("filter")); + TQDomNodeList filterElems = n.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("filter")); for(uint j = 0; j < filterElems.count(); ++j) { readFilter(filterElems.item(j).toElement()); } @@ -361,21 +361,21 @@ void TellicoImporter::loadXMLData(const TQByteArray& data_, bool loadImages_) { void TellicoImporter::readField(uint syntaxVersion_, const TQDomElement& elem_) { // special case: if the i18n attribute equals true, then translate the title, description, and category - bool isI18n = elem_.attribute(TQString::fromLatin1("i18n")) == Latin1Literal("true"); + bool isI18n = elem_.attribute(TQString::tqfromLatin1("i18n")) == Latin1Literal("true"); - TQString name = elem_.attribute(TQString::fromLatin1("name"), TQString::fromLatin1("unknown")); - TQString title = elem_.attribute(TQString::fromLatin1("title"), i18n("Unknown")); + TQString name = elem_.attribute(TQString::tqfromLatin1("name"), TQString::tqfromLatin1("unknown")); + TQString title = elem_.attribute(TQString::tqfromLatin1("title"), i18n("Unknown")); if(isI18n) { title = i18n(title.utf8()); } - TQString typeStr = elem_.attribute(TQString::fromLatin1("type"), TQString::number(Data::Field::Line)); + TQString typeStr = elem_.attribute(TQString::tqfromLatin1("type"), TQString::number(Data::Field::Line)); Data::Field::Type type = static_cast<Data::Field::Type>(typeStr.toInt()); Data::FieldPtr field; if(type == Data::Field::Choice) { - TQStringList allowed = TQStringList::split(TQString::fromLatin1(";"), - elem_.attribute(TQString::fromLatin1("allowed"))); + TQStringList allowed = TQStringList::split(TQString::tqfromLatin1(";"), + elem_.attribute(TQString::tqfromLatin1("allowed"))); if(isI18n) { for(TQStringList::Iterator it = allowed.begin(); it != allowed.end(); ++it) { (*it) = i18n((*it).utf8()); @@ -386,9 +386,9 @@ void TellicoImporter::readField(uint syntaxVersion_, const TQDomElement& elem_) field = new Data::Field(name, title, type); } - if(elem_.hasAttribute(TQString::fromLatin1("category"))) { + if(elem_.hasAttribute(TQString::tqfromLatin1("category"))) { // at one point, the categories had keyboard accels - TQString cat = elem_.attribute(TQString::fromLatin1("category")); + TQString cat = elem_.attribute(TQString::tqfromLatin1("category")); if(syntaxVersion_ < 9 && cat.find('&') > -1) { cat.remove('&'); } @@ -398,8 +398,8 @@ void TellicoImporter::readField(uint syntaxVersion_, const TQDomElement& elem_) field->setCategory(cat); } - if(elem_.hasAttribute(TQString::fromLatin1("flags"))) { - int flags = elem_.attribute(TQString::fromLatin1("flags")).toInt(); + if(elem_.hasAttribute(TQString::tqfromLatin1("flags"))) { + int flags = elem_.attribute(TQString::tqfromLatin1("flags")).toInt(); // I also changed the enum values for syntax 3, but the only custom field // would have been bibtex-id if(syntaxVersion_ < 3 && field->name() == Latin1Literal("bibtex-id")) { @@ -414,12 +414,12 @@ void TellicoImporter::readField(uint syntaxVersion_, const TQDomElement& elem_) field->setFlags(flags); } - TQString formatStr = elem_.attribute(TQString::fromLatin1("format"), TQString::number(Data::Field::FormatNone)); + TQString formatStr = elem_.attribute(TQString::tqfromLatin1("format"), TQString::number(Data::Field::FormatNone)); Data::Field::FormatFlag format = static_cast<Data::Field::FormatFlag>(formatStr.toInt()); field->setFormatFlag(format); - if(elem_.hasAttribute(TQString::fromLatin1("description"))) { - TQString desc = elem_.attribute(TQString::fromLatin1("description")); + if(elem_.hasAttribute(TQString::tqfromLatin1("description"))) { + TQString desc = elem_.attribute(TQString::tqfromLatin1("description")); if(isI18n) { desc = i18n(desc.utf8()); } @@ -427,42 +427,42 @@ void TellicoImporter::readField(uint syntaxVersion_, const TQDomElement& elem_) } if(syntaxVersion_ >= 5) { - TQDomNodeList props = elem_.elementsByTagNameNS(m_namespace, TQString::fromLatin1("prop")); + TQDomNodeList props = elem_.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("prop")); for(uint i = 0; i < props.count(); ++i) { TQDomElement e = props.item(i).toElement(); - field->setProperty(e.attribute(TQString::fromLatin1("name")), e.text()); + field->setProperty(e.attribute(TQString::tqfromLatin1("name")), e.text()); } // all track fields in music collections prior to version 9 get converted to three columns if(syntaxVersion_ < 9) { if(m_coll->type() == Data::Collection::Album && field->name() == Latin1Literal("track")) { - field->setProperty(TQString::fromLatin1("columns"), TQChar('3')); - field->setProperty(TQString::fromLatin1("column1"), i18n("Title")); - field->setProperty(TQString::fromLatin1("column2"), i18n("Artist")); - field->setProperty(TQString::fromLatin1("column3"), i18n("Length")); + field->setProperty(TQString::tqfromLatin1("columns"), TQChar('3')); + field->setProperty(TQString::tqfromLatin1("column1"), i18n("Title")); + field->setProperty(TQString::tqfromLatin1("column2"), i18n("Artist")); + field->setProperty(TQString::tqfromLatin1("column3"), i18n("Length")); } else if(m_coll->type() == Data::Collection::Video && field->name() == Latin1Literal("cast")) { - field->setProperty(TQString::fromLatin1("column1"), i18n("Actor/Actress")); - field->setProperty(TQString::fromLatin1("column2"), i18n("Role")); + field->setProperty(TQString::tqfromLatin1("column1"), i18n("Actor/Actress")); + field->setProperty(TQString::tqfromLatin1("column2"), i18n("Role")); } } - } else if(elem_.hasAttribute(TQString::fromLatin1("bibtex-field"))) { - field->setProperty(TQString::fromLatin1("bibtex"), elem_.attribute(TQString::fromLatin1("bibtex-field"))); + } else if(elem_.hasAttribute(TQString::tqfromLatin1("bibtex-field"))) { + field->setProperty(TQString::tqfromLatin1("bibtex"), elem_.attribute(TQString::tqfromLatin1("bibtex-field"))); } // Table2 is deprecated if(field->type() == Data::Field::Table2) { field->setType(Data::Field::Table); - field->setProperty(TQString::fromLatin1("columns"), TQChar('2')); + field->setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); } // for syntax 8, rating fields got their own type if(syntaxVersion_ < 8) { Data::Field::convertOldRating(field); // does all its own checking } m_coll->addField(field); -// myDebug() << TQString(" Added field: %1, %2").arg(field->name()).arg(field->title()) << endl; +// myDebug() << TQString(" Added field: %1, %2").tqarg(field->name()).tqarg(field->title()) << endl; } void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryElem_) { - const int id = entryElem_.attribute(TQString::fromLatin1("id")).toInt(); + const int id = entryElem_.attribute(TQString::tqfromLatin1("id")).toInt(); Data::EntryPtr entry; if(id > 0) { entry = new Data::Entry(m_coll, id); @@ -472,20 +472,20 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryEl bool oldMusic = (syntaxVersion_ < 9 && m_coll->type() == Data::Collection::Album); - // iterate over all field value children + // iterate over all field value tqchildren for(TQDomNode node = entryElem_.firstChild(); !node.isNull(); node = node.nextSibling()) { TQDomElement elem = node.toElement(); if(elem.isNull()) { continue; } - bool isI18n = elem.attribute(TQString::fromLatin1("i18n")) == Latin1Literal("true"); + bool isI18n = elem.attribute(TQString::tqfromLatin1("i18n")) == Latin1Literal("true"); // Entry::setField checks to see if an field of 'name' is allowed // in version 3 and prior, checkbox attributes had no text(), set it to "true" now if(syntaxVersion_ < 4 && elem.text().isEmpty()) { // "true" means checked - entry->setField(elem.localName(), TQString::fromLatin1("true")); + entry->setField(elem.localName(), TQString::tqfromLatin1("true")); continue; } @@ -493,7 +493,7 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryEl Data::FieldPtr f = m_coll->fieldByName(name); // if the first child of the node is a text node, just set the attribute text - // otherwise, recurse over the node's children + // otherwise, recurse over the node's tqchildren // this is the case for <authors><author>..</author></authors> // but if there's nothing but white space, then it's a BaseNode for some reason // if(node.firstChild().nodeType() == TQDomNode::TextNode) { @@ -507,17 +507,17 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryEl if(f->type() == Data::Field::Date) { if(elem.hasChildNodes()) { TQString value; - TQDomNode yNode = elem.elementsByTagNameNS(m_namespace, TQString::fromLatin1("year")).item(0); + TQDomNode yNode = elem.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("year")).item(0); if(!yNode.isNull()) { value += yNode.toElement().text(); } value += '-'; - TQDomNode mNode = elem.elementsByTagNameNS(m_namespace, TQString::fromLatin1("month")).item(0); + TQDomNode mNode = elem.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("month")).item(0); if(!mNode.isNull()) { value += mNode.toElement().text(); } value += '-'; - TQDomNode dNode = elem.elementsByTagNameNS(m_namespace, TQString::fromLatin1("day")).item(0); + TQDomNode dNode = elem.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("day")).item(0); if(!dNode.isNull()) { value += dNode.toElement().text(); } @@ -571,7 +571,7 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryEl } } else if(syntaxVersion_ < 2 && name == Latin1Literal("keywords")) { // in version 2, "keywords" changed to "keyword" - name = TQString::fromLatin1("keyword"); + name = TQString::tqfromLatin1("keyword"); } // special case: if the i18n attribute equals true, then translate the title, description, and category if(isI18n) { @@ -580,13 +580,13 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryEl // special case for isbn fields, go ahead and validate if(name == Latin1Literal("isbn")) { const ISBNValidator val(0); - if(elem.attribute(TQString::fromLatin1("validate")) != Latin1Literal("no")) { + if(elem.attribute(TQString::tqfromLatin1("validate")) != Latin1Literal("no")) { val.fixup(value); } } entry->setField(name, value); } - } else { // if no field by the tag name, then it has children, iterate through them + } else { // if no field by the tag name, then it has tqchildren, iterate through them // the field name has the final 's', so remove it name.truncate(name.length() - 1); f = m_coll->fieldByName(name); @@ -603,24 +603,24 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryEl for(TQDomNode childNode = node.firstChild(); !childNode.isNull(); childNode = childNode.nextSibling()) { TQString value; // don't worry about i18n here, Tables are never translated - TQDomNodeList cols = childNode.toElement().elementsByTagNameNS(m_namespace, TQString::fromLatin1("column")); + TQDomNodeList cols = childNode.toElement().elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("column")); if(cols.count() > 0) { for(uint i = 0; i < cols.count(); ++i) { // special case for old tracks if(oldTracks && i == 1) { // if the second column holds the track length, bump it to next column - TQRegExp rx(TQString::fromLatin1("\\d+:\\d\\d")); + TQRegExp rx(TQString::tqfromLatin1("\\d+:\\d\\d")); if(rx.exactMatch(cols.item(i).toElement().text())) { - value += entry->field(TQString::fromLatin1("artist")); - value += TQString::fromLatin1("::"); + value += entry->field(TQString::tqfromLatin1("artist")); + value += TQString::tqfromLatin1("::"); } } value += cols.item(i).toElement().text().stripWhiteSpace(); if(i < cols.count()-1) { - value += TQString::fromLatin1("::"); + value += TQString::tqfromLatin1("::"); } else if(oldTracks && cols.count() == 1) { - value += TQString::fromLatin1("::"); - value += entry->field(TQString::fromLatin1("artist")); + value += TQString::tqfromLatin1("::"); + value += entry->field(TQString::tqfromLatin1("artist")); } } values += value; @@ -634,15 +634,15 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryEl value += s; } if(oldTracks) { - value += TQString::fromLatin1("::"); - value += entry->field(TQString::fromLatin1("artist")); + value += TQString::tqfromLatin1("::"); + value += entry->field(TQString::tqfromLatin1("artist")); } if(values.findIndex(value) == -1) { values += value; } } } - entry->setField(name, values.join(TQString::fromLatin1("; "))); + entry->setField(name, values.join(TQString::tqfromLatin1("; "))); } } // end field value loop @@ -650,10 +650,10 @@ void TellicoImporter::readEntry(uint syntaxVersion_, const TQDomElement& entryEl } void TellicoImporter::readImage(const TQDomElement& elem_, bool loadImage_) { - TQString format = elem_.attribute(TQString::fromLatin1("format")); - const bool link = elem_.attribute(TQString::fromLatin1("link")) == Latin1Literal("true"); - TQString id = shareString(link ? elem_.attribute(TQString::fromLatin1("id")) - : Data::Image::idClean(elem_.attribute(TQString::fromLatin1("id")))); + TQString format = elem_.attribute(TQString::tqfromLatin1("format")); + const bool link = elem_.attribute(TQString::tqfromLatin1("link")) == Latin1Literal("true"); + TQString id = shareString(link ? elem_.attribute(TQString::tqfromLatin1("id")) + : Data::Image::idClean(elem_.attribute(TQString::tqfromLatin1("id")))); bool readInfo = true; if(loadImage_) { @@ -670,8 +670,8 @@ void TellicoImporter::readImage(const TQDomElement& elem_, bool loadImage_) { } if(readInfo) { // a width or height of 0 is ok here - int width = elem_.attribute(TQString::fromLatin1("width")).toInt(); - int height = elem_.attribute(TQString::fromLatin1("height")).toInt(); + int width = elem_.attribute(TQString::tqfromLatin1("width")).toInt(); + int height = elem_.attribute(TQString::tqfromLatin1("height")).toInt(); Data::ImageInfo info(id, format.latin1(), width, height, link); ImageFactory::cacheImageInfo(info); } @@ -679,29 +679,29 @@ void TellicoImporter::readImage(const TQDomElement& elem_, bool loadImage_) { void TellicoImporter::readFilter(const TQDomElement& elem_) { FilterPtr f = new Filter(Filter::MatchAny); - f->setName(elem_.attribute(TQString::fromLatin1("name"))); + f->setName(elem_.attribute(TQString::tqfromLatin1("name"))); - TQString match = elem_.attribute(TQString::fromLatin1("match")); + TQString match = elem_.attribute(TQString::tqfromLatin1("match")); if(match == Latin1Literal("all")) { f->setMatch(Filter::MatchAll); } - TQDomNodeList rules = elem_.elementsByTagNameNS(m_namespace, TQString::fromLatin1("rule")); + TQDomNodeList rules = elem_.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("rule")); for(uint i = 0; i < rules.count(); ++i) { TQDomElement e = rules.item(i).toElement(); if(e.isNull()) { continue; } - TQString field = e.attribute(TQString::fromLatin1("field")); + TQString field = e.attribute(TQString::tqfromLatin1("field")); // empty field means match any of them - TQString pattern = e.attribute(TQString::fromLatin1("pattern")); + TQString pattern = e.attribute(TQString::tqfromLatin1("pattern")); // empty pattern is bad if(pattern.isEmpty()) { kdWarning() << "TellicoImporter::readFilter() - empty rule!" << endl; continue; } - TQString function = e.attribute(TQString::fromLatin1("function")).lower(); + TQString function = e.attribute(TQString::tqfromLatin1("function")).lower(); FilterRule::Function func; if(function == Latin1Literal("contains")) { func = FilterRule::FuncContains; @@ -728,36 +728,36 @@ void TellicoImporter::readFilter(const TQDomElement& elem_) { } void TellicoImporter::readBorrower(const TQDomElement& elem_) { - TQString name = elem_.attribute(TQString::fromLatin1("name")); - TQString uid = elem_.attribute(TQString::fromLatin1("uid")); + TQString name = elem_.attribute(TQString::tqfromLatin1("name")); + TQString uid = elem_.attribute(TQString::tqfromLatin1("uid")); Data::BorrowerPtr b = new Data::Borrower(name, uid); - TQDomNodeList loans = elem_.elementsByTagNameNS(m_namespace, TQString::fromLatin1("loan")); + TQDomNodeList loans = elem_.elementsByTagNameNS(m_namespace, TQString::tqfromLatin1("loan")); for(uint i = 0; i < loans.count(); ++i) { TQDomElement e = loans.item(i).toElement(); if(e.isNull()) { continue; } - long id = e.attribute(TQString::fromLatin1("entryRef")).toLong(); + long id = e.attribute(TQString::tqfromLatin1("entryRef")).toLong(); Data::EntryPtr entry = m_coll->entryById(id); if(!entry) { myDebug() << "TellicoImporter::readBorrower() - no entry with id = " << id << endl; continue; } - TQString uid = e.attribute(TQString::fromLatin1("uid")); + TQString uid = e.attribute(TQString::tqfromLatin1("uid")); TQDate loanDate, dueDate; - TQString s = e.attribute(TQString::fromLatin1("loanDate")); + TQString s = e.attribute(TQString::tqfromLatin1("loanDate")); if(!s.isEmpty()) { loanDate = TQDate::fromString(s, Qt::ISODate); } - s = e.attribute(TQString::fromLatin1("dueDate")); + s = e.attribute(TQString::tqfromLatin1("dueDate")); if(!s.isEmpty()) { dueDate = TQDate::fromString(s, Qt::ISODate); } Data::LoanPtr loan = new Data::Loan(entry, loanDate, dueDate, e.text()); loan->setUID(uid); b->addLoan(loan); - s = e.attribute(TQString::fromLatin1("calendar")); + s = e.attribute(TQString::tqfromLatin1("calendar")); loan->setInCalendar(s == Latin1Literal("true")); } if(!b->isEmpty()) { @@ -776,7 +776,7 @@ void TellicoImporter::loadZipData() { m_zip = new KZip(TQT_TQIODEVICE(m_buffer)); } if(!m_zip->open(IO_ReadOnly)) { - setStatusMessage(i18n(errorLoad).arg(url().fileName())); + setStatusMessage(i18n(errorLoad).tqarg(url().fileName())); m_format = Error; delete m_zip; m_zip = 0; @@ -787,7 +787,7 @@ void TellicoImporter::loadZipData() { const KArchiveDirectory* dir = m_zip->directory(); if(!dir) { - TQString str = i18n(errorLoad).arg(url().fileName()) + TQChar('\n'); + TQString str = i18n(errorLoad).tqarg(url().fileName()) + TQChar('\n'); str += i18n("The file is empty."); setStatusMessage(str); m_format = Error; @@ -800,12 +800,12 @@ void TellicoImporter::loadZipData() { } // main file was changed from bookcase.xml to tellico.xml as of version 0.13 - const KArchiveEntry* entry = dir->entry(TQString::fromLatin1("tellico.xml")); + const KArchiveEntry* entry = dir->entry(TQString::tqfromLatin1("tellico.xml")); if(!entry) { - entry = dir->entry(TQString::fromLatin1("bookcase.xml")); + entry = dir->entry(TQString::tqfromLatin1("bookcase.xml")); } if(!entry || !entry->isFile()) { - TQString str = i18n(errorLoad).arg(url().fileName()) + TQChar('\n'); + TQString str = i18n(errorLoad).tqarg(url().fileName()) + TQChar('\n'); str += i18n("The file contains no collection data."); setStatusMessage(str); m_format = Error; @@ -838,7 +838,7 @@ void TellicoImporter::loadZipData() { return; } - const KArchiveEntry* imgDirEntry = dir->entry(TQString::fromLatin1("images")); + const KArchiveEntry* imgDirEntry = dir->entry(TQString::tqfromLatin1("images")); if(!imgDirEntry || !imgDirEntry->isDirectory()) { m_zip->close(); delete m_zip; @@ -913,7 +913,7 @@ bool TellicoImporter::loadAllImages(const KURL& url_) { KZip zip(url_.path()); if(!zip.open(IO_ReadOnly)) { if(u != url_) { - Kernel::self()->sorry(i18n(errorImageLoad).arg(url_.fileName())); + Kernel::self()->sorry(i18n(errorImageLoad).tqarg(url_.fileName())); } u = url_; return false; @@ -922,14 +922,14 @@ bool TellicoImporter::loadAllImages(const KURL& url_) { const KArchiveDirectory* dir = zip.directory(); if(!dir) { if(u != url_) { - Kernel::self()->sorry(i18n(errorImageLoad).arg(url_.fileName())); + Kernel::self()->sorry(i18n(errorImageLoad).tqarg(url_.fileName())); } u = url_; zip.close(); return false; } - const KArchiveEntry* imgDirEntry = dir->entry(TQString::fromLatin1("images")); + const KArchiveEntry* imgDirEntry = dir->entry(TQString::tqfromLatin1("images")); if(!imgDirEntry || !imgDirEntry->isDirectory()) { zip.close(); return false; @@ -949,38 +949,38 @@ bool TellicoImporter::loadAllImages(const KURL& url_) { void TellicoImporter::addDefaultFilters() { switch(m_coll->type()) { case Data::Collection::Book: - if(m_coll->hasField(TQString::fromLatin1("read"))) { + if(m_coll->hasField(TQString::tqfromLatin1("read"))) { FilterPtr f = new Filter(Filter::MatchAny); f->setName(i18n("Unread Books")); - f->append(new FilterRule(TQString::fromLatin1("read"), TQString::fromLatin1("true"), FilterRule::FuncNotContains)); + f->append(new FilterRule(TQString::tqfromLatin1("read"), TQString::tqfromLatin1("true"), FilterRule::FuncNotContains)); m_coll->addFilter(f); m_modified = true; } break; case Data::Collection::Video: - if(m_coll->hasField(TQString::fromLatin1("year"))) { + if(m_coll->hasField(TQString::tqfromLatin1("year"))) { FilterPtr f = new Filter(Filter::MatchAny); f->setName(i18n("Old Movies")); // old movies from before 1960 - f->append(new FilterRule(TQString::fromLatin1("year"), TQString::fromLatin1("19[012345]\\d"), FilterRule::FuncRegExp)); + f->append(new FilterRule(TQString::tqfromLatin1("year"), TQString::tqfromLatin1("19[012345]\\d"), FilterRule::FuncRegExp)); m_coll->addFilter(f); m_modified = true; } - if(m_coll->hasField(TQString::fromLatin1("widescreen"))) { + if(m_coll->hasField(TQString::tqfromLatin1("widescreen"))) { FilterPtr f = new Filter(Filter::MatchAny); f->setName(i18n("Widescreen")); - f->append(new FilterRule(TQString::fromLatin1("widescreen"), TQString::fromLatin1("true"), FilterRule::FuncContains)); + f->append(new FilterRule(TQString::tqfromLatin1("widescreen"), TQString::tqfromLatin1("true"), FilterRule::FuncContains)); m_coll->addFilter(f); m_modified = true; } break; case Data::Collection::Album: - if(m_coll->hasField(TQString::fromLatin1("year"))) { + if(m_coll->hasField(TQString::tqfromLatin1("year"))) { FilterPtr f = new Filter(Filter::MatchAny); f->setName(i18n("80's Music")); - f->append(new FilterRule(TQString::fromLatin1("year"), TQString::fromLatin1("198\\d"),FilterRule::FuncRegExp)); + f->append(new FilterRule(TQString::tqfromLatin1("year"), TQString::tqfromLatin1("198\\d"),FilterRule::FuncRegExp)); m_coll->addFilter(f); m_modified = true; } @@ -989,22 +989,22 @@ void TellicoImporter::addDefaultFilters() { default: break; } - if(m_coll->hasField(TQString::fromLatin1("rating"))) { + if(m_coll->hasField(TQString::tqfromLatin1("rating"))) { FilterPtr filter = new Filter(Filter::MatchAny); filter->setName(i18n("Favorites")); // check all the numbers, and use top 20% or so - Data::FieldPtr field = m_coll->fieldByName(TQString::fromLatin1("rating")); + Data::FieldPtr field = m_coll->fieldByName(TQString::tqfromLatin1("rating")); bool ok; - uint min = Tellico::toUInt(field->property(TQString::fromLatin1("minimum")), &ok); + uint min = Tellico::toUInt(field->property(TQString::tqfromLatin1("minimum")), &ok); if(!ok) { min = 1; } - uint max = Tellico::toUInt(field->property(TQString::fromLatin1("maximum")), &ok); + uint max = Tellico::toUInt(field->property(TQString::tqfromLatin1("maximum")), &ok); if(!ok) { min = 5; } for(uint i = TQMAX(min, static_cast<uint>(0.8*(max-min+1))); i <= max; ++i) { - filter->append(new FilterRule(TQString::fromLatin1("rating"), TQString::number(i), FilterRule::FuncContains)); + filter->append(new FilterRule(TQString::tqfromLatin1("rating"), TQString::number(i), FilterRule::FuncContains)); } if(!filter->isEmpty()) { m_coll->addFilter(filter); |