本文整理汇总了C++中kio::TransferJob类的典型用法代码示例。如果您正苦于以下问题:C++ TransferJob类的具体用法?C++ TransferJob怎么用?C++ TransferJob使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TransferJob类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: listSubCategories
void SmugTalker::listSubCategories(int categoryID)
{
if (m_job)
{
m_job->kill();
m_job = 0;
}
emit signalBusy(true);
KUrl url(m_apiURL);
url.addQueryItem("method", "smugmug.subcategories.get");
url.addQueryItem("SessionID", m_sessionID);
url.addQueryItem("CategoryID", QString::number(categoryID));
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)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
m_state = SMUG_LISTSUBCATEGORIES;
m_job = job;
m_buffer.resize(0);
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:30,代码来源:smugtalker.cpp
示例2: QString
KJob *UPnPRouter::sendSoapQuery(const QString & query,const QString & soapact,const QString & controlurl)
{
// if port is not set, 0 will be returned
// thanks to Diego R. Brogna for spotting this bug
if (location.port()<=0)
location.setPort(80);
QUrl address;
address.setScheme(QString("http"));
address.setHost(location.host());
address.setPort(location.port());
address.setPath(controlurl);
KIO::TransferJob *req = KIO::http_post( address, query.toLatin1(), KIO::HideProgressInfo );
req->addMetaData("content-type", QString("text/xml"));
req->addMetaData("UserAgent", QString("Konversation UPnP"));
req->addMetaData("customHTTPHeader", QString("SOAPAction: ") + soapact);
soap_data_out[req] = QByteArray();
soap_data_in[req] = QByteArray();
connect(req, &KIO::TransferJob::data, this, &UPnPRouter::recvSoapData);
connect(req, &KIO::TransferJob::dataReq, this, &UPnPRouter::sendSoapData);
connect(req, &KIO::TransferJob::result, this, &UPnPRouter::onRequestFinished);
return req;
}
开发者ID:KDE,项目名称:konversation,代码行数:30,代码来源:upnprouter.cpp
示例3: 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);
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:30,代码来源:smugtalker.cpp
示例4: getUploadPermission
/**
* Request upload permission using OAuth
*
* TODO (Dirk) maybe this can go or be merged with a re-authentication function.
*/
void FbTalker::getUploadPermission()
{
if (m_job)
{
m_job->kill();
m_job = 0;
}
emit signalBusy(true);
if (m_loginInProgress)
emit signalLoginProgress(8);
QMap<QString, QString> args;
args["access_token"] = m_accessToken;
args["ext_perm"] = "photo_upload";
QByteArray tmp(getCallString(args).toUtf8());
KIO::TransferJob* job = KIO::http_post(KUrl(m_apiURL,"users.hasAppPermission"), 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)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
m_state = FB_GETUPLOADPERM;
m_job = job;
m_buffer.resize(0);
}
开发者ID:tejastank,项目名称:kipi-plugins,代码行数:36,代码来源:fbtalker.cpp
示例5: listAlbums
void SmugTalker::listAlbums(const QString& nickName)
{
if (m_job)
{
m_job->kill();
m_job = 0;
}
emit signalBusy(true);
KUrl url(m_apiURL);
url.addQueryItem("method", "smugmug.albums.get");
url.addQueryItem("SessionID", m_sessionID);
url.addQueryItem("Heavy", "1");
if (!nickName.isEmpty())
url.addQueryItem("NickName", nickName);
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)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
m_state = SMUG_LISTALBUMS;
m_job = job;
m_buffer.resize(0);
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:32,代码来源:smugtalker.cpp
示例6: listFriends
void FbTalker::listFriends()
{
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,"friends.get"), 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)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
m_state = FB_LISTFRIENDS;
m_job = job;
m_buffer.resize(0);
}
开发者ID:tejastank,项目名称:kipi-plugins,代码行数:28,代码来源:fbtalker.cpp
示例7: 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);
}
开发者ID:tejastank,项目名称:kipi-plugins,代码行数:29,代码来源:fbtalker.cpp
示例8: listPhotos
void FbTalker::listPhotos(long long userID, const QString &albumID)
{
if (m_job)
{
m_job->kill();
m_job = 0;
}
emit signalBusy(true);
QMap<QString, QString> args;
args["access_token"] = m_accessToken;
if (!albumID.isEmpty())
args["aid"] = albumID;
else if (userID != 0)
args["subj_id"] = QString::number(userID);
else
args["subj_id"] = QString::number(m_user.id);
QByteArray tmp(getCallString(args).toUtf8());
KIO::TransferJob* job = KIO::http_post(KUrl(m_apiURL,"photos.get"), 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)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
m_state = FB_LISTPHOTOS;
m_job = job;
m_buffer.resize(0);
}
开发者ID:tejastank,项目名称:kipi-plugins,代码行数:34,代码来源:fbtalker.cpp
示例9: slotLocalGotResult
void DccTransferRecv::slotLocalGotResult( KIO::Job* job )
{
kdDebug() << "DccTransferRecv::slotLocalGotResult() [BEGIN]" << endl;
KIO::TransferJob* transferJob = static_cast<KIO::TransferJob*>( job );
disconnect( transferJob, 0, 0, 0 );
switch ( transferJob->error() )
{
case 0: // no error
kdDebug() << "DccTransferRecv::slotLocalGotResult(): job->error() returned 0." << endl
<< "DccTransferRecv::slotLocalGotResult(): Why was I called in spite of no error?" << endl;
break;
case KIO::ERR_FILE_ALREADY_EXIST:
askAndPrepareLocalKio( i18n( "<b>The file already exists.</b><br>"
"%1<br>" )
.arg( m_fileURL.prettyURL() ),
DccResumeDialog::RA_Overwrite | DccResumeDialog::RA_Rename | DccResumeDialog::RA_Cancel,
DccResumeDialog::RA_Overwrite );
break;
default:
askAndPrepareLocalKio( i18n( "<b>Could not open the file.<br>"
"Error: %1</b><br>"
"%2<br>" )
.arg( transferJob->error() )
.arg( m_fileURL.prettyURL() ),
DccResumeDialog::RA_Rename | DccResumeDialog::RA_Cancel,
DccResumeDialog::RA_Rename );
}
kdDebug() << "DccTransferRecv::slotLocalGotResult() [END]" << endl;
}
开发者ID:,项目名称:,代码行数:32,代码来源:
示例10: putAndGet
void JobRemoteTest::putAndGet()
{
const QString filePath = remoteTmpDir() + "putAndGetFile";
KUrl u(filePath);
KIO::TransferJob* job = KIO::put( u, 0600, KIO::Overwrite | KIO::HideProgressInfo );
QDateTime mtime = QDateTime::currentDateTime().addSecs( -30 ); // 30 seconds ago
mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds
job->setModificationTime(mtime);
job->setUiDelegate( 0 );
connect( job, SIGNAL( result(KJob*) ),
this, SLOT( slotResult(KJob*) ) );
connect( job, SIGNAL(dataReq(KIO::Job*, QByteArray&)),
this, SLOT(slotDataReq(KIO::Job*, QByteArray&)) );
m_result = -1;
m_dataReqCount = 0;
enterLoop();
QVERIFY( m_result == 0 ); // no error
m_result = -1;
KIO::StoredTransferJob* getJob = KIO::storedGet( u, KIO::NoReload, KIO::HideProgressInfo );
getJob->setUiDelegate( 0 );
connect( getJob, SIGNAL( result( KJob* ) ),
this, SLOT( slotGetResult( KJob* ) ) );
enterLoop();
QCOMPARE( m_result, 0 ); // no error
QCOMPARE( m_data, QByteArray("This is a test for KIO::put()\n") );
//QCOMPARE( m_data.size(), 11 );
}
开发者ID:vasi,项目名称:kdelibs,代码行数:29,代码来源:jobremotetest.cpp
示例11: onFinishedReadingFile
void ShareProvider::onFinishedReadingFile(KIO::Job* job, const QByteArray& data)
{
job->disconnect(this);
qobject_cast<KIO::FileJob *>(job)->close();
if (data.length() == 0) {
Q_EMIT finishedError(this, i18n("It was not possible to read the selected file"));
return;
}
d->m_data.clear();
AbstractSharer *sharer = d->getSharer();
if (sharer) {
KUrl sharerUrl = sharer->url();
if (!sharerUrl.isValid()) {
Q_EMIT finishedError(this, i18n("Service Url is not valid"));
return;
}
KIO::TransferJob *tJob = KIO::http_post(sharer->url(), sharer->postBody(data), KIO::HideProgressInfo);
tJob->setMetaData(sharer->headers());
connect(tJob, SIGNAL(data(KIO::Job*,QByteArray)),
this, SLOT(onTransferJobDataReceived(KIO::Job*,QByteArray)));
connect(tJob, SIGNAL(result(KJob*)), this, SLOT(onTransferJobResultReceived(KJob*)));
}
}
开发者ID:R4md4c,项目名称:image-sharer,代码行数:27,代码来源:shareprovider.cpp
示例12: onTransferJobResultReceived
void ShareProvider::onTransferJobResultReceived(KJob* job)
{
if (d->m_data.size() == 0) {
Q_EMIT finishedError(this, i18n("Service was not available"));
return;
}
KIO::TransferJob *tfJob = qobject_cast<KIO::TransferJob*>(job);
if (tfJob) {
QString mimeType = tfJob->mimetype();
AbstractSharer *sharer = d->getSharer();
if (sharer) {
sharer->parseResponse(d->m_data);
if (tfJob->isErrorPage() || sharer->hasError()) {
QString errorMessage = sharer->errorMessage();
if (!errorMessage.isEmpty()) {
Q_EMIT finishedError(this, errorMessage);
} else {
Q_EMIT finishedError(this, tfJob->errorString());
}
} else {
Q_EMIT finishedSuccess(this, sharer->imageUrl().url());
}
}
}
}
开发者ID:R4md4c,项目名称:image-sharer,代码行数:27,代码来源:shareprovider.cpp
示例13: fetchFinished
void HttpContainer::fetchFinished(KJob *job)
{
if (!job->error()) {
// We now set the data on the source with the retrieved data and some
// additional stats. Note that we don't include the source name, as that
// is implied as this object *is* the DataContainer. setData is called
// with just key/value pairs.
setData("Contents", m_data);
setData("Size", job->processedAmount(KJob::Bytes));
// Since we only create TransferJobs, it's safe to just static_cast here.
// In many real-world situations, this isn't the safest thing to do and a
// qobject_cast with a test on the result is often safer and cleaner.
KIO::TransferJob *tjob = static_cast<KIO::TransferJob *>(job);
setData("Error Page", tjob->isErrorPage());
setData("Mimetype", tjob->mimetype());
// Let DataContainer know we have data that needs storing
setNeedsToBeStored(true);
// Notify DataContainer that now is a good time to check to see that
// data has been updated. This will cause visualizations to be updated.
checkForUpdate();
// Clean up behind ourselves so there isn't unecessary memory usage
m_data.clear();
}
}
开发者ID:KDE,项目名称:plasma-framework,代码行数:28,代码来源:httpContainer.cpp
示例14: exchangeSession
/**
* upgrade session key to OAuth
*
* This method (or step) can be removed after June 2012 (a year after its
* implementation), since it is only a convenience method for those people
* who just upgraded and have an active session using the old authentication.
*/
void FbTalker::exchangeSession(const QString& sessionKey)
{
if (m_job)
{
m_job->kill();
m_job = 0;
}
emit signalBusy(true);
emit signalLoginProgress(1, 9, i18n("Upgrading to OAuth..."));
QMap<QString, QString> args;
args["client_id"] = m_appID;
args["client_secret"] = m_secretKey;
args["sessions"] = sessionKey;
QByteArray tmp(getCallString(args).toUtf8());
KIO::TransferJob* job = KIO::http_post(KUrl("https://graph.facebook.com/oauth/exchange_sessions"), 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)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
m_state = FB_EXCHANGESESSION;
m_job = job;
m_buffer.resize(0);
}
开发者ID:tejastank,项目名称:kipi-plugins,代码行数:38,代码来源:fbtalker.cpp
示例15: checkRegistrationCode
void ImageshackTalker::checkRegistrationCode()
{
if (m_job)
{
m_job->kill();
m_job = 0;
}
emit signalBusy(true);
emit signalLoginInProgress(2, 4, i18n("Checking the web server"));
QString args = "login=";
args.append(m_imageshack->registrationCode());
args.append("&xml=yes");
QByteArray tmp = args.toUtf8();
KIO::TransferJob* job = KIO::http_post(KUrl(m_loginApiUrl), 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)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
m_state = IMGHCK_CHECKREGCODE;
m_job = job;
m_buffer.resize(0);
}
开发者ID:NathanDM,项目名称:kipi-plugins,代码行数:32,代码来源:imageshacktalker.cpp
示例16: _k_contentTypeCheckFailed
void _k_contentTypeCheckFailed(KJob* job)
{
KIO::TransferJob* tJob = qobject_cast<KIO::TransferJob*>(job);
// On error simply call downloadResource which will probably fail as well.
if (tJob && tJob->error()) {
(void)downloadResource(tJob->url(), QString(), window, tJob->metaData());
}
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例17: addPhoto
bool SmugTalker::addPhoto(const QString& imgPath, int albumID,
const QString& caption)
{
if (m_job)
{
m_job->kill();
m_job = 0;
}
emit signalBusy(true);
QString imgName = QFileInfo(imgPath).fileName();
// load temporary image to buffer
QFile imgFile(imgPath);
if (!imgFile.open(QIODevice::ReadOnly))
{
emit signalBusy(false);
return false;
}
long long imgSize = imgFile.size();
QByteArray imgData = imgFile.readAll();
imgFile.close();
KMD5 imgMD5(imgData);
MPForm form;
form.addPair("ByteCount", QString::number(imgSize));
form.addPair("MD5Sum", QString(imgMD5.hexDigest()));
form.addPair("AlbumID", QString::number(albumID));
form.addPair("ResponseType", "REST");
if (!caption.isEmpty())
form.addPair("Caption", caption);
if (!form.addFile(imgName, imgPath))
return false;
form.finish();
QString customHdr;
KUrl url("http://upload.smugmug.com/photos/xmladd.mg");
KIO::TransferJob *job = KIO::http_post(url, form.formData(),
KIO::HideProgressInfo);
job->addMetaData("content-type", form.contentType());
job->addMetaData("UserAgent", m_userAgent);
customHdr += "X-Smug-SessionID: " + m_sessionID + "\r\n";
customHdr += "X-Smug-Version: " + m_apiVersion + "\r\n";
job->addMetaData("customHTTPHeader", customHdr);
connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
this, SLOT(data(KIO::Job*,QByteArray)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
m_state = SMUG_ADDPHOTO;
m_job = job;
m_buffer.resize(0);
return true;
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:58,代码来源:smugtalker.cpp
示例18: start
void FreeBusyDownloadJob::start()
{
KIO::TransferJob *job = KIO::get( mUrl, KIO::NoReload, KIO::HideProgressInfo );
job->ui()->setWindow( mParent );
connect( job, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)) );
connect( job, SIGNAL(data(KIO::Job*,QByteArray)), SLOT(slotData(KIO::Job*,QByteArray)) );
}
开发者ID:lenggi,项目名称:kcalcore,代码行数:9,代码来源:freebusydownloadjob_p.cpp
示例19: revokeAccess
void Resource::revokeAccess(const QString &id, const QString &name, const QString &password)
{
QUrl url = baseUrl;
url.setPath(url.path() + "/authorizations/" + id);
KIO::TransferJob *job = KIO::http_delete(url, KIO::HideProgressInfo);
job->addMetaData("customHTTPHeader", "Authorization: Basic " + QString (name + ':' + password).toUtf8().toBase64());
/* And we don't care if it's successful ;) */
job->start();
}
开发者ID:salamanderrake,项目名称:KDevelop,代码行数:9,代码来源:ghresource.cpp
示例20:
KIO::TransferJob * Resource::getTransferJob(const QString &uri, const QString &token) const
{
QUrl url = baseUrl;
url = url.adjusted(QUrl::StripTrailingSlash);
url.setPath(url.path() + '/' + uri);
KIO::TransferJob *job = KIO::get(url, KIO::Reload, KIO::HideProgressInfo);
if (!token.isEmpty())
job->addMetaData("customHTTPHeader", "Authorization: token " + token);
return job;
}
开发者ID:salamanderrake,项目名称:KDevelop,代码行数:10,代码来源:ghresource.cpp
注:本文中的kio::TransferJob类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论