Update change log and spec for wrt-plugins-tizen_0.4.26
authorDongjin Choi <milkelf.choi@samsung.com>
Mon, 29 Apr 2013 12:17:07 +0000 (21:17 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Mon, 29 Apr 2013 12:17:07 +0000 (21:17 +0900)
[model] REDWOOD
[binary_type] PDA
[customer] OPEN

[Issue#] N/A
[Problem] only file path is allowed to install
[Cause] N/A
[Solution] allow file uri path

[Issue#] SQL insert/update protocol change.
[Problem] N/A
[Cause] N/A
[Solution] Implementation.

[Issue#] N/A
[Problem] JS isinstanceof test failed for Messaging module.
[Cause] No use of constructor definition in class map.
[Solution] Use the constructor definition in class map.

[Issue] N/A
[Problem] MessageFolder get type attribute bug fix
[Cause] MessageFolder get type attribute bug fix
[Solution] MessageFolder get type attribute bug fix

[Issue] N/A
[Problem] N/A
[Cause] N/A
[Soution] updated the function for the valid person id.

[team] WebAPI
[request] N/A
[horizontal_expansion] N/A

13 files changed:
packaging/wrt-plugins-tizen.spec
src/Callhistory/CallHistory.cpp
src/Callhistory/CallHistory.h
src/DataControl/SqlDataControlConsumer.cpp
src/DataControl/SqlDataControlConsumer.h
src/Messaging/JSMessage.cpp
src/Messaging/JSMessageAttachment.cpp
src/Messaging/JSMessageFolder.cpp
src/Messaging/MessageFolder.h
src/Messaging/Messaging.cpp
src/Messaging/messageDB/MessageStorageReader.cpp
src/Messaging/plugin_initializer.cpp
src/Package/PackageManager.cpp

index 10f1fe1..5f8d769 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.25
-Release:    1
+Version:    0.4.26
+Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
 Source0:    %{name}-%{version}.tar.gz
index daf42b8..a181cd9 100755 (executable)
@@ -330,12 +330,23 @@ bool CallHistory::parseRecord(contacts_list_h *recordList, CallHistoryEntryListP
                }
 
                memset(&query_data, 0x00, sizeof(callhistory_query_s));
+               int validPersonId = 0;
 
                if (ret == CONTACTS_ERROR_NONE) {
                        contacts_record_get_int(record, _contacts_phone_log.id, &(query_data.calllog_db_id));
                        contacts_record_get_int(record, _contacts_phone_log.log_type , &logType);
                        contacts_record_get_int(record, _contacts_phone_log.person_id, &(query_data.person_db_id));
                        contacts_record_get_str_p(record, _contacts_phone_log.address, &(query_data.phone_number));
+
+                       validPersonId = 0;
+                       validPersonId = updateValidPersonId(query_data.phone_number);
+                       if(validPersonId != -1){
+                               query_data.person_db_id = validPersonId;
+                       }else{
+                               LoggerD("Failed callhistory parser");
+                               return false;
+                       }
+
                        contacts_record_get_int(record, _contacts_phone_log.log_time, &time);
                        contacts_record_get_int(record, _contacts_phone_log.extra_data1, &(query_data.duration_sec));
                        query_data.calllog_type = static_cast<contacts_phone_log_type_e>(logType);
@@ -354,6 +365,72 @@ bool CallHistory::parseRecord(contacts_list_h *recordList, CallHistoryEntryListP
 
 }
 
+int CallHistory::updateValidPersonId(char* phoneNum)
+{
+       contacts_query_h query = NULL;
+       contacts_filter_h filter = NULL;
+       contacts_list_h recordList = NULL;
+       int ret = CONTACTS_ERROR_NONE;
+
+       contacts_query_create(_contacts_person_phone_log._uri, &query);
+       contacts_filter_create(_contacts_person_phone_log._uri, &filter);
+       contacts_filter_add_str(filter, _contacts_person_phone_log.address, CONTACTS_MATCH_EXACTLY, phoneNum);
+
+       contacts_query_set_filter(query, filter);
+
+       ret = contacts_query_set_sort(query, _contacts_person_phone_log.address, false);
+       if (ret != CONTACTS_ERROR_NONE) {
+               LoggerD("Invalid callhistory query [" << ret << "]");
+       }
+
+       ret = contacts_db_get_records_with_query(query, 0, 1, &recordList);
+       if (ret != CONTACTS_ERROR_NONE) {
+               contacts_list_destroy(recordList, true);
+               contacts_query_destroy(query);
+               contacts_filter_destroy(filter);
+               LoggerD("Invalid callhistory query [" << ret << "]");
+               return -1;
+       }
+
+       unsigned int total = 0;
+       contacts_record_h record = NULL;
+       int validPersonId = 0;
+
+       contacts_list_get_count(recordList, &total);
+
+       for (int i = 0; i < total; i++) {
+               ret = contacts_list_get_current_record_p(recordList, &record);
+
+               if (record == NULL) {
+                       ret = contacts_list_next(recordList);
+                       if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) {
+                               LoggerD("Failed contacts");
+                               return -1;
+                       } else {
+                               continue;
+                       }
+               }
+
+               if (ret == CONTACTS_ERROR_NONE) {
+                       contacts_record_get_int(record, _contacts_person_phone_log.person_id, &validPersonId);
+               }
+
+               ret = contacts_list_next(recordList);
+               if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) {
+                       LoggerD("Failed contacts");
+                       return -1;
+               }
+       }
+
+       contacts_list_destroy(recordList, true);
+       contacts_query_destroy(query);
+       contacts_filter_destroy(filter);
+
+       return validPersonId;
+
+}
+
+
 unsigned int CallHistory::convertAttrName(std::string &name)
 {
        std::string attrName("");
index ef34e74..2f600a2 100755 (executable)
@@ -125,6 +125,7 @@ public:
 private:
        bool convertCallHistory(callhistory_query_s *query_log, CallHistoryEntryListPtr &callEntries);
        bool parseRecord(contacts_list_h *recordList, CallHistoryEntryListPtr &callEntries);
+       int updateValidPersonId(char* phoneNum);
        unsigned int  convertAttrName(std::string &name);
 
        std::vector<EventRemoveBatchDataPtr> m_removeBatchEvent;
index 21b1f62..89e23bc 100644 (file)
 #include <aul/aul.h>
 #include <sstream>
 #include <package-manager.h>
+#include <app.h>
+// to get package name by appid
+#include <app_info.h>
+#include <app_manager.h>
+// To get ppid
+#include <unistd.h>
 
 
 namespace DeviceAPI {
@@ -62,9 +68,13 @@ static const char BUNDLE_KEY_WINDOW[] = "__APP_SVC_K_WIN_ID__";
 #define OSP_K_APPCONTROL_URI        "__OSP_APPCONTROL_URI__"
 #define OSP_K_DATACONTROL_PROVIDER      "__OSP_DATACONTROL_PROVIDER__"
 #define OSP_K_DATACONTROL_REQUEST_TYPE  "__OSP_DATACONTROL_REQUEST_TYPE__"
-
 #define RESULT_TRUE_FROM_OSP "1"
 #define RESULT_FALSE_FROM_OSP "0"
+#define OSP_K_DATACONTROL_PROTOCOL_VERSION  "__OSP_DATACONTROL_PROTOCOL_VERSION__"
+#define OSP_K_DATACONTROL_PROTOCOL_VERSION_VALUE "ver_2.1.0.2"
+
+#define DATACONTROL_PROTOCOL_DIR_PARENT  "/tmp/osp"
+#define DATACONTROL_PROTOCOL_DIR  "/tmp/osp/DataControlRequest"
 
 
 
@@ -348,8 +358,8 @@ static void sqldataControlUpdateCallback(bundle* b, int request_code, appsvc_res
                delete pendingEvent;
        }
 }
-
 }
+
 SQLDataControlConsumer::SQLDataControlConsumer() 
 {
        LoggerD("Enter");
@@ -358,8 +368,8 @@ SQLDataControlConsumer::SQLDataControlConsumer()
        m_type = "";;
        m_dataId = "";
        m_providerId = "";
-
-
+       m_currentAppId = getCurrentApplicationId();
+       createResultDir();
 }
 
 SQLDataControlConsumer::~SQLDataControlConsumer() 
@@ -369,6 +379,23 @@ SQLDataControlConsumer::~SQLDataControlConsumer()
 
 DPL::Mutex SQLDataControlConsumer::m_mutex;
 
+std::string SQLDataControlConsumer::getCurrentApplicationId()
+{
+       char *app_id = NULL;
+       std::string appId = "";
+       int parent_pid = getppid();
+       LoggerD("parent pid : " << parent_pid); 
+       int ret = app_manager_get_app_id(parent_pid, &app_id);  
+
+       if((ret != APP_ERROR_NONE) || (app_id == NULL))
+       {
+               LoggerE("Can not get app id from current pid (" << ret << ")");
+               ThrowMsg(WrtDeviceApis::Commons::PlatformException, "could not get information about application");
+       }
+       appId = app_id;
+       free(app_id);
+       return appId;           
+}
 
 void SQLDataControlConsumer::setType(std::string& type)
 {
@@ -480,6 +507,43 @@ std::string SQLDataControlConsumer::getApplicationId(const std::string& provId)
 
 }
 
+std::string SQLDataControlConsumer::generateFileName(unsigned int reqId)
+{
+       std::stringstream ssdata;
+       ssdata.str("");
+       ssdata << reqId;
+       std::string parent = DATACONTROL_PROTOCOL_DIR;
+       std::string filename = parent  + "/" + m_currentAppId + ssdata.str();
+       return filename;
+}
+
+void SQLDataControlConsumer::saveArrayToFile(std::string filename, RowDataPtr &rowData)
+{
+       std::fstream insertUpdateFile;
+       std::map<std::string, std::string>::iterator it;
+       int strLength = 0;
+       insertUpdateFile.open(filename.c_str(), std::ios::out | std::ios::binary);
+
+       if (!insertUpdateFile.is_open()) 
+       {
+               LoggerD("fail open" << filename);
+               ThrowMsg(WrtDeviceApis::Commons::PlatformException, "DataControl IPC Error");
+       }
+
+       for (it = rowData->m_Data.begin(); it != rowData->m_Data.end(); ++it)
+       {
+               strLength = it->first.size();
+               insertUpdateFile.write((const char*)&strLength, sizeof(int));
+               insertUpdateFile.write(it->first.c_str(), strLength);
+
+               strLength = it->second.size();
+               insertUpdateFile.write((const char*)&strLength, sizeof(int));
+               insertUpdateFile.write(it->second.c_str(), strLength);
+       }
+       
+       insertUpdateFile.close();               
+       
+}
 void SQLDataControlConsumer::addArrayToBundle(bundle* passData, std::vector<std::string>& array)
 {
        size_t arraySize = array.size();
@@ -553,6 +617,42 @@ void SQLDataControlConsumer::updateData(const EventUpdatePtr& event)
        WrtDeviceApis::Commons::EventRequestReceiver<EventUpdate>::PostRequest(event);
 }
 
+void SQLDataControlConsumer::createResultDir()
+{
+    struct stat info;
+    memset(&info, 0, sizeof(struct stat));
+
+    int status = lstat(DATACONTROL_PROTOCOL_DIR_PARENT, &info);
+
+       if (status != 0 && errno == ENOENT) 
+       {
+               if (mkdir(DATACONTROL_PROTOCOL_DIR_PARENT, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) 
+               {
+                       LoggerD("make error");
+                       ThrowMsg(WrtDeviceApis::Commons::PlatformException, "result dir could not be created.");
+               }
+       }
+               
+    status = lstat(DATACONTROL_PROTOCOL_DIR, &info);
+
+       // already exist
+       if (status == 0) 
+       {
+               LoggerD("already exist");
+        return;
+    } 
+       else if (errno == ENOENT) 
+       {
+               if (mkdir(DATACONTROL_PROTOCOL_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) 
+               {
+                       LoggerD("make error");
+                       ThrowMsg(WrtDeviceApis::Commons::PlatformException, "result dir could not be created.");
+               }
+               return;
+    }
+    ThrowMsg(WrtDeviceApis::Commons::PlatformException, "result dir could be error during checking status");
+}
+
 void SQLDataControlConsumer::OnRequestReceived(const EventInsertPtr& event)
 {
        LoggerD("Enter");
@@ -570,6 +670,7 @@ void SQLDataControlConsumer::OnRequestReceived(const EventInsertPtr& event)
                int columnSize = rowData->m_Data.size();
                std::stringstream counts;
                std::string countStr;
+               std::string ipcFilename = generateFileName(reqId);
 
                if (checkReqIdUniqueness(reqId) == false)
                {
@@ -612,19 +713,24 @@ void SQLDataControlConsumer::OnRequestReceived(const EventInsertPtr& event)
                bundle_add(passData, OSP_K_LAUNCH_TYPE, OSP_V_LAUNCH_TYPE_DATACONTROL);
                bundle_add(passData, OSP_K_DATACONTROL_REQUEST_TYPE, reqtypestr.c_str());
                bundle_add(passData, OSP_K_DATACONTROL_PROVIDER, m_providerId.c_str());
+               bundle_add(passData, OSP_K_DATACONTROL_PROTOCOL_VERSION, OSP_K_DATACONTROL_PROTOCOL_VERSION_VALUE); // version
 
                queryItem.push_back(dataId); // dataid
-               queryItem.push_back(countStr);
+               queryItem.push_back(countStr); // count
+               queryItem.push_back(ipcFilename); // filepath
 
-               std::map<std::string, std::string>::iterator it;
+               // 
+/*             std::map<std::string, std::string>::iterator it;
 
                for (it = rowData->m_Data.begin(); it != rowData->m_Data.end(); ++it)
                {
                        queryItem.push_back(it->first);
                        queryItem.push_back(it->second);
-               }
-
+               }*/
+               
                addArrayToBundle(passData, queryItem);
+               saveArrayToFile(ipcFilename, rowData);
+
 
                // FIXEME
                // reqid sholud be known
@@ -903,6 +1009,7 @@ void SQLDataControlConsumer::OnRequestReceived(const EventUpdatePtr& event)
                int columnSize = rowData->m_Data.size();
                std::stringstream ss, ssreqtype;
                std::string reqIdStr, reqtypestr;
+               std::string ipcFilename = generateFileName(reqId);
 
 
                if (checkReqIdUniqueness(reqId) == false)
@@ -934,6 +1041,8 @@ void SQLDataControlConsumer::OnRequestReceived(const EventUpdatePtr& event)
                bundle_add(passData, OSP_K_LAUNCH_TYPE, OSP_V_LAUNCH_TYPE_DATACONTROL);
                bundle_add(passData, OSP_K_DATACONTROL_REQUEST_TYPE, reqtypestr.c_str());
                bundle_add(passData, OSP_K_DATACONTROL_PROVIDER, m_providerId.c_str());
+               bundle_add(passData, OSP_K_DATACONTROL_PROTOCOL_VERSION, OSP_K_DATACONTROL_PROTOCOL_VERSION_VALUE);
+               
 
                queryItem.push_back(dataId); // dataid
 
@@ -949,14 +1058,17 @@ void SQLDataControlConsumer::OnRequestReceived(const EventUpdatePtr& event)
 
                        counts << columnSize;
                        countStr = counts.str();
-                       queryItem.push_back(countStr);
+                       queryItem.push_back(countStr); // count
+                       queryItem.push_back(ipcFilename); // filepath
 
-                       for (std::map<std::string, std::string>::iterator it= rowData->m_Data.begin();
+/*                     for (std::map<std::string, std::string>::iterator it= rowData->m_Data.begin();
                                it != rowData->m_Data.end(); ++it)
                        {
                                queryItem.push_back((*it).first); // key - column
                                queryItem.push_back((*it).second); // value
-                       }
+                       }*/
+                       saveArrayToFile(ipcFilename, rowData);
+                       
 
                }
 
index dc1d296..90e6a29 100755 (executable)
@@ -61,10 +61,14 @@ private:
        std::string m_appId;
        
        std::string getApplicationId(const std::string& provId);
+       std::string getCurrentApplicationId();
        void addArrayToBundle(bundle* passData, std::vector<std::string>& array);
        std::vector<unsigned int> m_currentReqIds;
        bool checkReqIdUniqueness(unsigned int reqId);
-       void removeReqId(unsigned int reqId);
+       void removeReqId(unsigned int reqId);           
+       std::string generateFileName(unsigned int reqId);
+       void saveArrayToFile(std::string filename, RowDataPtr &rowData);
+       void createResultDir();
 
        static DPL::Mutex m_mutex;
 protected:
@@ -74,10 +78,8 @@ protected:
        virtual void OnRequestReceived(const EventDeletePtr& event);
        virtual void OnRequestReceived(const EventSelectPtr& event);
        virtual void OnRequestReceived(const EventUpdatePtr& event);
-
-
-
 private:
+       std::string m_currentAppId;
 
 
 };
index 7ffde2f..05d9b1d 100644 (file)
@@ -330,23 +330,23 @@ bool JSMessage::setProperty(JSContextRef context,
             if(JSStringIsEqualToUTF8CString(propertyName,m_property[index].name)) {
                 if(m_property[index].setProperty != NULL) {
                     if (JSStringIsEqualToUTF8CString(propertyName, MESSAGE_ATTRIBUTE_TO)){
-                        if (JSValueIsNull(context, value))
+                        if (JSValueIsNull(context, value)||JSValueIsUndefined(context, value))
                         {
-                            throw TypeMismatchException("Value is null");
+                            throw TypeMismatchException("Value is null or undefined");
                         }
                         JSUtil::JSArrayToStringVector(context, value);
                     }
                     if (JSStringIsEqualToUTF8CString(propertyName, MESSAGE_ATTRIBUTE_CC)){
-                        if (JSValueIsNull(context, value))
+                        if (JSValueIsNull(context, value)||JSValueIsUndefined(context, value))
                         {
-                            throw TypeMismatchException("Value is null");
+                            throw TypeMismatchException("Value is null or undefined");
                         }
                         JSUtil::JSArrayToStringVector(context, value);
                     }
                     if (JSStringIsEqualToUTF8CString(propertyName, MESSAGE_ATTRIBUTE_BCC)){
-                        if (JSValueIsNull(context, value))
+                        if (JSValueIsNull(context, value)||JSValueIsUndefined(context, value))
                         {
-                            throw TypeMismatchException("Value is null");
+                            throw TypeMismatchException("Value is null or undefined");
                         }
                         JSUtil::JSArrayToStringVector(context, value);
                     }
@@ -557,15 +557,12 @@ JSObjectRef JSMessage::constructor(JSContextRef context,
             }
         }
 
-        //return
-        JSClassRef jsClassRef = JSClassCreate(JSMessage::getClassInfo());
-        LoggerD("jsClassRef success");
+
         JSMessagePrivateObject* priv = new JSMessagePrivateObject(context, msg);
         LoggerD("priv success");
 
-        JSObjectRef jsObjRef = JSObjectMake(context, jsClassRef, static_cast<void*>(priv));
+        JSObjectRef jsObjRef = JSObjectMake(context, JSMessage::getClassRef(), static_cast<void*>(priv));
         LoggerD("JSObjectMake success");
-        JSClassRelease(jsClassRef);
         if (NULL == jsObjRef) {
             LoggerE("JSObject creation error");
             throw DeviceAPI::Common::UnknownException("JSObject make error");
index 792b766..9be10e2 100644 (file)
@@ -527,14 +527,11 @@ JSObjectRef JSMessageAttachment::constructor(JSContextRef context,
                                                                                mimetype);
                if (attachment)
                {
-                       JSClassRef jsClassRef = JSClassCreate(getClassInfo());
-                       LoggerD("jsClassRef success");
                        JSMessageAttachmentPrivate* priv = new JSMessageAttachmentPrivate(context, attachment);
                        LoggerD("priv success");
 
-                       JSObjectRef jsObjRef = JSObjectMake(context, jsClassRef, static_cast<void*>(priv));
+                       JSObjectRef jsObjRef = JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
                        LoggerD("JSObjectMake success");
-                       JSClassRelease(jsClassRef);
                        if (NULL == jsObjRef) {
                                LoggerE("object creation error");
                                throw DeviceAPI::Common::UnknownException("JSObject make error");
index f373a35..eafd0b4 100644 (file)
@@ -354,7 +354,7 @@ std::string JSMessageFolder::convertFolderType(int msgType){
        }else if(msgType == USERDEFINED_FOLDER){
                return JSMessageFolder::FOLDER_NOTSTANDARD;
        }else{
-               return NULL;
+               return JSMessageFolder::FOLDER_NOTSTANDARD;
        }
  }
 
index 430519f..1658d09 100644 (file)
@@ -42,7 +42,7 @@ public:
          FOLDER_OUTBOX = 2,
          FOLDER_DRAFTS = 3,
          FOLDER_SENTBOX = 4,
-         FOLDER_NOTSTANDARD = 7,                 
+         FOLDER_NOTSTANDARD = 10,
        } MsgFolder_FolerType;
 
        typedef enum
index fe5bf42..3b2bba5 100644 (file)
@@ -219,7 +219,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt
        filter->travel(filterVisitor, 0);
        filterSql = queryGenerator->getQuery();
 
-       LoggerD(">>> filterSql:[" << filterSql << "]");
+//     LOGD(">>> filterSql:[%s]",  filterSql.c_str());
        return filterSql;
 }
 
@@ -353,7 +353,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt
        }
 
        vector<IMessagePtr> Messaging::querySmsMmsMessages(const std::string& queryString){
-               LoggerD("<<< queryString:[" << queryString <<"]");
+//             LOGD("<<< queryString:[%s]" ,queryString.c_str());
 
                vector<IMessagePtr> retVal;
                std::string tempString = "";
@@ -388,8 +388,8 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt
        }
 
        vector<IMessagePtr> Messaging::querySmsMmsMessages(const std::string& queryString, const std::string& orderLimitString){
-               LoggerD("<<< queryString:[" << queryString <<"]");
-               LoggerD("<<< orderLimitString:[" << orderLimitString <<"]");            
+//             LOGD("<<< queryString:[%s]", queryString.c_str());
+//             LOGD("<<< orderLimitString:[%s]", orderLimitString.c_str());            
 
                vector<IMessagePtr> retVal;
 //             MSG_LIST_S message_list = {0, NULL};
@@ -425,8 +425,8 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt
        }
 
 vector<IConversationPtr> Messaging::querySmsMmsConversation(const std::string& sqlWhereClause, const std::string& orderLimitString){
-       LoggerD("sqlWhereClause:[" << sqlWhereClause << "]");
-       LoggerD("<<< orderLimitString:[" << orderLimitString <<"]");            
+//     LOGD("sqlWhereClause:[%s]", sqlWhereClause.c_str());
+//     LOGD("<<< orderLimitString:[%s]", orderLimitString.c_str());            
 
        std::vector<IConversationPtr> recVec;
 //     MSG_THREAD_VIEW_LIST_S threadViewList;
@@ -453,7 +453,7 @@ vector<IConversationPtr> Messaging::querySmsMmsConversation(const std::string& s
 }
 
 vector<IConversationPtr> Messaging::queryEmailConversation(const std::string& sqlWhereClause){
-       LoggerD("sqlWhereClause:[" << sqlWhereClause << "]");
+//     LOGD("sqlWhereClause:[%s]",sqlWhereClause.c_str());
 
        std::vector<IConversationPtr> emailResultVector;
        email_mail_list_item_t* mailList = NULL;
@@ -499,7 +499,7 @@ vector<IConversationPtr> Messaging::queryEmailConversation(const std::string& sq
 }
 
 vector<IMessagePtr> Messaging::queryEmailMessage(const std::string& sqlWhereClause){
-       LoggerD("sqlWhereClause:[" << sqlWhereClause << "]");
+//     LOGD("sqlWhereClause:[%s]", sqlWhereClause.c_str());
 
        vector<IMessagePtr> emailResultVector;
 
@@ -551,7 +551,7 @@ vector<IMessagePtr> Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f
        IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
        filter->travel(filterVisitor, 0);
        filterSql = queryGenerator->getQuery();
-       LoggerD("filterSql:[" << filterSql <<"]");
+//     LOGD("filterSql:[%s]",  filterSql.c_str());
 
        int messageType = queryGenerator->getMessageType();
        switch(messageType){
@@ -593,7 +593,7 @@ vector<IMessagePtr> Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f
        IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
        filter->travel(filterVisitor, 0);
        filterSql = queryGenerator->getQuery();
-       LoggerD("filterSql:[" << filterSql <<"]");
+//     LOGD("filterSql:[%s]",  filterSql.c_str());
 
        int messageType = queryGenerator->getMessageType();
        switch(messageType){
@@ -638,8 +638,9 @@ vector<IMessagePtr> Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f
        filter->travel(filterVisitor, 0);
        filterSql = queryGenerator->getQuery();
        orderLimitSql = queryGenerator->getOrderLimit();
-       LoggerD("filterSql:[" << filterSql <<"]");
-       LoggerD("orderLimitSql:[" << orderLimitSql <<"]");
+//     //LOGD("filterSql:[%s]",  filterSql.c_str());
+//     LOGD("filterSql:[%s]",  filterSql.c_str());
+//     LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
 
        int messageType = queryGenerator->getMessageType();
        if(messageType != -1)
@@ -654,7 +655,7 @@ vector<IMessagePtr> Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f
                case EMAIL:
                        LoggerD("message type is EMAIL:[" << messageType <<"]");
                        emailFilterSql = filterSql + orderLimitSql;
-                       LoggerD("filterSql:[" << emailFilterSql <<"]");
+//                     LOGD("filterSql:[%s]",  emailFilterSql.c_str());
                        retVal = queryEmailMessage(emailFilterSql);
                        break;
 
@@ -665,17 +666,17 @@ vector<IMessagePtr> Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f
                        if(filterSql.length() == 0)
                        {
                                filterSql.append(typeString);
-                               LoggerD("filterSql:[" << filterSql <<"]");
+//                             LOGD("filterSql:[%s]",  filterSql.c_str());
                        }
                        else
                        {
                                filterSql.append(typeAndString);
-                               LoggerD("filterSql:[" << filterSql <<"]");                              
+//                             LOGD("filterSql:[%s]",  filterSql.c_str());
                        }
-                       LoggerD("filterSql:[" << filterSql <<"]");
+//                     LOGD("filterSql:[%s]",  filterSql.c_str());
                        LoggerD("orderLimitSql.length():[" << orderLimitSql.length() <<"]");
                        retVal = querySmsMmsMessages(filterSql, orderLimitSql);
-                       LoggerD("filterSql:[" << filterSql <<"]");                              
+//                     LOGD("filterSql:[%s]",  filterSql.c_str());
                        break;                  
                case MMS:
                        LoggerD("message type is MMS:[" << messageType <<"]");
@@ -684,17 +685,17 @@ vector<IMessagePtr> Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f
                        if(filterSql.length() == 0)
                        {
                                filterSql.append(typeString);
-                               LoggerD("filterSql:[" << filterSql <<"]");
+//                             LOGD("filterSql:[%s]",  filterSql.c_str());
                        }
                        else
                        {
                                filterSql.append(typeAndString);
-                               LoggerD("filterSql:[" << filterSql <<"]");                      
+//                             LOGD("filterSql:[%s]",  filterSql.c_str());                     
                        }
-                       LoggerD("filterSql:[" << filterSql <<"]");                      
+//                     LOGD("filterSql:[%s]",  filterSql.c_str());                     
                        LoggerD("orderLimitSql.length():[" << orderLimitSql.length() <<"]");
                        retVal = querySmsMmsMessages(filterSql, orderLimitSql);
-                       LoggerD("filterSql:[" << filterSql <<"]");                      
+//                     LOGD("filterSql:[%s]",  filterSql.c_str());                     
                        break;
 
                default:
@@ -2379,7 +2380,7 @@ std::vector<IConversationPtr> Messaging::queryConversations(const DeviceAPI::Tiz
        IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
        filter->travel(filterVisitor, 0);
 
-       LoggerD("filterSql:[" << filterSql <<"]");
+//     LOGD("filterSql:[%s]",  filterSql.c_str());
 
        int conversationType = queryGenerator->getMessageType();
        switch(conversationType){
@@ -2398,8 +2399,8 @@ std::vector<IConversationPtr> Messaging::queryConversations(const DeviceAPI::Tiz
                        IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
                        filter->travel(filterVisitor, 0);
                        filterSql = queryGenerator->getQuery();
-                       LoggerD("filterSql:[" << filterSql <<"]");
-                       LoggerD("orderLimitSql:[" << orderLimitSql <<"]");
+//                     LOGD("filterSql:[%s]",  filterSql.c_str());
+//                     LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
                        result = querySmsMmsConversation(filterSql, orderLimitSql);
                        break;
                }
@@ -2410,8 +2411,8 @@ std::vector<IConversationPtr> Messaging::queryConversations(const DeviceAPI::Tiz
                        IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
                        filter->travel(filterVisitor, 0);
                        filterSql = queryGenerator->getQuery(); 
-                       LoggerD("filterSql:[" << filterSql <<"]");
-                       LoggerD("orderLimitSql:[" << orderLimitSql <<"]");
+//                     LOGD("filterSql:[%s]",  filterSql.c_str());
+//                     LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
                        result = querySmsMmsConversation(filterSql, orderLimitSql);
                        break;
                }
@@ -2438,7 +2439,7 @@ std::vector<IConversationPtr> Messaging::queryConversations(const DeviceAPI::Tiz
        IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast<IFilterVisitor>(queryGenerator);
        filter->travel(filterVisitor, 0);
 
-       LoggerD("filterSql:[" << filterSql <<"]");
+//     LOGD("filterSql:[%s]",  filterSql.c_str());
        int conversationType = queryGenerator->getMessageType();
        if(conversationType != -1)
        {
@@ -2454,7 +2455,7 @@ std::vector<IConversationPtr> Messaging::queryConversations(const DeviceAPI::Tiz
                        queryGenerator->reset(MessageQueryGenerator::MODE_EMAIL);
                        filter->travel(filterVisitor, 0);
                        filterSql = queryGenerator->getQuery();
-                       LoggerD("filterSql:[" << filterSql <<"]");
+//                     LOGD("filterSql:[%s]",  filterSql.c_str());
                        result = queryEmailConversation(filterSql);
                        break;
                }
@@ -2466,8 +2467,8 @@ std::vector<IConversationPtr> Messaging::queryConversations(const DeviceAPI::Tiz
                        filter->travel(filterVisitor, 0);
                        filterSql = queryGenerator->getQuery();
                        orderLimitSql = queryGenerator->getOrderLimit();
-                       LoggerD("filterSql:[" << filterSql <<"]");
-                       LoggerD("orderLimitSql:[" << orderLimitSql <<"]");                      
+//                     LOGD("filterSql:[%s]",  filterSql.c_str());
+//                     LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
                        result = querySmsMmsConversation(filterSql, orderLimitSql);
                        break;
                }
@@ -2479,8 +2480,8 @@ std::vector<IConversationPtr> Messaging::queryConversations(const DeviceAPI::Tiz
                        filter->travel(filterVisitor, 0);
                        filterSql = queryGenerator->getQuery();
                        orderLimitSql = queryGenerator->getOrderLimit();        
-                       LoggerD("filterSql:[" << filterSql <<"]");
-                       LoggerD("orderLimitSql:[" << orderLimitSql <<"]");
+//                     LOGD("filterSql:[%s]",  filterSql.c_str());
+//                     LOGD("orderLimitSql:[%s]", orderLimitSql.c_str());
                        result = querySmsMmsConversation(filterSql, orderLimitSql);
                        break;
                }
index 2756d42..1c120c7 100644 (file)
@@ -177,7 +177,7 @@ msg_error_t MessageStorageReader::MsgStoDisconnectDB(){
 
 // MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList)
 int MessageStorageReader::queryMessage(const std::string& whereClause, const std::string& orderLimit, /*out*/msg_struct_list_s *pMsgList){
-       LoggerD("<<< whereClause:[" << whereClause << "]");
+//     LOGD("<<< whereClause:[%s]", whereClause.c_str());
 
        // Clear Out Parameter
        pMsgList->nCount = 0;
@@ -216,20 +216,20 @@ FROM " << MSGFW_MESSAGE_TABLE_NAME << " A, " << MSGFW_ADDRESS_TABLE_NAME << " B
 
        if(orderLimit.length() == 0)
        {
-               LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+//             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
        }
        else
        {
                tmpWhereClause.append(orderLimit);
-               LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+//             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
        }
-       LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+//     LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
 
 
        oStream << tmpWhereClause;
        stringSqlQuery = oStream.str();
 
-       LoggerD("stringSqlQuery:[" << stringSqlQuery << "]");
+//     LOGD("stringSqlQuery:[%s]", stringSqlQuery.c_str());
        msg_error_t err = dbHandle.getTable(stringSqlQuery.c_str(), &rowCnt);
 
        if (err == MSG_ERR_DB_NORECORD) {
@@ -389,25 +389,25 @@ int MessageStorageReader::queryConversation(const std::string& whereClause, cons
        std::string stringSqlQuery;
 
        std::string tmpWhereClause;
-       LoggerD("<<< whereClause:[" << whereClause << "]");
+//     LOGD("<<< whereClause:[%s]",whereClause.c_str());
        if(whereClause.length()==0){
-               LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");               
+//             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
                tmpWhereClause.append("WHERE (B.SMS_CNT > 0 OR B.MMS_CNT > 0) AND A.CONV_ID = B.CONV_ID ");
-               LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");                       
+//             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
        }else{
-               LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");       
+//             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
                tmpWhereClause.append(whereClause);
-               LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");       
+//             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
        }
 
        if(orderLimit.length() == 0)
        {
-               LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+//             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
        }
        else
        {
                tmpWhereClause.append(orderLimit);
-               LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]");
+//             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
        }
 
        oStream << "SELECT B.CONV_ID, B.UNREAD_CNT, B.SMS_CNT, B.MMS_CNT, \
@@ -416,7 +416,7 @@ FROM " << MSGFW_ADDRESS_TABLE_NAME << " A, "  << MSGFW_CONVERSATION_TABLE_NAME
 
        oStream << tmpWhereClause;
        stringSqlQuery = oStream.str();
-       LoggerD("stringSqlQuery:[" << stringSqlQuery << "]");
+//     LOGD("stringSqlQuery:[%s]", stringSqlQuery.c_str());
 
        msg_error_t err = dbHandle.getTable(stringSqlQuery.c_str(), &rowCnt);
 
@@ -424,7 +424,7 @@ FROM " << MSGFW_ADDRESS_TABLE_NAME << " A, "  << MSGFW_CONVERSATION_TABLE_NAME
                dbHandle.freeTable();
                return MSG_SUCCESS;
        } else if (err != MSG_SUCCESS) {
-               LoggerD("stringSqlQuery:[" << stringSqlQuery << "]");
+//             LOGD("stringSqlQuery:[%s]", stringSqlQuery.c_str());
                dbHandle.freeTable();
                return err;
        }
index 38607e2..016421e 100755 (executable)
@@ -34,7 +34,7 @@ namespace Messaging {
 
 namespace Options{
 
-class_definition_options_t TizenOptions =
+class_definition_options_t MessagingOptions =
 {
     JS_CLASS,
     CREATE_INSTANCE,
@@ -100,11 +100,10 @@ PLUGIN_ON_FRAME_LOAD(on_frame_load_callback)
 PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback)
 
 PLUGIN_CLASS_MAP_BEGIN
-       PLUGIN_CLASS_MAP_ADD_CLASS(
-               WRT_JS_EXTENSION_OBJECT_TIZEN,
-               "messaging",
-               (js_class_template_getter)DeviceAPI::Messaging::JSMessagingServiceManager::getClassRef,
-               NULL)
+    PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
+                               "messaging",
+                               (js_class_template_getter)DeviceAPI::Messaging::JSMessagingServiceManager::getClassRef,
+                               &Options::MessagingOptions)
 
     PLUGIN_CLASS_MAP_ADD_INTERFACE(WRT_JS_EXTENSION_OBJECT_TIZEN,
                                "Message",
index 91813ce..ce64dc6 100644 (file)
@@ -588,6 +588,40 @@ void install_request_cb(int id, const char *type, const char *package,
 
 }
 
+static string ltrim(const string s)
+{
+       string str = s;
+       string::iterator i;
+       for (i = str.begin(); i != str.end(); i++) {
+               if (!isspace(*i)) {
+                       break;
+               }
+       }
+       if (i == str.end()) {
+               str.clear();
+       } else {
+               str.erase(str.begin(), i);
+       }
+       return str;
+}
+
+
+static string convertUriToPath(const string str)
+{
+       string result;
+       string schema ("file://");
+       string _str = ltrim(str);
+
+       string _schema = _str.substr(0,schema.size());
+       if(_schema == schema) {
+               result = _str.substr(schema.size());
+       } else {
+               result = _str;
+       }
+       return result;
+}
+
+
 void PackageManager::install(string pkgPath, PackageInstallEventCallback* callback)
 {
        int ret = 0;
@@ -607,7 +641,7 @@ void PackageManager::install(string pkgPath, PackageInstallEventCallback* callba
                return;
        }
 
-       ret = package_manager_request_install(request_h, pkgPath.c_str(), &id);
+       ret = package_manager_request_install(request_h, convertUriToPath(pkgPath).c_str(), &id);
        if (ret != PACKAGE_MANAGER_ERROR_NONE) {
                if (errCallback) {
                        JSValueRef error =