mmsharing/livecommsui/lcui/src/lcviewmanager_p.cpp
changeset 34 01f0bb65bcf1
parent 26 5554410e16f5
child 39 4bcc59142325
equal deleted inserted replaced
29:36d7ded3ca23 34:01f0bb65bcf1
    44 LcMainWindow::LcMainWindow() : 
    44 LcMainWindow::LcMainWindow() : 
    45     HbMainWindow(0, Hb::WindowFlagFixedHorizontal | Hb::WindowFlagTransparent)
    45     HbMainWindow(0, Hb::WindowFlagFixedHorizontal | Hb::WindowFlagTransparent)
    46 {
    46 {
    47     // TODO: remove flag WindowFlagFixedHorizontal if portait layout
    47     // TODO: remove flag WindowFlagFixedHorizontal if portait layout
    48     // is going to be supported.
    48     // is going to be supported.
       
    49     qApp->installEventFilter(this);
    49 }
    50 }
    50 
    51 
    51 // -----------------------------------------------------------------------------
    52 // -----------------------------------------------------------------------------
    52 // LcMainWindow::~LcMainWindow
    53 // LcMainWindow::~LcMainWindow
    53 // -----------------------------------------------------------------------------
    54 // -----------------------------------------------------------------------------
    55 LcMainWindow::~LcMainWindow()
    56 LcMainWindow::~LcMainWindow()
    56 {
    57 {
    57 }
    58 }
    58 
    59 
    59 // -----------------------------------------------------------------------------
    60 // -----------------------------------------------------------------------------
    60 // LcMainWindow::event
    61 // LcMainWindow::eventFilter
    61 // -----------------------------------------------------------------------------
    62 // -----------------------------------------------------------------------------
    62 //
    63 //
    63 bool LcMainWindow::event(QEvent *event)
    64 bool LcMainWindow::eventFilter ( QObject * watched, QEvent * event )
    64 {
    65 {    
    65     if ( event->type() == QEvent::FocusIn ){
    66     if ( event->type() == QEvent::ApplicationActivate ){
    66         LC_QDEBUG( "livecomms [UI] -> LcMainWindow::event(), focus in" )
    67         LC_QDEBUG( "livecomms [UI] -> LcMainWindow::eventFilter(), ApplicationActivate" )
    67         emit appFocusGained();
    68         emit appFocusGained();
    68     } else if ( event->type() == QEvent::FocusOut ){
    69     } else if (( event->type() == QEvent::ApplicationDeactivate ) && 
    69         LC_QDEBUG( "livecomms [UI] -> LcMainWindow::event(), focus out" )
    70             ( !this->windowSurface()) ){
       
    71         LC_QDEBUG( "livecomms [UI] -> LcMainWindow::eventFilter(), ApplicationDeactivate" )
    70         emit appFocusLost();
    72         emit appFocusLost();
    71     }
    73     }
    72     return HbMainWindow::event(event);
    74     return QObject::eventFilter(watched, event);
    73 }
    75 }
       
    76 
    74 
    77 
    75 // -----------------------------------------------------------------------------
    78 // -----------------------------------------------------------------------------
    76 // LcViewManagerPrivate::LcViewManagerPrivate
    79 // LcViewManagerPrivate::LcViewManagerPrivate
    77 // -----------------------------------------------------------------------------
    80 // -----------------------------------------------------------------------------
    78 //
    81 //
   100 //
   103 //
   101 LcViewManagerPrivate::~LcViewManagerPrivate()
   104 LcViewManagerPrivate::~LcViewManagerPrivate()
   102 {
   105 {
   103     LC_QDEBUG( "livecomms [UI] -> LcViewManagerPrivate::~LcViewManagerPrivate()" )
   106     LC_QDEBUG( "livecomms [UI] -> LcViewManagerPrivate::~LcViewManagerPrivate()" )
   104 
   107 
       
   108     delete mEngine;
   105     QList<HbView *> views = mMainWindow.views();
   109     QList<HbView *> views = mMainWindow.views();
   106     foreach( HbView* view, views ){
   110     foreach( HbView* view, views ){
   107         mMainWindow.removeView(view);
   111         mMainWindow.removeView(view);
   108     }
   112     }
   109     delete mRepository;
   113     delete mRepository;    
   110     delete mEngine;
       
   111 
   114 
   112     LC_QDEBUG( "livecomms [UI] <- LcViewManagerPrivate::~LcViewManagerPrivate()" ) 
   115     LC_QDEBUG( "livecomms [UI] <- LcViewManagerPrivate::~LcViewManagerPrivate()" ) 
   113 }
   116 }
   114 
   117 
   115 // -----------------------------------------------------------------------------
   118 // -----------------------------------------------------------------------------