コード例 #1
0
ファイル: fbtalker.cpp プロジェクト: tejastank/kipi-plugins
void FbTalker::logout()
{
    if (m_job)
    {
        m_job->kill();
        m_job = 0;
    }
    emit signalBusy(true);

    QMap<QString, QString> args;
    args["access_token"] = m_accessToken;

    QByteArray tmp(getCallString(args).toUtf8());
    KIO::TransferJob* job = KIO::http_post(KUrl(m_apiURL,"auth.expireSession"), tmp, KIO::HideProgressInfo);
    job->addMetaData("UserAgent", m_userAgent);
    job->addMetaData("content-type",
                     "Content-Type: application/x-www-form-urlencoded");

    connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
            this, SLOT(data(KIO::Job*,QByteArray)));

    m_state = FB_LOGOUT;
    m_job   = job;
    m_buffer.resize(0);

    // logout is synchronous call
    job->exec();
    slotResult(job);
}
コード例 #2
0
void SmugTalker::logout()
{
    if (m_job)
    {
        m_job->kill();
        m_job = 0;
    }
    emit signalBusy(true);

    KUrl url(m_apiURL);
    url.addQueryItem("method", "smugmug.logout");
    url.addQueryItem("SessionID", m_sessionID);

    QByteArray tmp;
    KIO::TransferJob* job = KIO::http_post(url, tmp, KIO::HideProgressInfo);
    job->addMetaData("UserAgent", m_userAgent);
    job->addMetaData("content-type",
                     "Content-Type: application/x-www-form-urlencoded");

    connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
            this, SLOT(data(KIO::Job*,QByteArray)));

    m_state = SMUG_LOGOUT;
    m_job   = job;
    m_buffer.resize(0);

    // logout is synchronous call
    job->exec();
    slotResult(job);
}
コード例 #3
0
ファイル: imagewidget.cpp プロジェクト: quazgar/kdepimlibs
QImage ImageLoader::loadImage(const QUrl &url, bool *ok, bool selectPictureSize)
{
    QImage image;

    if (url.isEmpty()) {
        return image;
    }

    (*ok) = false;

    if (url.isLocalFile()) {
        if (image.load(url.toLocalFile())) {
            (*ok) = true;
        }
    } else {
        QByteArray imageData;
        KIO::TransferJob *job = KIO::get(url, KIO::NoReload);
        QObject::connect(job, &KIO::TransferJob::data,
        [&imageData](KIO::Job *, const QByteArray & data) {
            imageData.append(data);
        });
        if (job->exec()) {
            if (image.loadFromData(imageData)) {
                (*ok) = true;
            }
        }
    }

    if (!(*ok)) {
        // image does not exist (any more)
        KMessageBox::sorry(mParent, i18n("This contact's image cannot be found."));
        return image;
    }

    if (selectPictureSize) {
        QPixmap pixmap = QPixmap::fromImage(image);
        image = KPixmapRegionSelectorDialog::getSelectedImage(pixmap, 1, 1, mParent);
        if (image.isNull()) {
            (*ok) = false;
            return image;
        }
    }

    if (image.height() > 720 || image.width() > 720) {
        if (image.height() > image.width()) {
            image = image.scaledToHeight(720);
        } else {
            image = image.scaledToWidth(720);
        }
    }

    (*ok) = true;

    return image;
}
コード例 #4
0
ファイル: manpagedocumentation.cpp プロジェクト: krf/kdevelop
QString ManPageDocumentation::getManPageContent()
{
    KIO::TransferJob  * transferJob = KIO::get(m_url, KIO::NoReload, KIO::HideProgressInfo);
    connect( transferJob, SIGNAL(data(KIO::Job*,QByteArray)),
             this, SLOT(readDataFromManPage(KIO::Job*,QByteArray)) );
    if (transferJob->exec()){
        return m_manPageBuffer;
    } else {
        return i18n("Could not find any documentation for '%1'", m_name);
    }
}