fixed "no data" label on the event form

This commit is contained in:
Dorian Zedler 2018-12-26 10:23:54 +01:00
parent 9c0e867ffd
commit a7a26513c0
3 changed files with 19 additions and 7 deletions

View file

@ -34,8 +34,8 @@ HEADERS += \
headers/filtermodel.h headers/filtermodel.h
RESOURCES += \ 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 # Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH = QML_IMPORT_PATH =

View file

@ -20,12 +20,10 @@ ApplicationWindow {
property bool is_error property bool is_error
property string error property string error
property bool initdone: false
property bool firstinitdone: false
property string text_color: "black" // "#424753" property string textColor: "black" // "#424753"
property string background_color: "white" property string backgroundColor: "white"
property string toolbar_color: "#312f38" property string toolbarColor: "#312f38"
state: "loggedIn" state: "loggedIn"

View file

@ -253,6 +253,14 @@ int ServerConn::getEvents(QString day){
QVariant status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); QVariant status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
this->progress = 1; this->progress = 1;
if(status_code != 200){ 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()); return(status_code.toInt());
} }
@ -367,6 +375,12 @@ int ServerConn::getEvents(QString day){
this->m_events = tmpEvents; this->m_events = tmpEvents;
qDebug() << tmpEvents; qDebug() << tmpEvents;
// check if there is any valid data
if(this->m_events.isEmpty()){
// no data
return(901);
}
// return success // return success
return(200); return(200);