本文整理汇总了C++中kio::Job::setAutoDelete方法的典型用法代码示例。如果您正苦于以下问题:C++ Job::setAutoDelete方法的具体用法?C++ Job::setAutoDelete怎么用?C++ Job::setAutoDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kio::Job
的用法示例。
在下文中一共展示了Job::setAutoDelete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadImage
void ImageSource::loadImage(const QString &who, const KUrl &url)
{
if (who.isEmpty()) {
return;
}
if (!m_imageCache) {
m_imageCache = new KImageCache("plasma_engine_preview", 10485760); // Re-use previewengine's cache
}
// Make sure we only start one job per user
if (m_loadedPersons.contains(who)) {
return;
}
const QString cacheKey = who + "@" + url.pathOrUrl();
// Check if the image is in the cache, if so return it
QImage preview = QImage(QSize(48, 48), QImage::Format_ARGB32_Premultiplied);
preview.fill(Qt::transparent);
if (m_imageCache->findImage(cacheKey, &preview)) {
// cache hit
//kDebug() << "cache hit: " << cacheKey;
setData(who, polishImage(preview));
Q_EMIT dataChanged();
checkForUpdate();
return;
}
if (!url.isValid()) {
return;
}
m_loadedPersons << who;
//FIXME: since kio_http bombs the system with too many request put a temporary
// arbitrary limit here, revert as soon as BUG 192625 is fixed
// Note: seems fixed.
if (m_runningJobs < 500) {
m_runningJobs++;
KIO::Job *job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo);
job->setAutoDelete(true);
m_jobs[job] = who;
connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
this, SLOT(recv(KIO::Job*,QByteArray)));
connect(job, SIGNAL(result(KJob*)), this, SLOT(result(KJob*)));
job->start();
} else {