aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2020-07-28 04:29:59 +0200
committerDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2020-07-28 04:29:59 +0200
commitaf51bcd8dddff473790e906fa65fbfb74d7f369e (patch)
treedf50167baff9f5e3bf8a3ba8e62967dc1449bc2d /src
parentbff841139a36892603361ef02de2d48ea5798dea (diff)
downloadRWA.Support.DesktopApp-af51bcd8dddff473790e906fa65fbfb74d7f369e.tar.gz
RWA.Support.DesktopApp-af51bcd8dddff473790e906fa65fbfb74d7f369e.tar.bz2
RWA.Support.DesktopApp-af51bcd8dddff473790e906fa65fbfb74d7f369e.zip
Add cleanup function when window is about to be closed
Diffstat (limited to 'src')
-rw-r--r--src/main_qmladaptor.cpp5
-rw-r--r--src/main_qmladaptor.h5
-rw-r--r--src/session.cpp15
-rw-r--r--src/session.h2
4 files changed, 19 insertions, 8 deletions
diff --git a/src/main_qmladaptor.cpp b/src/main_qmladaptor.cpp
index ea8f732..9aafbce 100644
--- a/src/main_qmladaptor.cpp
+++ b/src/main_qmladaptor.cpp
@@ -126,6 +126,11 @@ QString MainQMLAdaptor::getPin() {
return _pin;
}
+void MainQMLAdaptor::onCloseHandler() {
+ // Do cleanup things here...
+ emit onCloseSignal();
+}
+
//void MainQMLAdaptor::onCloseHandler() {
// qDebug() << "Inside MainQMLAdaptor::onCloseHandler()";
diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h
index 6b90208..eb88b3a 100644
--- a/src/main_qmladaptor.h
+++ b/src/main_qmladaptor.h
@@ -47,7 +47,7 @@ signals:
void pinChanged(QString pin);
void urlChanged(QString URL);
-// static void onCloseSignal();
+ void onCloseSignal();
protected:
QString _url;
@@ -68,5 +68,6 @@ public slots:
void setURL(QString URL);
QString getURL();
QString getPin();
-// static void onCloseHandler();
+
+ void onCloseHandler();
};
diff --git a/src/session.cpp b/src/session.cpp
index c87ff71..92ec5fc 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -27,6 +27,12 @@ Session::Session(QObject *parent, MainQMLAdaptor* main_gui) : QObject(parent) {
main_gui,
SLOT(setURL(QString)));
+ // QML -> MainQMLAdaptor::onCloseHandler --onCloseSignal--> session::onCloseHandler
+ QObject::connect(main_gui,
+ SIGNAL(onCloseSignal()),
+ this,
+ SLOT(onCloseHandler()));
+
this->init_vars();
}
@@ -327,8 +333,7 @@ void Session::status_dbus_replied(QDBusPendingCallWatcher *call) {
_main_gui->setConnectButtonEnabled(true);
}
-//void Session::onCloseHandler() {
-// qDebug() << "Inside Session::onCloseHandler()";
-
-// this->stop(this->getId());
-//}
+void Session::onCloseHandler() {
+ // To cleanup things here
+ this->stop(this->getId());
+}
diff --git a/src/session.h b/src/session.h
index b9106ba..5005cb4 100644
--- a/src/session.h
+++ b/src/session.h
@@ -69,5 +69,5 @@ public slots:
void stop_dbus_replied(QDBusPendingCallWatcher *call);
void status_dbus_replied(QDBusPendingCallWatcher *call);
-// void onCloseHandler();
+ void onCloseHandler();
};