2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (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 CalllogManager.h
19 * @brief This is the header file for the %CallLogManager class.
21 * This header file contains the declarations for %CallLogManager, %CallLogDetails, %LogListComparer class.
24 #ifndef _PHN_CALL_LOG_MANAGER_H_
25 #define _PHN_CALL_LOG_MANAGER_H_
30 #include "CallTypes.h"
31 #include "CallICalllogChangeListener.h"
33 using namespace Tizen::Social;
37 * @class LogListComparer
38 * @brief LogListComparer provides comparison functions used to
39 * sort an arraylist of CallLogDetails.
43 : public Tizen::Base::Collection::IComparerT<CallLogDetails>
47 virtual ~LogListComparer() {};
48 result Compare (const CallLogDetails& obj1, const CallLogDetails& obj2, int& cmp) const;
52 * @class CallLogDetails
53 * @brief CallLogDetails used to store information call logs.
57 : public Tizen::Base::Object
61 virtual ~CallLogDetails();
62 bool operator ==(const CallLogDetails& rhs) const;
63 bool operator !=(const CallLogDetails& rhs) const;
64 CallLogDetails& operator =(const CallLogDetails& rhs);
66 void SetCalllogDbId(int id);
67 int GetCalllogDbId(void);
68 void SetCalllogType(contacts_phone_log_type_e type);
69 CallLogType GetCalllogType(void);
70 void SetContactDbId(int id);
71 int GetContactDbId(void);
72 void SetFirstName(char* name);
73 char* GetFirstName(void);
74 void SetLastName(char* name);
75 char* GetLastName(void);
76 void SetDisplayName(char* name);
77 char* GetDisplayName(void);
78 void SetContactImagePath(char* path);
79 char* GetContactImagePath(void);
80 void SetPhoneNumber(char* number);
81 char* GetPhoneNumber(void);
82 void SetShortMessage(char* message);
83 char* GetShortMessage(void);
84 void SetStartTime(time_t time);
85 time_t GetStartTime(void);
86 void SetDuration(int duration);
87 int GetDuration(void);
88 void ConvertTimetoDateTime(void);
89 Tizen::Base::DateTime GetDateTime(void);
92 //TODO: Naming conventions to be followed.
93 //NOTE: Below fields are not owned.
94 int calllog_db_id; /**< Call log entry id */
95 CallLogType calllog_type; /**< Call log entry type */
96 int contact_db_id; /**< Contact's id in database */
97 char* first_name; /**< Contact's first name (also known as given name) */
98 char* last_name; /**< Contact's last name (also known as family name) */
99 char* display_name; /**< Display name (how contact's name should be presented) */
100 char* contact_image_path; /**< Path to image with contact's picture */
101 // contact_number_type_e phone_number_type; /**< Phone number type (i.e.: work, cell) */
102 char* phone_number; /**< Phone number */
103 char* short_message; /**< Short message for this log */
104 time_t startTime; /**< Timestamp of this change */
106 Tizen::Base::DateTime dateTime;
111 * @class CallLogManager
112 * @brief CallLogManager is a singleton class used to save and retrieve call log related data.
118 static CallLogManager* GetInstance(void);
121 CallLogManager(void);
122 virtual ~CallLogManager(void);
123 result Construct(void);
124 static void CreateInstance(void);
125 static void DestroyInstance(void);
126 unsigned long GetDuration(long long start_time);
127 int GetPersonId(Tizen::Base::String& personId);
129 result AddCallogInfoToDatabase(AppCallInfo* calllogInfo);
131 static CallLogManager* __pCallogManager;
132 Addressbook* pAddressBook;
136 #endif // _PHN_CALL_LOG_MANAGER_H_