Initialize Tizen 2.3
[apps/osp/Call.git] / inc / CallEndCallForm.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                CallEndCallForm.h
19  * @brief               This is the header file for the %EndCallForm class.
20  *
21  * This header file contains the declarations for %EndCallForm class.
22  */
23 #ifndef _PHN_END_CALL_FORM_H_
24 #define _PHN_END_CALL_FORM_H_
25
26 #include <FBase.h>
27 #include <FApp.h>
28 #include <FUi.h>
29 #include "CallBaseForm.h"
30 #include "CallTypes.h"
31 #include "CallIAppStateChangeListner.h"
32
33 class CallButtonsPanel;
34
35 /**
36  * @class EndCallForm
37  * @brief This class presents a form based UI for end call scenarios.
38  *
39  */
40 class EndCallForm
41         : public BaseForm
42         , public Tizen::Ui::Scenes::ISceneEventListener
43         , public Tizen::Base::Runtime::ITimerEventListener
44         , public Tizen::App::IAppControlResponseListener
45         , public Tizen::Social::IAddressbookChangeEventListener
46         , public IAppStateChangeListener
47         , public Tizen::Ui::IOrientationEventListener
48 {
49 public:
50         EndCallForm(void);
51         virtual ~EndCallForm(void);
52         //From BaseForm
53         virtual void Initialize(void);
54
55 public:
56         virtual result OnInitializing(void);
57         virtual result OnTerminating(void);
58         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
59
60         virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
61         virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
62
63         /**
64          * Called when the container needs to draw itself. @n
65          * Users can override this method to display user-specific drawings. @n
66          * This method is called after the container has drawn itself, but just before the container draws its child controls.
67          */
68         virtual result OnDraw(void);
69
70         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
71
72         /**
73          * Called when the application control is completed.
74          * @param[in]   providerId      The provider ID
75          * @param[in]   operationId             The operation ID used in application control invocation
76          * @param[in]   pResultList             The list of callback strings of application control
77          * @remarks     The specified @c pResultList provides the result code for the first array element.
78          * @remarks     When the invoked application control is terminated without sending a result,
79          *           then this method is invoked with @c pResultList and it contains App::APPCONTROL_RESULT_TERMINATED.
80          * @remarks     Switching forms using Tizen::Ui::Controls::Frame::SetCurrentForm() in this listener disables the upcoming form
81          *           (UiApp::OnForeground()). If UiApp::OnForeground() is being used in the application logic,
82          *                      it is recommended to avoid switching forms in this listener.
83          * @see         Tizen::App::AppControl
84          */
85         virtual void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
86         //Used to set the Viewcontact button state in the end call form
87         void ShowViewContactButton(void);
88         //Used to set the Viewcontact button state in the end call form
89         void ShowAddContactButton(void);
90         // Called by AddressBook to notify when contacts are changed.
91         virtual void OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList);
92         // Called by AddressBook to notify when categories are changed.
93         virtual void OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList) {};
94         //Called when App comes to foreground
95         virtual void OnForeground(void);
96         //Called when App goes to background
97         virtual void OnBackground(void);
98         //Called when screen goes off
99         virtual void OnScreenOff(void){};
100         //From IOrientationEventListener
101         virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus);
102
103         void UpdatePersonDetail(void);
104
105 private:
106         //initialise the end call panel
107         void InitializeCallButtonsPanel(void);
108         //Add the action listener for the buttons
109         void AddKeyPadActionListener(const Tizen::Base::String& keyName, CommandIds cmdId);
110         // Method to show phone number on screen for all calls except conference call.
111         void ShowPhoneNumber(const Tizen::Base::String& phoneNumber, const Tizen::Base::String& lblName);
112         // Method to show caller name and photo for all calls.
113         void ShowPersonDetails(const Tizen::Base::String& phoneNumber, const Tizen::Base::String& nameLblName, const Tizen::Base::String& photoLblName, AppCallInfo* pCallInfo);
114         // Method to show thumbnail
115         void ShowCallersPhotoThumbnail(const Tizen::Graphics::Bitmap& pPhotoId);
116         //private method to handle whether to close App or goto initial scene, after no more active calls are left.
117         void HandleLastCallCompletion(void);
118         //Handle Add to contacts button press
119         void HandleAddToContacts(void);
120         //Method to show thumbnail image
121         void ShowThumbnailImage(const Tizen::Graphics::Bitmap* pPhotoId,const Tizen::Base::String& photoLabel);
122
123 private:
124         //Custom Buttons Panel
125         CallButtonsPanel* __pCallButtonsPanel;
126         Tizen::Base::String* __pContactNumber;
127         //Timer used to show End call scene for 3 sec
128         Tizen::Base::Runtime::Timer* __pEndCallEventTimer;
129         Tizen::Social::Addressbook* __pAddressBook;
130         Tizen::Ui::Controls::Label* __pSmallPhotoLabel;
131         bool __isMsgAppControlLaunched;
132         bool __isContactAppControlLaunched;
133 };
134
135 #endif  // _PHN_END_CALL_FORM_H_