예제 #1
0
파일: ibsfetcher.cpp 프로젝트: KDE/tellico
void IBSFetcher::slotCompleteISBN(KJob* job_) {
  if(m_job->error()) {
    m_job->ui()->showErrorMessage();
    stop();
    return;
  }

  QByteArray data = m_job->data();
  if(data.isEmpty()) {
    myDebug() << "no data";
    stop();
    return;
  }

  // since the fetch is done, don't worry about holding the job pointer
  m_job = 0;

  QString str = Tellico::decodeHTML(data);
  if(str.indexOf(QLatin1String("Libro non presente"), 0, Qt::CaseInsensitive) > -1) {
    stop();
    return;
  }
  Data::EntryPtr entry = parseEntry(str);
  if(entry) {
    QString desc = entry->field(QLatin1String("author"))
                 + QLatin1Char('/') + entry->field(QLatin1String("publisher"));
    FetchResult* r = new FetchResult(Fetcher::Ptr(this), entry->title(), desc, entry->field(QLatin1String("isbn")));
    m_matches.insert(r->uid, static_cast<KIO::TransferJob*>(job_)->url());
    emit signalResultFound(r);
  }

  stop();
}
예제 #2
0
파일: fetchresult.cpp 프로젝트: KDE/tellico
FetchResult::FetchResult(Fetcher::Ptr fetcher_, Data::EntryPtr entry_)
   : uid(KRandom::random())
   , fetcher(fetcher_)
   , title(entry_->title())
   , desc(makeDescription(entry_))
   , isbn(entry_->field(QLatin1String("isbn"))) {
}
예제 #3
0
 foreach(Data::EntryPtr entry, entries_) {
   QModelIndex index = sourceModel()->indexFromEntry(entry);
   if(index.isValid()) {
     sourceModel()->setData(index, state, SaveStateRole);
   } else {
     myWarning() << "no index found for" << entry->id() << entry->title();
   }
 }