/* * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include #include "CtListDataGroup.h" #include "ContactsDebug.h" #include "CtString.h" using namespace std; CtListDataGroup::CtListDataGroup(contacts_record_h record) { __initialize(); __setDataFromRecord(record); } CtListDataGroup::CtListDataGroup() { } CtListDataGroup::~CtListDataGroup() { if (__name) free(__name); } const char* CtListDataGroup::getName(void) { if (SAFE_STRCMP(__name, "System Group: My Contacts") == 0) { if (__name) free(__name); __name = strdup(V_("IDS_PB_BODY_MY_CONTACTS")); } else if (SAFE_STRCMP(__name, "System Group: Friends") == 0) { if (__name) free(__name); __name = strdup(V_("IDS_PB_BODY_DEFAULT_GROUP_FRIENDS")); } else if (SAFE_STRCMP(__name, "System Group: Family") == 0) { if (__name) free(__name); __name = strdup(V_("IDS_PB_BODY_DEFAULT_GROUP_FAMILY")); } else if (SAFE_STRCMP(__name, "System Group: Coworkers") == 0) { if (__name) free(__name); __name = strdup(V_("IDS_PB_BODY_CO_WORKERS")); } return __name; } void CtListDataGroup::__initialize(void) { __name = NULL; } void CtListDataGroup::__setDataFromRecord(contacts_record_h record) { int err = CONTACTS_ERROR_NONE; const char* uri = NULL; contacts_record_get_uri_p(record, &uri); if(strcmp(uri, _contacts_group_relation._uri) != 0) { WERROR("INVALID uri!!! uri is not _contacts_group._uri !!!"); } err = contacts_record_get_str(record, _contacts_group_relation.name, &__name); WPWARN(CONTACTS_ERROR_NONE != err, "contacts_record_get_str() Failed(%d)", err); }