void QgsNetworkContentFetcher::contentLoaded( bool ok ) { Q_UNUSED( ok ); if ( mReply->error() != QNetworkReply::NoError ) { QgsMessageLog::logMessage( tr( "HTTP fetch %1 failed with error %2" ).arg( mReply->url().toString() ).arg( mReply->errorString() ) ); mContentLoaded = true; emit finished(); return; } QVariant redirect = mReply->attribute( QNetworkRequest::RedirectionTargetAttribute ); if ( redirect.isNull() ) { //no error or redirect, got target QVariant status = mReply->attribute( QNetworkRequest::HttpStatusCodeAttribute ); if ( !status.isNull() && status.toInt() >= 400 ) { QgsMessageLog::logMessage( tr( "HTTP fetch %1 failed with error %2" ).arg( mReply->url().toString() ).arg( status.toString() ) ); } mContentLoaded = true; emit finished(); return; } //redirect, so fetch redirect target mReply->deleteLater(); fetchContent( redirect.toUrl() ); }
int StorageMgr::DiaryMgr::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = UpCntrBase::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: upload((*reinterpret_cast< QString*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 1: upload((*reinterpret_cast< QString*(*)>(_a[1]))); break; case 2: checkDiary(); break; case 3: fetchContent((*reinterpret_cast< QString(*)>(_a[1]))); break; case 4: recv((*reinterpret_cast< QByteArray(*)>(_a[1]))); break; default: ; } _id -= 5; } return _id; }
void QgsNetworkContentFetcher::fetchContent( const QUrl &url ) { fetchContent( QNetworkRequest( url ) ); }