2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
18 * @file CtAccountListItemProvider.cpp
19 * @brief This is the implementation file for the AccountListItemProvider class.
22 #include "CtAccountListItemProvider.h"
23 #include "CtContactListPresentationModel.h"
25 using namespace Tizen::Base;
26 using namespace Tizen::Base::Collection;
27 using namespace Tizen::Graphics;
28 using namespace Tizen::Ui::Controls;
30 static const int H_ITEM = 112;
32 AccountListItemProvider::AccountListItemProvider(Tizen::Ui::Controls::ListView* pAccountListView, ContactListPresentationModel* pContactListPresentationModel)
33 : __pAccountListView(pAccountListView)
34 , __pContactListPresentationModel(pContactListPresentationModel)
38 AccountListItemProvider::~AccountListItemProvider(void)
42 Tizen::Ui::Controls::ListItemBase*
43 AccountListItemProvider::CreateItem(int index, int itemWidth)
45 SimpleItem* pItem = null;
46 String addressbookName(__pContactListPresentationModel->GetAddressbookName(index));
48 pItem = new (std::nothrow) SimpleItem();
49 pItem->Construct(Dimension(itemWidth, H_ITEM), LIST_ANNEX_STYLE_RADIO);
50 pItem->SetElement(addressbookName);
52 if (addressbookName.Equals(__pContactListPresentationModel->GetCurrentAddressbook()))
54 __pAccountListView->SetItemChecked(index, true);
61 AccountListItemProvider::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
70 AccountListItemProvider::GetItemCount(void)
72 return __pContactListPresentationModel->GetAddressbookCount();