2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.tizenopensource.org/license
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.
18 #include "FormManager.h"
19 #include "SettingInfoForm.h"
20 #include "CustomListElement.h"
22 using namespace Osp::Base;
23 using namespace Osp::Ui;
24 using namespace Osp::Ui::Controls;
25 using namespace Osp::System;
26 using namespace Osp::Graphics;
28 const int NumberOfSettingElement = 21;
30 SettingInfoForm::SettingInfoForm(void)
31 : __pSlidableListSettingInfo(null)
39 SettingInfoForm::~SettingInfoForm(void)
45 SettingInfoForm::Initialize()
47 Construct(L"IDF_SETTING_INFO_FORM");
48 SetName(String(L"SettingInfoForm"));
49 SettingInfo::SetSettingEventListener((ISettingEventListener*) this);
51 __pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL_SETTING_INFO"));
52 __pListView = new ListView();
53 __pListView->Construct(Rectangle(0, 70, GetClientAreaBounds().width, GetClientAreaBounds().height - 80), true, false);
54 __pListView->SetItemProvider(*this);
55 __pListView->AddListViewItemEventListener(*this);
57 listElements.Construct(NumberOfSettingElement);
59 AddControl(*__pListView);
65 SettingInfoForm::OnInitializing(void)
69 Footer* pFooter = GetFooter();
70 FormManager::MakeSystemAppFooter(this, pFooter, FormManager::REQUEST_FORM_SETTING_INFO);
76 SettingInfoForm::OnTerminating(void)
84 SettingInfoForm::OnActionPerformed(const Osp::Ui::Control& source, int actionId)
90 Frame *pFrame = Osp::App::Application::GetInstance()->GetAppFrame()->GetFrame();
91 FormManager* pFormManager = static_cast<FormManager*>(pFrame->GetControl(String(L"FormManager")));
92 if (pFormManager != null)
94 pFormManager->SendUserEvent(static_cast<RequestId>(actionId), null);
98 AppLog("FormManager getting has failed.");
108 SettingInfoForm::OnSettingChanged(Osp::Base::String& key)
113 __pLabel->SetText(szEvent);
114 __pListView->UpdateList();
122 SettingInfoForm::OnListViewContextItemStateChanged(Osp::Ui::Controls::ListView& listView,
125 Osp::Ui::Controls::ListContextItemStatus state)
130 SettingInfoForm::OnListViewItemStateChanged(Osp::Ui::Controls::ListView& listView,
133 Osp::Ui::Controls::ListItemStatus status)
138 SettingInfoForm::OnListViewItemSwept(Osp::Ui::Controls::ListView& listView,
140 Osp::Ui::Controls::SweepDirection direction)
144 Osp::Ui::Controls::ListItemBase*
145 SettingInfoForm::CreateItem(int index, int itemWidth)
147 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
148 CustomItem* pItem = new CustomItem();
151 String szDescription;
154 CustomListElement* pCustomListElement;
155 pItem->Construct(Osp::Graphics::Dimension(itemWidth, 100), style);
162 szTitle = "24HourFormatSelected";
163 SettingInfo::GetValue(szTitle, bResult);
165 szDescription = "Enabled";
167 szDescription = "Disabled";
175 SettingInfo::GetValue(szTitle, szDescription);
181 szTitle = "DataRoamingEnabled";
182 SettingInfo::GetValue(szTitle, bResult);
184 szDescription = "Enabled";
186 szDescription = "Disabled";
192 szTitle = "GPSEnabled";
193 SettingInfo::GetValue(szTitle, bResult);
195 szDescription = "Enabled";
197 szDescription = "Disabled";
203 szTitle = "Language";
204 SettingInfo::GetValue(szTitle, szDescription);
210 szTitle = "PacketServiceAllowed";
211 SettingInfo::GetValue(szTitle, bResult);
213 szDescription = "Enabled";
215 szDescription = "Disabled";
221 szTitle = "SilentMode";
222 SettingInfo::GetValue(szTitle, bResult);
224 szDescription = "Enabled";
226 szDescription = "Disabled";
232 szTitle = "TouchVibrationLevel";
233 SettingInfo::GetValue(szTitle, nResult);
235 szDescription.Append(nResult);
241 szTitle = "WPSEnabled";
242 SettingInfo::GetValue(szTitle, bResult);
244 szDescription = "Enabled";
246 szDescription = "Disabled";
252 szTitle = "FlightModeEnabled";
253 SettingInfo::GetValue(szTitle, bResult);
255 szDescription = "Enabled";
257 szDescription = "Disabled";
263 szTitle = "FontType";
264 SettingInfo::GetValue(szTitle, szDescription);
270 szTitle = "FontSize";
271 SettingInfo::GetValue(szTitle, szDescription);
278 SettingInfo::GetValue(szTitle, szDescription);
284 szTitle = "MediaSoundVolume";
285 SettingInfo::GetValue(szTitle, nResult);
287 szDescription.Append(nResult);
293 szTitle = "NotificationSoundVolume";
294 SettingInfo::GetValue(szTitle, nResult);
296 szDescription.Append(nResult);
302 szTitle = "Ringtone";
303 SettingInfo::GetValue(szTitle, szDescription);
309 szTitle = "RingtoneSoundVolume";
310 SettingInfo::GetValue(szTitle, nResult);
312 szDescription.Append(nResult);
318 szTitle = "SystemSoundVolume";
319 SettingInfo::GetValue(szTitle, nResult);
321 szDescription.Append(nResult);
327 szTitle = "Wallpaper";
328 SettingInfo::GetValue(szTitle, szDescription);
334 szTitle = "TimeFormat";
335 SettingInfo::GetValue(szTitle, szDescription);
341 szTitle = "DateFormat";
342 SettingInfo::GetValue(szTitle, szDescription);
343 szTitle = "DateFormat (Setting menu)";
344 if (szDescription == "dd MMM. yyyy" || szDescription == "dd/MM/yyyy" || szDescription == "d MMM. yyyy"
345 || szDescription == "dd.MM.yyyy")
346 szDescription.Append(" (DD/MM/YYYY)");
347 else if (szDescription == "MMM. d yyyy" || szDescription == "MM/dd/yyyy" || szDescription == "MM.dd.yyyy"
348 || szDescription == "MMM. dd yyyy")
349 szDescription.Append(" (MM/DD/YYYY)");
350 else if (szDescription == "yyyy/dd/MM" || szDescription == "yyyy d MMM." || szDescription == "yyyy.dd.MM"
351 || szDescription == "yyyy.MM.dd")
352 szDescription.Append(" (YYYY/DD/MM)");
353 else if (szDescription == "yyyy/MM/dd" || szDescription == "yyyy MMM. d" || szDescription == "yyyy.MM.dd"
354 || szDescription == "yyyy MMM. dd")
355 szDescription.Append(" (YYYY/MM/DD)");
363 listElements.RemoveAt(index, true);
365 pCustomListElement = new CustomListElement();
366 pCustomListElement->SetTitleDescription(szTitle, szDescription);
367 listElements.InsertAt(*((Object*) pCustomListElement), index);
368 pItem->AddElement(Rectangle(0, 0, GetClientAreaBounds().width, height), ID_FORMAT_CUSTOM, *(static_cast<ICustomElement*>(pCustomListElement)));
374 SettingInfoForm::DeleteItem(int index, Osp::Ui::Controls::ListItemBase* pItem, int itemWidth)
376 listElements.RemoveAt(index, true);
385 SettingInfoForm::GetItemCount(void)
387 return NumberOfSettingElement;