extern long long all_apps_db_insert_shortcut(const char *appid, const char *name, int type, const char *content_info, const char *icon);
extern menu_screen_error_e all_apps_db_delete_shortcut(long long rowid);
+extern int all_apps_db_count_shortcut(const char *appid, const char *name);
#endif // __MENU_SCREEN_ALL_APPS_DB_H__
// End of file
"'%s', '%s', %d, '%s', '%s');"
#define QUERY_DELETE_SHORTCUT "DELETE FROM "SHORTCUT_TABLE" WHERE ROWID=%lld"
#define QUERY_GET_ALL "SELECT ROWID, appid, name, type, content_info, icon FROM "SHORTCUT_TABLE
+#define QUERY_COUNT_SHORTCUT "SELECT COUNT(*) FROM "SHORTCUT_TABLE" WHERE appid='%s' AND name='%s'"
+HAPI int all_apps_db_count_shortcut(const char *appid, const char *name)
+{
+ retv_if(MENU_SCREEN_ERROR_OK != db_open(MENU_SCREEN_DB_FILE), -1);
+
+ char q[QUERY_LEN];
+ snprintf(q, sizeof(q), QUERY_COUNT_SHORTCUT, appid, name);
+
+ stmt_h *st;
+ st = db_prepare(q);
+ retv_if(NULL == st, -1);
+
+ menu_screen_error_e ret = MENU_SCREEN_ERROR_FAIL;
+ ret = db_next(st);
+ retv_if(MENU_SCREEN_ERROR_FAIL == ret, -1);
+
+ int count = -1;
+ count = db_get_int(st, 0);
+
+ db_finalize(st);
+
+ return count;
+}
+
+
+
HAPI long long all_apps_db_insert_shortcut(const char *appid, const char *name, int type, const char *content_info, const char *icon)
{
char q[QUERY_LEN];
const char *icon,
int pid,
double period,
+ int allow_duplicate,
void *data)
{
Evas_Object *scroller = data;
_D("period : %.2f", period);
_D("CBDATA: %p", data);
+ if (!allow_duplicate) {
+ int count = 0;
+ count = all_apps_db_count_shortcut(pkgname, name);
+ if (0 < count) {
+ _D("There is already a package(%s:%s) in the Menu-screen", pkgname, name);
+ return -1;
+ }
+ }
+
long long rowid = -1l;
rowid = all_apps_db_insert_shortcut(pkgname, name, type, content_info, icon);
retv_if(0l > rowid, -1);