fixed "no data" label on the event form
This commit is contained in:
parent
9c0e867ffd
commit
a7a26513c0
3 changed files with 19 additions and 7 deletions
|
@ -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 =
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Reference in a new issue