diff --git a/src/common/eventhandler.cpp b/src/common/eventhandler.cpp index f71ece7..974799b 100644 --- a/src/common/eventhandler.cpp +++ b/src/common/eventhandler.cpp @@ -1,6 +1,5 @@ #include #include -#include #include "coverage.h" #include "eventhandler.h" @@ -29,22 +28,16 @@ EventHandler::~EventHandler() void EventHandler::runEventLoop() { + // Exit from event loop when invoker is ready to connect + connect(this, SIGNAL(connectionAccepted()), QApplication::instance(), SLOT(quit())); + connect(this, SIGNAL(connectionRejected()), QApplication::instance(), SLOT(quit())); + if (m_type == MEventHandler) { - // Exit from event loop when invoker is ready to connect - connect(this, SIGNAL(connectionAccepted()), MApplication::instance(), SLOT(quit())); - connect(this, SIGNAL(connectionRejected()), MApplication::instance(), SLOT(quit())); - // Enable theme change handler m_item = new MGConfItem(MEEGOTOUCH_THEME_GCONF_KEY, 0); connect(m_item, SIGNAL(valueChanged()), this, SLOT(notifyThemeChange())); } - else if (m_type == QEventHandler) - { - // Exit from event loop when invoker is ready to connect - connect(this, SIGNAL(connectionAccepted()), QApplication::instance(), SLOT(quit())); - connect(this, SIGNAL(connectionRejected()), QApplication::instance(), SLOT(quit())); - } // Start another thread to listen connection from invoker QtConcurrent::run(this, &EventHandler::accept); @@ -69,10 +62,7 @@ void EventHandler::runEventLoop() } // Run event loop so application instance can receive notifications - if (m_type == MEventHandler) - MApplication::exec(); - else if (m_type == QEventHandler) - QApplication::exec(); + QApplication::exec(); // Disable theme change handler disconnect(m_item, 0, this, 0); @@ -105,7 +95,7 @@ void EventHandler::notifyThemeChange() #endif // only MApplication is connected to this signal - MApplication::quit(); + QApplication::quit(); _exit(EXIT_SUCCESS); } @@ -126,11 +116,7 @@ void EventHandler::handleSigHup() __gcov_flush(); #endif - if (m_type == MEventHandler) - MApplication::quit(); - else if (m_type == QEventHandler) - QApplication::quit(); - + QApplication::quit(); _exit(EXIT_SUCCESS); }