+++ /dev/null
-Jungki Kwak <jungki.kwak@samsung.com>\r
-/*\r
- * Copyright 2012 Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.1 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://floralicense.org/license/\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file download-manager-history-db.cpp\r
- * @author Jungki Kwak (jungki.kwak@samsung.com)\r
- * @brief Manager for a download history DB\r
- */\r
-\r
-#include <list>\r
-#include <string>\r
-#include <iostream>\r
-#include <memory>\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <glib.h>\r
-\r
-#include <sstream>\r
-//#include "download-manager-common.h"\r
-//#include "download-manager-history-db.h"\r
-#include "download-db-service-main.h"\r
-#include "download-db-service-debug.h"\r
-\r
-\r
-#define FINALIZE_ON_ERROR( stmt ) { \\r
- DM_LOGE("SQL error:%d[%s]", ret, sqlite3_errmsg(historyDb));\\r
- if (sqlite3_finalize(stmt) != SQLITE_OK)\\r
- DM_LOGE("sqlite3_finalize is failed");\\r
- closeDB();\\r
- return false; \\r
-}\r
-\r
-sqlite3 *DownloadHistoryDB::historyDb = NULL;\r
-\r
-DownloadHistoryDB::DownloadHistoryDB()\r
-{\r
-}\r
-\r
-DownloadHistoryDB::~DownloadHistoryDB()\r
-{\r
-}\r
-\r
-bool DownloadHistoryDB::openDB()\r
-{\r
- DM_LOGV("");\r
- int ret = 0;\r
- if (historyDb == NULL) {\r
- DM_LOGD("TRY to open [%s]", DBDATADIR"/"HISTORYDB);\r
- if (sqlite3_open_v2(DBDATADIR"/"HISTORYDB, &historyDb,\r
- SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK) {\r
- DM_LOGD("[ERROR][%s][%s]", DBDATADIR"/"HISTORYDB,\r
- sqlite3_errmsg(historyDb));\r
-\r
- int errorcode = sqlite3_errcode(historyDb);\r
- closeDB();\r
- if (errorcode == SQLITE_CORRUPT) {\r
- DM_LOGD("unlink [%s]", DBDATADIR"/"HISTORYDB);\r
- //unlink(DBDATADIR"/"HISTORYDB);\r
- errorcode = SQLITE_CANTOPEN;\r
- }\r
-\r
- if (errorcode == SQLITE_CANTOPEN) {\r
- DM_LOGD("Error :: CANTOPEN");\r
- int trycount = 0;\r
- while ((loadSqlSchema() == false) && (++trycount <= 3));\r
- if (trycount > 3)\r
- DM_LOGD("[ERROR] Could not restore DB");\r
- return isOpen();\r
- }\r
- return false;\r
- }\r
- ret = sqlite3_exec(historyDb, "PRAGMA journal_mode=PERSIST;", 0, 0, 0);\r
- if (SQLITE_OK != ret)\r
- return false;\r
- }\r
-\r
- return isOpen();\r
-}\r
-\r
-void DownloadHistoryDB::closeDB()\r
-{\r
- DM_LOGV("");\r
- if (historyDb) {\r
- sqlite3_close(historyDb);\r
- historyDb = NULL;\r
- }\r
-}\r
-\r
-bool DownloadHistoryDB::loadSqlSchema(void)\r
-{\r
- if (sqlite3_open_v2(DBDATADIR"/"HISTORYDB, &historyDb,\r
- SQLITE_OPEN_READWRITE |SQLITE_OPEN_CREATE, NULL) != SQLITE_OK) {\r
- DM_LOGD("[ERROR][%s][%s]", DBDATADIR"/"HISTORYDB,\r
- sqlite3_errmsg(historyDb));\r
- closeDB();\r
- return false;\r
- }\r
-\r
- char *error_msg = NULL;\r
- int ret = 0;\r
- ret = sqlite3_exec(historyDb, REBUILD_QUERY, 0, 0, &error_msg);\r
- if((error_msg != NULL) || (SQLITE_OK != ret)) {\r
- DM_LOGD("SQL error :: [%s]",error_msg);\r
- sqlite3_free(error_msg);\r
- error_msg = NULL;\r
- closeDB();\r
- return false;\r
- }\r
-\r
- ret = sqlite3_exec(historyDb, REBUILD_QUERY_INDEX, 0, 0, &error_msg);\r
- if((error_msg != NULL) || (SQLITE_OK != ret)) {\r
- DM_LOGD("SQL error :: [%s]",error_msg);\r
- sqlite3_free(error_msg);\r
- error_msg = NULL;\r
- }\r
- return true;\r
-}\r
-\r
-void DownloadHistoryDB::insert_request_cb(int request_id, data_control_h provider, bundle *insert_data)\r
-{\r
- char* command = data_control_provider_create_insert_statement(provider, insert_data);\r
-\r
- if (!openDB()) {\r
- DM_LOGE("NULL Check:historyDB");\r
- free(command);\r
- return ;\r
- }\r
-\r
- int ret = sqlite3_exec(historyDb, command, NULL, NULL, NULL);\r
-\r
- if (ret != SQLITE_OK) {\r
- data_control_provider_send_error(request_id, sqlite3_errmsg(historyDb));\r
- free(command);\r
- return;\r
- }\r
- DM_LOGI("[insert_request_cb] insert success");\r
-\r
- long long inserted_row_id = sqlite3_last_insert_rowid(historyDb);\r
- ret = data_control_provider_send_insert_result(request_id, inserted_row_id);\r
- if (ret != DATA_CONTROL_ERROR_NONE)\r
- DM_LOGE("insert_send_result failed with error: %d", ret);\r
- DM_LOGI("[insert_request_cb] send result success");\r
-\r
- free(command);\r
-}\r
-\r
-void DownloadHistoryDB::delete_request_cb(int request_id, data_control_h provider, const char *where)\r
-{\r
- DM_LOGI("[delete_request_cb] request_id(%d)", request_id);\r
-\r
- char* command = data_control_provider_create_delete_statement(provider, where);\r
-\r
- if (!openDB()) {\r
- DM_LOGE("NULL Check:historyDB");\r
- free(command);\r
- return ;\r
- }\r
-\r
- int ret = sqlite3_exec(historyDb, command, NULL, NULL, NULL);\r
- if (ret != SQLITE_OK) {\r
- data_control_provider_send_error(request_id, sqlite3_errmsg(historyDb));\r
- free(command);\r
- return;\r
- }\r
-\r
- ret = data_control_provider_send_delete_result(request_id);\r
- if (ret != DATA_CONTROL_ERROR_NONE)\r
- DM_LOGE("delete_send_result failed with error: %d", ret);\r
- DM_LOGI("[delete_request_cb] delete success");\r
-\r
- free(command);\r
-}\r
-\r
-void DownloadHistoryDB::select_request_cb(int request_id, data_control_h provider, const char **column_list,\r
- int column_count, const char *where, const char *order)\r
-{\r
- sqlite3_stmt* sql_stmt = NULL;\r
-\r
- char* command = data_control_provider_create_select_statement(provider, column_list,\r
- column_count, where, order);\r
-\r
- if (!openDB()) {\r
- DM_LOGE("NULL Check:historyDB");\r
- free(command);\r
- return ;\r
- }\r
-\r
- int ret = sqlite3_prepare_v2(historyDb, command, strlen(command), &sql_stmt, NULL);\r
- if (ret != SQLITE_OK) {\r
- data_control_provider_send_error(request_id, sqlite3_errmsg(historyDb));\r
- free(command);\r
- return;\r
- }\r
-\r
- ret = data_control_provider_send_select_result(request_id, (void *)sql_stmt);\r
- if (ret != DATA_CONTROL_ERROR_NONE)\r
- DM_LOGE("select_send_result failed with error: %d", ret);\r
- DM_LOGI("[select_request_cb] send result success");\r
-\r
- sqlite3_finalize(sql_stmt);\r
- free(command);\r
-}\r
-\r
-void DownloadHistoryDB::update_request_cb(int request_id, data_control_h provider, bundle *update_data, const char *where)\r
-{\r
- char* command = data_control_provider_create_update_statement(provider, update_data, where);\r
-\r
- if (!openDB()) {\r
- DM_LOGE("NULL Check:historyDB");\r
- free(command);\r
- return ;\r
- }\r
-\r
- int ret = sqlite3_exec(historyDb, command, NULL, NULL, NULL);\r
- if (ret != SQLITE_OK) {\r
- data_control_provider_send_error(request_id, sqlite3_errmsg(historyDb));\r
- free(command);\r
- return;\r
- }\r
-\r
- ret = data_control_provider_send_update_result(request_id);\r
- if (ret != DATA_CONTROL_ERROR_NONE)\r
- DM_LOGE("update_send_result failed with error: %d", ret);\r
- DM_LOGI("[update_request_cb] send result success");\r
-\r
- free(command);\r
-}\r
-\r
+/*
+ * Copyright 2012 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 <list>
+#include <string>
+#include <iostream>
+#include <memory>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+
+#include <sstream>
+//#include "download-manager-common.h"
+//#include "download-manager-history-db.h"
+#include "download-db-service-main.h"
+#include "download-db-service-debug.h"
+
+
+#define FINALIZE_ON_ERROR(stmt) { \
+ DM_LOGE("SQL error:%d[%s]", ret, sqlite3_errmsg(historyDb));\
+ if (sqlite3_finalize(stmt) != SQLITE_OK)\
+ DM_LOGE("sqlite3_finalize is failed");\
+ closeDB();\
+ return false; \
+}
+
+sqlite3 *DownloadHistoryDB::historyDb = NULL;
+
+DownloadHistoryDB::DownloadHistoryDB()
+{
+}
+
+DownloadHistoryDB::~DownloadHistoryDB()
+{
+}
+
+bool DownloadHistoryDB::openDB()
+{
+ DM_LOGV("");
+ int ret = 0;
+ if (historyDb == NULL) {
+ DM_LOGD("TRY to open [%s]", DBDATADIR"/"HISTORYDB);
+ if (sqlite3_open_v2(DBDATADIR"/"HISTORYDB, &historyDb,
+ SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK) {
+ DM_LOGD("[ERROR][%s][%s]", DBDATADIR"/"HISTORYDB,
+ sqlite3_errmsg(historyDb));
+
+ int errorcode = sqlite3_errcode(historyDb);
+ closeDB();
+ if (errorcode == SQLITE_CORRUPT) {
+ DM_LOGD("unlink [%s]", DBDATADIR"/"HISTORYDB);
+ //unlink(DBDATADIR"/"HISTORYDB);
+ errorcode = SQLITE_CANTOPEN;
+ }
+
+ if (errorcode == SQLITE_CANTOPEN) {
+ DM_LOGD("Error :: CANTOPEN");
+ int trycount = 0;
+ while ((loadSqlSchema() == false) && (++trycount <= 3));
+ if (trycount > 3)
+ DM_LOGD("[ERROR] Could not restore DB");
+ return isOpen();
+ }
+ return false;
+ }
+ ret = sqlite3_exec(historyDb, "PRAGMA journal_mode=PERSIST;", 0, 0, 0);
+ if (SQLITE_OK != ret)
+ return false;
+ }
+
+ return isOpen();
+}
+
+void DownloadHistoryDB::closeDB()
+{
+ DM_LOGV("");
+ if (historyDb) {
+ sqlite3_close(historyDb);
+ historyDb = NULL;
+ }
+}
+
+bool DownloadHistoryDB::loadSqlSchema(void)
+{
+ if (sqlite3_open_v2(DBDATADIR"/"HISTORYDB, &historyDb,
+ SQLITE_OPEN_READWRITE |SQLITE_OPEN_CREATE, NULL) != SQLITE_OK) {
+ DM_LOGD("[ERROR][%s][%s]", DBDATADIR"/"HISTORYDB,
+ sqlite3_errmsg(historyDb));
+ closeDB();
+ return false;
+ }
+
+ char *error_msg = NULL;
+ int ret = 0;
+ ret = sqlite3_exec(historyDb, REBUILD_QUERY, 0, 0, &error_msg);
+ if((error_msg != NULL) || (SQLITE_OK != ret)) {
+ DM_LOGD("SQL error :: [%s]", error_msg);
+ sqlite3_free(error_msg);
+ error_msg = NULL;
+ closeDB();
+ return false;
+ }
+
+ ret = sqlite3_exec(historyDb, REBUILD_QUERY_INDEX, 0, 0, &error_msg);
+ if((error_msg != NULL) || (SQLITE_OK != ret)) {
+ DM_LOGD("SQL error :: [%s]", error_msg);
+ sqlite3_free(error_msg);
+ error_msg = NULL;
+ }
+ return true;
+}
+
+void DownloadHistoryDB::insert_request_cb(int request_id, data_control_h provider, bundle *insert_data)
+{
+ char* command = data_control_provider_create_insert_statement(provider, insert_data);
+
+ if (!openDB()) {
+ DM_LOGE("NULL Check:historyDB");
+ free(command);
+ return ;
+ }
+
+ int ret = sqlite3_exec(historyDb, command, NULL, NULL, NULL);
+
+ if (ret != SQLITE_OK) {
+ data_control_provider_send_error(request_id, sqlite3_errmsg(historyDb));
+ free(command);
+ return;
+ }
+ DM_LOGI("[insert_request_cb] insert success");
+
+ long long inserted_row_id = sqlite3_last_insert_rowid(historyDb);
+ ret = data_control_provider_send_insert_result(request_id, inserted_row_id);
+ if (ret != DATA_CONTROL_ERROR_NONE)
+ DM_LOGE("insert_send_result failed with error: %d", ret);
+ DM_LOGI("[insert_request_cb] send result success");
+
+ free(command);
+}
+
+void DownloadHistoryDB::delete_request_cb(int request_id, data_control_h provider, const char *where)
+{
+ DM_LOGI("[delete_request_cb] request_id(%d)", request_id);
+
+ char* command = data_control_provider_create_delete_statement(provider, where);
+
+ if (!openDB()) {
+ DM_LOGE("NULL Check:historyDB");
+ free(command);
+ return ;
+ }
+
+ int ret = sqlite3_exec(historyDb, command, NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ data_control_provider_send_error(request_id, sqlite3_errmsg(historyDb));
+ free(command);
+ return;
+ }
+
+ ret = data_control_provider_send_delete_result(request_id);
+ if (ret != DATA_CONTROL_ERROR_NONE)
+ DM_LOGE("delete_send_result failed with error: %d", ret);
+ DM_LOGI("[delete_request_cb] delete success");
+
+ free(command);
+}
+
+void DownloadHistoryDB::select_request_cb(int request_id, data_control_h provider, const char **column_list,
+ int column_count, const char *where, const char *order)
+{
+ sqlite3_stmt* sql_stmt = NULL;
+
+ char* command = data_control_provider_create_select_statement(provider, column_list,
+ column_count, where, order);
+
+ if (!openDB()) {
+ DM_LOGE("NULL Check:historyDB");
+ free(command);
+ return ;
+ }
+
+ int ret = sqlite3_prepare_v2(historyDb, command, strlen(command), &sql_stmt, NULL);
+ if (ret != SQLITE_OK) {
+ data_control_provider_send_error(request_id, sqlite3_errmsg(historyDb));
+ free(command);
+ return;
+ }
+
+ ret = data_control_provider_send_select_result(request_id, (void *)sql_stmt);
+ if (ret != DATA_CONTROL_ERROR_NONE)
+ DM_LOGE("select_send_result failed with error: %d", ret);
+ DM_LOGI("[select_request_cb] send result success");
+
+ sqlite3_finalize(sql_stmt);
+ free(command);
+}
+
+void DownloadHistoryDB::update_request_cb(int request_id, data_control_h provider, bundle *update_data, const char *where)
+{
+ char* command = data_control_provider_create_update_statement(provider, update_data, where);
+
+ if (!openDB()) {
+ DM_LOGE("NULL Check:historyDB");
+ free(command);
+ return ;
+ }
+
+ int ret = sqlite3_exec(historyDb, command, NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ data_control_provider_send_error(request_id, sqlite3_errmsg(historyDb));
+ free(command);
+ return;
+ }
+
+ ret = data_control_provider_send_update_result(request_id);
+ if (ret != DATA_CONTROL_ERROR_NONE)
+ DM_LOGE("update_send_result failed with error: %d", ret);
+ DM_LOGI("[update_request_cb] send result success");
+
+ free(command);
+}
+
* limitations under the License.\r
*/\r
\r
-/**\r
- * @file main.cpp\r
- * @author Jungki Kwak (jungki.kwak@samsung.com)\r
- * @brief main file for download manager\r
- */\r
-\r
#include <list>\r
#include <string>\r
#include <iostream>\r
-/*\r
- * Copyright 2012 Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.1 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://floralicense.org/license/\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file download-manager-common.h\r
- * @author Jungki Kwak (jungki.kwak@samsung.com)\r
- * @brief Common define and data\r
- */\r
-\r
-#ifndef DOWNLOAD_DB_SERVICE_COMMON_H\r
-#define DOWNLOAD_DB_SERVICE_COMMON_H\r
-\r
-#include <libintl.h>\r
-#include "download-db-service-debug.h"\r
-#include <tzplatform_config.h>\r
-\r
-#define _EDJ(o) elm_layout_edje_get(o)\r
-#define __(s) dgettext(PROJ_NAME, s)\r
-#define S_(s) dgettext("sys_string", s)\r
-\r
-#define DM_LOCALEDIR LOCALEDIR\r
-#define DM_DOMAIN PROJ_NAME\r
-\r
-// Download Manager Common Strings.\r
-#define ERROR_POPUP_LOW_MEM_DEFAULT_PHONE_WITH_SD_CARD __("IDS_DM_BODY_THERE_IS_NOT_ENOUGH_SPACE_IN_YOUR_DEVICE_STORAGE_GO_TO_PS_SETTINGS_TO_FREE_UP_SOME_STORAGE_SPACE_THEN_TRY_AGAIN")\r
-#define ERROR_POPUP_LOW_MEM_DEFAULT_PHONE_WITHOUT_SD_CARD __("IDS_DM_BODY_THERE_IS_NOT_ENOUGH_SPACE_IN_YOUR_DEVICE_STORAGE_GO_TO_PS_SETTINGS_TO_DELETE_SOME_DATA_OR_INSERT_AN_SD_CARD")\r
-#define ERROR_POPUP_LOW_MEM_DEFAULT_MMC_WITH_NO_PHONE_MEMORY_AVAILABLE __("IDS_DM_BODY_THERE_IS_NOT_ENOUGH_SPACE_ON_YOUR_SD_CARD_GO_TO_PS_SETTINGS_TO_DELETE_SOME_DATA_THEN_TRY_AGAIN")\r
-#define ERROR_POPUP_LOW_MEM_DEFAULT_MMC_WITH_PHONE_MEMORY_AVAILABLE __("IDS_DM_BODY_THERE_IS_NOT_ENOUGH_SPACE_ON_YOUR_SD_CARD_GO_TO_PS_SETTINGS_TO_DELETE_SOME_DATA_OR_CHANGE_THE_DEFAULT_STORAGE_LOCATION_TO_DEVICE")\r
-\r
-#define DM_POP_TEXT_DOWNLOAD_COMPLETE __("IDS_DM_HEADER_DOWNLOAD_COMPLETE")\r
-#define DM_POP_TEXT_DOWNLOAD_FAILED __("IDS_DM_BODY_DOWNLOAD_FAILED_M_STATUS_ABB")\r
-#define DM_DOWNLOAD_COMPLETE_STRING_ID __("IDS_DM_HEADER_DOWNLOAD_COMPLETE")\r
-#define DM_DOWNLOAD_FAILED_STRING_ID __("IDS_DM_BODY_DOWNLOAD_FAILED_M_STATUS_ABB")\r
-\r
-#ifdef _TIZEN_2_3_UX\r
-#define DM_POP_TEXT_ERROR ""\r
-#define DM_BODY_TEXT_NO_NAME "No name"\r
-#define DM_BODY_TEXT_UNSUPPORTED_FILE_TYPE "Unsupported file type"\r
-#define DM_OPT_TEXT_DELETE __("IDS_DM_OPT_DELETE")\r
-#define DM_SK_TEXT_CANCEL __("IDS_DM_BUTTON_CANCEL_ABB2")\r
-#define DM_SK_TEXT_OK __("IDS_DM_BUTTON_OK_ABB")\r
-#define DM_BODY_TEXT_SELECT_ALL __("IDS_DM_MBODY_SELECT_ALL")\r
-#define DM_BODY_TEXT_PD_SELECTED __("IDS_DM_HEADER_PD_SELECTED_ABB3")\r
-#define DM_SK_TEXT_DOWNLOAD __("IDS_DM_BUTTON_DOWNLOAD_ABB2")\r
-#define DM_BODY_TEXT_TODAY __("IDS_DM_HEADER_TODAY")\r
-#define DM_BODY_TEXT_YESTERDAY __("IDS_DM_HEADER_YESTERDAY")\r
-#define DM_POP_TEXT_FAILED __("IDS_DM_BODY_DOWNLOAD_FAILED_M_STATUS_ABB")\r
-#define DM_HEADER_DOWNLOAD_MANAGER __("IDS_DM_HEADER_DOWNLOAD_MANAGER_ABB")\r
-#else\r
-#define DM_POP_TEXT_ERROR S_("IDS_COM_POP_ERROR")\r
-#define DM_BODY_TEXT_NO_NAME S_("IDS_COM_BODY_NO_NAME")\r
-#define DM_BODY_TEXT_UNSUPPORTED_FILE_TYPE S_("IDS_COM_BODY_UNSUPPORTED_FILE_TYPE")\r
-#define DM_OPT_TEXT_DELETE S_("IDS_COM_OPT_DELETE")\r
-#define DM_SK_TEXT_CANCEL S_("IDS_COM_SK_CANCEL")\r
-#define DM_SK_TEXT_OK S_("IDS_COM_SK_OK")\r
-#define DM_BODY_TEXT_SELECT_ALL S_("IDS_COM_BODY_SELECT_ALL")\r
-#define DM_BODY_TEXT_PD_SELECTED S_("IDS_COM_BODY_PD_SELECTED")\r
-#define DM_SK_TEXT_DOWNLOAD S_("IDS_COM_SK_DOWNLOAD")\r
-#define DM_BODY_TEXT_TODAY S_("IDS_COM_BODY_TODAY")\r
-#define DM_BODY_TEXT_YESTERDAY S_("IDS_COM_BODY_YESTERDAY")\r
-#define DM_POP_TEXT_FAILED S_("IDS_COM_POP_FAILED")\r
-#endif\r
-\r
-// Other defines\r
-#define MAX_FILE_PATH_LEN 256\r
-#define MAX_BUF_LEN 256\r
-#define LOAD_HISTORY_COUNT 500\r
-#define WAITING_RO_MAX_SECONDS 20\r
-\r
-#define KEY_MODE "mode"\r
-#define KEY_REQ_HTTP_HEADER_FIELD "req_http_header_field"\r
-#define KEY_REQ_HTTP_HEADER_VALUE "req_http_header_value"\r
-#define KEY_MODE_VALUE_VIEW "view"\r
-#define KEY_MODE_VALUE_SILENT "silent"\r
-#define KEY_FAILED_HISTORYID "failed_historyid"\r
-#define KEY_DOWNLOADING_HISTORYID "downloading_historyid"\r
-#define KEY_DEFAULT_STORAGE "default_storage"\r
-#define KEY_NETWORK_BONDING "network_bonding"\r
-#define KEY_FILE_NAME "file_name"\r
-\r
-#define DM_DRM_MIME_STR "application/vnd.oma.drm.message"\r
-#define DM_DCF_MIME_STR "application/vnd.oma.drm.content"\r
-\r
-#define MYFILE_PKG_NAME "org.tizen.myfile"\r
-\r
-#define DM_DEFAULT_PHONE_INSTALL_DIR "/opt/usr/media/Downloads"\r
-\r
-#define DM_DEFAULT_MMC_TEMP_DIR "/opt/media/SDCardA1/.temp_download"\r
-#define DM_DEFAULT_MMC_INSTALL_DIR "/opt/media/SDCardA1/"\r
-\r
-#define DM_TEMP_DIR_NAME ".temp_download/"\r
-#define DM_INVALID_PATH_STRING ";\\\":*?<>|()"\r
-enum\r
-{\r
- DM_CONTENT_NONE = 0,\r
- DM_CONTENT_IMAGE,\r
- DM_CONTENT_VIDEO,\r
- DM_CONTENT_MUSIC,\r
- DM_CONTENT_PDF,\r
- DM_CONTENT_WORD,\r
- DM_CONTENT_PPT, // 5\r
- DM_CONTENT_EXCEL,\r
- DM_CONTENT_HTML,\r
- DM_CONTENT_TEXT,\r
- DM_CONTENT_DRM,\r
- DM_CONTENT_SD_DRM,//10\r
- DM_CONTENT_FLASH,\r
- DM_CONTENT_TPK,\r
- DM_CONTENT_VCAL,\r
- DM_CONTENT_UNKOWN //14\r
-};\r
-\r
-namespace DL_TYPE{\r
-enum TYPE {\r
- TYPE_NONE,\r
- HTTP_DOWNLOAD,\r
-};\r
-}\r
-\r
-namespace ERROR {\r
-enum CODE {\r
- NONE = 0,\r
- INVALID_URL,\r
- NETWORK_FAIL,\r
- NOT_ENOUGH_MEMORY,\r
- FAIL_TO_INSTALL,\r
- ENGINE_FAIL,\r
-#ifdef _ENABLE_OMA_DOWNLOAD\r
- PARSING_FAIL,\r
-#endif\r
- UNKNOWN\r
-};\r
-}\r
-\r
-namespace NOTIFICATION_TYPE{\r
-enum TYPE {\r
- NOTI_NONE = 0,\r
- NOTI_DOWNLOADING,\r
- NOTI_FAILED,\r
- NOTI_COMPLETED\r
-};\r
-}\r
-\r
-#endif /* DOWNLOAD_DB_SERVICE_COMMON_H */\r
-\r
+/*
+ * Copyright 2012 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.
+ */
+
+#ifndef DOWNLOAD_DB_SERVICE_COMMON_H
+#define DOWNLOAD_DB_SERVICE_COMMON_H
+
+#include <libintl.h>
+#include "download-db-service-debug.h"
+#include <tzplatform_config.h>
+
+#define _EDJ(o) elm_layout_edje_get(o)
+#define __(s) dgettext(PROJ_NAME, s)
+#define S_(s) dgettext("sys_string", s)
+
+#define DM_LOCALEDIR LOCALEDIR
+#define DM_DOMAIN PROJ_NAME
+
+// Download Manager Common Strings.
+#define ERROR_POPUP_LOW_MEM_DEFAULT_PHONE_WITH_SD_CARD __("IDS_DM_BODY_THERE_IS_NOT_ENOUGH_SPACE_IN_YOUR_DEVICE_STORAGE_GO_TO_PS_SETTINGS_TO_FREE_UP_SOME_STORAGE_SPACE_THEN_TRY_AGAIN")
+#define ERROR_POPUP_LOW_MEM_DEFAULT_PHONE_WITHOUT_SD_CARD __("IDS_DM_BODY_THERE_IS_NOT_ENOUGH_SPACE_IN_YOUR_DEVICE_STORAGE_GO_TO_PS_SETTINGS_TO_DELETE_SOME_DATA_OR_INSERT_AN_SD_CARD")
+#define ERROR_POPUP_LOW_MEM_DEFAULT_MMC_WITH_NO_PHONE_MEMORY_AVAILABLE __("IDS_DM_BODY_THERE_IS_NOT_ENOUGH_SPACE_ON_YOUR_SD_CARD_GO_TO_PS_SETTINGS_TO_DELETE_SOME_DATA_THEN_TRY_AGAIN")
+#define ERROR_POPUP_LOW_MEM_DEFAULT_MMC_WITH_PHONE_MEMORY_AVAILABLE __("IDS_DM_BODY_THERE_IS_NOT_ENOUGH_SPACE_ON_YOUR_SD_CARD_GO_TO_PS_SETTINGS_TO_DELETE_SOME_DATA_OR_CHANGE_THE_DEFAULT_STORAGE_LOCATION_TO_DEVICE")
+
+#define DM_POP_TEXT_DOWNLOAD_COMPLETE __("IDS_DM_HEADER_DOWNLOAD_COMPLETE")
+#define DM_POP_TEXT_DOWNLOAD_FAILED __("IDS_DM_BODY_DOWNLOAD_FAILED_M_STATUS_ABB")
+#define DM_DOWNLOAD_COMPLETE_STRING_ID __("IDS_DM_HEADER_DOWNLOAD_COMPLETE")
+#define DM_DOWNLOAD_FAILED_STRING_ID __("IDS_DM_BODY_DOWNLOAD_FAILED_M_STATUS_ABB")
+
+#ifdef _TIZEN_2_3_UX
+#define DM_POP_TEXT_ERROR ""
+#define DM_BODY_TEXT_NO_NAME "No name"
+#define DM_BODY_TEXT_UNSUPPORTED_FILE_TYPE "Unsupported file type"
+#define DM_OPT_TEXT_DELETE __("IDS_DM_OPT_DELETE")
+#define DM_SK_TEXT_CANCEL __("IDS_DM_BUTTON_CANCEL_ABB2")
+#define DM_SK_TEXT_OK __("IDS_DM_BUTTON_OK_ABB")
+#define DM_BODY_TEXT_SELECT_ALL __("IDS_DM_MBODY_SELECT_ALL")
+#define DM_BODY_TEXT_PD_SELECTED __("IDS_DM_HEADER_PD_SELECTED_ABB3")
+#define DM_SK_TEXT_DOWNLOAD __("IDS_DM_BUTTON_DOWNLOAD_ABB2")
+#define DM_BODY_TEXT_TODAY __("IDS_DM_HEADER_TODAY")
+#define DM_BODY_TEXT_YESTERDAY __("IDS_DM_HEADER_YESTERDAY")
+#define DM_POP_TEXT_FAILED __("IDS_DM_BODY_DOWNLOAD_FAILED_M_STATUS_ABB")
+#define DM_HEADER_DOWNLOAD_MANAGER __("IDS_DM_HEADER_DOWNLOAD_MANAGER_ABB")
+#else
+#define DM_POP_TEXT_ERROR S_("IDS_COM_POP_ERROR")
+#define DM_BODY_TEXT_NO_NAME S_("IDS_COM_BODY_NO_NAME")
+#define DM_BODY_TEXT_UNSUPPORTED_FILE_TYPE S_("IDS_COM_BODY_UNSUPPORTED_FILE_TYPE")
+#define DM_OPT_TEXT_DELETE S_("IDS_COM_OPT_DELETE")
+#define DM_SK_TEXT_CANCEL S_("IDS_COM_SK_CANCEL")
+#define DM_SK_TEXT_OK S_("IDS_COM_SK_OK")
+#define DM_BODY_TEXT_SELECT_ALL S_("IDS_COM_BODY_SELECT_ALL")
+#define DM_BODY_TEXT_PD_SELECTED S_("IDS_COM_BODY_PD_SELECTED")
+#define DM_SK_TEXT_DOWNLOAD S_("IDS_COM_SK_DOWNLOAD")
+#define DM_BODY_TEXT_TODAY S_("IDS_COM_BODY_TODAY")
+#define DM_BODY_TEXT_YESTERDAY S_("IDS_COM_BODY_YESTERDAY")
+#define DM_POP_TEXT_FAILED S_("IDS_COM_POP_FAILED")
+#endif
+
+// Other defines
+#define MAX_FILE_PATH_LEN 256
+#define MAX_BUF_LEN 256
+#define LOAD_HISTORY_COUNT 500
+#define WAITING_RO_MAX_SECONDS 20
+
+#define KEY_MODE "mode"
+#define KEY_REQ_HTTP_HEADER_FIELD "req_http_header_field"
+#define KEY_REQ_HTTP_HEADER_VALUE "req_http_header_value"
+#define KEY_MODE_VALUE_VIEW "view"
+#define KEY_MODE_VALUE_SILENT "silent"
+#define KEY_FAILED_HISTORYID "failed_historyid"
+#define KEY_DOWNLOADING_HISTORYID "downloading_historyid"
+#define KEY_DEFAULT_STORAGE "default_storage"
+#define KEY_NETWORK_BONDING "network_bonding"
+#define KEY_FILE_NAME "file_name"
+
+#define DM_DRM_MIME_STR "application/vnd.oma.drm.message"
+#define DM_DCF_MIME_STR "application/vnd.oma.drm.content"
+
+#define MYFILE_PKG_NAME "org.tizen.myfile"
+
+#define DM_DEFAULT_PHONE_INSTALL_DIR "/opt/usr/media/Downloads"
+
+#define DM_DEFAULT_MMC_TEMP_DIR "/opt/media/SDCardA1/.temp_download"
+#define DM_DEFAULT_MMC_INSTALL_DIR "/opt/media/SDCardA1/"
+
+#define DM_TEMP_DIR_NAME ".temp_download/"
+#define DM_INVALID_PATH_STRING ";\\\":*?<>|()"
+enum {
+ DM_CONTENT_NONE = 0,
+ DM_CONTENT_IMAGE,
+ DM_CONTENT_VIDEO,
+ DM_CONTENT_MUSIC,
+ DM_CONTENT_PDF,
+ DM_CONTENT_WORD,
+ DM_CONTENT_PPT, // 5
+ DM_CONTENT_EXCEL,
+ DM_CONTENT_HTML,
+ DM_CONTENT_TEXT,
+ DM_CONTENT_DRM,
+ DM_CONTENT_SD_DRM,//10
+ DM_CONTENT_FLASH,
+ DM_CONTENT_TPK,
+ DM_CONTENT_VCAL,
+ DM_CONTENT_UNKOWN //14
+};
+
+namespace DL_TYPE{
+enum TYPE {
+ TYPE_NONE,
+ HTTP_DOWNLOAD,
+};
+}
+
+namespace ERROR {
+enum CODE {
+ NONE = 0,
+ INVALID_URL,
+ NETWORK_FAIL,
+ NOT_ENOUGH_MEMORY,
+ FAIL_TO_INSTALL,
+ ENGINE_FAIL,
+#ifdef _ENABLE_OMA_DOWNLOAD
+ PARSING_FAIL,
+#endif
+ UNKNOWN
+};
+}
+
+namespace NOTIFICATION_TYPE{
+enum TYPE {
+ NOTI_NONE = 0,
+ NOTI_DOWNLOADING,
+ NOTI_FAILED,
+ NOTI_COMPLETED
+};
+}
+
+#endif /* DOWNLOAD_DB_SERVICE_COMMON_H */
+
* limitations under the License.
*/
-/**
- * @file download-manager-debug.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief debug function
- */
-
#ifndef DOWNLOAD_DB_SERVICE_DEBUG_H
#define DOWNLOAD_DB_SERVICE_DEBUG_H
#include <pthread.h>
#define DM_LOGD(args...) do {\
- printf("[D:%s][LN:%d][%lu]",__func__,__LINE__,pthread_self());\
- printf(args);printf("\n");}while(0)
+ printf("[D:%s][LN:%d][%lu]", __func__, __LINE__, pthread_self());\
+ printf(args); printf("\n"); } while (0)
#define DM_LOGI(args...) do {\
- printf("[I:%s][LN:%d][%lu]",__func__,__LINE__,pthread_self());\
- printf(args);printf("\n");}while(0)
+ printf("[I:%s][LN:%d][%lu]", __func__, __LINE__, pthread_self());\
+ printf(args); printf("\n"); } while (0)
#define DM_LOGE(args...) do {\
- printf("[ERR:%s][LN:%d][%lu]",__func__,__LINE__,pthread_self());\
- printf(args);printf("\n");}while(0)
+ printf("[ERR:%s][LN:%d][%lu]", __func__, __LINE__, pthread_self());\
+ printf(args); printf("\n"); } while (0)
#define DM_SLOGD DM_LOGD
#define DM_SLOGI DM_LOGI
#define DM_SLOGE DM_LOGE
-/*\r
- * Copyright 2012 Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.1 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://floralicense.org/license/\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file download-manager-history-db.h\r
- * @author Jungki Kwak (jungki.kwak@samsung.com)\r
- * @brief Manager for a download history DB\r
- */\r
-\r
-#ifndef DOWNLOAD_DB_SERVICE_MAIN_H\r
-#define DOWNLOAD_DB_SERVICE_MAIN_H\r
-\r
-#include <string>\r
-#include <queue>\r
-#include <sqlite3.h>\r
-//#include "download-manager-item.h"\r
-#include "data_control.h"\r
-#include <libintl.h>\r
-\r
-extern "C" {\r
-#include <unicode/utypes.h>\r
-}\r
-#define REBUILD_QUERY "CREATE TABLE IF NOT EXISTS history( \\r
-id INTEGER PRIMARY KEY AUTOINCREMENT, \\r
-downloadid INTEGER, \\r
-historyid INTEGER, \\r
-downloadtype INTEGER, \\r
-contenttype INTEGER, \\r
-state INTEGER, \\r
-err INTEGER, \\r
-name, \\r
-path, \\r
-url, \\r
-filename, \\r
-headerfield, \\r
-headervalue, \\r
-installdir, \\r
-installnotifyurl, \\r
-etag, \\r
-tempfilepath, \\r
-date datetime, \\r
-filesize UNSIGNED BIG INT DEFAULT 0);"\r
-#define REBUILD_QUERY_INDEX "CREATE INDEX history_date_index on history (date);"\r
-\r
-using namespace std;\r
-\r
-class DownloadHistoryDB\r
-{\r
-public:\r
- static bool openDBConn(void) { return openDB(); }\r
- static void closeDBConn(void) { closeDB(); }\r
- static void insert_request_cb(int request_id, data_control_h provider, bundle *insert_data);\r
- static void delete_request_cb(int request_id, data_control_h provider, const char *where);\r
- static void select_request_cb(int request_id, data_control_h provider, const char **column_list, int column_count, const char *where, const char *order);\r
- static void update_request_cb(int request_id, data_control_h provider, bundle *update_data, const char *where);\r
-private:\r
- DownloadHistoryDB(void);\r
- ~DownloadHistoryDB(void);\r
- static sqlite3 *historyDb;\r
- static bool openDB(void);\r
- static bool isOpen(void) { return historyDb ? true : false; }\r
- static void closeDB(void);\r
- static bool loadSqlSchema(void);\r
-};\r
-\r
-#endif /* DOWNLOAD_DB_SERVICE_MAIN_H */\r
-\r
-\r
+/*
+ * Copyright 2012 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.
+ */
+
+#ifndef DOWNLOAD_DB_SERVICE_MAIN_H
+#define DOWNLOAD_DB_SERVICE_MAIN_H
+
+#include <string>
+#include <queue>
+#include <sqlite3.h>
+//#include "download-manager-item.h"
+#include "data_control.h"
+#include <libintl.h>
+
+extern "C" {
+#include <unicode/utypes.h>
+}
+#define REBUILD_QUERY "CREATE TABLE IF NOT EXISTS history( \
+id INTEGER PRIMARY KEY AUTOINCREMENT, \
+downloadid INTEGER, \
+historyid INTEGER, \
+downloadtype INTEGER, \
+contenttype INTEGER, \
+state INTEGER, \
+err INTEGER, \
+name, \
+path, \
+url, \
+filename, \
+headerfield, \
+headervalue, \
+installdir, \
+installnotifyurl, \
+etag, \
+tempfilepath, \
+date datetime, \
+filesize UNSIGNED BIG INT DEFAULT 0);"
+#define REBUILD_QUERY_INDEX "CREATE INDEX history_date_index on history (date);"
+
+using namespace std;
+
+class DownloadHistoryDB
+{
+public:
+ static bool openDBConn(void) { return openDB(); }
+ static void closeDBConn(void) { closeDB(); }
+ static void insert_request_cb(int request_id, data_control_h provider, bundle *insert_data);
+ static void delete_request_cb(int request_id, data_control_h provider, const char *where);
+ static void select_request_cb(int request_id, data_control_h provider, const char **column_list, int column_count, const char *where, const char *order);
+ static void update_request_cb(int request_id, data_control_h provider, bundle *update_data, const char *where);
+private:
+ DownloadHistoryDB(void);
+ ~DownloadHistoryDB(void);
+ static sqlite3 *historyDb;
+ static bool openDB(void);
+ static bool isOpen(void) { return historyDb ? true : false; }
+ static void closeDB(void);
+ static bool loadSqlSchema(void);
+};
+
+#endif /* DOWNLOAD_DB_SERVICE_MAIN_H */
+
+
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * @file oma-parser-common.c
- * @brief common function for oma dd parser
- * @author Jungki Kwak(jungki.kwak@samsung.com)
- *
- */
#include <stdlib.h>
#include <string.h>
matched_str++;
trailing_str_ptr = matched_str;
trailing_end_ptr = matched_str + len - 1;
- while (*trailing_end_ptr) {
+ while (*trailing_end_ptr)
*matched_str++ = *trailing_end_ptr++;
- }
*matched_str = '\0';
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * @file oma-parser-common.h
- * @brief common header file for oma dd parser
- * @author Jungki Kwak(jungki.kwak@samsung.com)
- */
#ifndef OMA_PARSER_COMMON_H_
#define OMA_PARSER_COMMON_H_
};
int op_com_util_remove_blankspace(char *Source, int srcLen);
-int op_com_util_resolve_version(char *source, int *major, int *minor,
- int *micro);
+int op_com_util_resolve_version(char *source, int *major, int *minor, int *micro);
void op_com_utils_convert_amp_string(char *amp_string);
int op_com_utils_is_number(const char *source);
char *op_com_utils_concat(char *source, char *substring);
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * @file oma-parser-dd1.c
- * @brief function for oma 1.0 dd parser
- * @author Jungki Kwak(jungki.kwak@samsung.com)
- */
#include <stdio.h>
#include <string.h>
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * @file oma-parser-dd1.h
- * @brief header file for oma 1.0 dd parser
- * @author Jungki Kwak(jungki.kwak@samsung.com)
- */
#ifndef OMA_PARSER_DD1_H_
#define OMA_PARSER_DD1_H_
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * @file oma-parser-interface.c
- * @brief interface function for oma dd parser
- * @author Jungki Kwak(jungki.kwak@samsung.com)
- */
#include <expat.h>
#include <string.h>
xmlCleanupParser();
}
-int op_parse_dd_file(
- const char *dd_file_path,
- void **dd_info,
- int *error_code)
+int op_parse_dd_file(const char *dd_file_path, void **dd_info, int *error_code)
{
int b_ret = OP_TRUE;
op_parser_app_data_t *app_data = OP_NULL;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @file oma-parser-interface.h
- * @brief Including interface functions regarding oma dd parser
- * @author Jungki Kwak(jungki.kwak@samsung.com)
- */
#ifndef _OMA_PARSER_INTERFACE_H
#define _OMA_PARSER_INTERFACE_H
#ifdef __cplusplus
- extern "C"
- {
+extern "C"
+{
#endif
#include "oma-parser-dd1.h"
*/
#ifdef __cplusplus
- }
+}
#endif
* limitations under the License.
*/
-/**
- * @file download-manager-dateTime.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief data and utility APIs for Date and Time
- */
-
#include <string>
#include <stdlib.h>
#include <system_settings.h>
* limitations under the License.
*/
-/**
- * @file download-manager-downloadItem.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief download item class for interface of download agent
- */
-
#include <iostream>
#ifdef _ENABLE_OMA_DOWNLOAD
#include <unistd.h>
CbData::CbData()
:m_type(DA_CB::STARTED)
- ,m_userData(NULL)
- ,m_download_id(-1)
- ,m_receivedFileSize(0)
+ , m_userData(NULL)
+ , m_download_id(-1)
+ , m_receivedFileSize(0)
{
}
if (fileObj.deleteFile(registeredFilePath))
DM_LOGD("The dd file deleted successfully.");
downloadItem->destroyId();
- }
- else if (!fileObj.checkAvailableMemory(dd_info->size)) {
+ } else if (!fileObj.checkAvailableMemory(dd_info->size)) {
downloadItem->setState(DL_ITEM::FAILED);
downloadItem->setErrorCode(ERROR::NOT_ENOUGH_MEMORY);
if (dd_info->install_notify_uri) {
ret = download_start(m_download_id);
DM_LOGI("URL download id:[%d] ret[%d]", m_download_id, ret);
-
if (ret != DOWNLOAD_ERROR_NONE) {
DM_LOGE("Fail to start:[%s]", __convertErrToString(ret));
default :
return ERROR::UNKNOWN;
}
-
}
#ifdef _ENABLE_OMA_DOWNLOAD
int DownloadItem::convertInstallStatus(int err)
th = NULL;
notifyFinished = false;
if (dd_info) {
- if (strlen(dd_info->name)>0)
+ if (strlen(dd_info->name) > 0)
name = string(dd_info->name);
- if (dd_info->major_version>0 || dd_info->minor_version) {
- char buf[256] = {0,};
+ if (dd_info->major_version > 0 || dd_info->minor_version) {
+ char buf[256] = {0, };
snprintf(buf, sizeof(buf), "%d.%d", dd_info->major_version, dd_info->minor_version);
version = string(buf);
}
if (curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_URL, item->getInstallUri().c_str());
- DM_SLOGD("install notify url[%s]",item->getInstallUri().c_str());
+ DM_SLOGD("install notify url[%s]", item->getInstallUri().c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, msg.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, msg.length() + 1);
if (!proxyAddr.empty())
DM_LOGI("proxy is not set");
/* debug */
curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, myTrace);
- }
- else{
+ } else {
DM_LOGE("[CRITICAL]NULL Check: curl");
return;
}
* limitations under the License.
*/
-/**
- * @file download-provier-downloadRequest.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief download request data class
- */
#include "download-manager-downloadRequest.h"
DownloadRequest::DownloadRequest(string url, string reqHeaderField, string reqHeaderValue,
* limitations under the License.
*/
-/**
- * @file download-manager-event.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief download event class for event flow
- */
#include "download-manager-event.h"
#include "download-manager-common.h"
while (it < _observers.end()) {
curObserver = *it;
- DM_LOGV("[%s]Call Update",curObserver->name().c_str());
+ DM_LOGV("[%s]Call Update", curObserver->name().c_str());
(*it)->update(this);
if (curObserver != *it)
* limitations under the License.
*/
-/**
- * @file download-manager-history-db.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Manager for a download history DB
- */
-
#include <sstream>
#include "download-manager-common.h"
#include "download-manager-history-db.h"
-#define FINALIZE_ON_ERROR( stmt ) { \
+#define FINALIZE_ON_ERROR(stmt) { \
DM_LOGE("SQL error:%d[%s]", ret, sqlite3_errmsg(historyDb));\
if (sqlite3_finalize(stmt) != SQLITE_OK)\
DM_LOGE("sqlite3_finalize is failed");\
return false;
}
- const string statement = "insert into history (historyid, \
- downloadtype, contenttype, state, name, url, filename, \
+ const string statement = "insert into history \
+ (historyid, downloadtype, contenttype, state, name, url, filename, \
headerfield, headervalue, installdir, date) \
values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
DM_LOGE("NULL Check:historyDB");
return false;
}
- const string statement = "update history set downloadtype=?,\
- contenttype=?, state=?, err=?, name=?, path=?, url=?, filename=?,\
- headerfield=?, headervalue=?, installdir=?, date=? where historyid = ?";
+ const string statement = "update history set downloadtype = ?, \
+ contenttype = ?, state = ?, err = ?, name = ?, path = ?, url = ?, filename = ?, \
+ headerfield = ?, headervalue = ?, installdir = ?, date = ? where historyid = ?";
ret = sqlite3_prepare_v2(historyDb, statement.c_str(), -1, &stmt, NULL);
DM_LOGE("NULL Check:historyDB");
return false;
}
- const string statement = "update history set state=?, err=?, \
- date=? where historyid = ?";
+ const string statement = "update history set state = ?, err = ?, \
+ date = ? where historyid = ?";
ret = sqlite3_prepare_v2(historyDb, statement.c_str(), -1, &stmt, NULL);
return false;
}
#ifdef _ENABLE_OMA_DOWNLOAD
- const string statement = "update history set downloadtype=?,\
- contenttype=?, state=?, name=?, etag=?, tempfilepath=?,\
- installnotifyurl=?, date=?, filesize=? where historyid = ?";
+ const string statement = "update history set downloadtype = ?, \
+ contenttype = ?, state = ?, name = ?, etag = ?, tempfilepath = ?, \
+ installnotifyurl = ?, date = ?, filesize = ? where historyid = ?";
#else
- const string statement = "update history set downloadtype=?,\
- contenttype=?, state=?, name=?, etag=?, tempfilepath=?,\
- date=?, filesize=? where historyid = ?";
+ const string statement = "update history set downloadtype = ?, \
+ contenttype = ?, state = ?, name = ?, etag = ?, tempfilepath = ?, \
+ date = ?, filesize = ? where historyid = ?";
#endif
ret = sqlite3_prepare_v2(historyDb, statement.c_str(), -1, &stmt, NULL);
return false;
}
- const string statement = "update history set state=? \
+ const string statement = "update history set state = ? \
where historyid = ?";
ret = sqlite3_prepare_v2(historyDb, statement.c_str(), -1, &stmt, NULL);
return false;
}
- const string statement = "update history set downloadid=? \
+ const string statement = "update history set downloadid = ? \
where historyid = ?";
ret = sqlite3_prepare_v2(historyDb, statement.c_str(), -1, &stmt, NULL);
DM_LOGD("SQL return: %s",
(ret == SQLITE_ROW || ret == SQLITE_OK)?"Success":"Fail");
if (ret == SQLITE_ROW) {
- *count = sqlite3_column_int(stmt,0);
- DM_LOGI("count[%d]",*count);
+ *count = sqlite3_column_int(stmt, 0);
+ DM_LOGI("count[%d]", *count);
} else {
DM_LOGE("SQL query error:%s", sqlite3_errmsg(historyDb));
*count = 0;
item->attachHistoryItem();
item->setRetryData(url, reqHeaderField, reqHeaderValue,
installDir, fileName, tempFilePath, etag);
- } else
+ } else {
break;
+ }
}
DM_LOGD("SQL return: %s",
(ret == SQLITE_ROW || ret == SQLITE_OK)?"Success":"Fail");
item->attachHistoryItem();
item->setRetryData(url, reqHeaderField, reqHeaderValue,
installDir, fileName, tempFilePath, etag);
- } else
+ } else {
break;
+ }
}
if (sqlite3_finalize(stmt) != SQLITE_OK)
DM_LOGE("NULL Check:historyDB");
return false;
}
- ret = sqlite3_exec(historyDb, "PRAGMA synchronous=OFF;\
- PRAGMA count_changes=OFF; PRAGMA temp_store=memory;",
+ ret = sqlite3_exec(historyDb, "PRAGMA synchronous = OFF;\
+ PRAGMA count_changes = OFF; PRAGMA temp_store = memory;",
NULL, NULL, &errmsg);
if (SQLITE_OK != ret) {
sqlite3_free(errmsg);
return false;
}
- DM_LOGI("queue size[%d]",q.size());
+ DM_LOGI("queue size[%d]", q.size());
while (!q.empty()) {
ret = sqlite3_prepare_v2(historyDb, "delete from history where historyid=?",
-1, &stmt, NULL);
int ret = 0;
ret = sqlite3_exec(historyDb, REBUILD_QUERY, 0, 0, &error_msg);
if((error_msg != NULL) || (SQLITE_OK != ret)) {
- DM_LOGD("SQL error :: [%s]",error_msg);
+ DM_LOGD("SQL error :: [%s]", error_msg);
sqlite3_free(error_msg);
error_msg = NULL;
closeDB();
ret = sqlite3_exec(historyDb, REBUILD_QUERY_INDEX, 0, 0, &error_msg);
if((error_msg != NULL) || (SQLITE_OK != ret)) {
- DM_LOGD("SQL error :: [%s]",error_msg);
+ DM_LOGD("SQL error :: [%s]", error_msg);
sqlite3_free(error_msg);
error_msg = NULL;
}
* limitations under the License.
*/
-/**
- * @file download-manager-item.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief item class for saving download data
- */
-
#include <iostream>
#include <time.h>
#include "download-manager-item.h"
items.attachItem(newItem);
ViewItem::create(newItem);
- DM_LOGV("newItem[%p]",newItem);
+ DM_LOGV("newItem[%p]", newItem);
newItem->download();
newItem->notify();
Item *newItem = new Item(request);
- DM_LOGV("new History Item[%p]",newItem);
+ DM_LOGV("new History Item[%p]", newItem);
return newItem;
}
{
Items &items = Items::getInstance();
- DM_LOGI("attach History Item[%p] state[%d]",this, getState());
+ DM_LOGI("attach History Item[%p] state[%d]", this, getState());
items.attachItem(this);
if (!isFinished()) {
DM_LOGI("Change downloading state to fail state");
FileUtility fileObj;
// FIXME prohibit to destroy if downloading
if (!isFinished()) {
- DM_LOGE("Cannot delete this item:state[%d]",m_state);
+ DM_LOGE("Cannot delete this item:state[%d]", m_state);
return;
}
} else {
return ECORE_CALLBACK_RENEW;
}
-
}
#endif
m_aptr_downloadItem->sendInstallNotification(902);
handleFinishedItem();
notify();
-
}
-
}
#endif
break;
}
return ret;
-
}
bool Item::isCompletedDownload()
* limitations under the License.
*/
-/**
- * @file download-manager-items.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Interface API with item list
- */
#include "download-manager-items.h"
void Items::attachItem(Item *item)
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @file download-manager-network.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Download netowkr manager
- */
#include <stdlib.h>
#include "download-manager-common.h"
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * @file download-manager-notification.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Noti APIs and interface
- */
#include <stdio.h>
#include <vector>
* limitations under the License.
*/
-/*
- * @file download-manager-util.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Utility APIs and interface with content player
- */
-
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
struct MimeTableType MimeTable[]={
// PDF
- {"application/pdf",DM_CONTENT_PDF},
+ {"application/pdf", DM_CONTENT_PDF},
// word
- {"application/msword",DM_CONTENT_WORD},
- {"application/vnd.openxmlformats-officedocument.wordprocessingml.document",DM_CONTENT_WORD},
+ {"application/msword", DM_CONTENT_WORD},
+ {"application/vnd.openxmlformats-officedocument.wordprocessingml.document", DM_CONTENT_WORD},
// ppt
- {"application/vnd.ms-powerpoint",DM_CONTENT_PPT},
- {"application/vnd.openxmlformats-officedocument.presentationml.presentation",DM_CONTENT_PPT},
+ {"application/vnd.ms-powerpoint", DM_CONTENT_PPT},
+ {"application/vnd.openxmlformats-officedocument.presentationml.presentation", DM_CONTENT_PPT},
// excel
- {"application/vnd.ms-excel",DM_CONTENT_EXCEL},
- {"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",DM_CONTENT_EXCEL},
+ {"application/vnd.ms-excel", DM_CONTENT_EXCEL},
+ {"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", DM_CONTENT_EXCEL},
// html
- {"text/html",DM_CONTENT_HTML},
+ {"text/html", DM_CONTENT_HTML},
// txt
- {"text/txt",DM_CONTENT_TEXT},
- {"text/plain",DM_CONTENT_TEXT},
+ {"text/txt", DM_CONTENT_TEXT},
+ {"text/plain", DM_CONTENT_TEXT},
// DRM
- {"application/vnd.oma.drm.content",DM_CONTENT_SD_DRM},
- {"application/vnd.oma.drm.message",DM_CONTENT_DRM},
+ {"application/vnd.oma.drm.content", DM_CONTENT_SD_DRM},
+ {"application/vnd.oma.drm.message", DM_CONTENT_DRM},
{"application/x-shockwave-flash", DM_CONTENT_FLASH},
{"application/vnd.tizen.package", DM_CONTENT_TPK},
- {"text/calendar",DM_CONTENT_VCAL},
+ {"text/calendar", DM_CONTENT_VCAL},
};
void FileUtility::cleanTempDir()
DM_LOGE("Fail to call opendir");
return;
} else {
- while(readdir_r(dir, &entry, &dirInfo) == 0 && dirInfo != NULL) {
- DM_SLOGD("%s",dirInfo->d_name);
- if (0 == strncmp(dirInfo->d_name,".",strlen(".")) ||
- 0 == strncmp(dirInfo->d_name,"..",strlen("..")))
+ while (readdir_r(dir, &entry, &dirInfo) == 0 && dirInfo != NULL) {
+ DM_SLOGD("%s", dirInfo->d_name);
+ if (0 == strncmp(dirInfo->d_name, ".", strlen(".")) ||
+ 0 == strncmp(dirInfo->d_name, "..", strlen("..")))
continue;
filePath.append(defTempPath);
filePath.append("/");
filePath.append(dirInfo->d_name);
/* The sub-directory should not be created under temporary directory */
if (isExistedFile(filePath, false)) {
- if (remove(filePath.c_str())<0)
+ if (remove(filePath.c_str()) < 0)
DM_LOGE("Fail to Remove");
} else {
DM_LOGE("Cannot enter here type[%d]", dirInfo->d_type);
struct stat fileState;
int stat_ret;
-// DM_LOGD("");
-
if (path.empty())
return false;
stat_ret = stat(path.c_str(), &fileState);
{
string path;
- if (optionTempDir)
- {
+ if (optionTempDir) {
path.assign(DM_DEFAULT_PHONE_INSTALL_DIR);
path.append("/.temp_download");
- }
- else{
+ } else {
path.assign(DM_DEFAULT_PHONE_INSTALL_DIR);
path.append("/");
}
unaliasedMime = xdg_mime_unalias_mime_type(tempMime);
if (unaliasedMime != NULL) {
- DM_SLOGD("unaliased mime type[%s]",unaliasedMime);
- if (strstr(unaliasedMime,"video/") != NULL)
+ DM_SLOGD("unaliased mime type[%s]", unaliasedMime);
+ if (strstr(unaliasedMime, "video/") != NULL)
type = DM_CONTENT_VIDEO;
- else if (strstr(unaliasedMime,"audio/") != NULL)
+ else if (strstr(unaliasedMime, "audio/") != NULL)
type = DM_CONTENT_MUSIC;
- else if (strstr(unaliasedMime,"image/") != NULL)
+ else if (strstr(unaliasedMime, "image/") != NULL)
type = DM_CONTENT_IMAGE;
}
}
free(tempMime);
- DM_LOGV("type[%d]",type);
+ DM_LOGV("type[%d]", type);
return type;
}
bool DownloadUtil::isAmbiguousMIMEType(const char *mimeType)
{
-
if (!mimeType)
return false;
string finalPath = string();
string dirPath;
size_t found1 = string::npos;
- size_t found2= string::npos;
+ size_t found2 = string::npos;
size_t len = string::npos;
string str1 = ".temp_download";
string contentName;
int *count = NULL;
count = (int *)user_data;
if (appid) {
- DM_SLOGD("appid[%s]",appid);
+ DM_SLOGD("appid[%s]", appid);
*count = *count + 1;
}
return true;
* limitations under the License.
*/
-/**
- * @file download-manager-view.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief UI manager class for download list view and delete view
- */
#include <sstream>
#include <queue>
//#include "utilX.h"
* limitations under the License.
*/
-/**
- * @file download-manager-viewItem.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief item data class for download view
- */
-
#include <stdio.h>
#include "download-manager-viewItem.h"
DM_LOGE("Check NULL:m_glItem");
return;
}
- DM_LOGTEST("DEL:glItem[%p]viewItem[%p]",m_glItem, this);
+ DM_LOGTEST("DEL:glItem[%p]viewItem[%p]", m_glItem, this);
item = elm_genlist_item_next_get(m_glItem);
if (item) {
if (fp != NULL) {
msg = ERROR_POPUP_LOW_MEM_DEFAULT_PHONE_WITH_SD_CARD;
fclose(fp);
- } else
+ } else {
msg = ERROR_POPUP_LOW_MEM_DEFAULT_PHONE_WITHOUT_SD_CARD;
+ }
} else if (installDir.compare(DM_DEFAULT_MMC_INSTALL_DIR) == 0) {
FileUtility fileObj;
if (fileObj.checkAvailableMemory(0))
view.showMemoryFullPopup(msg);
}
- DM_LOGTEST("Update:glItem[%p]viewItem[%p]",m_glItem, this);
+ DM_LOGTEST("Update:glItem[%p]viewItem[%p]", m_glItem, this);
if (state == ITEM::SUSPENDED) {
return;
} else if (state == ITEM::DOWNLOADING) {
double percentageProgress = 0.0;
percentageProgress = (double)getReceivedFileSize() /
(double)getFileSize();
- DM_LOGV("progress value[%.2f]",percentageProgress);
+ DM_LOGV("progress value[%.2f]", percentageProgress);
elm_progressbar_value_set(progress, percentageProgress);
}
#ifdef _TIZEN_2_3_UX
- elm_genlist_item_fields_update(m_glItem,"elm.text.progress",
+ elm_genlist_item_fields_update(m_glItem, "elm.text.progress",
ELM_GENLIST_ITEM_FIELD_TEXT);
#else
- elm_genlist_item_fields_update(m_glItem,"elm.text.2",
+ elm_genlist_item_fields_update(m_glItem, "elm.text.2",
ELM_GENLIST_ITEM_FIELD_TEXT);
#endif
} else if (m_isRetryCase && state == ITEM::PREPARE_TO_RETRY) {
#ifdef _TIZEN_2_3_UX
DownloadView &view = DownloadView::getInstance();
- if (strcmp(part,"elm.icon.1") == 0) {
+ if (strcmp(part, "elm.icon.1") == 0) {
Evas_Object *icon = elm_icon_add(obj);
elm_image_file_set(icon, getIconPath(), NULL);
evas_object_size_hint_min_set(icon, ELM_SCALE_SIZE(GENLIST_ICON_SIZE),
ELM_SCALE_SIZE(GENLIST_ICON_SIZE));
return icon;
- }
- else if (strcmp(part,"elm.swallow.icon") == 0) {
+ } else if (strcmp(part, "elm.swallow.icon") == 0) {
Evas_Object *image = elm_image_add(obj);
elm_image_file_set(image, getIconPath(), NULL);
evas_object_size_hint_min_set(image, ELM_SCALE_SIZE(GENLIST_ICON_SIZE),
} else if (getState() < ITEM::FINISH_DOWNLOAD) {
if (strcmp(part, "elm.icon") == 0)
return createProgressBar(obj);
- else if (strcmp(part,"elm.icon.2") == 0)
+ else if (strcmp(part, "elm.icon.2") == 0)
return createCancelBtn(obj);
- } else if (view.isGenlistEditMode() && strcmp(part,"elm.swallow.icon.2") == 0) {
+ } else if (view.isGenlistEditMode() && strcmp(part, "elm.swallow.icon.2") == 0) {
Evas_Object *check = elm_check_add(obj);
elm_check_state_pointer_set(check, &m_checked);
evas_object_repeat_events_set(check, EINA_FALSE);
return NULL;
#else
if (elm_genlist_decorate_mode_get(obj) && isFinished()) {
- if (strncmp(part,"elm.edit.icon.1", strlen("elm.edit.icon.1")) == 0) {
+ if (strncmp(part, "elm.edit.icon.1", strlen("elm.edit.icon.1")) == 0) {
Evas_Object *checkBtn = elm_check_add(obj);
elm_object_style_set(checkBtn, "default/genlist");
elm_check_state_pointer_set(checkBtn, &m_checked);
elm_access_object_unregister(checkBtn);
m_checkedBtn = checkBtn;
return checkBtn;
- } else if (strncmp(part,"elm.edit.icon.2", strlen("elm.edit.icon.2")) ==
+ } else if (strncmp(part, "elm.edit.icon.2", strlen("elm.edit.icon.2")) ==
0) {
return NULL;
}
}
/* elm.icon.2 should be checked prior to elm.icon */
- if (strncmp(part,"elm.icon.2", strlen("elm.icon.2")) == 0) {
+ if (strncmp(part, "elm.icon.2", strlen("elm.icon.2")) == 0) {
if (getState() == ITEM::RECEIVING_DOWNLOAD_INFO ||
getState() == ITEM::DOWNLOADING ||
isPreparingDownload())
return createCancelBtn(obj);
else
return NULL;
- } else if (strncmp(part,"elm.icon.1", strlen("elm.icon.1")) == 0 ||
+ } else if (strncmp(part, "elm.icon.1", strlen("elm.icon.1")) == 0 ||
strncmp(part, "elm.icon", strlen("elm.icon")) == 0) {
Evas_Object *icon = elm_image_add(obj);
elm_image_file_set(icon, getIconPath(), NULL);
evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
return icon;
- } else if (strcmp(part,"elm.swallow.progress") == 0) {
+ } else if (strcmp(part, "elm.swallow.progress") == 0) {
return createProgressBar(obj);
} else {
DM_LOGE("Cannot enter here");
#endif
elm_progressbar_horizontal_set(progress, EINA_TRUE);
- if (isCompletedDownload())
+ if (isCompletedDownload()) {
elm_progressbar_value_set(progress, 1.0);
/* When realized event is happened, the progress is created.
This is needed for that case */
- else if (getState() == ITEM::DOWNLOADING) {
+ } else if (getState() == ITEM::DOWNLOADING) {
double percentageProgress = 0.0;
percentageProgress = (double)(getReceivedFileSize()) /
(double)(getFileSize());
Evas_Object *ViewItem::createCancelBtn(Evas_Object *parent)
{
- DM_LOGV ("");
+ DM_LOGV("");
#ifdef _TIZEN_2_3_UX
Evas_Object *button = elm_button_add(parent);
elm_object_style_set(button, "dm_cancel_button");
evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_part_content_set(button, "elm.swallow.icon", icon) ;
- evas_object_propagate_events_set(button, EINA_FALSE); //
- evas_object_smart_callback_add(button,"clicked", cancelBtnClickedCB, this); //
+ evas_object_propagate_events_set(button, EINA_FALSE);
+ evas_object_smart_callback_add(button, "clicked", cancelBtnClickedCB, this);
return button;
#else
Evas_Object *button = elm_button_add(parent);
elm_object_text_set(button, DM_SK_TEXT_CANCEL);
evas_object_propagate_events_set(button, EINA_FALSE);
- evas_object_smart_callback_add(button,"clicked", cancelBtnClickedCB, this);
+ evas_object_smart_callback_add(button, "clicked", cancelBtnClickedCB, this);
return button;
#endif
return NULL;
* limitations under the License.
*/
-/**
- * @file download-manager-common.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Common define and data
- */
-
#ifndef DOWNLOAD_MANAGER_DOWNLOAD_COMMON_H
#define DOWNLOAD_MANAGER_DOWNLOAD_COMMON_H
* limitations under the License.
*/
-/**
- * @file download-manager-dateTime.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief data and utility APIs for Date and Time
- */
#ifndef DOWNLOAD_MANAGER_DATE_TIME_H
#define DOWNLOAD_MANAGER_DATE_TIME_H
i18n_udate_format_h dateShortFormat;
i18n_udate_format_h timeFormat12H;
i18n_udate_format_h timeFormat24H;
-
};
#endif /* DOWNLOAD_MANAGER_DATE_TIME_H */
* limitations under the License.
*/
-/**
- * @file download-manager-debug.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief debug function
- */
#ifndef DOWNLOAD_MANAGER_DEBUG_H
#define DOWNLOAD_MANAGER_DEBUG_H
#include <pthread.h>
#define DM_LOGD(args...) do {\
- printf("[D:%s][LN:%d][%lu]",__func__,__LINE__,pthread_self());\
+ printf("[D:%s][LN:%d][%lu]", __func__, __LINE__, pthread_self());\
printf(args);printf("\n");}while(0)
#define DM_LOGI(args...) do {\
- printf("[I:%s][LN:%d][%lu]",__func__,__LINE__,pthread_self());\
+ printf("[I:%s][LN:%d][%lu]", __func__, __LINE__, pthread_self());\
printf(args);printf("\n");}while(0)
#define DM_LOGE(args...) do {\
- printf("[ERR:%s][LN:%d][%lu]",__func__,__LINE__,pthread_self());\
+ printf("[ERR:%s][LN:%d][%lu]", __func__, __LINE__, pthread_self());\
printf(args);printf("\n");}while(0)
#define DM_SLOGD DM_LOGD
#define DM_SLOGI DM_LOGI
* limitations under the License.
*/
-/**
- * @file download-manager-downloadItem.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief download item class
- */
-
#ifndef DOWNLOAD_MANAGER_DOWNLOAD_ITEM_H
#define DOWNLOAD_MANAGER_DOWNLOAD_ITEM_H
string getUserMessage(void);
inline void sendInstallNotification(int status)
{
- if (m_oma_item.get()){
- if(!m_oma_item->getInstallUri().empty()){
+ if (m_oma_item.get()) {
+ if (!m_oma_item->getInstallUri().empty()) {
m_oma_item->sendInstallNotification(status);
}
- }
- else{
+ } else {
return;
}
}
};
class DownloadEngine {
-public:
- static DownloadEngine &getInstance(void) {
- static DownloadEngine downloadEngine;
- return downloadEngine;
- }
+ public:
+ static DownloadEngine &getInstance(void) {
+ static DownloadEngine downloadEngine;
+ return downloadEngine;
+ }
- void initEngine(void);
- void deinitEngine(void);
-private:
- DownloadEngine(void);
- ~DownloadEngine(void);
+ void initEngine(void);
+ void deinitEngine(void);
+ private:
+ DownloadEngine(void);
+ ~DownloadEngine(void);
};
* limitations under the License.
*/
-/**
- * @file download-manager-downloadRequest.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Download Request class
- */
-
#ifndef DOWNLOAD_MANAGER_DOWNLOAD_REQUEST_H
#define DOWNLOAD_MANAGER_DOWNLOAD_REQUEST_H
* limitations under the License.
*/
-/**
- * @file download-manager-event.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Download event class
- */
#ifndef DOWNLOAD_MANAGER_EVENT_H
#define DOWNLOAD_MANAGER_EVENT_H
* limitations under the License.
*/
-/**
- * @file download-manager-history-db.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Manager for a download history DB
- */
-
#ifndef DOWNLOAD_MANAGER_HISTORY_DB_H
#define DOWNLOAD_MANAGER_HISTORY_DB_H
* limitations under the License.
*/
-/**
- * @file download-manager-item.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Item class
- */
#ifndef DOWNLOAD_MANAGER_ITEM_H
#define DOWNLOAD_MANAGER_ITEM_H
* limitations under the License.
*/
-/*
- * @file download-manager-items.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief item inventory class
- */
#ifndef DOWNLOAD_MANAGER_ITEMS_H
#define DOWNLOAD_MANAGER_ITEMS_H
* limitations under the License.
*/
-/**
- * @file download-manager-network.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Download netowkr manager
- */
-
#ifndef DOWNLOAD_MANAGER_NETWORK_H
#define DOWNLOAD_MANAGER_NETWORK_H
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * @file download-manager-notification.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Noti APIs and interface
- */
#ifndef DOWNLOAD_MANAGER_NOTIFICATION_H
#define DOWNLOAD_MANAGER_NOTIFICATION_H
* limitations under the License.
*/
-/*
- * @file download-manager-util.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Utility APIs and interface with content player
- */
-
#ifndef DOWNLOAD_MANAGER_UTIL_H
#define DOWNLOAD_MANAGER_UTIL_H
* limitations under the License.
*/
-/**
- * @file download-manager-view.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Download UI View manager
- */
-
#ifndef DOWNLOAD_MANAGER_VIEW_H
#define DOWNLOAD_MANAGER_VIEW_H
* limitations under the License.
*/
-/**
- * @file download-manager-viewItem.h
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief Item class for Download view
- */
-
#ifndef DOWNLOAD_MANAGER_VIEW_ITEM_H
#define DOWNLOAD_MANAGER_VIEW_ITEM_H
else
return ITEM::IDLE;
}
- inline const char* stateStr(void) {
+ inline const char* stateStr(void)
+ {
if (m_item)
return m_item->stateStr();
else
return NULL;
}
- inline bool isFinished(void) {
+ inline bool isFinished(void)
+ {
if (m_item)
return m_item->isFinished();
else
return false;
}
- inline bool isFinishedWithErr(void) {
+ inline bool isFinishedWithErr(void)
+ {
if (m_item)
return m_item->isFinishedWithErr();
else
return false;
}
- inline bool isPreparingDownload(void) {
+ inline bool isPreparingDownload(void)
+ {
if (m_item)
return m_item->isPreparingDownload();
else
return false;
}
- inline bool isCompletedDownload(void) {
+ inline bool isCompletedDownload(void)
+ {
if (m_item)
return m_item->isCompletedDownload();
else
* limitations under the License.
*/
-/**
- * @file main.cpp
- * @author Jungki Kwak (jungki.kwak@samsung.com)
- * @brief main file for download manager
- */
-
#include <list>
#include <string>
#include <iostream>