phonebookui/pbkcommonui/src/cntmainwindow.cpp
changeset 24 0ba2181d7c28
child 25 76a2435edfd4
equal deleted inserted replaced
0:e686773b3f54 24:0ba2181d7c28
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "cntmainwindow.h"
       
    22 #include "cntviewmanager.h"
       
    23 #include "cntviewparameters.h"
       
    24  #include <QCoreApplication>
       
    25 
       
    26 CntMainWindow::CntMainWindow(QWidget *parent, CntViewParameters::ViewId defaultView)
       
    27     : HbMainWindow(parent),mViewManager(0)
       
    28 {
       
    29     if (defaultView != CntViewParameters::noView)
       
    30     {
       
    31         mViewManager = new CntViewManager(this,defaultView);
       
    32     }
       
    33 }
       
    34 
       
    35 CntMainWindow::~CntMainWindow()
       
    36 {
       
    37     // TODO: Remove
       
    38     // This is done because the HbMainWindow bug in wk04 platform. Next release, this must be removed.
       
    39     // Another fix is in main.cpp (tsrc) where TestCntBaseSelectionView test was removed due KERN-EXEC 3.
       
    40     // The KERN-EXEC 3 is caused by the following QCoreApplication::processEvents. Don't know why.
       
    41     QCoreApplication::processEvents(); 
       
    42     delete mViewManager;
       
    43     mViewManager=0;
       
    44 }
       
    45 
       
    46 /*
       
    47  * Lets let views handle send/end key press events, because if toolbar or menu has been focused
       
    48  * the view wont get the key press events
       
    49  */
       
    50 void CntMainWindow::keyPressEvent(QKeyEvent *event)
       
    51 {
       
    52     if (event->key() == Qt::Key_Yes || event->key() == Qt::Key_No)
       
    53     {
       
    54         emit keyPressed(event);
       
    55     }
       
    56     else
       
    57     {
       
    58         HbMainWindow::keyPressEvent(event);
       
    59     }
       
    60 }
       
    61 
       
    62 
       
    63 //
       
    64 
       
    65 // end of file