void TrainingstagebuchUploader::finishUpload(QNetworkReply *reply) { parent->progressBar->setValue(parent->progressBar->value()+60/parent->shareSiteCount); TtbUploadParser handler; QXmlInputSource source( reply ); QXmlSimpleReader reader; reader.setContentHandler( &handler ); if( ! reader.parse( source ) ){ parent->errorLabel->setText(tr("failed to parse upload response: ") +handler.errorString()); eventLoop.quit(); return; } if( handler.error.length() > 0 ){ parent->errorLabel->setText(tr("failed to upload file: ") +handler.error ); eventLoop.quit(); return; } exerciseId = handler.id; if( exerciseId.length() == 0 ){ parent->errorLabel->setText(tr("got empty exercise")); eventLoop.quit(); return; } uploadSuccessful = true; eventLoop.quit(); }
void TtbDialog::finishUpload(QNetworkReply *reply) { progressBar->setValue(100); closeButton->setText(tr("&Close")); TtbUploadParser handler; QXmlInputSource source( reply ); QXmlSimpleReader reader; reader.setContentHandler( &handler ); if( ! reader.parse( source ) ){ progressLabel->setText(tr("failed to parse upload response: ") +handler.errorString()); return; } if( handler.error.length() > 0 ){ progressLabel->setText(tr("failed to upload file: ") +handler.error ); return; } exerciseId = handler.id; if( exerciseId.length() == 0 ){ progressLabel->setText(tr("got empty exercise")); return; } progressLabel->setText(tr("successfully uploaded as %1") .arg(exerciseId)); ride->ride()->setTag("TtbExercise", exerciseId ); ride->setDirty(true); accept(); }