3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
5 * This file is part of msg-service.
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 * Sangkoo Kim <sangkoo.kim@samsung.com>
9 * Seunghwan Lee <sh.cat.lee@samsung.com>
10 * SoonMin Jung <sm0415.jung@samsung.com>
11 * Jae-Young Lee <jy4710.lee@samsung.com>
12 * KeeBum Kim <keebum.kim@samsung.com>
14 * PROPRIETARY/CONFIDENTIAL
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
36 #include "MsgUtilStorage.h"
37 #include "MsgGconfWrapper.h"
40 /*==================================================================================================
42 ==================================================================================================*/
43 #define MSG_UNREAD_CNT "db/badge/org.tizen.message"
46 /*==================================================================================================
47 FUNCTION IMPLEMENTATION
48 ==================================================================================================*/
49 MSG_ERROR_T MsgSettingSetString(const char *pKey, const char *pSetValue)
51 if (pKey == NULL || pSetValue == NULL)
53 MSG_DEBUG("IN Parameter is NULL");
54 return MSG_ERR_NULL_POINTER;
57 if (vconf_set_str(pKey, pSetValue) != 0)
58 return MSG_ERR_SET_SETTING;
64 MSG_ERROR_T MsgSettingSetInt(const char *pKey, int nSetValue)
68 MSG_DEBUG("IN Parameter is NULL");
69 return MSG_ERR_NULL_POINTER;
72 if (vconf_set_int(pKey, nSetValue) != 0)
73 return MSG_ERR_SET_SETTING;
79 MSG_ERROR_T MsgSettingSetBool(const char *pKey, bool bSetValue)
83 MSG_DEBUG("IN Parameter is NULL");
84 return MSG_ERR_NULL_POINTER;
87 if (vconf_set_bool(pKey, bSetValue) != 0)
88 return MSG_ERR_SET_SETTING;
94 char* MsgSettingGetString(const char *pKey)
98 MSG_DEBUG("IN Parameter is NULL");
102 return vconf_get_str(pKey);
106 int MsgSettingGetInt(const char *pKey)
110 MSG_DEBUG("IN Parameter is NULL");
116 if (vconf_get_int(pKey, &retVal) < 0)
123 int MsgSettingGetBool(const char *pKey, bool *pVal)
127 MSG_DEBUG("IN Parameter is NULL");
131 int retVal = 0, param = 0;
133 if (vconf_get_bool(pKey, ¶m) < 0)
142 MSG_ERROR_T MsgSettingHandleNewMsg(int SmsCnt, int MmsCnt)
146 MSG_DEBUG("smsCnt = %d, mmsCnt = %d ##", SmsCnt, MmsCnt);
148 // Set Msg Count into VConf
149 if (MsgSettingSetIndicator(SmsCnt, MmsCnt) != MSG_SUCCESS)
151 MSG_DEBUG("MsgSettingSetIndicator() FAILED");
152 return MSG_ERR_SET_SETTING;
155 if (SmsCnt == 0 && MmsCnt == 0)
157 MSG_DEBUG("No New Message.");
161 MSG_DEBUG("New Message.");
162 pm_change_state(LCD_NORMAL);
171 MSG_ERROR_T MsgSettingSetIndicator(int SmsCnt, int MmsCnt)
174 if (MsgSettingSetInt(VCONFKEY_MESSAGE_RECV_SMS_STATE, SmsCnt) != 0)
175 return MSG_ERR_SET_SETTING;
176 if (MsgSettingSetInt(VCONFKEY_MESSAGE_RECV_MMS_STATE, MmsCnt) != 0)
177 return MSG_ERR_SET_SETTING;
179 int sumCnt = SmsCnt + MmsCnt;
181 if (MsgSettingSetInt(MSG_UNREAD_CNT, sumCnt) != 0)
182 return MSG_ERR_SET_SETTING;