diff options
Diffstat (limited to 'src/translators/pdfimporter.cpp')
-rw-r--r-- | src/translators/pdfimporter.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/translators/pdfimporter.cpp b/src/translators/pdfimporter.cpp index 2d59b33..09df294 100644 --- a/src/translators/pdfimporter.cpp +++ b/src/translators/pdfimporter.cpp @@ -48,7 +48,7 @@ bool PDFImporter::canImport(int type_) const { } Tellico::Data::CollPtr PDFImporter::collection() { - QString xsltfile = ::locate("appdata", QString::fromLatin1("xmp2tellico.xsl")); + TQString xsltfile = ::locate("appdata", TQString::tqfromLatin1("xmp2tellico.xsl")); if(xsltfile.isEmpty()) { kdWarning() << "DropHandler::handleURL() - can not locate xmp2tellico.xsl" << endl; return 0; @@ -56,7 +56,7 @@ Tellico::Data::CollPtr PDFImporter::collection() { ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true); item.setTotalSteps(urls().count()); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); const bool showProgress = options() & ImportProgress; @@ -86,12 +86,12 @@ Tellico::Data::CollPtr PDFImporter::collection() { Data::CollPtr newColl; Data::EntryPtr entry; - QString xmp = xmpHandler.extractXMP(ref->fileName()); + TQString xmp = xmpHandler.extractXMP(ref->fileName()); // myDebug() << xmp << endl; if(xmp.isEmpty()) { setStatusMessage(i18n("Tellico was unable to read any metadata from the PDF file.")); } else { - setStatusMessage(QString()); + setStatusMessage(TQString()); Import::TellicoImporter importer(xsltHandler.applyStylesheet(xmp)); newColl = importer.collection(); @@ -100,7 +100,7 @@ Tellico::Data::CollPtr PDFImporter::collection() { setStatusMessage(i18n("Tellico was unable to read any metadata from the PDF file.")); } else { entry = newColl->entries().front(); - hasDOI |= !entry->field(QString::fromLatin1("doi")).isEmpty(); + hasDOI |= !entry->field(TQString::tqfromLatin1("doi")).isEmpty(); } } @@ -119,30 +119,30 @@ Tellico::Data::CollPtr PDFImporter::collection() { if(doc && !doc->isLocked()) { // now the question is, do we overwrite XMP data with Poppler data? // for now, let's say yes conditionally - QString s = doc->getInfo(QString::fromLatin1("Title")).simplifyWhiteSpace(); + TQString s = doc->getInfo(TQString::tqfromLatin1("Title")).simplifyWhiteSpace(); if(!s.isEmpty()) { - entry->setField(QString::fromLatin1("title"), s); + entry->setField(TQString::tqfromLatin1("title"), s); } // author could be separated by commas, "and" or whatever // we're not going to overwrite it - if(entry->field(QString::fromLatin1("author")).isEmpty()) { - QRegExp rx(QString::fromLatin1("\\s*(and|,|;)\\s*")); - QStringList authors = QStringList::split(rx, doc->getInfo(QString::fromLatin1("Author")).simplifyWhiteSpace()); - entry->setField(QString::fromLatin1("author"), authors.join(QString::fromLatin1("; "))); + if(entry->field(TQString::tqfromLatin1("author")).isEmpty()) { + TQRegExp rx(TQString::tqfromLatin1("\\s*(and|,|;)\\s*")); + TQStringList authors = TQStringList::split(rx, doc->getInfo(TQString::tqfromLatin1("Author")).simplifyWhiteSpace()); + entry->setField(TQString::tqfromLatin1("author"), authors.join(TQString::tqfromLatin1("; "))); } - s = doc->getInfo(QString::fromLatin1("Keywords")).simplifyWhiteSpace(); + s = doc->getInfo(TQString::tqfromLatin1("Keywords")).simplifyWhiteSpace(); if(!s.isEmpty()) { // keywords are also separated by semi-colons in poppler - entry->setField(QString::fromLatin1("keyword"), s); + entry->setField(TQString::tqfromLatin1("keyword"), s); } // now parse the first page text and try to guess Poppler::Page* page = doc->getPage(0); if(page) { // a null rectangle means get all text on page - QString text = page->getText(Poppler::Rectangle()); + TQString text = page->getText(Poppler::Rectangle()); // borrowed from Referencer - QRegExp rx(QString::fromLatin1("(?:" + TQRegExp rx(TQString::tqfromLatin1("(?:" "(?:[Dd][Oo][Ii]:? *)" "|" "(?:[Dd]igital *[Oo]bject *[Ii]dentifier:? *)" @@ -155,26 +155,26 @@ Tellico::Data::CollPtr PDFImporter::collection() { "[^\\s]+" ")")); if(rx.search(text) > -1) { - QString doi = rx.cap(1); + TQString doi = rx.cap(1); myDebug() << "PDFImporter::collection() - in PDF file, found DOI: " << doi << endl; - entry->setField(QString::fromLatin1("doi"), doi); + entry->setField(TQString::tqfromLatin1("doi"), doi); hasDOI = true; } - rx = QRegExp(QString::fromLatin1("arXiv:" + rx = TQRegExp(TQString::tqfromLatin1("arXiv:" "(" "[^\\/\\s]+" "[\\/\\.]" "[^\\s]+" ")")); if(rx.search(text) > -1) { - QString arxiv = rx.cap(1); + TQString arxiv = rx.cap(1); myDebug() << "PDFImporter::collection() - in PDF file, found arxiv: " << arxiv << endl; - if(entry->collection()->fieldByName(QString::fromLatin1("arxiv")) == 0) { - Data::FieldPtr field = new Data::Field(QString::fromLatin1("arxiv"), i18n("arXiv ID")); + if(entry->collection()->fieldByName(TQString::tqfromLatin1("arxiv")) == 0) { + Data::FieldPtr field = new Data::Field(TQString::tqfromLatin1("arxiv"), i18n("arXiv ID")); field->setCategory(i18n("Publishing")); entry->collection()->addField(field); } - entry->setField(QString::fromLatin1("arxiv"), arxiv); + entry->setField(TQString::tqfromLatin1("arxiv"), arxiv); hasArxiv = true; } @@ -186,22 +186,22 @@ Tellico::Data::CollPtr PDFImporter::collection() { delete doc; #endif - entry->setField(QString::fromLatin1("url"), (*it).url()); + entry->setField(TQString::tqfromLatin1("url"), (*it).url()); // always an article? - entry->setField(QString::fromLatin1("entry-type"), QString::fromLatin1("article")); + entry->setField(TQString::tqfromLatin1("entry-type"), TQString::tqfromLatin1("article")); - QPixmap pix = NetAccess::filePreview(ref->fileName(), PDF_FILE_PREVIEW_SIZE); + TQPixmap pix = NetAccess::filePreview(ref->fileName(), PDF_FILE_PREVIEW_SIZE); delete ref; // removes temp file if(!pix.isNull()) { // is png best option? - QString id = ImageFactory::addImage(pix, QString::fromLatin1("PNG")); + TQString id = ImageFactory::addImage(pix, TQString::tqfromLatin1("PNG")); if(!id.isEmpty()) { - Data::FieldPtr field = newColl->fieldByName(QString::fromLatin1("cover")); + Data::FieldPtr field = newColl->fieldByName(TQString::tqfromLatin1("cover")); if(!field && !newColl->imageFields().isEmpty()) { field = newColl->imageFields().front(); } else if(!field) { - field = new Data::Field(QString::fromLatin1("cover"), i18n("Front Cover"), Data::Field::Image); + field = new Data::Field(TQString::tqfromLatin1("cover"), i18n("Front Cover"), Data::Field::Image); newColl->addField(field); } entry->setField(field, id); @@ -227,13 +227,13 @@ Tellico::Data::CollPtr PDFImporter::collection() { myDebug() << "looking for DOI" << endl; Fetch::FetcherVec vec = Fetch::Manager::self()->createUpdateFetchers(coll->type(), Fetch::DOI); if(vec.isEmpty()) { - GUI::CursorSaver cs(Qt::arrowCursor); + GUI::CursorSaver cs(TQt::arrowCursor); KMessageBox::information(Kernel::self()->widget(), i18n("Tellico is able to download information about entries with a DOI from " "CrossRef.org. However, you must create an CrossRef account and add a new " "data source with your account information."), - QString::null, - QString::fromLatin1("CrossRefSourceNeeded")); + TQString(), + TQString::tqfromLatin1("CrossRefSourceNeeded")); } else { Data::EntryVec entries = coll->entries(); for(Fetch::FetcherVec::Iterator fetcher = vec.begin(); fetcher != vec.end(); ++fetcher) { @@ -263,8 +263,8 @@ Tellico::Data::CollPtr PDFImporter::collection() { for(Data::EntryVecIt entry = entries.begin(); entry != entries.end(); ++entry) { if(entry->title().isEmpty()) { // use file name - KURL u = entry->field(QString::fromLatin1("url")); - entry->setField(QString::fromLatin1("title"), u.fileName()); + KURL u = entry->field(TQString::tqfromLatin1("url")); + entry->setField(TQString::tqfromLatin1("title"), u.fileName()); } } |