logsui/logsapp/src/logsmainwindow.cpp
changeset 18 acd4e87b24b4
parent 17 90fe74753f71
--- a/logsui/logsapp/src/logsmainwindow.cpp	Fri Sep 03 14:26:05 2010 +0300
+++ b/logsui/logsapp/src/logsmainwindow.cpp	Fri Sep 17 16:47:32 2010 +0300
@@ -31,6 +31,8 @@
 {
     qApp->installEventFilter(this);
     mKeyCapture = new XQKeyCapture;
+    connect( this, SIGNAL(obscured()), this, SLOT(obscuredCalled()) );
+    connect( this, SIGNAL(revealed()), this, SLOT(revealedCalled()) );
 }
 
 // -----------------------------------------------------------------------------
@@ -101,17 +103,9 @@
     if (event->type() == QEvent::ApplicationActivate) {
         LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationActivate" );
         startKeyCapture();
-        mForeground = true;
-        if (mLocaleChanged) {
-            LOGS_QDEBUG( "logs [UI] -> locale changed when we were on BG" );
-            emit localeChanged();
-            mLocaleChanged = false;
-        }
-        emit appGainedForeground();
     } else if (event->type() == QEvent::ApplicationDeactivate ) {
         LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationDeactivate" );
         stopKeyCapture();
-        mForeground = false;
     } else if (event->type() == QEvent::LocaleChange) {
         if (mForeground) {
             emit localeChanged();
@@ -127,6 +121,33 @@
 //
 // -----------------------------------------------------------------------------
 //
+void LogsMainWindow::obscuredCalled()
+{
+    LOGS_QDEBUG( "logs [UI] -> LogsMainWindow::obscuredCalled" );
+    mForeground = false;
+    emit appLostForeground();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMainWindow::revealedCalled()
+{
+    LOGS_QDEBUG( "logs [UI] -> LogsMainWindow::revealedCalled" );
+    mForeground = true;
+    if (mLocaleChanged) {
+        LOGS_QDEBUG( "logs [UI] -> locale changed when we were on BG" );
+        emit localeChanged();
+        mLocaleChanged = false;
+    }
+    emit appGainedForeground();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void LogsMainWindow::startKeyCapture()
 {
     mKeyCapture->captureKey(Qt::Key_Yes);