mmsharing/livecommsui/lcui/src/lcviewmanager_p.cpp
changeset 34 01f0bb65bcf1
parent 26 5554410e16f5
child 39 4bcc59142325
--- a/mmsharing/livecommsui/lcui/src/lcviewmanager_p.cpp	Wed Aug 18 09:46:00 2010 +0300
+++ b/mmsharing/livecommsui/lcui/src/lcviewmanager_p.cpp	Thu Sep 02 20:23:40 2010 +0300
@@ -46,6 +46,7 @@
 {
     // TODO: remove flag WindowFlagFixedHorizontal if portait layout
     // is going to be supported.
+    qApp->installEventFilter(this);
 }
 
 // -----------------------------------------------------------------------------
@@ -57,21 +58,23 @@
 }
 
 // -----------------------------------------------------------------------------
-// LcMainWindow::event
+// LcMainWindow::eventFilter
 // -----------------------------------------------------------------------------
 //
-bool LcMainWindow::event(QEvent *event)
-{
-    if ( event->type() == QEvent::FocusIn ){
-        LC_QDEBUG( "livecomms [UI] -> LcMainWindow::event(), focus in" )
+bool LcMainWindow::eventFilter ( QObject * watched, QEvent * event )
+{    
+    if ( event->type() == QEvent::ApplicationActivate ){
+        LC_QDEBUG( "livecomms [UI] -> LcMainWindow::eventFilter(), ApplicationActivate" )
         emit appFocusGained();
-    } else if ( event->type() == QEvent::FocusOut ){
-        LC_QDEBUG( "livecomms [UI] -> LcMainWindow::event(), focus out" )
+    } else if (( event->type() == QEvent::ApplicationDeactivate ) && 
+            ( !this->windowSurface()) ){
+        LC_QDEBUG( "livecomms [UI] -> LcMainWindow::eventFilter(), ApplicationDeactivate" )
         emit appFocusLost();
     }
-    return HbMainWindow::event(event);
+    return QObject::eventFilter(watched, event);
 }
 
+
 // -----------------------------------------------------------------------------
 // LcViewManagerPrivate::LcViewManagerPrivate
 // -----------------------------------------------------------------------------
@@ -102,12 +105,12 @@
 {
     LC_QDEBUG( "livecomms [UI] -> LcViewManagerPrivate::~LcViewManagerPrivate()" )
 
+    delete mEngine;
     QList<HbView *> views = mMainWindow.views();
     foreach( HbView* view, views ){
         mMainWindow.removeView(view);
     }
-    delete mRepository;
-    delete mEngine;
+    delete mRepository;    
 
     LC_QDEBUG( "livecomms [UI] <- LcViewManagerPrivate::~LcViewManagerPrivate()" ) 
 }