aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.qml3
-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
5 files changed, 20 insertions, 10 deletions
diff --git a/main.qml b/main.qml
index 649630f..357d5a8 100644
--- a/main.qml
+++ b/main.qml
@@ -32,8 +32,7 @@ ApplicationWindow {
title: qsTr("Remote Support for your Desktop")
onClosing: {
-// mainqmladaptor.onCloseHandler();
-// console.log("Cleanup done, can close!");
+ mainqmladaptor.onCloseHandler();
}
function minimizeWindow() {
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();
};