phoneapp/phoneuiqtviewadapter/inc/phonevisibilityhandler.h
branchRCL_3
changeset 61 41a7f70b3818
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
       
     1 /*
       
     2 * Copyright (c) 2010 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: Adjusts visibility of Phone app in device lock situations.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PHONEVISIBILITYHANDLER_H
       
    19 #define PHONEVISIBILITYHANDLER_H
       
    20 
       
    21 #include <QObject>
       
    22 
       
    23 #include "mphonepubsubobserver.h"
       
    24 #include <qvaluespacesubscriber.h>
       
    25 #include <qvaluespacepublisher.h>
       
    26 
       
    27 using namespace QtMobility;
       
    28 
       
    29 class CEikonEnv;
       
    30 class PhoneUIQtViewIF;
       
    31 
       
    32 /*!
       
    33  * \class PhoneVisibilityHandler
       
    34  * \brief Adjusts visibility of Phone application in device lock situations.
       
    35 */
       
    36 class PhoneVisibilityHandler : 
       
    37     public QObject,
       
    38     public MPhonePubSubObserver
       
    39 {
       
    40     Q_OBJECT
       
    41     
       
    42     enum AdjustAction {
       
    43         ForceOnTop,
       
    44         BringForwards,
       
    45         KeepCurrentPos,
       
    46         SendToBack
       
    47     };
       
    48 
       
    49 public:
       
    50     
       
    51     /**
       
    52      * Constructor.
       
    53      */
       
    54     PhoneVisibilityHandler(PhoneUIQtViewIF &view, QObject *parent = 0);
       
    55 
       
    56     /**
       
    57      * Destructor.
       
    58      */
       
    59     ~PhoneVisibilityHandler();
       
    60 
       
    61 public:
       
    62     /**
       
    63      * Control visiblity
       
    64      */
       
    65     void bringToForeground();
       
    66     void sendToBackground(bool homeScreenForeground);
       
    67     void hideDeviceDialogs(bool hide);
       
    68     
       
    69     /**
       
    70      * Return true if phone is visible application
       
    71      */
       
    72     bool phoneVisible();
       
    73     
       
    74 public: // from MPhonePubSubObserver
       
    75 
       
    76     /**
       
    77     * This function is called when there is property value change.
       
    78     * @param aCategory Category of the property
       
    79     * @param aKey Property key that is changed
       
    80     * @param aValue New property value
       
    81     */
       
    82     void HandlePropertyChangedL( 
       
    83         const TUid& aCategory,
       
    84         const TUint aKey,
       
    85         const TInt aValue);
       
    86         
       
    87 private:
       
    88     /**
       
    89      * Handle keyguard according phone visiblity
       
    90      * and keyguard previous state
       
    91      */
       
    92     bool disableKeyGuard();
       
    93     void enableKeyGuard();
       
    94 
       
    95     /**
       
    96      * Number of currently ongoing call's
       
    97      */
       
    98     int ongoingCalls();
       
    99     
       
   100     /**
       
   101      * Adjusts visibility based on current call and device security statuses.
       
   102      */
       
   103     void adjustVisibility(AdjustAction action);
       
   104     
       
   105 private slots:
       
   106 
       
   107     /**
       
   108      * QValueSpaceSubscriber has notified that Car Mode value has changed by calling this slot.
       
   109      */
       
   110     void carModeChanged();
       
   111     
       
   112 private:
       
   113     /** Phone view */
       
   114     PhoneUIQtViewIF &m_view;
       
   115     
       
   116     /** Cached pointer to Eikon environment. Not own.*/
       
   117     CEikonEnv *m_eikonEnv;
       
   118     
       
   119     /** Car mode effects visibility */
       
   120     bool m_carModeEnabled;
       
   121     
       
   122     /** Hide device dialogs */
       
   123     bool m_hideDeviceDialogs;
       
   124     
       
   125     /** Device lock enabled */
       
   126     bool m_deviceLockEnabled;
       
   127     
       
   128     /** Subscribes to Car Mode changes */
       
   129     QValueSpaceSubscriber* m_carModeSubscriber;
       
   130     
       
   131     /** Car Mode publisher */
       
   132     QValueSpacePublisher* m_carModePublisher;
       
   133     
       
   134     /** Key guard status before phone came top */
       
   135     bool m_keyguardOnBeforeForeground;
       
   136 };
       
   137 
       
   138 #endif // PHONEVISIBILITYHANDLER_H