本文整理汇总了C++中KJob::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ KJob::setProperty方法的具体用法?C++ KJob::setProperty怎么用?C++ KJob::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KJob
的用法示例。
在下文中一共展示了KJob::setProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotParseResults
void ArchiveOrg::slotParseResults(KJob* job)
{
KIO::StoredTransferJob* storedQueryJob = static_cast<KIO::StoredTransferJob*>( job );
QDomDocument doc;
doc.setContent(QString::fromUtf8(storedQueryJob->data()));
QDomNodeList links = doc.elementsByTagName(QStringLiteral("a"));
QString html = QStringLiteral("<style type=\"text/css\">tr.cellone {background-color: %1;}").arg(qApp->palette().alternateBase().color().name());
html += QLatin1String("</style><table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">");
QString link;
int ct = 0;
m_thumbsPath.clear();
for (int i = 0; i < links.count(); ++i) {
QString href = links.at(i).toElement().attribute(QStringLiteral("href"));
if (href.endsWith(QLatin1String(".thumbs/"))) {
// sub folder contains image thumbs, display one.
m_thumbsPath = m_metaInfo.value(QStringLiteral("url")) + '/' + href;
KJob* thumbJob = KIO::storedGet( QUrl(m_thumbsPath), KIO::NoReload, KIO::HideProgressInfo );
thumbJob->setProperty("id", m_metaInfo.value(QStringLiteral("id")));
connect(thumbJob, &KJob::result, this, &ArchiveOrg::slotParseThumbs);
}
else if (!href.contains('/') && !href.endsWith(QLatin1String(".xml"))) {
link = m_metaInfo.value(QStringLiteral("url")) + '/' + href;
ct++;
if (ct %2 == 0) {
html += QLatin1String("<tr class=\"cellone\">");
}
else html += QLatin1String("<tr>");
html += "<td>" + QUrl(link).fileName() + QStringLiteral("</td><td><a href=\"%1\">%2</a></td><td><a href=\"%3\">%4</a></td></tr>").arg(link).arg(i18n("Preview")).arg(link + "_import").arg(i18n("Import"));
}
}
html += QLatin1String("</table>");
if (m_metaInfo.value(QStringLiteral("id")) == job->property("id").toString()) emit gotMetaInfo(html);
}
示例2: displayItemDetails
OnlineItemInfo ArchiveOrg::displayItemDetails(QListWidgetItem *item)
{
OnlineItemInfo info;
m_metaInfo.clear();
if (!item) {
return info;
}
info.itemPreview = item->data(previewRole).toString();
info.itemDownload = item->data(downloadRole).toString();
info.itemId = item->data(idRole).toInt();
info.itemName = item->text();
info.infoUrl = item->data(infoUrl).toString();
info.author = item->data(authorRole).toString();
info.authorUrl = item->data(authorUrl).toString();
info.license = item->data(licenseRole).toString();
info.description = item->data(descriptionRole).toString();
m_metaInfo.insert(QStringLiteral("url"), info.itemDownload);
m_metaInfo.insert(QStringLiteral("id"), info.itemId);
QString extraInfoUrl = item->data(downloadRole).toString();
if (!extraInfoUrl.isEmpty()) {
KJob* resolveJob = KIO::storedGet( QUrl(extraInfoUrl), KIO::NoReload, KIO::HideProgressInfo );
resolveJob->setProperty("id", info.itemId);
connect(resolveJob, &KJob::result, this, &ArchiveOrg::slotParseResults);
}
return info;
}