void ImageshackTalker::slotResult(KJob* kjob) { m_job = 0; KIO::Job* job = static_cast<KIO::Job*>(kjob); if (job->error()) { if (m_loginInProgress) { checkRegistrationCodeDone(job->error(), job->errorString()); } else if (m_state == IMGHCK_ADDPHOTO) { emit signalBusy(false); emit signalAddPhotoDone(job->error(), job->errorString()); } return; } switch (m_state) { case IMGHCK_CHECKREGCODE: parseCheckRegistrationCode(m_buffer); break; case IMGHCK_ADDPHOTO: parseUploadPhotoDone(m_buffer); break; default: break; } }
void ImageshackTalker::slotResult(KJob* kjob) { KIO::Job* job = static_cast<KIO::Job*>(kjob); if (job->error()) { if (m_loginInProgress) { checkRegistrationCodeDone(job->error(), job->errorString()); m_loginInProgress = false; } else if (m_state == IMGHCK_GETGALLERIES) { emit signalBusy(false); emit signalGetGalleriesDone(job->error(), job->errorString()); } else if (m_state == IMGHCK_ADDPHOTO || m_state == IMGHCK_ADDPHOTOGALLERY) { emit signalBusy(false); emit signalAddPhotoDone(job->error(), job->errorString()); } m_state = IMGHCK_DONOTHING; m_job = 0; return; } int step; switch (m_state) { case IMGHCK_CHECKREGCODE: m_job = 0; parseCheckRegistrationCode(m_buffer); break; case IMGHCK_ADDPHOTOGALLERY: step = job->property("k_step").toInt(); if (step == STEP_UPLOADITEM) parseUploadPhotoDone(m_buffer); else parseAddPhotoToGalleryDone(m_buffer); break; case IMGHCK_ADDVIDEO: case IMGHCK_ADDPHOTO: m_job = 0; parseUploadPhotoDone(m_buffer); break; case IMGHCK_GETGALLERIES: m_job = 0; parseGetGalleries(m_buffer); break; default: break; } }
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; }
static bool checkNetworkAccess() { if (s_networkAccess == Unknown) { QElapsedTimer tm; tm.start(); KIO::Job *job = KIO::get(QUrl(s_iconUrl), KIO::NoReload, KIO::HideProgressInfo); if (job->exec()) { s_networkAccess = Yes; qDebug() << "Network access OK. Download time" << tm.elapsed() << "ms"; } else { qWarning() << job->errorString(); s_networkAccess = No; } } return s_networkAccess == Yes; }
void BackendOsmRG::slotResult(KJob* kJob) { KIO::Job* kioJob = qobject_cast<KIO::Job*>(kJob); if (kioJob->error()) { d->errorMessage = kioJob->errorString(); emit(signalRGReady(d->jobs.first().request)); d->jobs.clear(); return; } for (int i = 0; i < d->jobs.count(); ++i) { if (d->jobs.at(i).kioJob == kioJob) { QString dataString; dataString = QString::fromUtf8(d->jobs[i].data.constData(),qstrlen(d->jobs[i].data.constData())); int pos = dataString.indexOf("<reversegeocode"); dataString.remove(0,pos); QMap<QString, QString> resultMap = makeQMapFromXML(dataString); for (int j = 0; j < d->jobs[i].request.count(); ++j) { d->jobs[i].request[j].rgData = resultMap; } emit(signalRGReady(d->jobs[i].request)); d->jobs.removeAt(i); if (!d->jobs.empty()) { QTimer::singleShot(500, this, SLOT(nextPhoto())); } break; } } }
void PiwigoTalker::slotResult(KJob* job) { KIO::Job* tempjob = static_cast<KIO::Job*>(job); State state = m_state; // Can change in the treatment itself // so we cache it if (tempjob->error()) { if (state == GE_LOGIN) { emit signalLoginFailed(tempjob->errorString()); kDebug() << tempjob->errorString(); } else if (state == GE_GETVERSION) { kDebug() << tempjob->errorString(); // Version isn't mandatory and errors can be ignored // As login succeeded, albums can be listed listAlbums(); } else if (state == GE_CHECKPHOTOEXIST || state == GE_GETINFO || state == GE_SETINFO || state == GE_ADDPHOTOCHUNK || state == GE_ADDPHOTOSUMMARY || state == GE_OLD_ADDPHOTOCHUNK || state == GE_OLD_ADDTHUMB || state == GE_OLD_ADDHQ || state == GE_OLD_ADDPHOTOSUMMARY) { emit signalAddPhotoFailed(tempjob->errorString()); } else { tempjob->ui()->setWindow(m_parent); tempjob->ui()->showErrorMessage(); } emit signalBusy(false); return; } switch (state) { case(GE_LOGIN): parseResponseLogin(m_talker_buffer); break; case(GE_GETVERSION): parseResponseGetVersion(m_talker_buffer); break; case(GE_LISTALBUMS): parseResponseListAlbums(m_talker_buffer); break; case(GE_CHECKPHOTOEXIST): parseResponseDoesPhotoExist(m_talker_buffer); break; case(GE_GETINFO): parseResponseGetInfo(m_talker_buffer); break; case(GE_SETINFO): parseResponseSetInfo(m_talker_buffer); break; // Support for Web API >= 2.4 case(GE_ADDPHOTOCHUNK): parseResponseAddPhotoChunk(m_talker_buffer); break; case(GE_ADDPHOTOSUMMARY): parseResponseAddPhotoSummary(m_talker_buffer); break; // Support for Web API < 2.4 case(GE_OLD_ADDPHOTOCHUNK): parseResponseOldAddPhoto(m_talker_buffer); break; case(GE_OLD_ADDTHUMB): parseResponseOldAddThumbnail(m_talker_buffer); break; case(GE_OLD_ADDHQ): parseResponseOldAddHQPhoto(m_talker_buffer); break; case(GE_OLD_ADDPHOTOSUMMARY): parseResponseOldAddPhotoSummary(m_talker_buffer); break; } tempjob->kill(); m_job = 0; if (state == GE_GETVERSION && m_loggedIn) { listAlbums(); } emit signalBusy(false); }
void GalleryTalker::slotResult(KJob *job) { KIO::Job *tempjob = static_cast<KIO::Job*>(job); if (tempjob->error()) { if (m_state == GE_LOGIN) { emit signalLoginFailed(tempjob->errorString()); } else { if (m_state == GE_ADDPHOTO) { emit signalAddPhotoFailed(tempjob->errorString()); } else { tempjob->ui()->setWindow(m_parent); tempjob->ui()->showErrorMessage(); } } emit signalBusy(false); return; } switch (m_state) { case(GE_LOGIN): parseResponseLogin(m_talker_buffer); break; case(GE_LISTALBUMS): parseResponseListAlbums(m_talker_buffer); break; case(GE_LISTPHOTOS): parseResponseListPhotos(m_talker_buffer); break; case(GE_CREATEALBUM): parseResponseCreateAlbum(m_talker_buffer); break; case(GE_ADDPHOTO): parseResponseAddPhoto(m_talker_buffer); break; } if (m_state == GE_LOGIN && m_loggedIn) { const QStringList cookielist = (tempjob->queryMetaData("setcookies")).split('\n'); m_cookie = "Cookie:"; if(!cookielist.isEmpty()) { QRegExp rx("^GALLERYSID=.+"); QString app; foreach(const QString &str, cookielist) { if(str.contains("Set-Cookie: ")) { const QStringList cl = str.split(' '); int n = cl.lastIndexOf(rx); if(n!= -1) { app = cl.at(n); } } } m_cookie += app; } tempjob->kill(); listAlbums(); }
void FlickrTalker::slotResult(KJob* kjob) { m_job = 0; emit signalBusy(false); KIO::Job* job = static_cast<KIO::Job*>(kjob); if (job->error()) { if (m_state == FE_ADDPHOTO) { emit signalAddPhotoFailed(job->errorString()); } else { job->ui()->setWindow(m_parent); job->ui()->showErrorMessage(); } return; } switch (m_state) { case (FE_LOGIN): //parseResponseLogin(m_buffer); break; case (FE_LISTPHOTOSETS): parseResponseListPhotoSets(m_buffer); break; case (FE_GETFROB): parseResponseGetFrob(m_buffer); break; case (FE_GETTOKEN): parseResponseGetToken(m_buffer); break; case (FE_CHECKTOKEN): parseResponseCheckToken(m_buffer); break; case (FE_GETAUTHORIZED): //parseResponseGetToken(m_buffer); break; case (FE_LISTPHOTOS): parseResponseListPhotos(m_buffer); break; case (FE_GETPHOTOPROPERTY): parseResponsePhotoProperty(m_buffer); break; case (FE_ADDPHOTO): parseResponseAddPhoto(m_buffer); break; case (FE_ADDPHOTOTOPHOTOSET): parseResponseAddPhotoToPhotoSet(m_buffer); break; case (FE_CREATEPHOTOSET): parseResponseCreatePhotoSet(m_buffer); break; } }