本文整理汇总了C++中kio::TransferJob::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ TransferJob::exec方法的具体用法?C++ TransferJob::exec怎么用?C++ TransferJob::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kio::TransferJob
的用法示例。
在下文中一共展示了TransferJob::exec方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logout
void FbTalker::logout()
{
if (m_job)
{
m_job->kill();
m_job = 0;
}
emit signalBusy(true);
QMap<QString, QString> args;
args["access_token"] = m_accessToken;
QByteArray tmp(getCallString(args).toUtf8());
KIO::TransferJob* job = KIO::http_post(KUrl(m_apiURL,"auth.expireSession"), tmp, KIO::HideProgressInfo);
job->addMetaData("UserAgent", m_userAgent);
job->addMetaData("content-type",
"Content-Type: application/x-www-form-urlencoded");
connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
this, SLOT(data(KIO::Job*,QByteArray)));
m_state = FB_LOGOUT;
m_job = job;
m_buffer.resize(0);
// logout is synchronous call
job->exec();
slotResult(job);
}
示例2: logout
void SmugTalker::logout()
{
if (m_job)
{
m_job->kill();
m_job = 0;
}
emit signalBusy(true);
KUrl url(m_apiURL);
url.addQueryItem("method", "smugmug.logout");
url.addQueryItem("SessionID", m_sessionID);
QByteArray tmp;
KIO::TransferJob* job = KIO::http_post(url, tmp, KIO::HideProgressInfo);
job->addMetaData("UserAgent", m_userAgent);
job->addMetaData("content-type",
"Content-Type: application/x-www-form-urlencoded");
connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
this, SLOT(data(KIO::Job*,QByteArray)));
m_state = SMUG_LOGOUT;
m_job = job;
m_buffer.resize(0);
// logout is synchronous call
job->exec();
slotResult(job);
}
示例3: loadImage
QImage ImageLoader::loadImage(const QUrl &url, bool *ok, bool selectPictureSize)
{
QImage image;
if (url.isEmpty()) {
return image;
}
(*ok) = false;
if (url.isLocalFile()) {
if (image.load(url.toLocalFile())) {
(*ok) = true;
}
} else {
QByteArray imageData;
KIO::TransferJob *job = KIO::get(url, KIO::NoReload);
QObject::connect(job, &KIO::TransferJob::data,
[&imageData](KIO::Job *, const QByteArray & data) {
imageData.append(data);
});
if (job->exec()) {
if (image.loadFromData(imageData)) {
(*ok) = true;
}
}
}
if (!(*ok)) {
// image does not exist (any more)
KMessageBox::sorry(mParent, i18n("This contact's image cannot be found."));
return image;
}
if (selectPictureSize) {
QPixmap pixmap = QPixmap::fromImage(image);
image = KPixmapRegionSelectorDialog::getSelectedImage(pixmap, 1, 1, mParent);
if (image.isNull()) {
(*ok) = false;
return image;
}
}
if (image.height() > 720 || image.width() > 720) {
if (image.height() > image.width()) {
image = image.scaledToHeight(720);
} else {
image = image.scaledToWidth(720);
}
}
(*ok) = true;
return image;
}
示例4: getManPageContent
QString ManPageDocumentation::getManPageContent()
{
KIO::TransferJob * transferJob = KIO::get(m_url, KIO::NoReload, KIO::HideProgressInfo);
connect( transferJob, SIGNAL(data(KIO::Job*,QByteArray)),
this, SLOT(readDataFromManPage(KIO::Job*,QByteArray)) );
if (transferJob->exec()){
return m_manPageBuffer;
} else {
return i18n("Could not find any documentation for '%1'", m_name);
}
}