From 231e02f97ddcf355855190ed61c71e54c1ab5157 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Sat, 7 Dec 2013 14:56:03 +0200 Subject: Divelogs.de: parse response once the upload is finished This is based on the GTK version. Signed-off-by: Lubomir I. Ivanov --- qt-ui/subsurfacewebservices.cpp | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 5c2fa6d12..e92dd431c 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -724,27 +724,19 @@ void DivelogsDeWebServices::uploadFinished() // check what the server sent us: it might contain // an error condition, such as a failed login QByteArray xmlData = reply->readAll(); - - // ### FIXME: what's the format? - /* - // char *error; - if (error) { - parsed = strstr(error, ""); - endat = strstr(error, ""); - if (parsed && endat) - *endat = '\0'; + char *resp = xmlData.data(); + if (resp) { + char *parsed = strstr(resp, ""); + // char *endat = strstr(resp, ""); + if (parsed) { + if (strstr(resp, "failed")) + ui.status->setText(tr("Login failed")); + else + ui.status->setText(tr("Upload successful")); + } else { + ui.status->setText(tr("Cannot parse response")); } - if (error && strstr(error, "failed")) - type = GTK_MESSAGE_ERROR; - else - type = GTK_MESSAGE_INFO; } - if (parsed) - divelogs_status_dialog(parsed, type); - else if (error) - divelogs_status_dialog(error, type); - free(error); - */ } void DivelogsDeWebServices::setStatusText(int status) -- cgit v1.2.3-70-g09d2