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"?> <?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"> <paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/> <external-path name="external_files" path="."/>
</paths> </paths>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!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> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View file

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

View file

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

View file

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