diff options
Diffstat (limited to 'lib/dialer/Search/ContactLogRecord.cpp')
-rw-r--r-- | lib/dialer/Search/ContactLogRecord.cpp | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/lib/dialer/Search/ContactLogRecord.cpp b/lib/dialer/Search/ContactLogRecord.cpp deleted file mode 100644 index d2d70a1..0000000 --- a/lib/dialer/Search/ContactLogRecord.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2012-2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - * - * 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 "Search/ContactLogRecord.h" - -#include "phone.h" -#include "phone-common.h" -#include "Database/Database.h" - -namespace Phone -{ - namespace Dialer - { - namespace Search - { - using Database::Database; - - ContactLogRecord::ContactLogRecord() - { - PH_TRACE; - } - - ContactLogRecord::ContactLogRecord(const ContactLogRecord &other) - : ContactData(other) - { - PH_TRACE; - } - - bool ContactLogRecord::initialize(int id) - { - PH_TRACE; - contacts_query_h query = NULL; - contacts_filter_h filter = NULL; - contacts_list_h list = NULL; - contacts_record_h record = NULL; - unsigned ids[] = { - _contacts_person_phone_log.person_id, - _contacts_person_phone_log.address, - }; - - bool success = Database::isSuccess( - contacts_filter_create(_contacts_person_phone_log._uri, &filter)) - && Database::isSuccess( - contacts_filter_add_int(filter, _contacts_person_phone_log.log_id, CONTACTS_MATCH_EQUAL, id)) - && Database::isSuccess( - contacts_query_create(_contacts_person_phone_log._uri, &query)) - && Database::isSuccess( - contacts_query_set_filter(query, filter)) - && Database::isSuccess( - contacts_query_set_projection(query, ids, sizeof(ids) / sizeof(*ids))) - && Database::isSuccess( - contacts_db_get_records_with_query(query, 0, 0, &list)) - && Database::isSuccess( - contacts_list_get_current_record_p(list, &record)) - && initialize(record); - - if(filter) - { - contacts_filter_destroy(filter); - } - - if(query) - { - contacts_query_destroy(query); - } - - if(list) - { - contacts_list_destroy(list, true); - } - - return success; - } - - bool ContactLogRecord::initialize(contacts_record_h record) - { - PH_TRACE; - char *number = NULL; - int id = 0; - - bool success = Database::isSuccess( - contacts_record_get_str_p(record, _contacts_person_phone_log.address, &number)) - && Database::isSuccess( - contacts_record_get_int(record, _contacts_person_phone_log.person_id, &id)); - - if(success) - { - m_Number.clear(); - if(number) - { - m_Number = number; - } - m_PersonId = id; - } - - return success; - } - - int ContactLogRecord::getPersonId() const - { - return m_PersonId; - } - - ContactLogRecord & ContactLogRecord::operator=(const ContactLogRecord &other) - { - PH_TRACE; - ContactData::operator=(other); - return *this; - } - } - } -} |