phoneapp/phoneuiqtviewadapter/inc/phonevisibilityhandler.h
changeset 45 6b911d05207e
child 46 bc5a64e5bc3c
equal deleted inserted replaced
37:ba76fc04e6c2 45:6b911d05207e
       
     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     int ordinalPosition();
       
    70     
       
    71 public: // from MPhonePubSubObserver
       
    72 
       
    73     /**
       
    74     * This function is called when there is property value change.
       
    75     * @param aCategory Category of the property
       
    76     * @param aKey Property key that is changed
       
    77     * @param aValue New property value
       
    78     */
       
    79     void HandlePropertyChangedL( 
       
    80         const TUid& aCategory,
       
    81         const TUint aKey,
       
    82         const TInt aValue);
       
    83         
       
    84 private:
       
    85 
       
    86     /**
       
    87      * Adjusts visibility based on current call and device security statuses.
       
    88      */
       
    89     void adjustVisibility(AdjustAction action);
       
    90     
       
    91 private slots:
       
    92 
       
    93     /**
       
    94      * QValueSpaceSubscriber has notified that Car Mode value has changed by calling this slot.
       
    95      */
       
    96     void carModeChanged();
       
    97     
       
    98 private:
       
    99     /** Phone view */
       
   100     PhoneUIQtViewIF &m_view;
       
   101     
       
   102     /** Cached pointer to Eikon environment. Not own.*/
       
   103     CEikonEnv *m_eikonEnv;
       
   104     
       
   105     /** Car mode effects visibility */
       
   106     bool m_carModeEnabled;
       
   107     
       
   108     /** Hide device dialogs */
       
   109     bool m_hideDeviceDialogs;
       
   110     
       
   111     /** Device lock enabled */
       
   112     bool m_deviceLockEnabled;
       
   113     
       
   114     /** Subscribes to Car Mode changes */
       
   115     QValueSpaceSubscriber* m_carModeSubscriber;
       
   116     
       
   117     /** Car Mode publisher */
       
   118     QValueSpacePublisher* m_carModePublisher;
       
   119     
       
   120 };
       
   121 
       
   122 #endif // PHONEVISIBILITYHANDLER_H