Tizen 2.0 Release
[apps/osp/Phone.git] / inc / PhnTabDialer.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (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                PhnTabDialer.h
19  * @brief               This is the header file for the %DialTabDialer class.
20  *
21  * This header file contains the declarations for %DialTabDialer class.
22  */
23 #ifndef _PHN_TAB_DIALER_H_
24 #define _PHN_TAB_DIALER_H_
25
26 #include <FBase.h>
27 #include <FSocial.h>
28 #include <FUi.h>
29 #include "PhnSuggestionItemProvider.h"
30 #include "PhnDialPresentationModel.h"
31 #include "PhnErrorMsgPopup.h"
32 #include "PhnIAppStateChangeListner.h"
33
34 class CallPresentationModel;
35 class DialerKeypad;
36
37 /**
38  * @class DialTabDialer
39  * @brief This class provides tab based UI for Dialer.
40  *
41  */
42 class DialTabDialer
43         : public Tizen::Ui::Controls::Panel
44         , public Tizen::Ui::Scenes::ISceneEventListener
45         , public Tizen::Ui::IActionEventListener
46         , public Tizen::Ui::Controls::IListViewItemEventListener
47         , public IPopupClosedEventListener
48         , public Tizen::Ui::IOrientationEventListener
49         , public Tizen::Ui::ITouchLongPressGestureEventListener
50         , public Tizen::Social::IAddressbookEventListener
51         , public IAppStateChangeListener
52 {
53 public:
54         DialTabDialer(void);
55         virtual ~DialTabDialer(void);
56         bool Initialize(void);
57
58         virtual result OnInitializing(void);
59         virtual result OnTerminating(void);
60         //Used to show suggestions
61         void ShowSuggestionBox(Tizen::Base::String& name, Tizen::Base::String& mobileNo, Tizen::Base::String& resultCount);
62         //Used to hide search results.
63         void HideSearchBox(void);
64         //Used to check if dialer is opened from other screen or as first screen.
65         bool IsOpenedFromOtherView(void);
66         //Used to show "Add to Contacts" button
67         void ShowAddToContactsButton(void);
68         //Used to update search results.
69         void UpdateSearchResults(void);
70         //Called when App comes to foreground
71         virtual void OnForeground(void);
72         //Called when App goes to background
73         virtual void OnBackground(void);
74
75 protected:
76         void ShowFormattedText(Tizen::Ui::Controls::EditField* pEditField, int actionId);
77         //search box create, update and hide
78         void InitializeSearchBox(void);
79         //Used to initialize search list view
80         void InitializeSearchListView(void);
81         //Used to show search results in list view.
82         void ShowSearchListView(void);
83         //Used to hide search results list view.
84         void HideSearchListView(void);
85         //Used to initialize EditField for contacts.
86         void InitializeContactsTextBox(void);
87         //Used to contruct drop-down menu for search results.
88         void ConstructMenu(void);
89         //Used to construct dial keypad.
90         void ConstructKeypad(int dialerState);
91
92         //Used to prepare for MOCall and switch to outgoing call screen.
93         void SwitchToOutgoingCallScreen(const Tizen::Base::String& contactNumber);
94         //Used to switch back to previous active call screen.
95         void SwitchToPreviousActiveCallScreen(void);
96         //Used to add pause
97         void AddPause(void);
98         //Used to add pause
99         void AddWait(void);
100         //Used to add +
101         void AddPlus(void);
102         //Switch to Speed dial settings form.
103         void SwitchToSpeedDialForm(void);
104         //Used to get confirmation for assigning speed dial.
105         void ShowSpeedDialConfirmationPopup(void);
106         //Used to show context menu
107         void ShowContextMenu(Tizen::Base::String& contactNumber);
108         //Used to check if App is in foreground.
109         bool IsForeground();
110
111         void SetAppControlLaunched(bool launched);
112         bool GetAppControlLaunched(void);
113         virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
114         virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
115         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
116         //IListViewItemEventListener method
117         virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status){}
118         virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback){}
119         virtual void OnListViewItemReordered(Tizen::Ui::Controls::ListView& listView, int indexFrom, int indexTo){}
120         virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
121         virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction){}
122         virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
123
124         ///IOrientationEventListener
125         virtual void OnOrientationChanged(const Control& source, OrientationStatus orientationStatus);
126         //Event Listener method from IPopupClosedEventListener
127         virtual void HandlePopupClosed(void);
128         // Called from TouchLongPressGestureDetector when a long press gesture is detected.
129         virtual void OnLongPressGestureDetected(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector);
130         //Called from TouchLongPressGestureDetector when a long press detection is canceled.
131         virtual void OnLongPressGestureCanceled(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector){}
132         // Called by AddressBook to notify when contacts are changed.
133         virtual void OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList);
134         // Called by AddressBook to notify when categories are changed.
135         virtual void OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList) {};
136
137         enum ActionIds
138         {
139                 IDA_BTN_SHOW_CONTEXTMENU = 100,
140                 IDA_BTN_USE_CONTACT_DATA,
141                 IDA_BTN_DISPLAY_CONTACTS,
142                 IDA_BTN_ADD_TO_CONTACTS,
143                 IDA_MENU_SEND_MESSAGE,
144                 IDA_MENU_ADD_CONTACT,
145                 IDA_MENU_SPEED_DIAL,
146                 IDA_MENU_ADD_PAUSE,
147                 IDA_MENU_ADD_WAIT,
148                 IDA_MENU_EXIT,
149                 IDA_SPEEDDIAL_POPUP_YES,
150                 IDA_SPEEDDIAL_POPUP_NO,
151         };
152
153         //Button Dimensions
154         static const int IDI_BGBITMAP_WIDTH ;
155         static const int IDI_BGBITMAP_HEIGHT;
156         static const int IDI_BGBITMAP_POS_X;
157         static const int IDI_BGBITMAP_POS_Y;
158         static const int IDI_TEXT1_SIZE;
159         static const int IDI_TEXT2_SIZE;
160
161 private:
162         //Panel* __pSearchBox;
163         Tizen::Ui::Controls::ListView* __pSearchListView;
164         Tizen::Ui::Controls::ContextMenu* __pContextMenu;
165         SuggestionItemProvider* __pSuggestionListProvider;
166         //Ownership
167         ErrorMsgPopup* __pErrorMsgPopup;
168         bool __isSearchListOpened;
169         DialPresentationModel* __pDialPresentationModel;
170         CallPresentationModel* __pCallPresentor;
171         Tizen::Ui::Scenes::SceneId* __pPreviousSceneId;
172         DialerKeypad* __pDialKeypad;
173         Tizen::Ui::Controls::Popup* __pConfirmationPopup;
174         bool __isAppForeground;
175         Tizen::Social::Addressbook* __pAddressBook;
176         bool                                    __isAppControlLaunched;
177 };
178
179 #endif // _PHN_TAB_DIALER_H_