Fix for 42792
[apps/osp/Call.git] / inc / CallActiveCallForm.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                CallActiveCallForm.h
19  * @brief               This is the header file for the %ActiveCallForm class.
20  *
21  * This header file contains the declarations for %ActiveCallForm class.
22  */
23 #ifndef _PHN_ACTIVE_CALL_FORM_H_
24 #define _PHN_ACTIVE_CALL_FORM_H_
25
26 #include <FBase.h>
27 #include <FUi.h>
28 #include "CallBaseForm.h"
29 #include "CallIAppStateChangeListner.h"
30
31 class CallButtonsPanel;
32 class DtmfKeyPadPanel;
33 class AppCallInfo;
34
35 /**
36  * @class ActiveCallForm
37  * @brief This class presents a form based UI for dialing call, active call, conference call,
38  *      single active call, multiple active call scenarios.
39  *
40  */
41 class ActiveCallForm
42         : public BaseForm
43         , public IAppStateChangeListener
44         , public Tizen::Ui::Controls::IListViewItemEventListener
45         , public Tizen::Ui::Controls::IListViewItemProvider
46         , public Tizen::Ui::Scenes::ISceneEventListener
47         , public Tizen::Base::Runtime::ITimerEventListener
48         , public Tizen::Ui::IOrientationEventListener
49         , public Tizen::Social::IAddressbookChangeEventListener
50 {
51 public:
52         ActiveCallForm(FormType formType);
53         virtual ~ActiveCallForm(void);
54         //From BaseForm
55         virtual void Initialize(void);
56         void SetSwapInProgress(bool progress);
57
58 public:
59         virtual result OnInitializing(void);
60         virtual result OnTerminating(void);
61         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
62
63         virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
64         virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
65
66         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
67
68         // Handle the changes(e.g. participant ended) in conference call
69         void HandleConfCallChanged(void);
70         // Used to update multiple call screen
71         void UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList);
72         //IAddressbookChangeEventListener
73         virtual void OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList);
74         virtual void OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList);
75         //From IOrientationEventListener
76         virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus);
77         //From IAppStateChangeListener
78         virtual void OnForeground(void);
79         virtual void OnBackground(void){};
80         virtual void OnScreenOff(void){};
81
82 private:
83         // Create the call buttons panel and add to form
84         result InitializeCallButtonsPanel(void);
85         // Set the correct bitmaps and action listeners for swap button
86         void InitializeSwapButton(void);
87         // Set the action listener for manage conf call button
88         void InitializeManageConfCallButton(void);
89         // Set the correct bitmaps and action listeners for hold button
90         void InitializeHoldButton(void);
91         // Set the state of the hold button according to call state
92         void SetHoldButtonStatus(bool toHoldCall);
93         // This function is used to fetch person details using phone number.
94         void ShowPersonDetails(const Tizen::Base::String& phoneNumber, const Tizen::Base::String& contactLblName, const Tizen::Base::String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo);
95         // Method to show phone number on screen for all calls except conference call.
96         void ShowPhoneNumber(const Tizen::Base::String& phoneNumber, const Tizen::Base::String& contactLblName);
97         // Method to show caller name for all calls.
98         void ShowCallerName(const Tizen::Base::String& callerName, const Tizen::Base::String& nameLblName);
99         // This function draws the caller's photo onto screen.
100         void ShowCallerPhoto(Tizen::Graphics::Bitmap* pPhotoId, bool isSecondCaller);
101         //This function is used to show small Thumbnail size photo of caller.
102         void ShowCallersPhotoThumbnail(const Tizen::Graphics::Bitmap& pPhotoId);
103         // Method to show call duration/state(held) for call in progress
104         void ShowTimerInfo(const Tizen::Base::String& timerLblName, bool isOnHold, long long startTime = 0);
105         // Method to set the show state of all the labels when DTMF keypad is launched
106         void SetShowStateOnKeypad(bool showState);
107         // Method to populate the list shown on "More" option
108         void CreateMoreOptionsMenuList(void);
109         // Method to destroy the list shown on "More" option
110         void DestroyMoreOptionsMenuList(void);
111         //Used to Show DTMF keypad
112         void ShowDTMFKeypad(void);
113         //Used to hide DTMF Keypad
114         void HideDTMFKeypad(void);
115         //Used to show text in text field
116         void SetTextToDTMFTextField(const Tizen::Base::String& dtmfStr);
117         // Set hold button status
118         void SetHoldButtonShowState(bool showState);
119
120         //From IListViewItemEventListener
121         virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
122         virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
123         virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
124         virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback);
125
126         //From IListViewItemProvider
127         virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
128         virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
129         virtual int GetItemCount(void);
130         //Method to show thumbnail image
131         void ShowThumbnailImage(const Tizen::Graphics::Bitmap* pPhotoId,Tizen::Base::String& photoLabel);
132         //Check if swap in progress
133         bool IsSwapInProgress(void);
134
135 private:
136         //Start time for Active call
137         long long __activeCallStartTime;
138         //Timer used to show call time
139         Tizen::Base::Runtime::Timer* __pActiveCallTimer;
140         //Custom Buttons Panel
141         CallButtonsPanel* __pCallButtonsPanel;
142         DtmfKeyPadPanel* __pDTMFKeypad;
143         Tizen::Social::Addressbook* __pAddressbook;
144         //Option Menu List for conference call
145         Tizen::Ui::Controls::ListView* __pMoreOptionsList;
146         Tizen::Ui::Controls::Label* __pMoreOptionsListAnchor;
147         Tizen::Ui::Controls::Label* __pSmallPhotoLabel;
148         Tizen::Base::String __DtmfString;
149         AppCallInfo* __pActiveCallInfo;
150         AppCallInfo* __pHeldCallInfo;
151         bool            __isSwapInProgress;
152 };
153
154 #endif  //_PHN_ACTIVE_CALL_FORM_H_