WebUI: Fix WebAPI returned data.

This commit is contained in:
Vladimir Golovnev (Glassez) 2014-11-05 19:45:31 +03:00
parent a63d4e3400
commit 7b7f88ae4f
3 changed files with 12 additions and 5 deletions

View file

@ -65,7 +65,8 @@ static const char *__TRANSLATIONS__[] = {
QT_TRANSLATE_NOOP("HttpServer", "Invalid Username or Password."),
QT_TRANSLATE_NOOP("HttpServer", "Password"),
QT_TRANSLATE_NOOP("HttpServer", "Login"),
QT_TRANSLATE_NOOP("HttpServer", "qBittorrent web User Interface")
QT_TRANSLATE_NOOP("HttpServer", "qBittorrent web User Interface"),
QT_TRANSLATE_NOOP("HttpServer", "Upload Failed!")
};
static const struct { const char *source; const char *comment; } __COMMENTED_TRANSLATIONS__[] = {

View file

@ -263,11 +263,12 @@ void RequestHandler::action_command_upload()
QBtSession::instance()->addTorrent(filePath);
// Clean up
fsutils::forceRemove(filePath);
print(QLatin1String("<script type=\"text/javascript\">window.parent.hideAll();</script>"));
}
else
{
qWarning() << "I/O Error: Could not create temporary file";
status(500, "Internal Server Error");
print(QByteArray("I/O Error: Could not create temporary file."), CONTENT_TYPE_TXT);
}
}
}

View file

@ -9,10 +9,15 @@
function stateChangeHandler() {
if (this.readyState == this.DONE) {
if (this.status == 200)
if (this.status == 200) {
window.parent.closeWindows();
else
alert("Upload Failed!");
} else {
if (this.responseText != "") {
alert(this.responseText);
} else {
alert("_(Upload Failed!)");
}
}
}
}