Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/pastebin/pastebinplugin.cpp
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 84 | if (m_data.isEmpty()) { | |||
---|---|---|---|---|---|
87 | emitResult(); | 87 | emitResult(); | ||
88 | return; | 88 | return; | ||
89 | } | 89 | } | ||
90 | 90 | | |||
91 | // qCDebug(PLUGIN_PASTEBIN) << "exporting patch to pastebin" << source->file(); | 91 | // qCDebug(PLUGIN_PASTEBIN) << "exporting patch to pastebin" << source->file(); | ||
92 | QByteArray bytearray = "api_option=paste&api_paste_private=1&api_paste_name=kde-purpose-pastebin-plugin&api_paste_expire_date=1D&api_paste_format=diff&api_dev_key="+*apiKey+"&api_paste_code="; | 92 | QByteArray bytearray = "api_option=paste&api_paste_private=1&api_paste_name=kde-purpose-pastebin-plugin&api_paste_expire_date=1D&api_paste_format=diff&api_dev_key="+*apiKey+"&api_paste_code="; | ||
93 | bytearray += QUrl::toPercentEncoding(QString::fromUtf8(m_data)); | 93 | bytearray += QUrl::toPercentEncoding(QString::fromUtf8(m_data)); | ||
94 | 94 | | |||
95 | const QUrl url(QStringLiteral("http://pastebin.com/api/api_post.php")); | 95 | const QUrl url(QStringLiteral("https://pastebin.com/api/api_post.php")); | ||
96 | 96 | | |||
97 | KIO::TransferJob *tf = KIO::http_post(url, bytearray); | 97 | KIO::TransferJob *tf = KIO::http_post(url, bytearray); | ||
98 | 98 | | |||
99 | tf->addMetaData(QStringLiteral("content-type"), QStringLiteral("Content-Type: application/x-www-form-urlencoded")); | 99 | tf->addMetaData(QStringLiteral("content-type"), QStringLiteral("Content-Type: application/x-www-form-urlencoded")); | ||
100 | connect(tf, &KIO::TransferJob::data, this, [this](KIO::Job*, const QByteArray& data) { m_resultData += data; }); | 100 | connect(tf, &KIO::TransferJob::data, this, [this](KIO::Job*, const QByteArray& data) { m_resultData += data; }); | ||
101 | connect(tf, &KJob::result, this, &PastebinJob::textUploaded); | 101 | connect(tf, &KJob::result, this, &PastebinJob::textUploaded); | ||
102 | 102 | | |||
103 | m_resultData.clear(); | 103 | m_resultData.clear(); | ||
Show All 35 Lines |