From a7a26513c0a890c83367cfe8b635185f521b4508 Mon Sep 17 00:00:00 2001 From: dorian Date: Wed, 26 Dec 2018 10:23:54 +0100 Subject: [PATCH] fixed "no data" label on the event form --- fannyapp.pro | 4 ++-- qml/main.qml | 8 +++----- sources/serverconn.cpp | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/fannyapp.pro b/fannyapp.pro index da34ee8..f11f0eb 100644 --- a/fannyapp.pro +++ b/fannyapp.pro @@ -34,8 +34,8 @@ HEADERS += \ headers/filtermodel.h RESOURCES += \ - qml/qml.qrc \ - shared/shared.qrc + shared/shared.qrc \ + qml/qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = diff --git a/qml/main.qml b/qml/main.qml index 8dc3ea5..fdbaeb3 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -20,12 +20,10 @@ ApplicationWindow { property bool is_error property string error - property bool initdone: false - property bool firstinitdone: false - property string text_color: "black" // "#424753" - property string background_color: "white" - property string toolbar_color: "#312f38" + property string textColor: "black" // "#424753" + property string backgroundColor: "white" + property string toolbarColor: "#312f38" state: "loggedIn" diff --git a/sources/serverconn.cpp b/sources/serverconn.cpp index 9ce2d34..d2b41b0 100644 --- a/sources/serverconn.cpp +++ b/sources/serverconn.cpp @@ -253,6 +253,14 @@ int ServerConn::getEvents(QString day){ QVariant status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); this->progress = 1; if(status_code != 200){ + // if the request didn't result in a success, return the error code + + // if the request failed but there is still old data available + if(!this->m_events.isEmpty()){ + // set the status code to 902 (old data) + status_code = 902; + } + return(status_code.toInt()); } @@ -367,6 +375,12 @@ int ServerConn::getEvents(QString day){ this->m_events = tmpEvents; qDebug() << tmpEvents; + // check if there is any valid data + if(this->m_events.isEmpty()){ + // no data + return(901); + } + // return success return(200);