当前位置: 首页>>代码示例>>C++>>正文


C++ Job::queryMetaData方法代码示例

本文整理汇总了C++中kio::Job::queryMetaData方法的典型用法代码示例。如果您正苦于以下问题:C++ Job::queryMetaData方法的具体用法?C++ Job::queryMetaData怎么用?C++ Job::queryMetaData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kio::Job的用法示例。


在下文中一共展示了Job::queryMetaData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: remove

void ResourceHandleManager::remove(ResourceHandle* job)
{
    ResourceHandleInternal* d = job->getInternal();
    if (!d || !d->m_client)
        return;

    KIO::Job* kioJob = 0;

    // Check if we know about 'job'...
    QMap<ResourceHandle*, KIO::Job*>::const_iterator it = m_jobToKioMap.find(job);
    if (it != m_jobToKioMap.end())
        kioJob = it.value();

    if (!kioJob)
        return;

    QString headers = kioJob->queryMetaData("HTTP-Headers");
    if (job->method() == "GET")
        d->m_charset = job->extractCharsetFromHeaders(headers);
    else if (job->method() == "POST") {
        // Will take care of informing our client...
        // This must be called before didFinishLoading(),
        // otherwhise assembleResponseHeaders() is called too early...
        RefPtr<PlatformResponseQt> response(new PlatformResponseQt());
        response->data = headers;
        response->url = job->url().url();

        job->receivedResponse(response);
    }

    d->m_client->receivedAllData(job, 0);
    d->m_client->didFinishLoading(job);

    m_jobToKioMap.remove(job);
    m_kioToJobMap.remove(kioJob);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:36,代码来源:ResourceHandleManagerKDE.cpp

示例2: slotResult

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();
    }
开发者ID:,项目名称:,代码行数:73,代码来源:


注:本文中的kio::Job::queryMetaData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。