phoneapp/phoneuiqtviewadapter/inc/phoneuiqtviewadapter.h
changeset 36 2eacb6118286
parent 30 ebdbd102c78a
child 37 ba76fc04e6c2
equal deleted inserted replaced
30:ebdbd102c78a 36:2eacb6118286
     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:  Phone UI's symbian adapter for Qt view.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PHONEUIQTVIEWADAPTER_H
       
    19 #define PHONEUIQTVIEWADAPTER_H
       
    20 
       
    21 #ifdef BUILD_PHONEUIQTVIEWADAPTER
       
    22 #define PHONEUIQTVIEWADAPTER_EXPORT Q_DECL_EXPORT
       
    23 #else
       
    24 #define PHONEUIQTVIEWADAPTER_EXPORT Q_DECL_IMPORT
       
    25 #endif
       
    26 
       
    27 #include <QObject>
       
    28 #include <QMap>
       
    29 #include <apgwgnam.h>
       
    30 #include "mphoneviewcommandhandle.h"
       
    31 #include "mphonepubsubobserver.h"
       
    32 #include "phoneaction.h"
       
    33 
       
    34 class PhoneUIQtViewIF;
       
    35 class PhoneBubbleWrapper;
       
    36 class CPhoneRingingToneController;
       
    37 class PhoneResourceAdapter;
       
    38 class PhoneUIQtButtonsController;
       
    39 class PhoneNoteController;
       
    40 class PhoneMessageController;
       
    41 class PhoneUiCommandController;
       
    42 class TelephonyService;
       
    43 class QKeyEvent;
       
    44 class PhoneIndicatorController;
       
    45 
       
    46 class PHONEUIQTVIEWADAPTER_EXPORT PhoneUIQtViewAdapter : 
       
    47     public QObject, 
       
    48     public MPhoneViewCommandHandle,
       
    49     public MPhonePubSubObserver
       
    50 {
       
    51     Q_OBJECT
       
    52 
       
    53 public:
       
    54 
       
    55     /**
       
    56      * Constructor
       
    57      */
       
    58     explicit PhoneUIQtViewAdapter (PhoneUIQtViewIF &view, QObject *parent = 0);
       
    59     
       
    60     /**
       
    61      * Destructor
       
    62      */
       
    63     virtual ~PhoneUIQtViewAdapter();
       
    64 
       
    65     
       
    66 public: // From MPhoneViewCommandHandle
       
    67 
       
    68     /**
       
    69     * Execute Command with given Command Id
       
    70     * @param aCmdId Command Id
       
    71     * @return None
       
    72     */
       
    73     void ExecuteCommandL (TPhoneViewCommandId aCmdId);
       
    74 
       
    75     /**
       
    76     * Execute Command with given Command Id  and Call Id
       
    77     * @param aCmdId Command Id
       
    78     * @param aCallId Call Id
       
    79     * @return None
       
    80     */
       
    81     void ExecuteCommandL (TPhoneViewCommandId aCmdId, TInt aCallId);
       
    82 
       
    83      /**
       
    84     * Execute Command with given command id, call id and command parameter.
       
    85     * @param aCmdId Command Id
       
    86     * @param aCommandParam Command parameter
       
    87     * @return None
       
    88     */
       
    89     void ExecuteCommandL (TPhoneViewCommandId aCmdId, TPhoneCommandParam* aCommandParam);
       
    90 
       
    91      /**
       
    92     * Execute Command with given command id, call id and command parameter.
       
    93     * @param aCmdId Command Id
       
    94     * @param aCallId Call Id
       
    95     * @param aCommandParam Command parameter
       
    96     * @return None
       
    97     */
       
    98     void ExecuteCommandL (TPhoneViewCommandId aCmdId, TInt aCallId,
       
    99         TPhoneCommandParam* aCommandParam);
       
   100 
       
   101     /**
       
   102     * Execute Command with given command id, call id and message.
       
   103     * @param aCmdId Command Id
       
   104     * @param aCallId Call Id
       
   105     * @param aMessage Command message
       
   106     */
       
   107     void ExecuteCommandL (TPhoneViewCommandId aCmdId, TInt aCallId, TDesC& aMessage);
       
   108 
       
   109     /**
       
   110     * Handle Command with given Command Id
       
   111     * @param aCmdId Command Id
       
   112     * @return TPhoneViewResponseId
       
   113     */
       
   114     TPhoneViewResponseId HandleCommandL (TPhoneViewCommandId aCmdId);
       
   115 
       
   116     /**
       
   117     * Handle Command with given command id and command parameter.
       
   118     * @param aCmdId Command Id
       
   119     * @param aCommandParam Command parameter
       
   120     * @return TPhoneViewResponseId
       
   121     */
       
   122     TPhoneViewResponseId HandleCommandL (TPhoneViewCommandId aCmdId, 
       
   123         TPhoneCommandParam* aCommandParam);
       
   124         
       
   125     /**
       
   126     * Execute Command with given Command Id
       
   127     * @param aCmdId Command Id
       
   128     * @return None
       
   129     */
       
   130     void ExecuteCommand (TPhoneViewCommandId aCmdId);
       
   131         
       
   132     /**
       
   133     * Execute Command with given command id and command parameter.
       
   134     * @param aCmdId Command Id
       
   135     * @param aCommandParam Command parameter
       
   136     * @return None
       
   137     */
       
   138     void ExecuteCommand (TPhoneViewCommandId aCmdId, TPhoneCommandParam* aCommandParam);
       
   139    
       
   140     /**
       
   141     * Execute Command with given Command Id
       
   142     */     
       
   143     const TDesC& FetchContent ();
       
   144     
       
   145     /*!
       
   146         \fn void PhoneUIQtViewAdapter::noteController ()
       
   147         
       
   148         Returns pointer to PhoneNoteController
       
   149     */
       
   150     PhoneNoteController* noteController() const;
       
   151     
       
   152 public: // from MPhonePubSubObserver
       
   153 
       
   154         /**
       
   155         * This function is called when there is property value change.
       
   156         * @param aCategory Category of the property
       
   157         * @param aKey Property key that is changed
       
   158         * @param aValue New property value
       
   159         */
       
   160         void HandlePropertyChangedL( 
       
   161             const TUid& aCategory,
       
   162             const TUint aKey,
       
   163             const TInt aValue);
       
   164     
       
   165 
       
   166 private slots:
       
   167 
       
   168     /*!
       
   169         \fn void PhoneUIQtViewAdapter::dialpadClosed ()
       
   170         
       
   171         PhoneView calls this method when dialpad
       
   172         is going to be closed.
       
   173     */
       
   174     void dialpadClosed();
       
   175     
       
   176     /*!
       
   177         \fn void PhoneUIQtViewAdapter::keyPressed ()
       
   178         
       
   179         PhoneView calls this method when key press is released.
       
   180     */
       
   181     void keyReleased(QKeyEvent *event);
       
   182     
       
   183     /*!
       
   184         \fn void PhoneUIQtViewAdapter::handleWindowActivated ()
       
   185         
       
   186         PhoneView calls this method when window is activated;
       
   187     */
       
   188     void handleWindowActivated();
       
   189     
       
   190     /*!
       
   191         \fn void PhoneUIQtViewAdapter::handleWindowDeactivated ()
       
   192         
       
   193         PhoneView calls this method when window is deactivated.
       
   194     */
       
   195     void handleWindowDeactivated();
       
   196     
       
   197 private:
       
   198 
       
   199     /*!
       
   200         \fn void PhoneUIQtViewAdapter::setTopApplication (TPhoneCommandParam *)
       
   201         
       
   202         This method is called when EPhoneViewSetTopApplication or
       
   203         EPhoneViewSetIdleTopApplication command is received.
       
   204     */
       
   205     void setTopApplication (TPhoneCommandParam *commandParam);
       
   206     
       
   207     /*!
       
   208         \fn int PhoneUIQtViewAdapter::idleAppUid()
       
   209         
       
   210         This method fetches Idle application's Id from PubSub and returns it.
       
   211     */
       
   212     int idleAppUid();
       
   213 
       
   214     /*!
       
   215         \fn int PhoneUIQtViewAdapter::createCallHeader()
       
   216         
       
   217         This method creates new call header.
       
   218     */
       
   219     void createCallHeader (int callId, TPhoneCommandParam *commandParam);
       
   220     
       
   221     /*!
       
   222         \fn int PhoneUIQtViewAdapter::createCallHeader()
       
   223         
       
   224         This method creates new call header.
       
   225     */
       
   226     void createEmergencyCallHeader (int callId, TPhoneCommandParam *commandParam);
       
   227 
       
   228     /*!
       
   229         \fn int PhoneUIQtViewAdapter::updateCallHeader()
       
   230         
       
   231         This method updates call state information in call header.
       
   232     */
       
   233     void updateCallHeaderState (int callId, TPhoneCommandParam *commandParam);
       
   234     
       
   235     /*!
       
   236         \fn int PhoneUIQtViewAdapter::updateCallHeaderRemoteInfo()
       
   237         
       
   238         This method updates remote information in call header.
       
   239     */
       
   240     void updateCallHeaderRemoteInfo (int callId, TPhoneCommandParam *commandParam);
       
   241     
       
   242     /*!
       
   243         \fn int PhoneUIQtViewAdapter::updateCallHeaderRemoteInfo()
       
   244         
       
   245         This method updates remote information in call header and label.
       
   246     */
       
   247     void updateCallHeaderRemoteInfoAndLabel (int callId, TPhoneCommandParam *commandParam);    
       
   248 
       
   249     /*!
       
   250         \fn int PhoneUIQtViewAdapter::handleCipheringInfoChange()
       
   251         
       
   252         This method updates ciphering indicators.
       
   253     */
       
   254     void handleCipheringInfoChange(int callId, TPhoneCommandParam *commandParam);    
       
   255     
       
   256     /*!
       
   257         \fn int PhoneUIQtViewAdapter::callIdByState()
       
   258         
       
   259         This method writes to commandParam the call id matching
       
   260         given call state.
       
   261         
       
   262         Returns EPhoneViewResponseSuccess operation is succesful
       
   263         otherwise EPhoneViewResponseFailed.
       
   264     */
       
   265     TPhoneViewResponseId callIdByState (TPhoneCommandParam *commandParam);
       
   266     
       
   267     /*!
       
   268         \fn void PhoneUIQtViewAdapter::setTouchButtons (TPhoneCmdParam *commandParam)
       
   269         
       
   270         This method sets buttons to call bubble.        
       
   271     */
       
   272     void setTouchButtons (TPhoneCommandParam *commandParam);
       
   273     
       
   274     /*!
       
   275         \fn void PhoneUIQtViewAdapter::setToolbarButtons (TPhoneCmdParam *commandParam)
       
   276         
       
   277         This method sets buttons to toolbar.        
       
   278     */
       
   279     void setToolbarButtons (TPhoneCommandParam *commandParam);
       
   280     
       
   281     /*!
       
   282         \fn void PhoneUIQtViewAdapter::setCallHoldFlag (TPhoneCmdParam *commandParam)
       
   283         
       
   284         This method sets flag telling is the call hold or not.
       
   285     */
       
   286     void setCallHoldFlag (TPhoneCommandParam *commandParam);
       
   287     
       
   288     /*!
       
   289         \fn void PhoneUIQtViewAdapter::callHoldFlag (TPhoneCmdParam *commandParam)
       
   290         
       
   291         This method retrieves flag telling is the call hold or not and writes
       
   292         it into given command parameter.
       
   293     */
       
   294     void callHoldFlag (TPhoneCommandParam *commandParam);
       
   295 
       
   296     /*!
       
   297         \fn void PhoneUIQtViewAdapter::writeAudioVolumeLevel (TPhoneCmdParam *commandParam)
       
   298         
       
   299         This method writes audio volume value into given command parameter.
       
   300     */
       
   301     void writeAudioVolumeLevel (TPhoneCommandParam *commandParam);
       
   302     
       
   303     /*!
       
   304         \fn void PhoneUIQtViewAdapter::setAudioVolumeSliderValue (TPhoneCmdParam *commandParam)
       
   305         
       
   306         This method sets volume value to view.
       
   307     */
       
   308     void setAudioVolumeSliderValue (TPhoneCommandParam *commandParam);
       
   309 
       
   310     /*!
       
   311         \fn void PhoneUIQtViewAdapter::setMuteIndication (TPhoneCmdParam *commandParam)
       
   312         
       
   313         This method sets muted indication to view.
       
   314     */
       
   315     void setMuteIndication (TPhoneCommandParam *commandParam);
       
   316     
       
   317     
       
   318     /*!
       
   319         \fn void PhoneUIQtViewAdapter::callHoldFlag (TPhoneCmdParam *commandParam)
       
   320         
       
   321         This method retrieves number of calls. Conference call counts one call, 
       
   322         participant calls are not count.
       
   323     */
       
   324     void activeCallCount (TPhoneCommandParam *commandParam);
       
   325     
       
   326     /*!
       
   327         \fn void PhoneUIQtViewAdapter::setAudioPath (TPhoneCommandParam *commandParam)
       
   328         
       
   329         This method sets audio paths
       
   330     */
       
   331     void setAudioPath (TPhoneCommandParam *commandParam);
       
   332     
       
   333     /*!
       
   334         \fn void PhoneUIQtViewAdapter::expandedBubbleCallId(TPhoneCommandParam *commandParam)
       
   335         
       
   336         This method gets call id of the expanded call bubble.
       
   337     */
       
   338     void expandedBubbleCallId(TPhoneCommandParam *commandParam);
       
   339 
       
   340     /*!
       
   341         \fn void openDialpad()
       
   342         
       
   343         This method opens dialpad.
       
   344     */
       
   345     void openDialpad();
       
   346     
       
   347     /*!
       
   348         \fn int PhoneUIQtViewAdapter::createConference()
       
   349         
       
   350         This method creates conference bubble.
       
   351     */
       
   352     void createConferenceBubble(int callId, TPhoneCommandParam *commandParam);
       
   353 
       
   354     /*!
       
   355         \fn int PhoneUIQtViewAdapter::conferenceCallId()
       
   356         
       
   357         This method checks if call id belongs to conference call.
       
   358     */
       
   359     void conferenceCallId(int callId, TPhoneCommandParam *commandParam);
       
   360 
       
   361     /*!
       
   362         \fn int PhoneUIQtViewAdapter::removeConferenceBubble()
       
   363         
       
   364         This method removes conference bubble.
       
   365     */
       
   366     void removeConferenceBubble();
       
   367 
       
   368     /*!
       
   369         \fn int PhoneUIQtViewAdapter::isConference()
       
   370         
       
   371         This method checks is conference bubble active.
       
   372     */
       
   373     void isConference(TPhoneCommandParam *commandParam);
       
   374 
       
   375     /*!
       
   376         \fn int PhoneUIQtViewAdapter::removeCallFromConference()
       
   377         
       
   378         This method removes a call from conference.
       
   379     */
       
   380     void removeCallFromConference(int callId);
       
   381 
       
   382     /*!
       
   383         \fn TPhoneViewResponseId PhoneUIQtViewAdapter::getSelectedConferenceMember()
       
   384         
       
   385         This method gets call id of selected conference member.
       
   386         Used in drop and private commands. 
       
   387     */
       
   388     TPhoneViewResponseId getSelectedConferenceMember(
       
   389             TPhoneCommandParam *commandParam);
       
   390     
       
   391     /*!
       
   392         \fn void PhoneUIQtViewAdapter::setPrivateFromConference()
       
   393         
       
   394         This method removes call from converence bubble.
       
   395         Used in private command. 
       
   396     */   
       
   397     void setPrivateFromConference(int callId);
       
   398 
       
   399     /*!
       
   400         \fn void PhoneUIQtViewAdapter::setExpandActions()
       
   401         
       
   402         This method sets expand action if needed. 
       
   403     */ 
       
   404     void setExpandActions();
       
   405 
       
   406     /*!
       
   407         \fn void PhoneUIQtViewAdapter::setParticipantListActions()
       
   408         
       
   409         This method sets participant list actions if needed. 
       
   410     */
       
   411     void setParticipantListActions();
       
   412 
       
   413     /*!
       
   414         \fn void PhoneUIQtViewAdapter::setExpandedConferenceCallHeader()
       
   415         
       
   416         This method sets conference call header expanded if needed. 
       
   417     */
       
   418     void setExpandedConferenceCallHeader();
       
   419     
       
   420     /*!
       
   421         \fn void PhoneUIQtViewAdapter::bringToForeground()
       
   422         
       
   423         This method brings application to foreground.
       
   424     */
       
   425     void bringToForeground();
       
   426     
       
   427     /*!
       
   428         \fn void PhoneUIQtViewAdapter::showGlobalNote()
       
   429         
       
   430         This method shows global note.
       
   431     */
       
   432     void showGlobalNote(TPhoneCommandParam *commandParam);
       
   433     
       
   434     /*!
       
   435         \fn void PhoneUIQtViewAdapter::callsExists()
       
   436         
       
   437         This method checks if there are calls in given states.
       
   438     */
       
   439     bool callsExists(int call1State, int call2State);
       
   440  
       
   441     /*!
       
   442         \fn void PhoneUIQtViewAdapter::setDialpadVisibility()
       
   443         
       
   444         This method sets dialpad visibility.
       
   445     */
       
   446     void setDialpadVisibility(TPhoneCommandParam *commandParam);
       
   447  
       
   448     /*!
       
   449         \fn void PhoneUIQtViewAdapter::removeAllCallHeaders()
       
   450         
       
   451         This method removes all call headers.
       
   452     */
       
   453     void removeAllCallHeaders();
       
   454  
       
   455     /*!
       
   456         \fn void PhoneUIQtViewAdapter::getNumberFromDialpad()
       
   457         
       
   458         This method gets number from dialpad.
       
   459     */
       
   460     void getNumberFromDialpad(TPhoneCommandParam *commandParam);
       
   461     
       
   462     /*!
       
   463         \fn void PhoneUIQtViewAdapter::getNumberEntryStringLength()
       
   464         
       
   465         This method gets text length from the dialpad.
       
   466     */
       
   467     void getDialpadStringLength(TPhoneCommandParam *commandParam);
       
   468     
       
   469     /*!
       
   470         \fn void PhoneUIQtViewAdapter::getNumberEntryStringLength()
       
   471         
       
   472         This method clears and removes dialpad from the view.
       
   473     */
       
   474     void removeDialpad();
       
   475     
       
   476     /*!
       
   477         \fn void PhoneUIQtViewAdapter::addToConference()
       
   478         
       
   479         This method adds call to conference.
       
   480     */
       
   481     void addToConference();
       
   482     
       
   483     /*!
       
   484         \fn void PhoneUIQtViewAdapter::setMenu()
       
   485         
       
   486         This method sets actions for menu.
       
   487     */
       
   488     void setMenu();
       
   489   
       
   490     /*!
       
   491         \fn void PhoneUIQtViewAdapter::setMenu()
       
   492         
       
   493         This method sets actions for menu in call handling view.
       
   494     */
       
   495     void setCallMenu();
       
   496     
       
   497     /*!
       
   498         \fn void PhoneUIQtViewAdapter::setMenu()
       
   499         
       
   500         This method sets actions for menu in dialpad view.
       
   501     */
       
   502     void setDialpadMenu();
       
   503     
       
   504     /*!
       
   505         \fn int PhoneUIQtViewAdapter::showNote()
       
   506         
       
   507         This method shows a note by command params.
       
   508     */
       
   509     void showNote(TPhoneCommandParam *commandParam);
       
   510     
       
   511 	/*!
       
   512 	    /fn QString convertDuration(int)
       
   513 		This method returns the localized call duration
       
   514     */
       
   515     QString convertDuration(int seconds);
       
   516  
       
   517     /*!
       
   518         /fn void setBubbleSelectionFlag()
       
   519         This method sets bubble selection flag.
       
   520     */
       
   521     void setBubbleSelectionFlag();
       
   522     
       
   523     /*!
       
   524         /fn void setHidden()
       
   525         This method sets hidden status.
       
   526     */    
       
   527     void setHidden(bool hidden);
       
   528     
       
   529     /*!
       
   530         /fn void SetHiddenL()
       
   531         This method sets hidden status.
       
   532     */
       
   533     void SetHiddenL(bool hidden);
       
   534     
       
   535     /*!
       
   536         /fn void openContacts()
       
   537         This method opens contacts application.
       
   538     */    
       
   539     void openContacts();
       
   540     
       
   541 private:
       
   542 
       
   543     PhoneUIQtViewIF &m_view;
       
   544     int m_idleUid;
       
   545     PhoneBubbleWrapper *m_bubbleWrapper;
       
   546     CPhoneRingingToneController *m_ringingtonecontroller;
       
   547     PhoneResourceAdapter *m_resourceAdapter;
       
   548     PhoneNoteController *m_noteController;
       
   549     TelephonyService *m_telephonyService;
       
   550     PhoneUiCommandController *m_uiCommandController;
       
   551     PhoneMessageController *m_messageController;
       
   552     PhoneIndicatorController *m_indicatorController;
       
   553     bool m_dialpadAboutToClose;
       
   554     bool m_homeScreenToForeground;
       
   555     bool m_carModeEnabled;
       
   556 };
       
   557 
       
   558 #endif // PHONEUIQTVIEWADAPTER_H