本文整理汇总了C++中kio::Job类的典型用法代码示例。如果您正苦于以下问题:C++ Job类的具体用法?C++ Job怎么用?C++ Job使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Job类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fileSaveAs
void MainWindow::fileSaveAs()
{
WebTab *w = currentTab();
KUrl srcUrl = w->url();
// First, try with suggested file name...
QString name = w->page()->suggestedFileName();
// Second, with KUrl fileName...
if (name.isEmpty())
{
name = srcUrl.fileName();
}
// Last chance...
if(name.isEmpty())
{
name = srcUrl.host() + QString(".html");
}
const QString destUrl = KFileDialog::getSaveFileName(name, QString(), this);
if (destUrl.isEmpty())
return;
KIO::Job *job = KIO::file_copy(srcUrl, KUrl(destUrl), -1, KIO::Overwrite);
job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache.
job->addMetaData("cache", "cache"); // Use entry from cache if available.
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
}
开发者ID:Fxrh,项目名称:rekonq,代码行数:29,代码来源:mainwindow.cpp
示例2: openTrashContextMenu
void DolphinContextMenu::openTrashContextMenu()
{
Q_ASSERT(m_context & TrashContext);
QAction* emptyTrashAction = new QAction(QIcon::fromTheme(QStringLiteral("trash-empty")), i18nc("@action:inmenu", "Empty Trash"), this);
KConfig trashConfig(QStringLiteral("trashrc"), KConfig::SimpleConfig);
emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true));
addAction(emptyTrashAction);
addCustomActions();
QAction* propertiesAction = m_mainWindow->actionCollection()->action(QStringLiteral("properties"));
addAction(propertiesAction);
addShowMenuBarAction();
if (exec(m_pos) == emptyTrashAction) {
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(m_mainWindow);
if (uiDelegate.askDeleteConfirmation(QList<QUrl>(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::emptyTrash();
KJobWidgets::setWindow(job, m_mainWindow);
job->ui()->setAutoErrorHandlingEnabled(true);
}
}
}
开发者ID:KDE,项目名称:dolphin,代码行数:26,代码来源:dolphincontextmenu.cpp
示例3: add
void ResourceHandleManager::add(ResourceHandle* job, FrameQtClient* frameClient)
{
ResourceHandleInternal* d = job->getInternal();
DeprecatedString url = d->m_request.url().url();
KIO::Job* kioJob = 0;
if (job->method() == "POST") {
DeprecatedString postData = job->postData().flattenToString().deprecatedString();
QByteArray postDataArray(postData.ascii(), postData.length());
kioJob = KIO::http_post(KUrl(url), postDataArray, false);
kioJob->addMetaData("PropagateHttpHeader", "true");
kioJob->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded");
} else
kioJob = KIO::get(KUrl(url), false, false);
Q_ASSERT(kioJob != 0);
QObject::connect(kioJob, SIGNAL(data(KIO::Job*, const QByteArray&)), this, SLOT(slotData(KIO::Job*, const QByteArray&)));
QObject::connect(kioJob, SIGNAL(mimetype(KIO::Job*, const QString&)), this, SLOT(slotMimetype(KIO::Job*, const QString&)));
QObject::connect(kioJob, SIGNAL(result(KJob*)), this, SLOT(slotResult(KJob*)));
m_jobToKioMap.insert(job, kioJob);
m_kioToJobMap.insert(kioJob, job);
if (!m_frameClient)
m_frameClient = frameClient;
else
ASSERT(m_frameClient == frameClient);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:31,代码来源:ResourceHandleManagerKDE.cpp
示例4: start
void TweetJob::start()
{
kDebug() << "starting job" << m_url;
QByteArray data;
QOAuth::ParamMap params;
data = "source=kdemicroblog";
params.insert("source", "kdemicroblog");
{
QMapIterator<QString, QVariant> i(m_parameters);
while (i.hasNext()) {
i.next();
if (!i.value().toString().isEmpty()) {
if (i.key() == "status") {
const QByteArray status = i.value().toString().toUtf8().toPercentEncoding();
params.insert("status", status);
data = data.append("&status=" + status);
} else {
const QByteArray key = i.key().toLatin1();
const QByteArray value = i.value().toString().toLatin1();
params.insert(key, value);
data = data.append("&"+key+"="+value);
}
}
}
}
KIO::Job *job = KIO::http_post(m_url, data, KIO::HideProgressInfo);
job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded");
m_source->oAuthHelper()->sign(job, m_url.pathOrUrl(), params, KOAuth::POST);
connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
this, SLOT(recv(KIO::Job*,QByteArray)));
connect(job, SIGNAL(result(KJob*)), this, SLOT(result(KJob*)));
}
开发者ID:KDE,项目名称:kdeplasma-addons,代码行数:34,代码来源:tweetjob.cpp
示例5: showConfigurationInterface
void IconApplet::showConfigurationInterface()
{
KPropertiesDialog *dialog = m_dialog.data();
m_configTarget = m_url;
if (m_hasDesktopFile) {
const QFileInfo fi(m_url.toLocalFile());
if (!fi.isWritable()) {
const QString suggestedName = fi.baseName();
m_configTarget = KService::newServicePath(false, suggestedName);
KIO::Job *job = KIO::file_copy(m_url, m_configTarget);
job->exec();
}
}
if (dialog) {
KWindowSystem::setOnDesktop(dialog->winId(), KWindowSystem::currentDesktop());
dialog->show();
KWindowSystem::activateWindow(dialog->winId());
} else {
dialog = new KPropertiesDialog(m_configTarget, 0 /*no parent widget*/);
m_dialog = dialog;
connect(dialog, SIGNAL(applied()), this, SLOT(acceptedPropertiesDialog()));
connect(dialog, SIGNAL(canceled()), this, SLOT(cancelledPropertiesDialog()));
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
dialog->setWindowTitle(i18n("%1 Icon Settings", m_configTarget.fileName()));
dialog->show();
}
}
开发者ID:mleduque,项目名称:kwin-tiling,代码行数:28,代码来源:icon.cpp
示例6: slotResult
void ImgurTalker::slotResult(KJob* kjob)
{
KIO::Job* job = static_cast<KIO::Job*>(kjob);
if ( job->error() )
{
ImgurError err;
err.message = tr("Upload failed");
emit signalError(err); //job->errorString()
kDebug() << "Error :" << job->errorString();
}
bool parseOk = false;
switch(m_state)
{
case IE_REMOVEPHOTO:
parseOk = parseResponseImageRemove(m_buffer);
break;
case IE_ADDPHOTO:
parseOk = parseResponseImageUpload(m_buffer);
break;
default:
break;
}
m_buffer.resize(0);
emit signalUploadDone();
emit signalBusy(false);
return;
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:34,代码来源:imgurtalker.cpp
示例7: sendData
void KexiUserFeedbackAgent::sendData()
{
kDebug();
if (d->areas == NoAreas) {
return;
}
if (KGlobal::mainComponent().aboutData()->programName() != i18n(KEXI_APP_NAME)) {
// Do not send feedback if this is not really Kexi but a test app based on Kexi
return;
}
if (!d->redirectChecked) {
sendRedirectQuestion();
return;
}
QByteArray postData;
foreach (const QByteArray& key, d->keys) {
Area area = d->areasForKeys.value(key);
if (area != NoAreas && (d->areas & area)) {
if (!postData.isEmpty()) {
postData += ',';
}
postData += (QByteArray("\"") + key + "\":\""
+ escapeJson(d->data.value(key).toString()).toUtf8() + '"');
}
}
kDebug() << postData;
KIO::Job* sendJob = KIO::storedHttpPost(postData, KUrl(d->url + "/send"), KIO::HideProgressInfo);
connect(sendJob, SIGNAL(result(KFakeJob*)), this, SLOT(sendDataFinished(KJob*)));
sendJob->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded");
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:32,代码来源:KexiUserFeedbackAgent.cpp
示例8: deleteItem
void KIO_Delete::deleteItem( const KornMailId *item, KURL kurl, KIO::MetaData metadata, const KIO_Protocol *& protocol )
{
KIO::Job* job = 0;
kurl = dynamic_cast<const KornStringId*>( item )->getId();
protocol->deleteMailKURL( kurl, metadata );
if( kurl.port() == 0 )
kurl.setPort( protocol->defaultPort( _kio->_ssl ) );
if( protocol->deleteFunction() == KIO_Protocol::get )
{
job = KIO::get( kurl, true, false );
if( protocol->connectionBased() )
KIO::Scheduler::assignJobToSlave( _slave, dynamic_cast< KIO::SimpleJob* >( job ) );
else
KIO::Scheduler::scheduleJob( dynamic_cast< KIO::SimpleJob* >( job ) );
}
else if( protocol->deleteFunction() == KIO_Protocol::del )
{
job = KIO::del( kurl, false, false );
}
else
return; //Unknown deleteFunction
connect( job, SIGNAL( result( KIO::Job* ) ), this, SLOT( slotResult( KIO::Job* ) ) );
job->addMetaData( metadata );
_jobs->append( dynamic_cast< KIO::Job* >( job ) );
}
开发者ID:,项目名称:,代码行数:33,代码来源:
示例9: updateTLEs
void SatellitesComponent::updateTLEs()
{
int i = 0;
QProgressDialog progressDlg( i18n( "Update TLEs..." ), i18n( "Abort" ), 0, m_groups.count() );
progressDlg.setWindowModality( Qt::WindowModal );
progressDlg.setValue( 0 );
foreach ( SatelliteGroup *group, m_groups ) {
if ( progressDlg.wasCanceled() )
return;
if( group->tleUrl().isEmpty() )
continue;
progressDlg.setLabelText( i18n( "Update %1 satellites", group->name() ) );
KIO::Job* getJob = KIO::file_copy(group->tleUrl(), group->tleFilename(), -1, KIO::Overwrite | KIO::HideProgressInfo );
if( getJob->exec() )
{
group->readTLE();
group->updateSatellitesPos();
progressDlg.setValue( ++i );
} else
{
getJob->uiDelegate()->showErrorMessage();
}
}
}
开发者ID:thelastpolaris,项目名称:kstars,代码行数:28,代码来源:satellitescomponent.cpp
示例10: finalizeImport
void Importer::finalizeImport()
{
KIO::Job* job = KIO::del(d->mTempImportDir, KIO::HideProgressInfo);
if (job->ui()) {
job->ui()->setWindow(d->mAuthWindow);
}
importFinished();
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例11: sendRedirectQuestion
void KexiUserFeedbackAgent::sendRedirectQuestion()
{
QByteArray postData = "get_url";
kDebug() << postData;
KIO::Job* sendJob = KIO::storedHttpPost(postData, KUrl(d->url + "/send"), KIO::HideProgressInfo);
connect(sendJob, SIGNAL(result(KFakeJob*)), this, SLOT(sendRedirectQuestionFinished(KJob*)));
sendJob->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded");
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:8,代码来源:KexiUserFeedbackAgent.cpp
示例12: executeStrategy
void KNewFileMenuPrivate::executeStrategy()
{
m_tempFileToDelete = m_copyData.tempFileToDelete();
const QString src = m_copyData.sourceFileToCopy();
QString chosenFileName = expandTilde(m_copyData.chosenFileName(), true);
if (src.isEmpty())
return;
KUrl uSrc(src);
if (uSrc.isLocalFile()) {
// In case the templates/.source directory contains symlinks, resolve
// them to the target files. Fixes bug #149628.
KFileItem item(uSrc, QString(), KFileItem::Unknown);
if (item.isLink())
uSrc.setPath(item.linkDest());
if (!m_copyData.m_isSymlink) {
// If the file is not going to be detected as a desktop file, due to a
// known extension (e.g. ".pl"), append ".desktop". #224142.
QFile srcFile(uSrc.toLocalFile());
if (srcFile.open(QIODevice::ReadOnly)) {
KMimeType::Ptr wantedMime = KMimeType::findByUrl(uSrc);
KMimeType::Ptr mime = KMimeType::findByNameAndContent(m_copyData.m_chosenFileName, srcFile.read(1024));
//kDebug() << "mime=" << mime->name() << "wantedMime=" << wantedMime->name();
if (!mime->is(wantedMime->name()))
chosenFileName += wantedMime->mainExtension();
}
}
}
// The template is not a desktop file [or it's a URL one]
// Copy it.
KUrl::List::const_iterator it = m_popupFiles.constBegin();
for (; it != m_popupFiles.constEnd(); ++it)
{
KUrl dest(*it);
dest.addPath(KIO::encodeFileName(chosenFileName));
KUrl::List lstSrc;
lstSrc.append(uSrc);
KIO::Job* kjob;
if (m_copyData.m_isSymlink) {
kjob = KIO::symlink(src, dest);
// This doesn't work, FileUndoManager registers new links in copyingLinkDone,
// which KIO::symlink obviously doesn't emit... Needs code in FileUndoManager.
//KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Link, lstSrc, dest, kjob);
} else {
//kDebug(1203) << "KIO::copyAs(" << uSrc.url() << "," << dest.url() << ")";
KIO::CopyJob * job = KIO::copyAs(uSrc, dest);
job->setDefaultPermissions(true);
kjob = job;
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Copy, lstSrc, dest, job);
}
kjob->ui()->setWindow(m_parentWidget);
QObject::connect(kjob, SIGNAL(result(KJob*)), q, SLOT(slotResult(KJob*)));
}
}
开发者ID:,项目名称:,代码行数:57,代码来源:
示例13: slotPopupEmptyTrashBin
void KonqPopupMenuPrivate::slotPopupEmptyTrashBin()
{
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(m_parentWidget);
if (uiDelegate.askDeleteConfirmation(QList<QUrl>(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job *job = KIO::emptyTrash();
KJobWidgets::setWindow(job, m_parentWidget);
job->ui()->setAutoErrorHandlingEnabled(true); // or connect to the result signal
}
}
开发者ID:CerebrosuS,项目名称:plasma-desktop,代码行数:10,代码来源:konq_popupmenu.cpp
示例14: delInternal
bool NetAccess::delInternal( const KUrl & url, QWidget* window )
{
d->bJobOK = true; // success unless further error occurs
KIO::Job * job = KIO::del( url );
job->ui()->setWindow (window);
connect( job, SIGNAL( result (KJob *) ),
this, SLOT( slotResult (KJob *) ) );
enter_loop();
return d->bJobOK;
}
开发者ID:vasi,项目名称:kdelibs,代码行数:10,代码来源:netaccess.cpp
示例15: abortLoad
void ReadOnlyPart::abortLoad()
{
m_file = "";
if ( m_job )
{
KIO::Job *job = m_job;
m_job = 0;
job->kill();
}
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:10,代码来源:part.cpp
示例16: killJob
void Observer::killJob(int progressId)
{
KIO::Job *job = m_dctJobs[progressId];
if(!job)
{
kdWarning() << "Can't find job to kill ! There is no job with progressId=" << progressId << " in this process" << endl;
return;
}
job->kill(false /* not quietly */);
}
开发者ID:,项目名称:,代码行数:10,代码来源:
示例17: emptyTrash
void KrTrashHandler::emptyTrash()
{
QByteArray packedArgs;
QDataStream stream(&packedArgs, QIODevice::WriteOnly);
stream << (int)1;
KIO::Job *job = KIO::special(QUrl(QStringLiteral("trash:/")), packedArgs);
KNotification::event("Trash: emptied", QString() , QPixmap() , 0l, KNotification::DefaultEvent);
KIO::JobUiDelegate *ui = static_cast<KIO::JobUiDelegate*>(job->uiDelegate());
ui->setWindow(krMainWindow);
QObject::connect(job, SIGNAL(result(KJob *)), ACTIVE_PANEL->func, SLOT(refresh()));
}
开发者ID:aremai,项目名称:krusader,代码行数:11,代码来源:krtrashhandler.cpp
示例18: showJobError
/// Helper to sanely show an error message for a job
void showJobError(KJob *job)
{
assert(job);
// we can be called from the KJob::kill, where we are no longer a KIO::Job
// so better safe than sorry
KIO::Job *kiojob = qobject_cast<KIO::Job *>(job);
if (kiojob && kiojob->uiDelegate()) {
kiojob->uiDelegate()->showErrorMessage();
} else {
qCWarning(AKONADIMIME_LOG) << "There is no GUI delegate set for a kjob, and it failed with error:" << job->errorString();
}
}
开发者ID:KDE,项目名称:akonadi-mime,代码行数:13,代码来源:util.cpp
示例19: populateVfsList
bool ftp_vfs::populateVfsList(const QUrl &origin, bool showHidden)
{
QString errorMsg;
if (!origin.isValid())
errorMsg = i18n("Malformed URL:\n%1", origin.url());
if (!KProtocolManager::supportsListing(origin)) {
if (origin.scheme() == "ftp" && KProtocolManager::supportsReading(origin))
errorMsg = i18n("Krusader does not support FTP access via HTTP.\nIf it is not the case, please check and change the proxy settings in the System Settings.");
else
errorMsg = i18n("Protocol not supported by Krusader:\n%1", origin.url());
}
if (!errorMsg.isEmpty()) {
printf("error\n");
if (!quietMode)
emit error(errorMsg);
return false;
}
busy = true;
vfs_origin = origin.adjusted(QUrl::StripTrailingSlash);
//QTimer::singleShot( 0,this,SLOT(startLister()) );
listError = false;
// Open the directory marked by origin
KIO::Job *job = KIO::listDir(vfs_origin, KIO::HideProgressInfo, showHidden);
connect(job, SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList&)),
this, SLOT(slotAddFiles(KIO::Job*, const KIO::UDSEntryList&)));
connect(job, SIGNAL(redirection(KIO::Job*, const QUrl&)),
this, SLOT(slotRedirection(KIO::Job*, const QUrl&)));
connect(job, SIGNAL(permanentRedirection(KIO::Job*, const QUrl&, const QUrl&)),
this, SLOT(slotPermanentRedirection(KIO::Job*, const QUrl&, const QUrl&)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotListResult(KJob*)));
if(!parentWindow.isNull()) {
KIO::JobUiDelegate *ui = static_cast<KIO::JobUiDelegate*>(job->uiDelegate());
ui->setWindow(parentWindow);
}
if (!quietMode) {
emit startJob(job);
}
while (busy && vfs_processEvents());
if (listError) return false;
return true;
}
开发者ID:unknownnf,项目名称:krusader,代码行数:52,代码来源:ftp_vfs.cpp
示例20: doList
bool ClientApp::doList( int firstArg )
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KUrl dir = args->url(firstArg);
KIO::Job * job = KIO::listDir(dir, KIO::HideProgressInfo);
if ( !s_interactive )
job->setUiDelegate(0);
connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)),
SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList)));
connect(job, SIGNAL(result(KJob *)), this, SLOT(slotResult(KJob *)));
this->exec();
return m_ok;
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:13,代码来源:kioclient.cpp
注:本文中的kio::Job类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论