Initialize Tizen 2.3
[apps/osp/Dial.git] / inc / PhnTabLogs.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                PhnTabLogs.h
19  * @brief               This is the header file for the %DialTabLogs class.
20  *
21  * This header file contains the declarations for %DialTabLogs class.
22  */
23 #ifndef _PHN_TAB_LOGS_H_
24 #define _PHN_TAB_LOGS_H_
25
26 #include <FBase.h>
27 #include <FSocial.h>
28 #include <FSysSettingInfo.h>
29 #include <FUi.h>
30 #include "PhnTabLogsItemProvider.h"
31 #include "PhnICalllogChangeListener.h"
32 #include "PhnCallLogPresentationModel.h"
33 #include "PhnIAppStateChangeListner.h"
34 #include "PhnCallLogViewByPopup.h"
35 #include "PhnICallLogViewByPopupListener.h"
36 //#include "calllog.h"
37
38 class CallLogDetails;
39 class CallLogManager;
40
41 /**
42  * @class DialTabLogs
43  * @brief This class provides tab based UI for Call Log.
44  *
45  */
46 class DialTabLogs
47         : public Tizen::Ui::Controls::Panel
48         , public Tizen::Ui::Scenes::ISceneEventListener
49         , public Tizen::Ui::Controls::IGroupedListViewItemEventListener
50         , public Tizen::Ui::IActionEventListener
51         , public ICalllogChangeListener
52         , public Tizen::Ui::IWindowEventListener
53         , public Tizen::Ui::IOrientationEventListener
54         , public Tizen::Base::Runtime::ITimerEventListener
55         , public Tizen::Social::IAddressbookChangeEventListener
56         , public IAppStateChangeListener
57         , public ICallLogViewByPopupListener
58         , public Tizen::Ui::IPropagatedKeyEventListener
59         , public Tizen::System::ISettingEventListener
60 {
61 public:
62         ///DialTabLogs constructor
63         DialTabLogs(void);
64
65         ///DialTabLogs destructor
66         virtual ~DialTabLogs(void);
67
68         ///Initializes the DialTabLogs form
69         /*
70          * @param: Whether Initialize is success or not
71          */
72         bool Initialize(void);
73
74         ///This functions gets called during form OnInitializing
75         /*
76          * @param: result
77          */
78         virtual result OnInitializing(void);
79
80         ///This functions gets called during form terminating
81         /*
82          * @param: result
83          */
84         virtual result OnTerminating(void);
85
86         void SetCallLogDisplayMode(bool isEdit);
87
88         void UnCheckAllItems(void);
89
90         ///IActionEventListener
91         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
92         ///ISceneEventListener
93         virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
94
95         ///ISceneEventListener
96         virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
97
98         /// IGroupedListViewItemEventListener
99         virtual void OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
100         /// IGroupedListViewItemEventListener
101         virtual void OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus state);
102         /// IGroupedListViewItemEventListener
103         virtual void OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction);
104         /// ICalllogChangeListener
105         virtual void OnCalllogChanged(void);
106
107         void SetListItemSelectStatus(bool status);
108
109         void DeleteSelectedCalllog(void);
110
111         void ShowDeletePopup(void);
112         void HideDeletePopup(void);
113         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer &timer);
114         virtual void OnWindowActivated(const Tizen::Ui::Window &source);
115         virtual void OnWindowDeactivated(const Tizen::Ui::Window &source){}
116         result RemoveLogsList(void);
117         //Handles userevents
118         virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
119
120         //Called when App comes to foreground
121         virtual void OnForeground(void);
122         //Called when App goes to background
123         virtual void OnBackground(void);
124
125         void StoreItemselection(int groupIndex, int itemIndex, int elementId, ListItemStatus state);
126         void ManageItemSelection(void);
127         bool IsScecneVisible();
128         void SetSceneVisible(bool sceneMode);
129         void ShowLogsViewByPopup(void);
130
131         //From IPopupEventListener
132         void OnItemSelected();
133         void ShowContextMenu();
134         ///IOrientationEventListener
135         virtual void OnOrientationChanged(const Control& source, Tizen::Ui::OrientationStatus orientationStatus);
136         //From IAddressbookEventListener
137         virtual void OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList);
138         virtual void OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList){};
139         void UpdateCallLogList(void);
140         //ISettingEventListener
141         virtual void OnSettingChanged(Tizen::Base::String& key);
142         void ShowOptionsMenu();
143         void CancelDelete();
144         void HandleFormBackRequest();
145         void ShowDeleteConfirmationPopup(int deleteCommandIdYes);
146
147         //IPropagatedKeyEventListener
148         virtual bool OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo);
149         virtual bool OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo){ return false; }
150         virtual bool OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo){ return false; }
151         virtual bool OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo){ return false; }
152         virtual bool TranslateKeyEventInfo(Control& source, KeyEventInfo& keyEventInfo) { return false; }
153
154 private:
155         //used to handle 'IDA_CHECKBUTTON_SELECT_ALL'
156         void HandleAllItemSelection(void);
157
158 protected:
159         //static const int IDA_FOOTER_LOG_MORE = 103;
160         static const int IDA_CONTEXTMENU_VIEWBY = 104;
161         static const int IDA_FOOTER_LOG_DELETE = 105;
162         static const int IDA_FOOTER_LOG_CANCEL = 106;
163         static const int IDA_CHECKBUTTON_SELECT_ALL = 108;
164         static const int IDA_CHECKBUTTON_UNSELECT_ALL = 109;
165         static const int IDA_POPUP_DELETE_CANCEL = 110;
166         static const int IDA_POPUP_DELETE_YES = 111;
167         static const int IDA_POPUP_DELETE_NO = 112;
168         static const int IDA_POPUP_DELETEALL_YES = 113;
169
170 private:
171         ///Form Footer
172         Tizen::Ui::Controls::Footer* __pFormFooter;
173
174         ///More option footer item
175         Tizen::Ui::Controls::ButtonItem __footerItemMore;
176
177         ///Delete footer item
178         Tizen::Ui::Controls::FooterItem __footerItemDelete;
179
180         ///Grouped list view
181         Tizen::Ui::Controls::GroupedListView* __plogsListView;
182
183         ///Grouped list view
184         Tizen::Ui::Controls::CheckButton* __pButtonSelectAll;
185
186         //Selected pop up label
187         Tizen::Ui::Controls::Label* __pSelectedLabel;
188
189         //Used only when device has HardWare key
190         Tizen::Ui::Controls::OptionMenu* __pOptionMenu;
191
192         Tizen::Social::Addressbook* __pAddressbook;
193
194         ///Grouped list view item provider
195         CustomDataProvider* __pDataProvider;
196
197         CalLogPresentationModel* __pLogPresentor;
198         int __groupCount;
199         int __itemCount;
200         bool __isSelectAll;
201         int __selectedItemCount;
202         bool __isEditMode;
203         int calllogCount;
204         Tizen::Base::Collection::ArrayList* __pArgs;
205         Tizen::Base::Runtime::Timer __deleteLogsTimer;
206         Tizen::Ui::Controls::Popup* __pDeletePopup;
207         Tizen::Ui::Controls::Popup* __pConfirmationDeletePopup;
208         int __deleteGroupIndex;
209         int __deleteItemIndex;
210         Tizen::Base::Collection::ArrayList* __pCallLogId;
211         bool __isSceneVisible;
212         CallLogViewByPopup* __pLogsViewbyPopup;
213         bool __isMsgAppControlLaunched;
214         bool __isCallAppControlLaunched;
215         bool __isDeleteInProgress;
216         float __fontSize;
217         float __itemHeight;
218 };
219
220 #endif // _PHN_TAB_LOGS_H_