This commit is contained in:
dorian 2018-06-25 08:07:05 +02:00
parent ae5630962e
commit 5d7cca3572
5 changed files with 29 additions and 12 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="com.itsblue.flgvertretung" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.03" android:versionCode="3" android:installLocation="auto">
<manifest package="com.itsblue.flgvertretung" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.03.1" android:versionCode="4" android:installLocation="auto">
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.6.2, 2018-06-25T00:15:00. -->
<!-- Written by QtCreator 4.6.2, 2018-06-25T08:02:51. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View file

@ -3,6 +3,7 @@ import QtQuick.Controls 2.2
Page {
id: root
objectName: "MainPage"
anchors.fill: parent
header: AppToolBar {
contentHeight: toolButton.implicitHeight

View file

@ -10,20 +10,30 @@ ApplicationWindow {
property bool is_error
property string error
property bool initdone: false
property bool firstinitdone: false
onBeforeRendering: {
if(!firstinitdone){
var isinit = _cppAppSettings.loadSetting("init")
console.log("getinit");
console.log(isinit);
if(isinit === "0"){
stackView.push("qrc:/LoginPage.qml", {});
}
}
firstinitdone = true
}
Timer {
//runs only one time at applictaion lauch
property bool finished: true
id: initTimer
interval: 1;
running: true
repeat: initdone === false
interval: 10;
running: initdone === false
repeat: finished
onTriggered: {
finished = false
var init = _cppAppSettings.loadSetting("init")
if(init !== "1"){
stackView.push("qrc:/LoginPage.qml")
initdone = true
return
}
var perm = _cppAppSettings.loadSetting("permanent")
console.log("checkoldlogin", perm);
@ -32,11 +42,15 @@ ApplicationWindow {
var ret = _cppServerConn.login(_cppAppSettings.loadSetting("username"), _cppAppSettings.loadSetting("password"), true);
if(ret === "OK"){
_cppAppSettings.writeSetting("init", 1);
if(stackView.currentItem.objectName !== "MainPage"){
stackView.push("qrc:/MainPage.qml", {});
}
window.is_error = false;
}
else if(ret === "Keine Verbindung zum Server."){
handleError(0)
initTimer.interval = 100
//initTimer.interval = 1000
finished = true
return
}
@ -48,6 +62,7 @@ ApplicationWindow {
else {
stackView.push("qrc:/LoginPage.qml")
}
finished = true
initdone = true
}
}

View file

@ -186,6 +186,7 @@ float ServerConn::getProgress()
int ServerConn::getFoodPlan()
{
this->progress = 0;
ReturnData_t ret; //this is a custom type to store the returned data
// Call the webservice
@ -209,7 +210,7 @@ int ServerConn::getFoodPlan()
//get the status code
QVariant status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
this->progress = 1;
if(status_code != 200){
return(status_code.toInt());
}