Initialize Tizen 2.3
[apps/osp/Dial.git] / inc / PhnLogsDetailForm.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                PhnLogsDetailForm.h
19  * @brief               This is the header file for the %DlLogsDetailForm class.
20  *
21  * This header file contains the declarations for %DlLogsDetailForm class.
22  */
23 #ifndef _PHN_LOGS_DETAIL_FORM_H_
24 #define _PHN_LOGS_DETAIL_FORM_H_
25
26 #include <FBase.h>
27 #include <FSysSettingInfo.h>
28 #include <FUi.h>
29 #include "PhnCallLogPresentationModel.h"
30 #include "PhnCallLogViewByPopup.h"
31 #include "PhnIAppStateChangeListner.h"
32 #include "PhnICallLogViewByPopupListener.h"
33 #include "PhnLogsDetailItemProvider.h"
34
35 class CallLogDetails;
36 class CallLogManager;
37
38 /**
39  * @class DlLogsDetailForm
40  * @brief This class presents a form based UI for call log details scene.
41  *
42  */
43 class DlLogsDetailForm
44         : public Tizen::Ui::Controls::Form
45         , public Tizen::Ui::IActionEventListener
46         , public Tizen::App::IAppControlResponseListener
47         , public Tizen::Ui::Controls::IFormBackEventListener
48         , public Tizen::Ui::IOrientationEventListener
49         , public Tizen::Ui::Scenes::ISceneEventListener
50         , public Tizen::Ui::IWindowEventListener
51         , public Tizen::Base::Runtime::ITimerEventListener
52         , public Tizen::Ui::Controls::IGroupedListViewItemEventListener
53         , public IAppStateChangeListener
54         , public ICalllogChangeListener
55         , public ICallLogViewByPopupListener
56         , public Tizen::Ui::Controls::IFormMenuEventListener
57         , public Tizen::Ui::IPropagatedKeyEventListener
58         , public Tizen::System::ISettingEventListener
59 {
60
61 // Construction
62 public:
63         ///DlLogsDetailForm constructor
64         DlLogsDetailForm(void);
65
66         ///DlLogsDetailForm destructor
67         virtual ~DlLogsDetailForm(void);
68
69         ///Initializes the DlLogsDetailForm form
70         /*
71          * @param: Whether Initialize is success or not
72          */
73         bool Initialize();
74
75         ///This functions gets called during form OnInitializing
76         /*
77          * @param: result
78          */
79         result OnInitializing(void);
80
81         ///This functions gets called during form terminating
82         /*
83          * @param: result
84          */
85         result OnTerminating(void);
86
87         ///IActionEventListener
88         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
89
90         ///IFormBackEventListener method
91         virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
92
93         void SetFormMode(bool mode);
94
95         void SetAllListItems(bool checked);
96
97         void UnCheckAllItems(void);
98
99         void GetUpdatedListFromDatabase();
100
101         bool DeleteSelectedCalllog(void);
102
103         /// IGroupedListViewItemEventListener
104         virtual void OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus state){}
105         virtual void OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus state);
106         virtual void OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction){}
107
108         ///ISceneEventListener
109         virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
110         ///ISceneEventListener
111         virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
112         void UpdateForm(void);
113         /**
114          * Called when the application control is completed.
115          */
116         virtual void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
117         //IPropagatedKeyEventListener
118         virtual bool OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo);
119         virtual bool OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo){ return false; }
120         virtual bool OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo){ return false; }
121         virtual bool OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo){ return false; }
122         virtual bool TranslateKeyEventInfo(Control& source, KeyEventInfo& keyEventInfo) { return false; }
123
124         void ShowDeletePopup(void);
125         void HideDeletePopup(void);
126         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer &timer);
127         virtual void OnWindowActivated(const Tizen::Ui::Window &source);
128         virtual void OnWindowDeactivated(const Tizen::Ui::Window &source){}
129         result RemoveLogsList();
130
131         //Called when App comes to foreground
132         virtual void OnForeground(void);
133         //Called when App goes to background
134         virtual void OnBackground(void);
135
136         void SetListItemSelectStatus(bool status);
137         //Called when callog list changes
138         virtual void OnCalllogChanged(void);
139
140         void StoreItemselection(int groupIndex, int itemIndex, int elementId, ListItemStatus state);
141         void ManageItemSelection(void);
142         bool IsScecneVisible();
143         void SetSceneVisible(bool sceneMode);
144         void ShowBlockPopup(void);\r
145         //Used to show error message box
146         void ShowDuplicateErrorMessageBox(Tizen::Base::String& message);
147         void ShowInvalidMessageNumberMessageBox(Tizen::Base::String& message);
148         void ShowInvalidNumberMessageBox(String& number);
149         //Handles userevents
150         virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
151         //From IPopupEventListener
152         void OnItemSelected();
153         void ViewContactDetail(void);
154         //void ShowContextMenu();
155         ///IOrientationEventListener
156         virtual void OnOrientationChanged(const Control& source, Tizen::Ui::OrientationStatus orientationStatus);
157         //ISettingEventListener
158         virtual void OnSettingChanged(Tizen::Base::String& key);
159         //IFormMenuEventListener
160         virtual void OnFormMenuRequested(Tizen::Ui::Controls::Form& source);
161         void ShowOptionsMenu();
162         void ManageUserDetail();
163         void GetTextWidthHeight(String str, float fontSize, float *width, float *height);
164
165         bool IsValidMessageNumber(const String& phoneNumber);
166         bool IsValidCallNumber(const String& phoneNumber);
167         void ShowDeleteConfirmationPopup();
168 private:
169         ///Call button
170         Tizen::Ui::Controls::Button* __pButtonCall;
171
172         ///Message button
173         Tizen::Ui::Controls::Button* __pButtonMessage;
174
175         ///Contact Image
176         Tizen::Ui::Controls::Button* __pButtonContactImage;
177
178         ///Contact name
179         Tizen::Ui::Controls::Panel* __pPanelName;
180         Tizen::Ui::Controls::Panel* __pPanelNumberUnsaved;
181
182         ///Contact number
183         Tizen::Ui::Controls::Label* __pLabelNumber;
184         Tizen::Ui::Controls::Label* __pLabelBlocked;
185
186         ///Form footer
187         Tizen::Ui::Controls::Footer* __pFormFooter;
188
189         ///More option footer item
190         Tizen::Ui::Controls::ButtonItem __footerItemMore;
191
192         ///Delete footer item
193         Tizen::Ui::Controls::FooterItem __pFooterItemDelete;
194
195         ///Grouped list view
196         Tizen::Ui::Controls::GroupedListView* __pList;
197
198         Tizen::Ui::Controls::CheckButton*       __pSelectAll;
199
200         //Selected pop up label
201         Tizen::Ui::Controls::Label* __pSelectedLabel;
202
203         LogsDetailItemProvider* __pDataProvider;
204
205         //Used only when device has HardWare key
206         Tizen::Ui::Controls::OptionMenu* __pOptionMenu;
207
208         ///List view height
209         int __listHeight;
210
211         ///form mode
212         bool __isEditMode;
213
214         bool __isSelectAll;
215         bool __isPresentInContacts;
216
217         int __listItemCount;
218         int __selectedItemCount;
219         Tizen::Base::Collection::ArrayListT<CallLogDetails>* __calllogListByNum;
220         CalLogPresentationModel* __pLogPresentor;
221         int __calllogCount;
222         Tizen::Base::String __number;
223         bool __isMsgAppControlLaunched;
224         bool __isCallAppControlLaunched;
225
226
227         Tizen::Base::Runtime::Timer __deleteLogsTimer;
228         Tizen::Ui::Controls::Popup* __pDeletePopup;
229         Tizen::Ui::Controls::Popup* __pConfirmationDeletePopup;
230
231         int __deleteGroupIndex;
232         int __deleteItemIndex;
233
234         Tizen::Base::Collection::ArrayList* __pCallLogId;
235         CallLogViewByPopup* __pLogsBlockPopup;\r
236         bool __isSceneVisible;
237         bool __isContactAppControlLaunched;
238         bool __isCallBeRejected;
239         bool __isMsgBeRejected;
240         Tizen::Base::String __contactName;
241         bool __isDeleteInProgress;
242 };
243
244 #endif /*_PHN_LOGS_DETAIL_FORM_H_*/