本文整理汇总了C++中KJob类的典型用法代码示例。如果您正苦于以下问题:C++ KJob类的具体用法?C++ KJob怎么用?C++ KJob使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KJob类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QUrl
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;
}
示例2: FILTER
void FileObjectEditDialog::saveAndMergeUrlChange()
{
QString newUrl = ui->editUrl->fullText();
QString existingUrl = m_fileObject.property(NIE::url()).toString();
if(newUrl == existingUrl) {
return;
}
if(!newUrl.isEmpty()) {
QString query = "Select DISTINCT ?r where {"
"?r nie:url ?url . FILTER ( regex(?url, \"^" + newUrl + "$\"))"
"}";
QList<Nepomuk2::Query::Result> queryResult = Nepomuk2::Query::QueryServiceClient::syncSparqlQuery(query);
if(!queryResult.isEmpty() && queryResult.first().resource().uri() != m_fileObject.uri()) {
kDebug() << "found a duplicate with url" << newUrl << "merge it";
KJob *job = Nepomuk2::mergeResources(queryResult.first().resource().uri(), m_fileObject.uri());
job->exec();
if(job->error() != 0) {
kDebug() << job->errorString() << job->errorText();
}
setResource(queryResult.first().resource());
}
else {
kDebug() << "set url to " << newUrl;
QList<QUrl> fileObjectUri; fileObjectUri << m_fileObject.uri();
QVariantList fileObjectValue; fileObjectValue << newUrl;
Nepomuk2::setProperty(fileObjectUri, NIE::url(), fileObjectValue);
}
}
}
示例3: QStringLiteral
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);
}
示例4: debug
void
IpodCopyTracksJob::slotStartOrTranscodeCopyJob( const KUrl &sourceUrl, const KUrl &destUrl )
{
KJob *job = 0;
if( m_transcodingConfig.isJustCopy() )
{
if( m_goingToRemoveSources && m_coll &&
sourceUrl.toLocalFile().startsWith( m_coll.data()->mountPoint() ) )
{
// special case for "add orphaned tracks" to either save space and significantly
// speed-up the process:
debug() << "Moving from" << sourceUrl << "to" << destUrl;
job = KIO::file_move( sourceUrl, destUrl, -1, KIO::HideProgressInfo | KIO::Overwrite );
}
else
{
debug() << "Copying from" << sourceUrl << "to" << destUrl;
job = KIO::file_copy( sourceUrl, destUrl, -1, KIO::HideProgressInfo | KIO::Overwrite );
}
}
else
{
debug() << "Transcoding from" << sourceUrl << "to" << destUrl;
job = new Transcoding::Job( sourceUrl, destUrl, m_transcodingConfig );
}
job->setUiDelegate( 0 ); // be non-interactive
job->setAutoDelete( true );
connect( job, SIGNAL(finished(KJob*)), // we must use this instead of result() to prevent deadlock
SLOT(slotCopyOrTranscodeJobFinished()) );
job->start(); // no-op for KIO job, but matters for transcoding job
}
示例5: initJob
void GitRunner::init()
{
QStringList command;
command << "init";
KJob *job = initJob(command);
connect(job, SIGNAL(result(KJob*)), this, SLOT(handleInit(KJob*)));
job->start();
}
示例6: kDebug
void Task::start()
{
kDebug(14010) << "Executing children tasks for this task.";
KJob *subTask = 0;
foreach( subTask, subjobs() )
{
subTask->start();
}
}
示例7:
void KUiServerJobTracker::Private::_k_killJob()
{
org::kde::JobViewV2 *jobView = qobject_cast<org::kde::JobViewV2*>(q->sender());
if (jobView) {
KJob *job = progressJobView.key(jobView);
if (job)
job->kill(KJob::EmitResult);
}
}
示例8: BupRepairJob
void PlanExecutor::startRepairJob() {
if(mPlan->mBackupType != BackupPlan::BupType || busy() || !destinationAvailable()) {
return;
}
KJob *lJob = new BupRepairJob(*mPlan, mDestinationPath, mLogFilePath, mKupDaemon);
connect(lJob, SIGNAL(result(KJob*)), SLOT(repairFinished(KJob*)));
lJob->start();
mLastState = mState;
mState = REPAIRING;
emit stateChanged();
startSleepInhibit();
}
示例9: BupVerificationJob
void PlanExecutor::startIntegrityCheck() {
if(mPlan->mBackupType != BackupPlan::BupType || busy() || !destinationAvailable()) {
return;
}
KJob *lJob = new BupVerificationJob(*mPlan, mDestinationPath, mLogFilePath, mKupDaemon);
connect(lJob, SIGNAL(result(KJob*)), SLOT(integrityCheckFinished(KJob*)));
lJob->start();
mLastState = mState;
mState = INTEGRITY_TESTING;
emit stateChanged();
startSleepInhibit();
}
示例10: setError
void XmlValidatorJob::start()
{
if(m_documentUrl.isEmpty()) {
m_result = Failed;
m_errors.append(i18n("No document to validate"));
setError(m_result);
emitResult();
return;
}
QString localUrl;
KJob *copyJob = 0;
//DTD inline
if(m_dtdUrl.isEmpty() && m_schemaUrl.isEmpty()) {
emit signalReady(this);
return;
}
if(!m_dtdUrl.isEmpty()) {
localUrl = getLocalURLForSchema(m_documentUrl, m_dtdUrl);
if(QFile::exists(localUrl)) {
m_dtdUrl = localUrl;
emit signalReady(this);
return;
} else {
copyJob = KIO::copy(m_dtdUrl, localUrl, KIO::HideProgressInfo);
m_dtdUrl = localUrl;
}
}
if(!m_schemaUrl.isEmpty()) {
localUrl = getLocalURLForSchema(m_documentUrl, m_schemaUrl);
if(QFile::exists(localUrl)) {
m_schemaUrl = localUrl;
emit signalReady(this);
return;
} else {
copyJob = KIO::copy(m_schemaUrl, localUrl, KIO::HideProgressInfo);
m_schemaUrl = localUrl;
}
}
copyJob->setAutoDelete(true);
copyJob->setUiDelegate(0);
connect(copyJob, SIGNAL(result(KJob *)), this, SLOT(ready(KJob *)));
copyJob->start();
}
示例11: LOG
ThumbnailLoadJob::~ThumbnailLoadJob()
{
LOG(this);
if (hasSubjobs()) {
LOG("Killing subjob");
KJob* job = subjobs().first();
job->kill();
removeSubjob(job);
}
mThumbnailThread.cancel();
mThumbnailThread.wait();
if (!sThumbnailCache->isRunning()) {
sThumbnailCache->start();
}
}
示例12: execSynchronously
void GitRunner::moveToCommit(const QString &sha1hash,
const QString &newBranch)
{
QStringList command;
command << "branch" << newBranch << sha1hash;
execSynchronously(command);
command.clear();
command << "checkout" << newBranch;
KJob *job = initJob(command);
connect(job, SIGNAL(result(KJob*)), this, SLOT(handleMoveToCommit(KJob*)));
job->start();
}
示例13: kDebug
bool Nepomuk2::Indexer::clearIndexingData(const QUrl& url)
{
kDebug() << "Starting to clear";
KJob* job = Nepomuk2::clearIndexedData( url );
kDebug() << "Done";
job->exec();
if( job->error() ) {
m_lastError = job->errorString();
kError() << m_lastError;
return false;
}
return true;
}
示例14: destinationDir
QUrl SharePlugin::destinationDir() const
{
const QString defaultDownloadPath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
QUrl dir = QUrl::fromLocalFile(config()->get<QString>("incoming_path", defaultDownloadPath));
if (dir.path().contains("%1")) {
dir.setPath(dir.path().arg(device()->name()));
}
KJob* job = KIO::mkpath(dir);
bool ret = job->exec();
if (!ret) {
qWarning() << "couldn't create" << dir;
}
return dir;
}
示例15: Q_FOREACH
void ThumbnailLoadJob::removeItems(const KFileItemList& itemList)
{
Q_FOREACH(const KFileItem & item, itemList) {
// If we are removing the next item, update to be the item after or the
// first if we removed the last item
mItems.removeAll(item);
if (item == mCurrentItem) {
// Abort current item
mCurrentItem = KFileItem();
if (hasSubjobs()) {
KJob* job = subjobs().first();
job->kill();
removeSubjob(job);
}
}
}