本文整理汇总了C++中KJob::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ KJob::exec方法的具体用法?C++ KJob::exec怎么用?C++ KJob::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KJob
的用法示例。
在下文中一共展示了KJob::exec方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveAndMergeUrlChange
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);
}
}
}
示例2: 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;
}
示例3: 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;
}
示例4: execSynchronously
QString GitRunner::execSynchronously(const QStringList& command)
{
KJob *job = initJob(command);
QString result;
if (!job->exec()) {
handleError(job);
return QString();
} else {
DvcsJob *j = qobject_cast<DvcsJob*>(job);
if (!j) {
return QString();
}
result = j->output();
}
return result;
}
示例5: typeChanged
void FileObjectEditDialog::typeChanged(int newType)
{
bool switchToWebsite = true;
bool switchToFile = true;
QList<QUrl> currentTypes = m_fileObject.types();
if(newType == 0) { // local file
switchToWebsite = false;
if(currentTypes.contains( NFO::FileDataObject() )) {
switchToFile = false;
}
if(currentTypes.contains( NFO::Website() )) {
switchToFile = true;
}
currentTypes.removeAll(NFO::Website());
currentTypes.removeAll(NFO::WebDataObject());
currentTypes.removeAll(NFO::RemoteDataObject());
if(!currentTypes.contains( NFO::FileDataObject() )) {
currentTypes.append( NFO::FileDataObject() );
}
}
else if(newType == 1) { // remote file
switchToWebsite = false;
if(currentTypes.contains( NFO::FileDataObject() )) {
switchToFile = false;
}
if(currentTypes.contains( NFO::Website() )) {
switchToFile = true;
}
currentTypes.removeAll(NFO::Website());
currentTypes.removeAll(NFO::WebDataObject());
if(!currentTypes.contains( NFO::FileDataObject() )) {
currentTypes.append( NFO::FileDataObject() );
}
if(!currentTypes.contains( NFO::RemoteDataObject() )) {
currentTypes.append(NFO::RemoteDataObject());
}
}
else if(newType == 2) { // nfo:website
switchToFile = false;
if(currentTypes.contains( NFO::FileDataObject() )) {
switchToWebsite = true;
}
if(currentTypes.contains( NFO::Website() )) {
switchToWebsite = false;
}
currentTypes.removeAll(NFO::FileDataObject());
currentTypes.removeAll(NFO::RemoteDataObject());
if(!currentTypes.contains( NFO::WebDataObject() )) {
currentTypes.append( NFO::WebDataObject() );
}
if(!currentTypes.contains( NFO::Website() )) {
currentTypes.append( NFO::Website() );
}
}
QList<QUrl> publicationUri; publicationUri << m_publication.uri();
QVariantList publicationValue; publicationValue << m_publication.uri();
QList<QUrl> fileObjectUri; fileObjectUri << m_fileObject.uri();
QVariantList fileObjectValue; fileObjectValue << m_fileObject.uri();
QVariantList typeValue;
foreach(const QUrl &url, currentTypes) {
typeValue << url;
}
//m_fileObject.setTypes(currentTypes);
// this appraoch is not working
QList<QUrl> removeAllTypes; removeAllTypes << RDF::type();
KJob *job = Nepomuk2::removeProperties(fileObjectUri, removeAllTypes);
if(!job->exec() ) {
kDebug() << job->errorString();
}
KJob *job2 = Nepomuk2::setProperty(fileObjectUri, RDF::type(), typeValue);
if(!job->exec() ) {
kDebug() << job2->errorString();
}
// change crosslink from nbib:publicationOf / nbib:isPublishedAs to nie:links
if( switchToFile ) {
Nepomuk2::removeProperty(publicationUri, NIE::links(), fileObjectValue);
Nepomuk2::addProperty(publicationUri, NBIB::isPublicationOf(), fileObjectValue);
Nepomuk2::addProperty(fileObjectUri, NBIB::publishedAs(), publicationValue);
}
else if( switchToWebsite ) {
Nepomuk2::removeProperty(publicationUri, NBIB::isPublicationOf(), fileObjectValue);
Nepomuk2::removeProperty(fileObjectUri, NBIB::publishedAs(), publicationValue);
Nepomuk2::addProperty(publicationUri, NIE::links(), fileObjectValue);
}
}