Tizen 2.0 Release
[apps/home/settings.git] / setting-network / src / setting-network-main-help.c
1 /*
2  * setting
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Flora License, Version 1.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://floralicense.org/license/
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an AS IS BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #include <setting-network-main-help.h>
18
19 #define SELECT_NETWORK "<b>1. Select network</b><br>"/*1. Select network*/\
20                         "User can select network operator which are supported in "\
21                         "current location. Even if you select specific network "\
22                         "operator in list, you may not use it, because your SIM card"\
23                         " is not verified with it.<br> -Recommend : Select automatic"
24
25 #define NETWORK_MODE "<b>2. Network mode</b><br>"/*2. Network mode*/\
26                         "Network mode list means possible network bands to be "\
27                         "attached. According to the condition of current network, "\
28                         "phone may be attached or not with user selection."\
29                         "<br> -Recommend : Select automatic"
30
31 #ifdef ENABLED_PREFERRED_NETWORKS
32 #define PERFER_NETWORKS "<b>3. Preferred networks</b><br>"/*3. Preferred networks*/\
33                         "User defined network list which is stored in SIM card. "\
34                         "If the phone couldn`t be registered with high priority "\
35                         "procedure, phone will try to register to network by using "\
36                         "user defined network list. The first record indicates the "\
37                         "highest priority and the last record indicates the lowest."
38
39 #define DATA_ROAMING  "<b>4. Data roaming setting</b><br>"/*4. Data roaming setting*/\
40                         "User can select data roaming availability. If user sets to "\
41                         "'OFF', user can not use data service when phone is registered "\
42                         "to roaming network (not home network) currently."
43 #else
44 #define PERFER_NETWORKS ""
45 #define DATA_ROAMING  "<b>3. Data roaming setting</b><br>"/*3. Data roaming setting*/\
46                         "User can select data roaming availability. If user sets to "\
47                         "'OFF', user can not use data service when phone is registered "\
48                         "to roaming network (not home network) currently."
49 #endif
50
51 static int setting_network_main_help_create(void *cb);
52 static int setting_network_main_help_destroy(void *cb);
53 static int setting_network_main_help_update(void *cb);
54 static int setting_network_main_help_cleanup(void *cb);
55
56 setting_view setting_view_network_main_help = {
57         .create = setting_network_main_help_create,
58         .destroy = setting_network_main_help_destroy,
59         .update = setting_network_main_help_update,
60         .cleanup = setting_network_main_help_cleanup,
61 };
62
63 /* ***************************************************
64  *
65  *basic func
66  *
67  ***************************************************/
68
69 static int setting_network_main_help_create(void *cb)
70 {
71         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
72         SETTING_TRACE_BEGIN;
73         SettingNetworkUG *ad = (SettingNetworkUG *) cb;
74
75         Evas_Object *genlist;
76         setting_push_layout_navi_bar_genlist(ad->win_main_layout,
77                                              ad->win_get,
78                                              _("IDS_COM_BODY_HELP"),
79                                              _("IDS_COM_BODY_BACK"),
80                                              NULL,
81                                              setting_network_main_help_click_back_cb,
82                                              NULL, ad, &genlist,
83                                              ad->navi_bar);
84
85         //SELECT_NETWORK
86         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
87                                          NULL,
88                                          ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X, NULL, NULL,
89                                          0, SELECT_NETWORK, NULL,
90                                          NULL);
91
92
93         //NETWORK_MODE
94         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
95                                          NULL,
96                                          ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X, NULL, NULL,
97                                          0, NETWORK_MODE, NULL,
98                                          NULL);
99
100
101         //PERFER_NETWORKS
102         #ifdef ENABLED_PREFERRED_NETWORKS
103         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
104                                          NULL,
105                                          ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X, NULL, NULL,
106                                          0, PERFER_NETWORKS, NULL,
107                                          NULL);
108         #endif
109
110         //DATA_ROAMING
111         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
112                                          NULL,
113                                          ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X, NULL, NULL,
114                                          0, DATA_ROAMING, NULL,
115                                          NULL);
116
117         setting_view_network_main_help.is_create = 1;
118         SETTING_TRACE_END;
119
120         return SETTING_RETURN_SUCCESS;
121 }
122
123 static int setting_network_main_help_destroy(void *cb)
124 {
125         SETTING_TRACE_BEGIN;
126         /* error check */
127         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
128
129         SettingNetworkUG *ad = (SettingNetworkUG *) cb;
130         elm_naviframe_item_pop(ad->navi_bar);
131         setting_view_network_main_help.is_create = 0;
132         return SETTING_RETURN_SUCCESS;
133 }
134
135 static int setting_network_main_help_update(void *cb)
136 {
137         SETTING_TRACE_BEGIN;
138         /* error check */
139         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
140         return SETTING_RETURN_SUCCESS;
141 }
142
143 static int setting_network_main_help_cleanup(void *cb)
144 {
145         SETTING_TRACE_BEGIN;
146         return setting_network_main_help_destroy(cb);
147 }
148
149 /* ***************************************************
150  *
151  *general func
152  *
153  ***************************************************/
154
155 /* ***************************************************
156  *
157  *call back func
158  *
159  ***************************************************/
160
161 static void
162 setting_network_main_help_click_back_cb(void *data, Evas_Object *obj,
163                                         void *event_info)
164 {
165         SETTING_TRACE_BEGIN;
166         /* error check */
167         retm_if(data == NULL, "Data parameter is NULL");
168
169         SettingNetworkUG *ad = (SettingNetworkUG *) data;
170         setting_view_change(&setting_view_network_main_help,
171                             &setting_view_network_main, ad);
172 }