Copy request to clipboard upon failure
This commit is contained in:
parent
45b1c6f2dc
commit
92132ed6fb
@ -216,7 +216,7 @@ QString parsePathspec(QJsonDocument &response, QString &pathspec) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseResult(QJsonDocument result, QString returnPathspec, QString name) {
|
void parseResult(QJsonDocument result, QByteArray data, QString returnPathspec, QString name) {
|
||||||
if (result.isObject()) {
|
if (result.isObject()) {
|
||||||
qDebug() << result.object()[".url"];
|
qDebug() << result.object()[".url"];
|
||||||
QString url = parsePathspec(result, returnPathspec);
|
QString url = parsePathspec(result, returnPathspec);
|
||||||
@ -225,8 +225,11 @@ void parseResult(QJsonDocument result, QString returnPathspec, QString name) {
|
|||||||
notifications::notify("KShare Custom Uploader " + name, "Copied upload link to clipboard!");
|
notifications::notify("KShare Custom Uploader " + name, "Copied upload link to clipboard!");
|
||||||
} else
|
} else
|
||||||
notifications::notify("KShare Custom Uploader " + name, "Upload done, but result empty!");
|
notifications::notify("KShare Custom Uploader " + name, "Upload done, but result empty!");
|
||||||
} else
|
} else {
|
||||||
notifications::notify("KShare Custom Uploader " + name, "Upload done, but result is not JSON Object!");
|
notifications::notify("KShare Custom Uploader " + name,
|
||||||
|
"Upload done, but result is not JSON Object! Result in clipboard.");
|
||||||
|
QApplication::clipboard()->setText(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomUploader::doUpload(QPixmap *pixmap) {
|
void CustomUploader::doUpload(QPixmap *pixmap) {
|
||||||
@ -284,8 +287,8 @@ void CustomUploader::doUpload(QPixmap *pixmap) {
|
|||||||
notifications::notify("KShare Custom Uploader " + name(), "Copied upload result to clipboard!");
|
notifications::notify("KShare Custom Uploader " + name(), "Copied upload result to clipboard!");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ioutils::postJson(target, h, data, [&](QJsonDocument result, QByteArray, QNetworkReply *) {
|
ioutils::postJson(target, h, data, [&](QJsonDocument result, QByteArray data, QNetworkReply *) {
|
||||||
parseResult(result, returnPathspec, name());
|
parseResult(result, data, returnPathspec, name());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user