diff --git a/android-sources/AndroidManifest.xml b/android-sources/AndroidManifest.xml index d1fbea3..fd3446e 100644 --- a/android-sources/AndroidManifest.xml +++ b/android-sources/AndroidManifest.xml @@ -2,7 +2,7 @@ - + @@ -60,6 +60,18 @@ --> + + + + + + diff --git a/android-sources/build.gradle b/android-sources/build.gradle new file mode 100644 index 0000000..b9ae535 --- /dev/null +++ b/android-sources/build.gradle @@ -0,0 +1,58 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.2.3' + } +} + +allprojects { + repositories { + jcenter() + } +} + +apply plugin: 'com.android.application' + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:support-v4:25.3.1' +} + +android { + /******************************************************* + * The following variables: + * - androidBuildToolsVersion, + * - androidCompileSdkVersion + * - qt5AndroidDir - holds the path to qt android files + * needed to build any Qt application + * on Android. + * + * are defined in gradle.properties file. This file is + * updated by QtCreator and androiddeployqt tools. + * Changing them manually might break the compilation! + *******************************************************/ + + compileSdkVersion androidCompileSdkVersion.toInteger() + + buildToolsVersion androidBuildToolsVersion + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] + aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] + res.srcDirs = [qt5AndroidDir + '/res', 'res'] + resources.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } + + lintOptions { + abortOnError false + } +} diff --git a/android-sources/res/xml/provider_paths.xml b/android-sources/res/xml/provider_paths.xml new file mode 100644 index 0000000..4ff8931 --- /dev/null +++ b/android-sources/res/xml/provider_paths.xml @@ -0,0 +1,4 @@ + + + + diff --git a/android-sources/src/com/itsblue/flgvertretung/MainActivity.java b/android-sources/src/com/itsblue/flgvertretung/MainActivity.java new file mode 100644 index 0000000..0757595 --- /dev/null +++ b/android-sources/src/com/itsblue/flgvertretung/MainActivity.java @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtAndroidExtras module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +package com.itsblue.flgvertretung; + +import android.app.Notification; +import android.app.NotificationManager; +import android.content.Context; + +import android.app.Activity; +import java.lang.Runnable; +import android.content.Intent; +import java.io.File; +import android.net.Uri; + +public class MainActivity extends org.qtproject.qt5.android.bindings.QtActivity +{ + private static MainActivity m_instance; + + public MainActivity() + { + m_instance = this; + } + /* + private static NotificationManager m_notificationManager; + private static Notification.Builder m_builder; + private static NotificationClient m_instance; + + public NotificationClient() + { + m_instance = this; + } + + public static void notify(String s) + { + if (m_notificationManager == null) { + m_notificationManager = (NotificationManager)m_instance.getSystemService(Context.NOTIFICATION_SERVICE); + m_builder = new Notification.Builder(m_instance); + m_builder.setSmallIcon(R.drawable.icon); + m_builder.setContentTitle("A message from Qt!"); + } + + m_builder.setContentText(s); + m_notificationManager.notify(1, m_builder.build()); + } +*/ + +public static boolean openUrl(String url, String mime) +{ + boolean ok = true; + Intent intent = new Intent(); + intent.setAction(android.content.Intent.ACTION_VIEW); + File file = new File(url); + intent.setDataAndType(Uri.fromFile(file), "text/plain"); + + m_instance.startActivity(intent); + return ok; + + +/* +try +{ + Uri uri = Uri.parse(url); + Intent intent = new Intent(Intent.ACTION_VIEW, uri); + if ( !mime.isEmpty() ) intent.setDataAndType(uri, mime); + m_instance.startActivity(intent); +} + +catch (Exception e) +{ e.printStackTrace(); ok = false; } + +return ok; +*/ +} + + +} diff --git a/fannyapp.pro b/fannyapp.pro index 43c9af7..bf2e553 100644 --- a/fannyapp.pro +++ b/fannyapp.pro @@ -19,17 +19,19 @@ ICON = favicon.icns RC_ICONS = favicon.ico SOURCES += \ - source/serverconn.cpp \ - source/main.cpp \ - source/appsettings.cpp + sources/serverconn.cpp \ + sources/main.cpp \ + sources/appsettings.cpp \ + sources/eventform.cpp HEADERS += \ headers/serverconn.h \ - headers/appsettings.h + headers/appsettings.h \ + headers/eventform.h RESOURCES += \ qml/qml.qrc \ - shared.qrc + shared/shared.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = @@ -43,10 +45,16 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target android { + QT += androidextras ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources } DISTFILES += \ favicon.png \ - android-sources/AndroidManifest.xml + android-sources/AndroidManifest.xml \ + android-sources/src/com/itsblue/flgvertretung/MainActivity.java \ + android-sources/res/drawable-hdpi/icon.png \ + android-sources/res/drawable-ldpi/icon.png \ + android-sources/res/drawable-mdpi/icon.png \ + android-sources/res/xml/provider_paths.xml diff --git a/headers/eventform.h b/headers/eventform.h new file mode 100644 index 0000000..74d418c --- /dev/null +++ b/headers/eventform.h @@ -0,0 +1,17 @@ +#ifndef EVENTFORM_H +#define EVENTFORM_H + +#include + +class EventForm : public QObject +{ + Q_OBJECT +public: + explicit EventForm(QObject *parent = nullptr); + +signals: + +public slots: +}; + +#endif // EVENTFORM_H \ No newline at end of file diff --git a/headers/serverconn.h b/headers/serverconn.h index e5fd142..42fcbc8 100644 --- a/headers/serverconn.h +++ b/headers/serverconn.h @@ -4,6 +4,8 @@ #include #include #include +#include + #include #include #include @@ -11,6 +13,10 @@ #include "headers/appsettings.h" +#ifdef Q_OS_ANDROID +#include +#endif + typedef struct strReturnData{ int status_code; diff --git a/qml/AppToolBar.qml b/qml/Components/AppToolBar.qml similarity index 92% rename from qml/AppToolBar.qml rename to qml/Components/AppToolBar.qml index 980493a..0552063 100644 --- a/qml/AppToolBar.qml +++ b/qml/Components/AppToolBar.qml @@ -10,7 +10,7 @@ ToolBar { id: errorField width: parent.width height: 30 - enabled: window.is_error & stackView.currentItem.objectName !== "LoginPage" & showErrorBar + enabled: app.is_error & app.state !== "notLoggedIn" & showErrorBar anchors.top: parent.bottom color: "red" @@ -41,7 +41,7 @@ ToolBar { color: "White" font.pointSize: 8 visible: parent.height !== 0 - text: window.error + text: app.error } } diff --git a/qml/ProgressCircle.qml b/qml/Components/ProgressCircle.qml similarity index 100% rename from qml/ProgressCircle.qml rename to qml/Components/ProgressCircle.qml diff --git a/qml/EventForm.qml b/qml/Forms/EventForm.qml similarity index 99% rename from qml/EventForm.qml rename to qml/Forms/EventForm.qml index e340986..8d08b3c 100644 --- a/qml/EventForm.qml +++ b/qml/Forms/EventForm.qml @@ -109,7 +109,7 @@ Page { Label { anchors.left: parent.left anchors.leftMargin: 10 - anchors.top: test.bottom + anchors.top: text.bottom anchors.topMargin: cust_spacing id: spacer text: "" diff --git a/qml/FoodPlanForm.qml b/qml/Forms/FoodPlanForm.qml similarity index 100% rename from qml/FoodPlanForm.qml rename to qml/Forms/FoodPlanForm.qml diff --git a/qml/HomeForm.qml b/qml/Forms/HomeForm.qml similarity index 96% rename from qml/HomeForm.qml rename to qml/Forms/HomeForm.qml index aa9aa29..be5d101 100644 --- a/qml/HomeForm.qml +++ b/qml/Forms/HomeForm.qml @@ -2,6 +2,8 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtGraphicalEffects 1.0 +import "../Components" + Page { //anchors.fill: parent @@ -35,7 +37,7 @@ Page { font.pixelSize: 20 wrapMode: Label.Wrap width: window.width / 1.2 - color: window.text_color + color: app.text_color anchors { top: parent.top topMargin: window.height / 8 - laWelcome.height / 2 @@ -110,7 +112,7 @@ Page { anchors.bottom: buttToday.bottom color: "white" opacity: 0.7 - visible: window.is_error + visible: app.is_error } Dialog { @@ -133,7 +135,9 @@ Page { progress.text = "100%" busyDialog.close() text.visible = true - if(ret === "OK"){ + if(ret.startsWith("OK")){ + var path = ret.replace("OK_", ""); + Qt.openUrlExternally(path); return } else if(ret === "Ungültige Benutzerdaten."){ diff --git a/qml/WebsitePage.qml b/qml/Forms/WebsiteForm.qml similarity index 98% rename from qml/WebsitePage.qml rename to qml/Forms/WebsiteForm.qml index 49b034e..9564b4b 100644 --- a/qml/WebsitePage.qml +++ b/qml/Forms/WebsiteForm.qml @@ -2,7 +2,6 @@ import QtQuick 2.9 import QtWebView 1.1 import QtQuick.Controls 2.2 -import QtWebView 1.1 import QtQuick.Layouts 1.1 import QtQuick.Controls.Styles 1.2 diff --git a/qml/LoginPage.qml b/qml/Pages/LoginPage.qml similarity index 99% rename from qml/LoginPage.qml rename to qml/Pages/LoginPage.qml index 530c691..a0b0cae 100644 --- a/qml/LoginPage.qml +++ b/qml/Pages/LoginPage.qml @@ -1,6 +1,7 @@ import QtQuick 2.11 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import "../Components" Page { id: root @@ -20,7 +21,7 @@ Page { Image { id: bigLogo - source: "favicon.png" + source: "qrc:/favicon.png" anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right diff --git a/qml/MainPage.qml b/qml/Pages/MainPage.qml similarity index 98% rename from qml/MainPage.qml rename to qml/Pages/MainPage.qml index a36a987..a0cadde 100644 --- a/qml/MainPage.qml +++ b/qml/Pages/MainPage.qml @@ -3,6 +3,8 @@ import QtQuick.Controls 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls.Styles 1.2 +import "../Components" +import "../Forms" Page { id: root @@ -207,7 +209,7 @@ Page { StackView { id: stackView - initialItem: "qrc:/HomeForm.qml" + initialItem: "qrc:/Forms/HomeForm.qml" anchors.fill: parent } diff --git a/qml/main.qml b/qml/main.qml index 755a319..ef9452e 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -1,133 +1,177 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 +import "./Components" +import "./Forms" +import "./Pages" + ApplicationWindow { id: window visible: true width: 540 height: 960 - property bool is_error - property string error - property bool initdone: false - property bool firstinitdone: false + Item { + id: app - property string text_color: "black" //"#424753" - property string background_color: "white" - property string toolbar_color: "#312f38" + anchors.fill: parent - onBeforeRendering: { - if(!firstinitdone){ - var isinit = _cppAppSettings.loadSetting("permanent") - console.log("getinit"); - console.log(isinit); - if(isinit === "0"){ - stackView.push("qrc:/LoginPage.qml", {}); + 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" + + states: [ + State { + name: "notLoggedIn" + PropertyChanges { + target: mainStack + currPage: loginPage + } + }, + + State { + name: "loggedIn" + PropertyChanges { + target: mainStack + currPage: mainPage + } + } + ] + +// onBeforeRendering: { +// if(!firstinitdone){ +// var isinit = _cppAppSettings.loadSetting("permanent") +// 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: false + onTriggered: { + var init = _cppAppSettings.loadSetting("init") + var perm = _cppAppSettings.loadSetting("permanent") + console.log("checkoldlogin:", perm); + if(perm === "1"){ + console.log("Perm") + var ret = _cppServerConn.login(_cppAppSettings.loadSetting("username"), _cppAppSettings.loadSetting("password"), true); + if(ret === "OK"){ + initdone = true + _cppAppSettings.writeSetting("init", 1); + if(app.state !== "loggedIn"){ + app.state = "loggedIn" + } + window.is_error = false; + } + else if(ret === "Keine Verbindung zum Server."){ + handleError(0) + //initTimer.interval = 1000 + finished = true + return + } + + else { + ret = _cppServerConn.checkConn() + handleError(ret) + } + } + else { + app.initdone = false + if(app.state !== "notLoggedIn"){ + app.state = "notLoggedIn" + } + } + app.initdone = true } } - firstinitdone = true - } - Timer { - //runs only one time at applictaion lauch - property bool finished: true - id: initTimer - interval: 1; - running: initdone === false - repeat: finished - onTriggered: { - finished = false - var init = _cppAppSettings.loadSetting("init") + Timer { + id: refreshTimer + interval: 1000; + running: app.initdone && stackView.currentItem.objectName !== "LoginPage" + repeat: true + onTriggered: { + var ret = _cppServerConn.checkConn() + handleError(ret) + } + } - var perm = _cppAppSettings.loadSetting("permanent") - console.log("checkoldlogin:", perm); - if(perm === "1"){ - console.log("Perm") - var ret = _cppServerConn.login(_cppAppSettings.loadSetting("username"), _cppAppSettings.loadSetting("password"), true); - if(ret === "OK"){ - initdone = true - _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 = 1000 - finished = true - return - } + StackView { + id: mainStack - else { - ret = _cppServerConn.checkConn() - handleError(ret) + property var currPage + + anchors.fill: parent + + onCurrPageChanged: { + mainStack.replace(currPage) + } + + initialItem: mainPage + + Component { + id: loginPage + LoginPage {} + } + + Component { + id: mainPage + MainPage {} + } + } + + function handleError(error_code){ + if(error_code === 200){ + window.is_error = false; + window.error = ""; + } + else if(error_code === 401){ + console.warn("401") + _cppAppSettings.writeSetting("permanent", 0) + _cppAppSettings.writeSetting("username", "") + _cppAppSettings.writeSetting("password", "") + if(["LoginPage"].indexOf(stackView.currentItem.objectName) < 0){ + console.log("switching to login page") + stackView.push("./Pages/LoginPage.qml"); } + window.is_error = true; + window.error = "Nicht angemeldet!!"; + } + else if(error_code === 500){ + window.is_error = true; + window.error = "Interner Server Fehler!"; + } + else if(error_code === 0){ + window.is_error = true; + window.error = "Keine Verbindung zum Server!"; + } + else if(error_code === 404){ + //the testcon function calls a non existent file to be fast, so no error here + window.is_error = false; + } + else if(error_code === 111){ + window.is_error = true; + window.error = "Unbekannter interner Fehler!"; } else { - initdone = false - if(stackView.currentItem.objectName !== "LoginPage"){ - stackView.push("qrc:/LoginPage.qml") - } + window.is_error = true; + window.error = "Unbekannter Fehler! ("+error_code+")"; } - finished = true - initdone = true } - } - Timer { - id: refreshTimer - interval: 1000; - running: initdone && stackView.currentItem.objectName !== "LoginPage" - repeat: true - onTriggered: { - var ret = _cppServerConn.checkConn() - handleError(ret) - } - } - - StackView { - id: stackView - initialItem: "MainPage.qml" - anchors.fill: parent - } - - function handleError(error_code){ - if(error_code === 200){ - window.is_error = false; - window.error = ""; - } - else if(error_code === 401){ - console.warn("401") - _cppAppSettings.writeSetting("permanent", 0) - _cppAppSettings.writeSetting("username", "") - _cppAppSettings.writeSetting("password", "") - if(["LoginPage"].indexOf(stackView.currentItem.objectName) < 0){ - console.log("switching to login page") - stackView.push("qrc:/LoginPage.qml"); - } - window.is_error = true; - window.error = "Nicht angemeldet!!"; - } - else if(error_code === 500){ - window.is_error = true; - window.error = "Interner Server Fehler!"; - } - else if(error_code === 0){ - window.is_error = true; - window.error = "Keine Verbindung zum Server!"; - } - else if(error_code === 404){ - //the testcon function calls a non existent file to be fast, so no error here - window.is_error = false; - } - else if(error_code === 111){ - window.is_error = true; - window.error = "Unbekannter interner Fehler!"; - } - else { - window.is_error = true; - window.error = "Unbekannter Fehler! ("+error_code+")"; - } } } diff --git a/qml/qml.qrc b/qml/qml.qrc index bd22266..5ef2fe6 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -1,14 +1,14 @@ main.qml - HomeForm.qml + Forms/HomeForm.qml qtquickcontrols2.conf - LoginPage.qml - MainPage.qml - AppToolBar.qml - WebsitePage.qml - FoodPlanForm.qml - ProgressCircle.qml - EventForm.qml + Pages/LoginPage.qml + Pages/MainPage.qml + Components/AppToolBar.qml + Forms/WebsiteForm.qml + Forms/FoodPlanForm.qml + Components/ProgressCircle.qml + Forms/EventForm.qml diff --git a/favicon.icns b/shared/favicon.icns similarity index 100% rename from favicon.icns rename to shared/favicon.icns diff --git a/favicon.ico b/shared/favicon.ico similarity index 100% rename from favicon.ico rename to shared/favicon.ico diff --git a/favicon.png b/shared/favicon.png similarity index 100% rename from favicon.png rename to shared/favicon.png diff --git a/favicon.xcf b/shared/favicon.xcf similarity index 100% rename from favicon.xcf rename to shared/favicon.xcf diff --git a/graphics/Banner.png b/shared/graphics/Banner.png similarity index 100% rename from graphics/Banner.png rename to shared/graphics/Banner.png diff --git a/graphics/Banner.xcf b/shared/graphics/Banner.xcf similarity index 100% rename from graphics/Banner.xcf rename to shared/graphics/Banner.xcf diff --git a/graphics/FannyLogo.png b/shared/graphics/FannyLogo.png similarity index 100% rename from graphics/FannyLogo.png rename to shared/graphics/FannyLogo.png diff --git a/graphics/FannyLogo_small.png b/shared/graphics/FannyLogo_small.png similarity index 100% rename from graphics/FannyLogo_small.png rename to shared/graphics/FannyLogo_small.png diff --git a/graphics/Icon Big.png b/shared/graphics/Icon Big.png similarity index 100% rename from graphics/Icon Big.png rename to shared/graphics/Icon Big.png diff --git a/graphics/TreffpunktFannyLogo.png b/shared/graphics/TreffpunktFannyLogo.png similarity index 100% rename from graphics/TreffpunktFannyLogo.png rename to shared/graphics/TreffpunktFannyLogo.png diff --git a/graphics/chat_background.jpg b/shared/graphics/chat_background.jpg similarity index 100% rename from graphics/chat_background.jpg rename to shared/graphics/chat_background.jpg diff --git a/graphics/favicon.png b/shared/graphics/favicon.png similarity index 100% rename from graphics/favicon.png rename to shared/graphics/favicon.png diff --git a/graphics/favicon.xcf b/shared/graphics/favicon.xcf similarity index 100% rename from graphics/favicon.xcf rename to shared/graphics/favicon.xcf diff --git a/graphics/icon.jpg b/shared/graphics/icon.jpg similarity index 100% rename from graphics/icon.jpg rename to shared/graphics/icon.jpg diff --git a/graphics/icons/back.png b/shared/graphics/icons/back.png similarity index 100% rename from graphics/icons/back.png rename to shared/graphics/icons/back.png diff --git a/graphics/icons/back_black.png b/shared/graphics/icons/back_black.png similarity index 100% rename from graphics/icons/back_black.png rename to shared/graphics/icons/back_black.png diff --git a/graphics/icons/drawer.png b/shared/graphics/icons/drawer.png similarity index 100% rename from graphics/icons/drawer.png rename to shared/graphics/icons/drawer.png diff --git a/graphics/icons/drawer_black.png b/shared/graphics/icons/drawer_black.png similarity index 100% rename from graphics/icons/drawer_black.png rename to shared/graphics/icons/drawer_black.png diff --git a/graphics/icons/hide.png b/shared/graphics/icons/hide.png similarity index 100% rename from graphics/icons/hide.png rename to shared/graphics/icons/hide.png diff --git a/graphics/icons/menu.png b/shared/graphics/icons/menu.png similarity index 100% rename from graphics/icons/menu.png rename to shared/graphics/icons/menu.png diff --git a/graphics/icons/menu_black.png b/shared/graphics/icons/menu_black.png similarity index 100% rename from graphics/icons/menu_black.png rename to shared/graphics/icons/menu_black.png diff --git a/graphics/icons/view.png b/shared/graphics/icons/view.png similarity index 100% rename from graphics/icons/view.png rename to shared/graphics/icons/view.png diff --git a/graphics/screenshots/1_Screenshot_LoginPage.jpg b/shared/graphics/screenshots/1_Screenshot_LoginPage.jpg similarity index 100% rename from graphics/screenshots/1_Screenshot_LoginPage.jpg rename to shared/graphics/screenshots/1_Screenshot_LoginPage.jpg diff --git a/graphics/screenshots/2_Screenshot_MainPage.jpg b/shared/graphics/screenshots/2_Screenshot_MainPage.jpg similarity index 100% rename from graphics/screenshots/2_Screenshot_MainPage.jpg rename to shared/graphics/screenshots/2_Screenshot_MainPage.jpg diff --git a/graphics/screenshots/3_Screenshot_WebsitePage.jpg b/shared/graphics/screenshots/3_Screenshot_WebsitePage.jpg similarity index 100% rename from graphics/screenshots/3_Screenshot_WebsitePage.jpg rename to shared/graphics/screenshots/3_Screenshot_WebsitePage.jpg diff --git a/graphics/screenshots/4_Screenshot_CookplanPage.jpg b/shared/graphics/screenshots/4_Screenshot_CookplanPage.jpg similarity index 100% rename from graphics/screenshots/4_Screenshot_CookplanPage.jpg rename to shared/graphics/screenshots/4_Screenshot_CookplanPage.jpg diff --git a/graphics/sheute.png b/shared/graphics/sheute.png similarity index 100% rename from graphics/sheute.png rename to shared/graphics/sheute.png diff --git a/graphics/sheute_new.png b/shared/graphics/sheute_new.png similarity index 100% rename from graphics/sheute_new.png rename to shared/graphics/sheute_new.png diff --git a/graphics/smorgen.png b/shared/graphics/smorgen.png similarity index 100% rename from graphics/smorgen.png rename to shared/graphics/smorgen.png diff --git a/shared/samplehtml/Download File-html.html b/shared/samplehtml/Download File-html.html new file mode 100644 index 0000000..890dd46 --- /dev/null +++ b/shared/samplehtml/Download File-html.html @@ -0,0 +1,485 @@ + + + +Download File-html.html + + +
+ + + +
+

D-70563 FANNY-LEICHT-GYMN.

+

STUTTGART, F.-LEICHT-STR. 13

+

Schuljahr 2018/19 - 1. Halbjahr
gültig ab 10. September 2018

+

Untis 2017

+

13.12.2018  9:04

+

Klasse  13.12. / Donnerstag Woche-A

+

Ordnungsdienst: Klasse 10a

+

Kl.

+

Std.

+

Vertr. Fach Rau nach

+

Vertretungs-Text

+

5b

+

1

+

Hei

+

D

+

---

+

Entfall

+

5b

+

2

+

Fu

+

D

+

114

+

Hei / Aufgaben, Arbeitsheft!

+

5b

+

3

+

Oe

+

M

+

114

+

Ei / Aufgaben

+

5b

+

4

+

Rm

+

M

+

114

+

Ei / Aufgaben

+

6bc

+

5

+

Sf

+

EvR

+

321

+

Bü / Aufgaben

+

6bc

+

5

+

Dk

+

KR

+

121

+

We / Aufgaben

+

6bc

+

6

+

+

EvR

+

---

+

Entfall

+

6bc

+

6

+

We

+

KR

+

---

+

Entfall

+

6d

+

6

+

Ku

+

Ek

+

---

+

Entfall

+

7b

+

2

+

Ga

+

G

+

414

+

KA Fkr

+

7b

+

8

+

Gg

+

BK

+

---

+

Mi-12.12. / 1

+

7b

+

9

+

Gg

+

BK

+

---

+

Mi-12.12. / 2

+

7c

+

8 - 9

+

Gw

+

G

+

---

+

Entfall

+

7d

+

1

+

Ku

+

D

+

---

+

Entfall

+

7d

+

2

+

Oz

+

D

+

416

+

Ku / Aufgaben

+

8a

+

1 - 2

+

Ei

+

Ch

+

---

+

Entfall

+

KEINE KA

+

9ac

+

8 - 9

+

Lk

+

SpJ

+

---

+

Entfall

+

9c

+

1 - 2

+

Jw

+

Gk

+

322

+

Raum!

+

9c

+

3

+

Hf

+

D

+

220

+

Hei / Aufgaben

+

9c

+

4

+

Bkn

+

D

+

220

+

Hei / Aufgaben

+

9d

+

1

+

Rt

+

Gk

+

---

+

Do-13.12. / 3

+

9d

+

2

+

Rt

+

Gk

+

---

+

Do-13.12. / 4

+

9d

+

3

+

Rt

+

Gk

+

218

+

9d

+

4

+

Rt

+

Gk

+

218

+

9d

+

5

+

Ni

+

BK

+

126

+

9d

+

6

+

Ni

+

BK

+

126

+

9d

+

8

+

Ni

+

BK

+

---

+

Do-13.12. / 5

+

9d

+

9

+

Ni

+

BK

+

---

+

Do-13.12. / 6

+

10b

+

10 - 11

+

Fe

+

Ph

+

---

+

Entfall

+

11

+

3 - 4

+

Ft

+

g4

+

---

+

Entfall

+

11

+

5

+

Ei

+

M1

+

---

+

Entfall

+

11

+

7

+

Gt

+

sem1 324

+

geteilte Gruppen Schwimmen / 

+

11

+

8 - 9

+

Ro

+

sem1 ???

+

11

+

10 - 11

+

Lk

+

sp3

+

---

+

Entfall

+

12

+

1 - 2

+

Ni

+

bk1

+

412

+

Raum!

+

12

+

5

+

Ku

+

D2

+

---

+

Entfall

+

1112 8 - 9

+

Fe

+

vma

+

---

+

Entfall

+
+ + + + + +Download File-html.html + + +
+ + + +
+

D-70563 FANNY-LEICHT-GYMN.

+

STUTTGART, F.-LEICHT-STR. 13

+

Schuljahr 2018/19 - 1. Halbjahr
gültig ab 10. September 2018

+

Untis 2017

+

13.12.2018  8:11

+

Klasse  14.12. / Freitag Woche-A

+

Ordnungsdienst: Klasse 10a

+

Kl.

+

Std. Vertr. Fach Rau nach

+

Vertretungs-Text

+

5abc 1

+

We

+

KR

+

---

+

Entfall

+

5a

+

1

+

+

EvR

+

---

+

Entfall

+

5abc 2

+

Jw

+

KR

+

123

+

We / Aufgaben

+

5a

+

2

+

Ng

+

EvR

+

321

+

Bü / Aufgaben

+

5d

+

3

+

Lo

+

D

+

122

+

anstatt 17.12., 1. Std.

+

5d

+

4

+

Lo

+

D

+

122

+

anstatt 19.12., 1 Std.

+

6a

+

6

+

He

+

E

+

---

+

Entfall

+

6acd 7

+

Ft

+

MF

+

---

+

Entfall

+

6c

+

1

+

Ku

+

D

+

---

+

Entfall

+

6c

+

2

+

Sl

+

D

+

121

+

Ku / Aufgaben

+

7a

+

3

+

Di

+

D

+

323

+

Raum

+

7a

+

4

+

Hhn

+

M

+

323

+

7a

+

5

+

Hhn

+

M

+

323

+

7a

+

6

+

Hhn

+

M

+

323

+

findet statt!

+

7b

+

6

+

Rt

+

D

+

---

+

Entfall

+

8a

+

1

+

Ft

+

M

+

---

+

Entfall

+

8a

+

2

+

Li

+

E

+

323

+

statt 18.12.

+

9c

+

5 - 6

+

Hei

+

D

+

---

+

Entfall

+

9d

+

1 - 2 Rm

+

NWT 412

+

Raum

+

9d

+

5 - 6

+

Ft

+

M

+

---

+

Entfall

+

10a

+

3 - 4 Smr

+

E

+

413

+

Hörverstehensklausur

+

10ad 3

+

Ro

+

EvR

+

SH

+

Sport!

+

10ad 3 - 4

+

We

+

KR

+

---

+

Entfall

+

10ad 4

+

Lk

+

EvR

+

SH

+

Sport!

+

10b

+

3 - 4 Ki

+

E

+

414

+

Hörverstehensklausur

+

10b

+

3 - 4

+

He

+

Gk

+

---

+

Entfall für Lehrer

+

10bc 5 - 6

+

We

+

KR

+

---

+

Entfall

+

10c

+

3 - 4

+

Ran

+

M

+

---

+

Entfall

+

alle bei Oe

+

10c

+

3 - 4 Oe

+

E

+

422

+

Hörverstehensklausur

+

10d

+

3 - 4 Wd

+

E

+

416

+

Hörverstehensklausur

+

11

+

3 - 4 At

+

D3

+

121

+

Raum

+

11

+

3 - 4 Sl

+

D2

+

415

+

Raum

+

12

+

1 - 2 Lo

+

Sp1

+

222

+

Theorie

+

12

+

3 - 4 Mf

+

E2

+

218

+

Raum

+

12

+

3 - 4 Sf

+

M3

+

322

+

Raum

+

12

+

3 - 4

+

Ft

+

M2

+

---

+

Entfall

+

12

+

5 - 6

+

Ku

+

ek1

+

---

+

Entfall

+
+ + diff --git a/shared/samplehtml/Download File.html b/shared/samplehtml/Download File.html new file mode 100644 index 0000000..e1624b0 --- /dev/null +++ b/shared/samplehtml/Download File.html @@ -0,0 +1,497 @@ + + + +MergedFile + + + + + + + + + +
+

D-70563 FANNY-LEICHT-GYMN.

+

STUTTGART, F.-LEICHT-STR. 13

+

Schuljahr 2018/19 - 1. Halbjahr
gültig ab 10. September 2018

+

Untis 2017

+

13.12.2018  9:04

+

Klasse  13.12. / Donnerstag Woche-A

+

Ordnungsdienst: Klasse 10a

+

Kl.

+

Std.

+

Vertr. Fach Rau nach

+

Vertretungs-Text

+

5b

+

1

+

Hei

+

D

+

---

+

Entfall

+

5b

+

2

+

Fu

+

D

+

114

+

Hei / Aufgaben, Arbeitsheft!

+

5b

+

3

+

Oe

+

M

+

114

+

Ei / Aufgaben

+

5b

+

4

+

Rm

+

M

+

114

+

Ei / Aufgaben

+

6bc

+

5

+

Sf

+

EvR

+

321

+

Bü / Aufgaben

+

6bc

+

5

+

Dk

+

KR

+

121

+

We / Aufgaben

+

6bc

+

6

+

+

EvR

+

---

+

Entfall

+

6bc

+

6

+

We

+

KR

+

---

+

Entfall

+

6d

+

6

+

Ku

+

Ek

+

---

+

Entfall

+

7b

+

2

+

Ga

+

G

+

414

+

KA Fkr

+

7b

+

8

+

Gg

+

BK

+

---

+

Mi-12.12. / 1

+

7b

+

9

+

Gg

+

BK

+

---

+

Mi-12.12. / 2

+

7c

+

8 - 9

+

Gw

+

G

+

---

+

Entfall

+

7d

+

1

+

Ku

+

D

+

---

+

Entfall

+

7d

+

2

+

Oz

+

D

+

416

+

Ku / Aufgaben

+

8a

+

1 - 2

+

Ei

+

Ch

+

---

+

Entfall

+

KEINE KA

+

9ac

+

8 - 9

+

Lk

+

SpJ

+

---

+

Entfall

+

9c

+

1 - 2

+

Jw

+

Gk

+

322

+

Raum!

+

9c

+

3

+

Hf

+

D

+

220

+

Hei / Aufgaben

+

9c

+

4

+

Bkn

+

D

+

220

+

Hei / Aufgaben

+

9d

+

1

+

Rt

+

Gk

+

---

+

Do-13.12. / 3

+

9d

+

2

+

Rt

+

Gk

+

---

+

Do-13.12. / 4

+

9d

+

3

+

Rt

+

Gk

+

218

+

9d

+

4

+

Rt

+

Gk

+

218

+

9d

+

5

+

Ni

+

BK

+

126

+

9d

+

6

+

Ni

+

BK

+

126

+

9d

+

8

+

Ni

+

BK

+

---

+

Do-13.12. / 5

+

9d

+

9

+

Ni

+

BK

+

---

+

Do-13.12. / 6

+

10b

+

10 - 11

+

Fe

+

Ph

+

---

+

Entfall

+

11

+

3 - 4

+

Ft

+

g4

+

---

+

Entfall

+

11

+

5

+

Ei

+

M1

+

---

+

Entfall

+

11

+

7

+

Gt

+

sem1 324

+

geteilte Gruppen Schwimmen / 

+

11

+

8 - 9

+

Ro

+

sem1 ???

+

11

+

10 - 11

+

Lk

+

sp3

+

---

+

Entfall

+

12

+

1 - 2

+

Ni

+

bk1

+

412

+

Raum!

+

12

+

5

+

Ku

+

D2

+

---

+

Entfall

+

1112 8 - 9

+

Fe

+

vma

+

---

+

Entfall

+
+ + + +
+

D-70563 FANNY-LEICHT-GYMN.

+

STUTTGART, F.-LEICHT-STR. 13

+

Schuljahr 2018/19 - 1. Halbjahr
gültig ab 10. September 2018

+

Untis 2017

+

13.12.2018  8:11

+

Klasse  14.12. / Freitag Woche-A

+

Ordnungsdienst: Klasse 10a

+

Kl.

+

Std. Vertr. Fach Rau nach

+

Vertretungs-Text

+

5abc 1

+

We

+

KR

+

---

+

Entfall

+

5a

+

1

+

+

EvR

+

---

+

Entfall

+

5abc 2

+

Jw

+

KR

+

123

+

We / Aufgaben

+

5a

+

2

+

Ng

+

EvR

+

321

+

Bü / Aufgaben

+

5d

+

3

+

Lo

+

D

+

122

+

anstatt 17.12., 1. Std.

+

5d

+

4

+

Lo

+

D

+

122

+

anstatt 19.12., 1 Std.

+

6a

+

6

+

He

+

E

+

---

+

Entfall

+

6acd 7

+

Ft

+

MF

+

---

+

Entfall

+

6c

+

1

+

Ku

+

D

+

---

+

Entfall

+

6c

+

2

+

Sl

+

D

+

121

+

Ku / Aufgaben

+

7a

+

3

+

Di

+

D

+

323

+

Raum

+

7a

+

4

+

Hhn

+

M

+

323

+

7a

+

5

+

Hhn

+

M

+

323

+

7a

+

6

+

Hhn

+

M

+

323

+

findet statt!

+

7b

+

6

+

Rt

+

D

+

---

+

Entfall

+

8a

+

1

+

Ft

+

M

+

---

+

Entfall

+

8a

+

2

+

Li

+

E

+

323

+

statt 18.12.

+

9c

+

5 - 6

+

Hei

+

D

+

---

+

Entfall

+

9d

+

1 - 2 Rm

+

NWT 412

+

Raum

+

9d

+

5 - 6

+

Ft

+

M

+

---

+

Entfall

+

10a

+

3 - 4 Smr

+

E

+

413

+

Hörverstehensklausur

+

10ad 3

+

Ro

+

EvR

+

SH

+

Sport!

+

10ad 3 - 4

+

We

+

KR

+

---

+

Entfall

+

10ad 4

+

Lk

+

EvR

+

SH

+

Sport!

+

10b

+

3 - 4 Ki

+

E

+

414

+

Hörverstehensklausur

+

10b

+

3 - 4

+

He

+

Gk

+

---

+

Entfall für Lehrer

+

10bc 5 - 6

+

We

+

KR

+

---

+

Entfall

+

10c

+

3 - 4

+

Ran

+

M

+

---

+

Entfall

+

alle bei Oe

+

10c

+

3 - 4 Oe

+

E

+

422

+

Hörverstehensklausur

+

10d

+

3 - 4 Wd

+

E

+

416

+

Hörverstehensklausur

+

11

+

3 - 4 At

+

D3

+

121

+

Raum

+

11

+

3 - 4 Sl

+

D2

+

415

+

Raum

+

12

+

1 - 2 Lo

+

Sp1

+

222

+

Theorie

+

12

+

3 - 4 Mf

+

E2

+

218

+

Raum

+

12

+

3 - 4 Sf

+

M3

+

322

+

Raum

+

12

+

3 - 4

+

Ft

+

M2

+

---

+

Entfall

+

12

+

5 - 6

+

Ku

+

ek1

+

---

+

Entfall

+
+ + diff --git a/shared/samplehtml/Download File.pdf b/shared/samplehtml/Download File.pdf new file mode 100644 index 0000000..c672d38 Binary files /dev/null and b/shared/samplehtml/Download File.pdf differ diff --git a/shared/samplehtml/Download File.xml b/shared/samplehtml/Download File.xml new file mode 100644 index 0000000..3f8ea63 --- /dev/null +++ b/shared/samplehtml/Download File.xml @@ -0,0 +1,455 @@ + + + + + + + + + + +D-70563 FANNY-LEICHT-GYMN. +STUTTGART, F.-LEICHT-STR. 13 +Schuljahr 2018/19 - 1. Halbjahr +gültig ab 10. September 2018 +Untis 2017 +13.12.2018 9:04 +Klasse 13.12. / Donnerstag Woche-A +Ordnungsdienst: Klasse 10a +Kl. +Std. +Vertr. Fach Rau nach +Vertretungs-Text +5b +1 +Hei +D +--- +Entfall +5b +2 +Fu +D +114 +Hei / Aufgaben, Arbeitsheft! +5b +3 +Oe +M +114 +Ei / Aufgaben +5b +4 +Rm +M +114 +Ei / Aufgaben +6bc +5 +Sf +EvR +321 +Bü / Aufgaben +6bc +5 +Dk +KR +121 +We / Aufgaben +6bc +6 + +EvR +--- +Entfall +6bc +6 +We +KR +--- +Entfall +6d +6 +Ku +Ek +--- +Entfall +7b +2 +Ga +G +414 +KA Fkr +7b +8 +Gg +BK +--- +Mi-12.12. / 1 +7b +9 +Gg +BK +--- +Mi-12.12. / 2 +7c +8 - 9 +Gw +G +--- +Entfall +7d +1 +Ku +D +--- +Entfall +7d +2 +Oz +D +416 +Ku / Aufgaben +8a +1 - 2 +Ei +Ch +--- +Entfall +KEINE KA +9ac +8 - 9 +Lk +SpJ +--- +Entfall +9c +1 - 2 +Jw +Gk +322 +Raum! +9c +3 +Hf +D +220 +Hei / Aufgaben +9c +4 +Bkn +D +220 +Hei / Aufgaben +9d +1 +Rt +Gk +--- +Do-13.12. / 3 +9d +2 +Rt +Gk +--- +Do-13.12. / 4 +9d +3 +Rt +Gk +218 +9d +4 +Rt +Gk +218 +9d +5 +Ni +BK +126 +9d +6 +Ni +BK +126 +9d +8 +Ni +BK +--- +Do-13.12. / 5 +9d +9 +Ni +BK +--- +Do-13.12. / 6 +10b +10 - 11 +Fe +Ph +--- +Entfall +11 +3 - 4 +Ft +g4 +--- +Entfall +11 +5 +Ei +M1 +--- +Entfall +11 +7 +Gt +sem1 324 +geteilte Gruppen Schwimmen / +11 +8 - 9 +Ro +sem1 ??? +11 +10 - 11 +Lk +sp3 +--- +Entfall +12 +1 - 2 +Ni +bk1 +412 +Raum! +12 +5 +Ku +D2 +--- +Entfall +1112 8 - 9 +Fe +vma +--- +Entfall + + +D-70563 FANNY-LEICHT-GYMN. +STUTTGART, F.-LEICHT-STR. 13 +Schuljahr 2018/19 - 1. Halbjahr +gültig ab 10. September 2018 +Untis 2017 +13.12.2018 8:11 +Klasse 14.12. / Freitag Woche-A +Ordnungsdienst: Klasse 10a +Kl. +Std. Vertr. Fach Rau nach +Vertretungs-Text +5abc 1 +We +KR +--- +Entfall +5a +1 + +EvR +--- +Entfall +5abc 2 +Jw +KR +123 +We / Aufgaben +5a +2 +Ng +EvR +321 +Bü / Aufgaben +5d +3 +Lo +D +122 +anstatt 17.12., 1. Std. +5d +4 +Lo +D +122 +anstatt 19.12., 1 Std. +6a +6 +He +E +--- +Entfall +6acd 7 +Ft +MF +--- +Entfall +6c +1 +Ku +D +--- +Entfall +6c +2 +Sl +D +121 +Ku / Aufgaben +7a +3 +Di +D +323 +Raum +7a +4 +Hhn +M +323 +7a +5 +Hhn +M +323 +7a +6 +Hhn +M +323 +findet statt! +7b +6 +Rt +D +--- +Entfall +8a +1 +Ft +M +--- +Entfall +8a +2 +Li +E +323 +statt 18.12. +9c +5 - 6 +Hei +D +--- +Entfall +9d +1 - 2 Rm +NWT 412 +Raum +9d +5 - 6 +Ft +M +--- +Entfall +10a +3 - 4 Smr +E +413 +Hörverstehensklausur +10ad 3 +Ro +EvR +SH +Sport! +10ad 3 - 4 +We +KR +--- +Entfall +10ad 4 +Lk +EvR +SH +Sport! +10b +3 - 4 Ki +E +414 +Hörverstehensklausur +10b +3 - 4 +He +Gk +--- +Entfall für Lehrer +10bc 5 - 6 +We +KR +--- +Entfall +10c +3 - 4 +Ran +M +--- +Entfall +alle bei Oe +10c +3 - 4 Oe +E +422 +Hörverstehensklausur +10d +3 - 4 Wd +E +416 +Hörverstehensklausur +11 +3 - 4 At +D3 +121 +Raum +11 +3 - 4 Sl +D2 +415 +Raum +12 +1 - 2 Lo +Sp1 +222 +Theorie +12 +3 - 4 Mf +E2 +218 +Raum +12 +3 - 4 Sf +M3 +322 +Raum +12 +3 - 4 +Ft +M2 +--- +Entfall +12 +5 - 6 +Ku +ek1 +--- +Entfall + + diff --git a/shared.qrc b/shared/shared.qrc similarity index 74% rename from shared.qrc rename to shared/shared.qrc index ac95bc6..5f845e6 100644 --- a/shared.qrc +++ b/shared/shared.qrc @@ -12,5 +12,9 @@ graphics/FannyLogo_small.png graphics/icons/hide.png graphics/icons/view.png + samplehtml/Download File-html.html + samplehtml/Download File.html + samplehtml/Download File.pdf + samplehtml/Download File.xml diff --git a/source/appsettings.cpp b/sources/appsettings.cpp similarity index 100% rename from source/appsettings.cpp rename to sources/appsettings.cpp diff --git a/sources/eventform.cpp b/sources/eventform.cpp new file mode 100644 index 0000000..820703a --- /dev/null +++ b/sources/eventform.cpp @@ -0,0 +1,6 @@ +#include "headers/eventform.h" + +EventForm::EventForm(QObject *parent) : QObject(parent) +{ + +} diff --git a/source/main.cpp b/sources/main.cpp similarity index 97% rename from source/main.cpp rename to sources/main.cpp index 445d69e..e81b70b 100644 --- a/source/main.cpp +++ b/sources/main.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include "headers/serverconn.h" #include "headers/appsettings.h" diff --git a/source/serverconn.cpp b/sources/serverconn.cpp similarity index 54% rename from source/serverconn.cpp rename to sources/serverconn.cpp index bbc323e..72071d8 100644 --- a/source/serverconn.cpp +++ b/sources/serverconn.cpp @@ -22,52 +22,52 @@ ServerConn::~ServerConn() QString ServerConn::login(QString username, QString password, bool permanent) { -// QUrlQuery pdata; -// ReturnData_t ret = this->senddata(QUrl("http://www.fanny-leicht.de/static15/http.intern/sheute.pdf"), pdata); -// qDebug() << ret.text; + // QUrlQuery pdata; + // ReturnData_t ret = this->senddata(QUrl("http://www.fanny-leicht.de/static15/http.intern/sheute.pdf"), pdata); + // qDebug() << ret.text; // Create request - QNetworkRequest request; - request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/sheute.pdf" ) ); + QNetworkRequest request; + request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/sheute.pdf" ) ); - // Pack in credentials - QString concatenatedCredentials = username + ":" + password; - QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64(); - QString headerData = "Basic " + data; - request.setRawHeader( "Authorization", headerData.toLocal8Bit() ); + // Pack in credentials + QString concatenatedCredentials = username + ":" + password; + QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64(); + QString headerData = "Basic " + data; + request.setRawHeader( "Authorization", headerData.toLocal8Bit() ); - QUrlQuery pdata; - // Send request and connect all possible signals - QNetworkReply*reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); - //QNetworkReply*reply = networkManager->get( request ); + QUrlQuery pdata; + // Send request and connect all possible signals + QNetworkReply*reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); + //QNetworkReply*reply = networkManager->get( request ); - QEventLoop loop; - loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); - loop.exec(); - int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + QEventLoop loop; + loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); + loop.exec(); + int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - if(status_code == 200){ - this->username = username; - this->password = password; - if(permanent){ - qDebug() << "permanent"; - pGlobalAppSettings->writeSetting("permanent", "1"); - pGlobalAppSettings->writeSetting("username", username); - pGlobalAppSettings->writeSetting("password", password); - } - return("OK"); - } - else if(status_code == 401){ - return("Ungültige Benutzerdaten."); - } - else if(status_code == 0){ - return("Keine Verbindung zum Server."); - } - else { - QString ret = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toChar(); - ret = ret + reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toChar(); - return(ret); + if(status_code == 200){ + this->username = username; + this->password = password; + if(permanent){ + qDebug() << "permanent"; + pGlobalAppSettings->writeSetting("permanent", "1"); + pGlobalAppSettings->writeSetting("username", username); + pGlobalAppSettings->writeSetting("password", password); } + return("OK"); + } + else if(status_code == 401){ + return("Ungültige Benutzerdaten."); + } + else if(status_code == 0){ + return("Keine Verbindung zum Server."); + } + else { + QString ret = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toChar(); + ret = ret + reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toChar(); + return(ret); + } } int ServerConn::logout() @@ -84,42 +84,44 @@ QString ServerConn::getDay(QString day) { this->progress = 0; // Create request - QNetworkRequest request; - request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/" + day + ".pdf" ) ); + QNetworkRequest request; + request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/" + day + ".pdf" ) ); - // Pack in credentials - // Pack in credentials - QString concatenatedCredentials = this->username + ":" + this->password; - QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64(); - QString headerData = "Basic " + data; - request.setRawHeader( "Authorization", headerData.toLocal8Bit() ); + // Pack in credentials + // Pack in credentials + QString concatenatedCredentials = this->username + ":" + this->password; + QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64(); + QString headerData = "Basic " + data; + request.setRawHeader( "Authorization", headerData.toLocal8Bit() ); - QUrlQuery pdata; - // Send request and connect all possible signals - QNetworkReply*reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); - //QNetworkReply*reply = networkManager->get( request ); + QUrlQuery pdata; + // Send request and connect all possible signals + QNetworkReply*reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); + //QNetworkReply*reply = networkManager->get( request ); - connect(reply, SIGNAL(downloadProgress(qint64, qint64)), - this, SLOT(updateProgress(qint64, qint64))); - QEventLoop loop; - loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); - loop.exec(); + connect(reply, SIGNAL(downloadProgress(qint64, qint64)), + this, SLOT(updateProgress(qint64, qint64))); + QEventLoop loop; + loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); + loop.exec(); - this->progress = 1; - int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - if(status_code == 200){ - QString path = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); + this->progress = 1; + int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if(status_code == 200){ + QString path = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); - QDir dir; - dir.mkdir(path + "/.fannyapp-tmp"); - QFile file(path + "/.fannyapp-tmp/" + day + ".pdf"); - file.remove(); + QDir dir; + dir.mkdir(path + "/.fannyapp-tmp"); + QFile file(path + "/.fannyapp-tmp/" + day + ".pdf"); + file.remove(); - file.open(QIODevice::ReadWrite); - file.write(reply->readAll()); - file.close(); - QDesktopServices::openUrl(QUrl::fromLocalFile(path + "/.fannyapp-tmp/" + day + ".pdf")); - return("OK"); + file.open(QIODevice::ReadWrite); + file.write(reply->readAll()); + file.close(); + QUrl url = QUrl::fromLocalFile(path + "/.fannyapp-tmp/" + day + ".pdf"); + + // QDesktopServices::openUrl(url); + return("OK_" + url.toString()); } else if(status_code == 401){ return("Ungültige Benutzerdaten."); @@ -128,37 +130,38 @@ QString ServerConn::getDay(QString day) return("Keine Verbindung zum Server."); } else { - QString ret = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toChar(); - ret = ret + " (" + reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toChar() + ")"; - return(ret); + QString ret = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toChar(); + ret = ret + " (" + reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toChar() + ")"; + return(ret); } -} + } + int ServerConn::checkConn() { // Create request - QNetworkRequest request; - request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/" ) ); + QNetworkRequest request; + request.setUrl( QUrl( "http://www.fanny-leicht.de/static15/http.intern/" ) ); - // Pack in credentials - // Pack in credentials - //ZedlerDo:LxyJQB - QString concatenatedCredentials = this->username + ":" + this->password; - QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64(); - QString headerData = "Basic " + data; - request.setRawHeader( "Authorization", headerData.toLocal8Bit() ); + // Pack in credentials + // Pack in credentials + //ZedlerDo:LxyJQB + QString concatenatedCredentials = this->username + ":" + this->password; + QByteArray data = concatenatedCredentials.toLocal8Bit().toBase64(); + QString headerData = "Basic " + data; + request.setRawHeader( "Authorization", headerData.toLocal8Bit() ); - QUrlQuery pdata; - // Send request and connect all possible signals - QNetworkReply*reply = this->refreshNetworkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); - //QNetworkReply*reply = networkManager->get( request ); + QUrlQuery pdata; + // Send request and connect all possible signals + QNetworkReply*reply = this->refreshNetworkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); + //QNetworkReply*reply = networkManager->get( request ); - QEventLoop loop; - loop.connect(this->refreshNetworkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); - loop.exec(); + QEventLoop loop; + loop.connect(this->refreshNetworkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); + loop.exec(); - int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - return(status_code); + int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + return(status_code); } @@ -170,7 +173,7 @@ void ServerConn::updateProgress(qint64 read, qint64 total) this->progress = percent; percent = (int)percent; -// qDebug() << read << total << percent << "%"; + // qDebug() << read << total << percent << "%"; } float ServerConn::getProgress() @@ -179,13 +182,14 @@ float ServerConn::getProgress() } int ServerConn::getEvents(){ + /* this->progress = 0; ReturnData_t ret; //this is a custom type to store the returned data // Call the webservice QNetworkRequest request(QUrl("http://api.itsblue.de/fanny/vertretung.php?uname=ZedlerDo&passwd=LxyJQB&day=smorgen&agree=true")); request.setHeader(QNetworkRequest::ContentTypeHeader, - "application/x-www-form-urlencoded"); + "application/x-www-form-urlencoded"); //set ssl configuration //send a POST request with the given url and data to the server @@ -195,7 +199,7 @@ int ServerConn::getEvents(){ reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); connect(reply, SIGNAL(downloadProgress(qint64, qint64)), - this, SLOT(updateProgress(qint64, qint64))); + this, SLOT(updateProgress(qint64, qint64))); //wait until the request has finished QEventLoop loop; loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); @@ -232,6 +236,72 @@ int ServerConn::getEvents(){ tmpEvents.takeLast(); m_eventlist = tmpEvents; qDebug() << tmpEvents; + */ + + qDebug() << "reading xml file"; + QFile * xmlFile = new QFile(":/samplehtml/Download File.xml"); + if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text)) { + qDebug() << "Load XML File Problem Couldn't open xmlfile.xml to load settings for download"; + return 900; + } + + QXmlStreamReader * xmlReader = new QXmlStreamReader(xmlFile); + //qDebug() << xmlFile->readAll(); + QList tmpEvents; + QStringList dayList; + int currTop = 0; + + //Parse the XML until we reach end of it + while(!xmlReader->atEnd()) { + if (xmlReader->readNextStartElement()) { + if (xmlReader->name().toString() == "text"){ + QXmlStreamAttributes attributes = xmlReader->attributes(); + QString attribute_value; + int top; + + if(attributes.hasAttribute("font")){ + attribute_value = attributes.value("font").toString(); + } + + if(attributes.hasAttribute("top")){ + top = attributes.value("top").toInt(); + if(abs(top - currTop) > 3){ + //next line started + if(currTop > 175){ + // ignore the header + tmpEvents.append(dayList); + } + + dayList.clear(); + currTop = top; + } + } + + QString text = xmlReader->readElementText(QXmlStreamReader::IncludeChildElements); + dayList.append(text); + + + + qDebug() << qPrintable(xmlReader->name().toString()) << text << attribute_value << dayList; + } + } + } + + tmpEvents.takeFirst(); + + qDebug() << tmpEvents; + + this->m_eventlist = tmpEvents; + + if(xmlReader->hasError()) { + qDebug() << "xmlFile.xml Parse Error" << xmlReader->errorString(); + //return(500); + } + + //close reader and flush file + xmlReader->clear(); + xmlFile->close(); + return(200); } @@ -243,7 +313,7 @@ int ServerConn::getFoodPlan() QNetworkRequest request(QUrl("http://www.treffpunkt-fanny.de/fuer-schueler-und-lehrer/speiseplan.html")); request.setHeader(QNetworkRequest::ContentTypeHeader, - "application/x-www-form-urlencoded"); + "application/x-www-form-urlencoded"); //set ssl configuration //send a POST request with the given url and data to the server @@ -253,7 +323,7 @@ int ServerConn::getFoodPlan() reply = this->networkManager->post(request, pdata.toString(QUrl::FullyEncoded).toUtf8()); connect(reply, SIGNAL(downloadProgress(qint64, qint64)), - this, SLOT(updateProgress(qint64, qint64))); + this, SLOT(updateProgress(qint64, qint64))); //wait until the request has finished QEventLoop loop; loop.connect(this->networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); @@ -306,33 +376,33 @@ int ServerConn::getFoodPlan() QStringList weeklist = table1list + table2list; //put both weeks into one big list for (int i = 0; i <=7; i ++){ - QString temp = weeklist[i]; //store item temporarly to edit it - weeklist[i] = temp.left(temp.length()-5); //remove "" at the and of the Item - temp = weeklist[i]; - //table list[i] looks now like: - //Red Hot Chili Peppers - //
- //26.06.2018 - //
Gulasch mit Kartoffeln - //
Pellkartoffeln mit Quark - //
Gemischter Salat - //
Eaton Mess ( Erdbeer-Nachtisch ) + QString temp = weeklist[i]; //store item temporarly to edit it + weeklist[i] = temp.left(temp.length()-5); //remove "" at the and of the Item + temp = weeklist[i]; + //table list[i] looks now like: + //Red Hot Chili Peppers + //
+ //26.06.2018 + //
Gulasch mit Kartoffeln + //
Pellkartoffeln mit Quark + //
Gemischter Salat + //
Eaton Mess ( Erdbeer-Nachtisch ) - QStringList templist = temp.split(""); //split item at strong, to get the cookteam and the date - //qDebug() << templist << "\n"; - temp = ""; - for (int i = 0; i <=2; i ++){ + QStringList templist = temp.split(""); //split item at strong, to get the cookteam and the date + //qDebug() << templist << "\n"; + temp = ""; + for (int i = 0; i <=2; i ++){ temp += templist[i]; //convert the list to a big string - } + } - temp.replace("
",""); - templist = temp.split("
"); - temp_weekplan.append({templist[0], templist[1]}); //store cookteam and date - temp = templist[2]; //store information in temp (looks like: "
Gulasch mit Kartoffeln
Pellkartoffeln mit Quark
Gemischter Salat
Eaton Mess ( Erdbeer-Nachtisch )") - templist = temp.split("
"); //seperate the information - templist.takeFirst(); //remove first item + temp.replace("
",""); + templist = temp.split("
"); + temp_weekplan.append({templist[0], templist[1]}); //store cookteam and date + temp = templist[2]; //store information in temp (looks like: "
Gulasch mit Kartoffeln
Pellkartoffeln mit Quark
Gemischter Salat
Eaton Mess ( Erdbeer-Nachtisch )") + templist = temp.split("
"); //seperate the information + templist.takeFirst(); //remove first item - temp_weekplan[i].append(templist); + temp_weekplan[i].append(templist); } @@ -424,7 +494,7 @@ ReturnData_t ServerConn::senddata(QUrl serviceUrl, QUrlQuery pdata) authenticator.setUser("ZedlerDo"); authenticator.setPassword("LxyJQB"); request.setHeader(QNetworkRequest::ContentTypeHeader, - "application/x-www-form-urlencoded"); + "application/x-www-form-urlencoded"); //set ssl configuration //send a POST request with the given url and data to the server