示例#1
0
void QDropboxFile::networkRequestFinished(QNetworkReply *rply)
{
#ifdef QTDROPBOX_DEBUG
    qDebug() << "QDropboxFile::networkRequestFinished(...)" << endl;
#endif

    switch(_waitMode)
    {
    case waitForRead:
        rplyFileContent(rply);
        stopEventLoop();
        break;
    case waitForWrite:
        rplyFileWrite(rply);
        stopEventLoop();
        break;
    case notWaiting:
		break; // when we are not waiting for anything, we don't do anything - simple!
    default:
#ifdef QTDROPBOX_DEBUG
		// debug information only - this should not happen, but if it does we 
		// ignore replies when not waiting for anything
		qDebug() << "QDropboxFile::networkRequestFinished(...) got reply in unknown state (" << _waitMode << ")" << endl;
#endif
        break;
    }
}
示例#2
0
void SM_QDropbox::parseBlockingRevisions(QString response)
{
    clearError();
    parseRevisions(response);
    stopEventLoop();
    return;
}
示例#3
0
void SM_QDropbox::parseBlockingAccountInfo(QString response)
{
    clearError();
    parseAccountInfo(response);
    stopEventLoop();
    return;
}
示例#4
0
void SM_QDropbox::parseBlockingDelta(QString response)
{
    clearError();
    parseDelta(response);
    stopEventLoop();
    return;
}
示例#5
0
void SM_QDropbox::parseBlockingSharedLink(QString response)
{
    clearError();
    parseSharedLink(response);
    stopEventLoop();
    return;
}
示例#6
0
void SM_QDropbox::responseBlockingAccessToken(QString response)
{
    clearError();
    responseAccessToken(response);
    stopEventLoop();
    return;
}
示例#7
0
void SM_QDropbox::responseBlockedTokenRequest(QString response)
{
    clearError();
    responseTokenRequest(response);
    stopEventLoop();
    return;
}
示例#8
0
void QDropbox::parseBlockingMetadata(QString response)
{
    clearError();
    parseMetadata(response);
    stopEventLoop();
    return;
}
示例#9
0
// The "end" event that prints the final result
static void terminate( void * arg ){
    
    fprintf( stderr, "Total number of lines %d\n", sum );

    free( f );
    cleanupStream( gStream );
    stopEventLoop( gEventLoop );
}
示例#10
0
void SM_QDropbox::parseRevisions(QString response)
{
    SM_Dropbox_Json json;
    _tempJson.parseString(response);
    if(!_tempJson.isValid())
    {
        errorState = SM_QDropbox::APIError;
        errorText  = "Dropbox API did not send correct answer for file/directory metadata.";
        emit errorOccured(errorState);
        stopEventLoop();
        return;
    }

    emit revisionsReceived(response);
    return;
}
示例#11
0
// check if the event loop has to be stopped after a blocking request was sent
void SM_QDropbox::checkReleaseEventLoop(int reqnr)
{
    switch(requestMap[reqnr].type)
    {
    case SM_DROPBOX_REQ_RQBTOKN:
    case SM_DROPBOX_REQ_BACCTOK:
    case SM_DROPBOX_REQ_BACCINF:
    case SM_DROPBOX_REQ_BMETADA:
    case SM_DROPBOX_REQ_BREVISI:
        stopEventLoop(); // release local event loop
        break;
    default:
        break;
    }
    return;
}
示例#12
0
bool qevercloud::AsyncResult::waitForFinished(int timeout)
{
    QEventLoop loop;
    QObject::connect(this, SIGNAL(finished(QVariant,QSharedPointer<EverCloudExceptionData>)), &loop, SLOT(quit()));
    if(timeout >= 0) {
        QTimer timer;
        EventLoopFinisher finisher(&loop, 1);
        connect(&timer, SIGNAL(timeout()), &finisher, SLOT(stopEventLoop()));
        timer.setSingleShot(true);
        timer.setInterval(timeout);
        timer.start();
        return loop.exec(QEventLoop::ExcludeUserInputEvents) == 0;
    } else {
        return loop.exec(QEventLoop::ExcludeUserInputEvents) == 0;
    }
}
示例#13
0
void SM_QDropbox::parseSharedLink(QString response)
{
#ifdef SM_QTDROPBOX_DEBUG
    qDebug() << "== shared link ==" << response << "== shared link end ==";
#endif

    //SM_Dropbox_Json json;
    //json.parseString(response);
    _tempJson.parseString(response);
    if(!_tempJson.isValid())
    {
        errorState = SM_QDropbox::APIError;
        errorText  = "Dropbox API did not send correct answer for file/directory shared link.";
#ifdef SM_QTDROPBOX_DEBUG
        qDebug() << "error: " << errorText << endl;
#endif
        emit errorOccured(errorState);
        stopEventLoop();
        return;
    }
    emit sharedLinkReceived(response);
}
示例#14
0
void SM_QDropbox::parseDelta(QString response)
{
#ifdef SM_QTDROPBOX_DEBUG
    qDebug() << "== metadata ==" << response << "== metadata end ==";
#endif

    SM_Dropbox_Json json;
    json.parseString(response);
    _tempJson.parseString(response);
    if(!json.isValid())
    {
        errorState = SM_QDropbox::APIError;
        errorText  = "Dropbox API did not send correct answer for delta.";
#ifdef SM_QTDROPBOX_DEBUG
        qDebug() << "error: " << errorText << endl;
#endif
        emit errorOccured(errorState);
        stopEventLoop();
        return;
    }

    emit deltaReceived(response);
    return;
}