phoneapp/phoneuiqtviewadapter/inc/phoneuiqtviewadapter.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Mar 2010 09:28:42 +0200
changeset 21 92ab7f8d0eab
child 22 6bb1b21d2484
permissions -rw-r--r--
Revision: 201007 Kit: 201011

/*!
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Phone UI's symbian adapter for Qt view.
*
*/

#ifndef PHONEUIQTVIEWADAPTER_H
#define PHONEUIQTVIEWADAPTER_H

#ifdef BUILD_PHONEUIQTVIEWADAPTER
#define PHONEUIQTVIEWADAPTER_EXPORT Q_DECL_EXPORT
#else
#define PHONEUIQTVIEWADAPTER_EXPORT Q_DECL_IMPORT
#endif

#include <QObject>
#include <QMap>
#include "mphoneviewcommandhandle.h"
#include "phoneaction.h"

class PhoneUIQtViewIF;
class PhoneBubbleWrapper;
class CPhoneRingingToneController;
class PhoneResourceAdapter;
class PhoneUIQtButtonsController;
class PhoneNoteController;
class PhoneUiCommandController;
class TelephonyService;
class QKeyEvent;

class PHONEUIQTVIEWADAPTER_EXPORT PhoneUIQtViewAdapter : 
    public QObject, 
    public MPhoneViewCommandHandle
{
    Q_OBJECT

public:

    /**
     * Constructor
     */
    explicit PhoneUIQtViewAdapter (PhoneUIQtViewIF &view, QObject *parent = 0);
    
    /**
     * Destructor
     */
    virtual ~PhoneUIQtViewAdapter();

    
public: // From MPhoneViewCommandHandle

    /**
    * Execute Command with given Command Id
    * @param aCmdId Command Id
    * @return None
    */
    void ExecuteCommandL (TPhoneViewCommandId aCmdId);

    /**
    * Execute Command with given Command Id  and Call Id
    * @param aCmdId Command Id
    * @param aCallId Call Id
    * @return None
    */
    void ExecuteCommandL (TPhoneViewCommandId aCmdId, TInt aCallId);

     /**
    * Execute Command with given command id, call id and command parameter.
    * @param aCmdId Command Id
    * @param aCommandParam Command parameter
    * @return None
    */
    void ExecuteCommandL (TPhoneViewCommandId aCmdId, TPhoneCommandParam* aCommandParam);

     /**
    * Execute Command with given command id, call id and command parameter.
    * @param aCmdId Command Id
    * @param aCallId Call Id
    * @param aCommandParam Command parameter
    * @return None
    */
    void ExecuteCommandL (TPhoneViewCommandId aCmdId, TInt aCallId,
        TPhoneCommandParam* aCommandParam);

    /**
    * Execute Command with given command id, call id and message.
    * @param aCmdId Command Id
    * @param aCallId Call Id
    * @param aMessage Command message
    */
    void ExecuteCommandL (TPhoneViewCommandId aCmdId, TInt aCallId, TDesC& aMessage);

    /**
    * Handle Command with given Command Id
    * @param aCmdId Command Id
    * @return TPhoneViewResponseId
    */
    TPhoneViewResponseId HandleCommandL (TPhoneViewCommandId aCmdId);

    /**
    * Handle Command with given command id and command parameter.
    * @param aCmdId Command Id
    * @param aCommandParam Command parameter
    * @return TPhoneViewResponseId
    */
    TPhoneViewResponseId HandleCommandL (TPhoneViewCommandId aCmdId, 
        TPhoneCommandParam* aCommandParam);
        
    /**
    * Execute Command with given Command Id
    * @param aCmdId Command Id
    * @return None
    */
    void ExecuteCommand (TPhoneViewCommandId aCmdId);
        
    /**
    * Execute Command with given command id and command parameter.
    * @param aCmdId Command Id
    * @param aCommandParam Command parameter
    * @return None
    */
    void ExecuteCommand (TPhoneViewCommandId aCmdId, TPhoneCommandParam* aCommandParam);
   
    /**
    * Execute Command with given Command Id
    */     
    const TDesC& FetchContent ();
    
    /*!
        \fn void PhoneUIQtViewAdapter::noteController ()
        
        Returns pointer to PhoneNoteController
    */
    PhoneNoteController* noteController() const;
    
private slots:

    /*!
        \fn void PhoneUIQtViewAdapter::dialpadClosed ()
        
        PhoneView calls this method when dialpad
        is going to be closed.
    */
    void dialpadClosed();
    
    /*!
        \fn void PhoneUIQtViewAdapter::keyPressed ()
        
        PhoneView calls this method when key press is released.
    */
    void keyReleased(QKeyEvent *event);
    
private:

    /*!
        \fn void PhoneUIQtViewAdapter::setTopApplication (TPhoneCommandParam *)
        
        This method is called when EPhoneViewSetTopApplication or
        EPhoneViewSetIdleTopApplication command is received.
    */
    void setTopApplication (TPhoneCommandParam *commandParam);
    
    /*!
        \fn int PhoneUIQtViewAdapter::idleAppUid()
        
        This method fetches Idle application's Id from PubSub and returns it.
    */
    int idleAppUid();

    /*!
        \fn int PhoneUIQtViewAdapter::createCallHeader()
        
        This method creates new call header.
    */
    void createCallHeader (int callId, TPhoneCommandParam *commandParam);
    
    /*!
        \fn int PhoneUIQtViewAdapter::createCallHeader()
        
        This method creates new call header.
    */
    void createEmergencyCallHeader (int callId, TPhoneCommandParam *commandParam);

    /*!
        \fn int PhoneUIQtViewAdapter::updateCallHeader()
        
        This method updates call state information in call header.
    */
    void updateCallHeaderState (int callId, TPhoneCommandParam *commandParam);
    
    /*!
        \fn int PhoneUIQtViewAdapter::updateCallHeaderRemoteInfo()
        
        This method updates remote information in call header.
    */
    void updateCallHeaderRemoteInfo (int callId, TPhoneCommandParam *commandParam);
    
    /*!
        \fn int PhoneUIQtViewAdapter::updateCallHeaderRemoteInfo()
        
        This method updates remote information in call header and label.
    */
    void updateCallHeaderRemoteInfoAndLabel (int callId, TPhoneCommandParam *commandParam);    
    
    /*!
        \fn int PhoneUIQtViewAdapter::callIdByState()
        
        This method writes to commandParam the call id matching
        given call state.
        
        Returns EPhoneViewResponseSuccess operation is succesful
        otherwise EPhoneViewResponseFailed.
    */
    TPhoneViewResponseId callIdByState (TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::setTouchButtons (TPhoneCmdParam *commandParam)
        
        This method sets buttons to call bubble.        
    */
    void setTouchButtons (TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::setToolbarButtons (TPhoneCmdParam *commandParam)
        
        This method sets buttons to toolbar.        
    */
    void setToolbarButtons (TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::setCallHoldFlag (TPhoneCmdParam *commandParam)
        
        This method sets flag telling is the call hold or not.
    */
    void setCallHoldFlag (TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::callHoldFlag (TPhoneCmdParam *commandParam)
        
        This method retrieves flag telling is the call hold or not and writes
        it into given command parameter.
    */
    void callHoldFlag (TPhoneCommandParam *commandParam);

    /*!
        \fn void PhoneUIQtViewAdapter::writeAudioVolumeLevel (TPhoneCmdParam *commandParam)
        
        This method writes audio volume value into given command parameter.
    */
    void writeAudioVolumeLevel (TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::setAudioVolumeSliderValue (TPhoneCmdParam *commandParam)
        
        This method sets volume value to view.
    */
    void setAudioVolumeSliderValue (TPhoneCommandParam *commandParam);

    /*!
        \fn void PhoneUIQtViewAdapter::setMuteIndication (TPhoneCmdParam *commandParam)
        
        This method sets muted indication to view.
    */
    void setMuteIndication (TPhoneCommandParam *commandParam);
    
    
    /*!
        \fn void PhoneUIQtViewAdapter::callHoldFlag (TPhoneCmdParam *commandParam)
        
        This method retrieves number of calls. Conference call counts one call, 
        participant calls are not count.
    */
    void activeCallCount (TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::setAudioPath (TPhoneCommandParam *commandParam)
        
        This method sets audio paths
    */
    void setAudioPath (TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::expandedBubbleCallId(TPhoneCommandParam *commandParam)
        
        This method gets call id of the expanded call bubble.
    */
    void expandedBubbleCallId(TPhoneCommandParam *commandParam);

    /*!
        \fn void openDialpad()
        
        This method opens dialpad.
    */
    void openDialpad();
    
    /*!
        \fn int PhoneUIQtViewAdapter::createConference()
        
        This method creates conference bubble.
    */
    void createConferenceBubble(int callId, TPhoneCommandParam *commandParam);

    /*!
        \fn int PhoneUIQtViewAdapter::conferenceCallId()
        
        This method checks if call id belongs to conference call.
    */
    void conferenceCallId(int callId, TPhoneCommandParam *commandParam);

    /*!
        \fn int PhoneUIQtViewAdapter::removeConferenceBubble()
        
        This method removes conference bubble.
    */
    void removeConferenceBubble();

    /*!
        \fn int PhoneUIQtViewAdapter::isConference()
        
        This method checks is conference bubble active.
    */
    void isConference(TPhoneCommandParam *commandParam);

    /*!
        \fn int PhoneUIQtViewAdapter::removeCallFromConference()
        
        This method removes a call from conference.
    */
    void removeCallFromConference(int callId);

    /*!
        \fn TPhoneViewResponseId PhoneUIQtViewAdapter::getSelectedConferenceMember()
        
        This method gets call id of selected conference member.
        Used in drop and private commands. 
    */
    TPhoneViewResponseId getSelectedConferenceMember(
            TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::setPrivateFromConference()
        
        This method removes call from converence bubble.
        Used in private command. 
    */   
    void setPrivateFromConference(int callId);

    /*!
        \fn void PhoneUIQtViewAdapter::setExpandActions()
        
        This method sets expand action if needed. 
    */ 
    void setExpandActions();

    /*!
        \fn void PhoneUIQtViewAdapter::setParticipantListActions()
        
        This method sets participant list actions if needed. 
    */
    void setParticipantListActions();

    /*!
        \fn void PhoneUIQtViewAdapter::setExpandedConferenceCallHeader()
        
        This method sets conference call header expanded if needed. 
    */
    void setExpandedConferenceCallHeader();
    
    /*!
        \fn void PhoneUIQtViewAdapter::bringToForeground()
        
        This method brings application to foreground.
    */
    void bringToForeground();
    
    /*!
        \fn void PhoneUIQtViewAdapter::showGlobalNote()
        
        This method shows global note.
    */
    void showGlobalNote(TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::callsExists()
        
        This method checks if there are calls in given states.
    */
    bool callsExists(int call1State, int call2State);
 
    /*!
        \fn void PhoneUIQtViewAdapter::setDialpadVisibility()
        
        This method sets dialpad visibility.
    */
    void setDialpadVisibility(TPhoneCommandParam *commandParam);
 
    /*!
        \fn void PhoneUIQtViewAdapter::removeAllCallHeaders()
        
        This method removes all call headers.
    */
    void removeAllCallHeaders();
 
    /*!
        \fn void PhoneUIQtViewAdapter::getNumberFromDialpad()
        
        This method gets number from dialpad.
    */
    void getNumberFromDialpad(TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::getNumberEntryStringLength()
        
        This method gets text length from the dialpad.
    */
    void getDialpadStringLength(TPhoneCommandParam *commandParam);
    
    /*!
        \fn void PhoneUIQtViewAdapter::getNumberEntryStringLength()
        
        This method clears and removes dialpad from the view.
    */
    void removeDialpad();
    
    /*!
        \fn void PhoneUIQtViewAdapter::addToConference()
        
        This method adds call to conference.
    */
    void addToConference();
    
    /*!
        \fn void PhoneUIQtViewAdapter::setMenu()
        
        This method sets actions for menu.
    */
    void setMenu();
  
    /*!
        \fn void PhoneUIQtViewAdapter::setMenu()
        
        This method sets actions for menu in call handling view.
    */
    void setCallMenu();
    
    /*!
        \fn void PhoneUIQtViewAdapter::setMenu()
        
        This method sets actions for menu in dialpad view.
    */
    void setDialpadMenu();
    
    /*!
        \fn int PhoneUIQtViewAdapter::showNote()
        
        This method shows a note by command params.
    */
    void showNote(TPhoneCommandParam *commandParam);
    
private:

    PhoneUIQtViewIF &m_view;
    int m_idleUid;
    PhoneBubbleWrapper *m_bubbleWrapper;
    CPhoneRingingToneController *m_ringingtonecontroller;
    PhoneResourceAdapter *m_resourceAdapter;
    PhoneNoteController *m_noteController;
    TelephonyService *m_telephonyService;
    PhoneUiCommandController *m_uiCommandController;
    bool m_dialpadAboutToClose;
};

#endif // PHONEUIQTVIEWADAPTER_H