Beispiel #1
0
void SohuMiniBlog::onReplyFinished()
{
     qDebug() << "SohuMiniBlog::onReplyFinished()";
     qDebug() << mReply->error();
     qDebug() << "Sever respond:"<<QDateTime::currentDateTime().toString();

    if(mRequestTimeoutTimer->isActive())
    {
        mRequestTimeoutTimer->stop();
    }

    disconnect(mReply, SIGNAL(finished()), this, SLOT(onReplyFinished()));

    QByteArray tempData = mReply->readAll();
    QNetworkReply::NetworkError replyError = mReply->error();

    mReply->deleteLater();
    mReply = NULL;

    if(QNetworkReply::NoError == replyError)
    {
        emit loadingFinished(tempData);
    }
    else if(QNetworkReply::AuthenticationRequiredError == replyError )
    {
        emit loadingError(KUserInfoError);
    }
    else
    {
        emit loadingError(KNetworkError);
    }

}
void HttpRequest::onReplyFinished()
{
    qDebug() << "HttpRequest::onReplyFinished()";
    TwtImageScaler::removeTemporaryFile();
    if(mRequestTimeoutTimer->isActive())
    {
        mRequestTimeoutTimer->stop();
    }

    mRequestTimeoutTimer->setInterval(KRequestTimeOut);
    disconnect(mReply, SIGNAL(finished()), this, SLOT(onReplyFinished()));

    QByteArray tempData = mReply->readAll();
    QNetworkReply::NetworkError replyError = mReply->error();
    if(QNetworkReply::NoError == replyError)
    {
        mReply->deleteLater();
        mReply = NULL;
        emit loadingFinished(tempData);
    }
    else
    {
        qDebug() << "HttpRequest::err: " << mReply->errorString();

        QString errStr("Twitter API returned ");
        errStr += QString::number(mReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt());
        errStr += " ";
        errStr += mReply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray();
        mReply->deleteLater();
        mReply = NULL;
        emit loadingError(errStr);
    }
}
Beispiel #3
0
void WebView::slotIconChanged()
{
    if (!loadingError()) {
        m_siteIcon = icon();
        m_siteIconUrl = url();

        IconProvider::instance()->saveIcon(this);
    }
}
Beispiel #4
0
void AuthenticationMgr::doLogin(const QString &userName, const QString &passwd , bool isSave)
{
    LOG_METHOD;
    if(userName.isEmpty() || passwd.isEmpty())
    {
        emit loadingError("User info error");
        return;
    }

    mCatNameList.clear();
    mFinishedCatList.clear();
    mAllDataMap.clear();
    mCachedUrlList.clear();
    mCachedUrlInFile.clear();

    mCachedUrlInFile = readCachedUrl();

    mUserName = userName;

    //now only use file for recording use loginin infomation;
    QString qAppPath = QApplication::applicationDirPath();
    QString qXmlFileName = qAppPath + "/" + userName;

    if (QFile::exists(qXmlFileName))
    {
        qDebug()<<"user name exisiting";
        QFile::remove(qXmlFileName);
    }

    QString postStr = getLoginString(userName, passwd);

    mIsSaveUserInfo = isSave;

    QNetworkRequest req;

    QUrl url(GOOGLE_CLIENT_LOGIN_HTTP);
    req.setUrl(url);

    mReqType = EReqSID;

    emit loadingStarted();

    QNetworkReply *reply = mpNetAccessMgr->post(req,QByteArray(postStr.toAscii()));

    //the SSL Errors should be ignored;
    reply->ignoreSslErrors();

}
Beispiel #5
0
MRSimpleModel::MRSimpleModel(QObject *aParent) : QAbstractListModel (aParent),
            mImgMgr(NULL), mRssChannelFile(NULL)
{
    QHash<int, QByteArray> roles;
    roles[ETitle] = "title";
    roles[EIconUrl]="iconUrl";
    roles[EExcerpt] = "excerpt";
    roles[EPubDate] = "pubDate";
    setRoleNames(roles);

    mImgMgr = ImageMgr::openInstance();
    connect(mImgMgr, SIGNAL(loadingFinished(QString, int)), this, SLOT(onImgFinished(QString, int)));
    connect(mImgMgr, SIGNAL(loadingError(QString)), this, SLOT(onImgError(QString)));
    connect(mImgMgr, SIGNAL(cancel()), this, SLOT(onImgReqCancel()));

}
Beispiel #6
0
void ImageViewer::emitSignals()
{
    emit imageChanged();
    emit loadingError("some error message");
}
Beispiel #7
0
void EntryBase::_maybeError()
{
    if (!_author)
        emit loadingError();
}