change log and spec for wrt-plugins-tizen_0.4.31
authorDongjin Choi <milkelf.choi@samsung.com>
Wed, 15 May 2013 07:14:48 +0000 (16:14 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Wed, 15 May 2013 07:14:48 +0000 (16:14 +0900)
[model] REDWOOD
[binary_type] PDA
[customer] OPEN

[Issue] N/A
[Problem] findMessages with timestamp range filter bug fix
[Cause] findMessages with timestamp range filter bug fix
[Solution] findMessages with timestamp range filter bug fix

[Issue#] DCM-1610
[Problem] The text [null] appears in the notification area
[Cause] if JS Null value , it will be as [null]
[Solution] inserted checking null value.

[Issue] N/A
[Problem] findConversations filter updated for: from, to, cc, bcc
[Cause] findConversations filter updated for: from, to, cc, bcc
[Solution] findConversations filter updated for: from, to, cc, bcc

[Issue] N/A
[Problem] findMessage with id error bug fix
[Cause] findMessage with id error bug fix
[Solution] findMessage with id error bug fix

[Issue#] TDIS-5521
[Problem] Constructor is not nullable. but, null check is added to constructor
[Cause] N/A
[Solution] remove null check and just convert null to 0

[Issue#] N/A
[Problem] Some error case is not handled (getAppSharedURI)
[Cause] N/A
[Solution] add error handling case

[Issue] Prevent 53191, 53192
[Problem] Structurally dead code
[Cause]  Structurally dead code
[Solution] remove code

[Issue] N/A
[Problem] N/A
[Cause]  Core api's policy is changed
[Solution] apply to filter for find function

[Issue] N/A
[Problem] N/A
[Cause]  Core api's policy is changed
[Solution] apply to filter for find function

[Issue#] DCM-1574
[Problem] "daysOfTheWeek" attribute not updated.
[Cause] Wrong update routine for rrule array.
[Solution] Revise the rrule array attribute routine together with platform crash patch.

[Issue] N/A
[Problem] Previous precondition script could not insert call log because of supporting SMACK.
[Solution] Fixed the precondition script.

13 files changed:
packaging/wrt-plugins-tizen.spec
src/Alarm/JSAlarmAbsolute.cpp
src/Application/ApplicationManager.cpp
src/Calendar/EventWrapper.cpp
src/Content/ContentManager.cpp
src/Messaging/Conversation.cpp
src/Messaging/Email.cpp
src/Messaging/Email.h
src/Messaging/JSMessage.cpp
src/Messaging/JSMessageAttachment.cpp
src/Messaging/MessageQueryGenerator.cpp
src/Messaging/Messaging.cpp
src/Notification/JSStatusNotification.cpp

index 0f1aec8..28cb9d0 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.30
+Version:    0.4.31
 Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index fa3cca4..3cf43db 100644 (file)
@@ -148,11 +148,7 @@ JSObjectRef DLL_EXPORT JSAlarmAbsolute::constructor(JSContextRef ctx, JSObjectRe
                                        throw InvalidValuesException("period can not be negative value");
                                }
 
-                               if (!JSValueIsNull(ctx, arguments[1])) {
-                                       priv->setInterval(interval);
-                               } else {
-                                       priv->setInterval(-1);
-                               }
+                               priv->setInterval(interval);
                        }
                }
 
@@ -234,12 +230,22 @@ JSValueRef JSAlarmAbsolute::getNextScheduledDate( JSContextRef ctx, JSObjectRef
                
         int id = privateData->getId(); 
         int err = alarm_get_scheduled_date(id, &date);
-        JSValueRef result = converter.toJSValueRef(date);
+        if(err != ALARM_ERROR_NONE) {
+            return JSValueMakeNull(ctx);
+        }
 
+        // check wheter the alarm is expired or not
+        struct tm curr_date;
+        err = alarm_get_current_time(&curr_date);
         if(err != ALARM_ERROR_NONE) {
             return JSValueMakeNull(ctx);
         }
-        return result;
+
+        if (mktime(&date) < mktime(&curr_date)) {
+            return JSValueMakeNull(ctx);
+        }
+
+        return converter.toJSValueRef(date);
                
        } catch (const BasePlatformException &err) {
         return JSWebAPIErrorFactory::postException(ctx, exception, err);
index 186ba0b..0a1e04a 100644 (file)
@@ -1495,7 +1495,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppSharedURI
        }
 
        ret = pkgmgrinfo_pkginfo_get_root_path(pkginfo_h, &root_path);
-       if ((ret != PMINFO_R_OK) && (root_path != NULL)) {
+       if ((ret != PMINFO_R_OK) || (root_path == NULL)) {
                LoggerE("Fail to get root path");
                free(pkg_name);
                event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
index 81b7004..7cb4131 100755 (executable)
@@ -524,7 +524,9 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent()
     if (NULL==rrule) {
         LoggerW("No way! Rrule is not set!");
         return;
-    } else if(EventRecurrenceRule::NO_RECURRENCE==rrule->getFrequency()) {
+    }
+
+       if(EventRecurrenceRule::NO_RECURRENCE==rrule->getFrequency()) {
         LoggerD("No recurrence frequency.");
     } else if(EventRecurrenceRule::UNDEFINED_RECURRENCE==rrule->getFrequency()) {
         LoggerD("Undefined recurrence frequency.");
@@ -539,6 +541,7 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent()
         if(CALENDAR_ERROR_NONE!=calendar_record_set_int(m_platformEvent, _calendar_event.freq, CALENDAR_RECURRENCE_NONE)) {
             LoggerW("Failed setting frequency.");
         }
+               return;
         break;
     case EventRecurrenceRule::DAILY_RECURRENCE:
         if(CALENDAR_ERROR_NONE!=calendar_record_set_int(m_platformEvent, _calendar_event.freq, CALENDAR_RECURRENCE_DAILY)) {
@@ -573,19 +576,18 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent()
 
     // set byday
     StringArrayPtr daysOfTheWeek = rrule->getDaysOfTheWeek();
+       std::string byday = "";
     if( 0 != daysOfTheWeek->size() ) {
-        std::string byday = "";
         for(unsigned int i=0; i<daysOfTheWeek->size(); i++) {
             byday.append(daysOfTheWeek->at(i));
             if(i!=daysOfTheWeek->size()-1) {
                 byday.append(",");
             }
         }
-
-        LoggerD("byday: "<<byday);
-        if (CALENDAR_ERROR_NONE!=calendar_record_set_str(m_platformEvent, _calendar_event.byday, byday.c_str())) {
-            LoggerW("Can't set byday.");
-        }
+    }
+    LoggerD("byday: "<<byday);
+    if (CALENDAR_ERROR_NONE!=calendar_record_set_str(m_platformEvent, _calendar_event.byday, byday.c_str())) {
+        LoggerW("Can't set byday.");
     }
 
     // set the ocurrence count
@@ -602,13 +604,11 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent()
     }
 
     // set the exceptions
-    if ( !rrule->getExceptions()->empty() )
-    {
+    std::string exdate = "";
+    if ( !rrule->getExceptions()->empty() ) {
         LoggerD("Set the exceptions of length: "<<rrule->getExceptions()->size());
 
-        std::string exdate = "";
-        for( unsigned int i=0; i<rrule->getExceptions()->size(); i++ )
-        {
+        for( unsigned int i=0; i<rrule->getExceptions()->size(); i++ ) {
             std::stringstream ss;
             ss<<rrule->getExceptions()->at(i);
             exdate.append(ss.str());
@@ -616,20 +616,18 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent()
                 exdate.append(",");
             }
         }
-        LoggerD("exdate: "<<exdate);
-        if (CALENDAR_ERROR_NONE!=calendar_record_set_str(m_platformEvent, _calendar_event.exdate, exdate.c_str())) {
-            LoggerW("Can't save exceptions.");
-        }
+    }
+    LoggerD("exdate: "<<exdate);
+    if (CALENDAR_ERROR_NONE!=calendar_record_set_str(m_platformEvent, _calendar_event.exdate, exdate.c_str())) {
+        LoggerW("Can't save exceptions.");
     }
 
     // set the setPositions
-    if ( !rrule->getSetPositions()->empty() )
-    {
+    std::string bysetpos = "";
+    if ( !rrule->getSetPositions()->empty() ) {
         LoggerD("Set the setPositions of length: "<<rrule->getSetPositions()->size());
 
-        std::string bysetpos = "";
-        for( unsigned int i=0; i<rrule->getSetPositions()->size(); i++ )
-        {
+        for( unsigned int i=0; i<rrule->getSetPositions()->size(); i++ ) {
             std::stringstream ss;
             ss<<rrule->getSetPositions()->at(i);
             bysetpos.append(ss.str());
@@ -637,17 +635,14 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent()
                 bysetpos.append(",");
             }
         }
-        LoggerD("bysetpos: "<<bysetpos);
-        if (CALENDAR_ERROR_NONE!=calendar_record_set_str(m_platformEvent, _calendar_event.bysetpos, bysetpos.c_str())) {
-            LoggerW("Can't save setPositions.");
-        }
+    }
+    LoggerD("bysetpos: "<<bysetpos);
+    if (CALENDAR_ERROR_NONE!=calendar_record_set_str(m_platformEvent, _calendar_event.bysetpos, bysetpos.c_str())) {
+        LoggerW("Can't save setPositions.");
     }
 
     // set the recurrence interval
-    if (CALENDAR_ERROR_NONE != calendar_record_set_int(m_platformEvent,
-                                                   _calendar_event.interval,
-                                                   rrule->getInterval()))
-    {
+    if (CALENDAR_ERROR_NONE != calendar_record_set_int(m_platformEvent, _calendar_event.interval, rrule->getInterval())) {
         LoggerW("Can't set interval.");
     }
 
index 0bbfb3e..6c1ca0a 100755 (executable)
@@ -656,7 +656,7 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten
 
 //Callback.
 bool MediacontentManager::mediaFolderCallback(media_folder_h folder, void *user_data)
-{      
+{
        if (user_data != NULL){
                IEventFindFolder* event = (IEventFindFolder*)user_data;
                if ( folder )
@@ -723,161 +723,163 @@ bool MediacontentManager::mediaItemCallback(media_info_h info, void* user_data)
 
 void MediacontentManager::OnRequestReceived(const IEventFindFolderPtr &eFolder)
 {
-       if ( MEDIA_CONTENT_ERROR_NONE != 
-               media_folder_foreach_folder_from_db (NULL, mediaFolderCallback, eFolder.Get()))
-       {       
-               LoggerE("error ( media_folder_foreach_folder_from_db ) : ");
-               eFolder->setResult(false);
-       }
-       else
-       {
-               eFolder->setResult(true);
-       }
+    filter_h filter = NULL;
+    //set filter
+    if ( MEDIA_CONTENT_ERROR_NONE == media_filter_create(&filter))
+    {
+        string condition="FOLDER_STORAGE_TYPE = 0 OR FOLDER_STORAGE_TYPE = 1";
+        LoggerI("condition:" + condition);
+        media_filter_set_condition(filter, condition.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT ); //set condition
+        if ( MEDIA_CONTENT_ERROR_NONE != 
+            media_folder_foreach_folder_from_db (filter, mediaFolderCallback, eFolder.Get()))
+        {
+            LoggerE("A platform error occurs in media_folder_foreach_folder_from_db");
+            eFolder->setResult(false);
+        }
+        else{
+            eFolder->setResult(true);
+        }
+        if ( MEDIA_CONTENT_ERROR_NONE != media_filter_destroy(filter))
+        {
+            LoggerE("A platform error occurs in media_filter_destroy");
+        }
+    }
 }
 
 void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse)
 {
-       MediaSearchVisitorPtr visitor(new MediaSearchVisitor());
-       visitor->setQueryType(MediaSearchVisitor::QUERY_MEDIA);
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       try{
-               filter_h filter = NULL;
+    MediaSearchVisitorPtr visitor(new MediaSearchVisitor());
+    visitor->setQueryType(MediaSearchVisitor::QUERY_MEDIA);
+    int ret = MEDIA_CONTENT_ERROR_NONE;
 
-               if(eBrowse->getFilterIsSet() || eBrowse->getFolderIdIsSet() || eBrowse->getSortModesIsSet()
-                       || eBrowse->getLimitIsSet() ||eBrowse->getOffsetIsSet() )
-               {
-                       //set filter
-                       if ( MEDIA_CONTENT_ERROR_NONE == media_filter_create(&filter))
-                       {
-                               if (eBrowse->getFilterIsSet())
-                               {
-                                       string condition;
-                                       FilterPtr jsFilter = eBrowse->getFilter();
-
-                                       FilterValidatorPtr validator = MediaFilterValidatorFactory::getMediaFilterValidator(MediaFilterValidatorFactory::QUERY_MEDIA);
-                                       bool success = jsFilter->validate(validator);
-
-                                       if(!success)
-                                               ThrowMsg(PlatformException, "Invalid attirbutes.");
-                                       
-                                       IFilterVisitorPtr IVisitor = DPL::StaticPointerCast<IFilterVisitor>(visitor);
-
-                                       jsFilter->travel(IVisitor);
-                                       condition = visitor->getResult();
+    try
+    {
+        filter_h filter = NULL;
 
-                                       media_filter_set_condition(filter, condition.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT );  //set condition
-                               }
+        //set filter
+        if ( MEDIA_CONTENT_ERROR_NONE == media_filter_create(&filter))
+        {
+            string condition = "(MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE = 1)";;
+            if (eBrowse->getFilterIsSet())
+            {
+                FilterPtr jsFilter = eBrowse->getFilter();
+                FilterValidatorPtr validator = MediaFilterValidatorFactory::getMediaFilterValidator(MediaFilterValidatorFactory::QUERY_MEDIA);
+                bool success = jsFilter->validate(validator);
 
-                               if(eBrowse->getSortModesIsSet()) 
-                               {
-                                       media_content_order_e order;
+                if(!success)
+                    ThrowMsg(PlatformException, "Invalid attirbutes.");
 
-                                       SortModePtr attr = eBrowse->getSortMode();
+                IFilterVisitorPtr IVisitor = DPL::StaticPointerCast<IFilterVisitor>(visitor);
+                jsFilter->travel(IVisitor);
+                condition += " AND ";
+                condition += visitor->getResult();
+            }
 
-                                       if ( attr )
-                                       {
-                                               string attriName = attr->getAttributeName();
-                                               attriName = visitor->getPlatformAttr(attriName);
-
-                                               if (attriName.compare("") != 0) 
-                                               {       
-                                                       if (attr->getOrder() == DeviceAPI::Tizen::ASCENDING_SORT_ORDER) 
-                                                       {
-                                                               order = MEDIA_CONTENT_ORDER_ASC;
-                                                       } 
-                                                       else 
-                                                       {
-                                                               order = MEDIA_CONTENT_ORDER_DESC;
-                                                       }
-
-                                                       if ( MEDIA_CONTENT_ERROR_NONE !=
-                                                               media_filter_set_order(filter, order, attriName.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT ))               //set order
-                                                       {
-                                                               LoggerD("media_filter_set_order fail...");      
-                                                       }
-                                               }
-                                       }
-                                       
-                               }                               
+            LoggerI("condition:" + condition);
+            media_filter_set_condition(filter, condition.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT );  //set condition
 
-                               if (eBrowse->getLimitIsSet() ||eBrowse->getOffsetIsSet() ) 
-                               {       
-                                       int count = -1;
-                                       int offset = 0;
-                                       
-                                       if ( eBrowse->getLimitIsSet() )
-                                       {
-                                               count =  eBrowse->getLimit();
-                                       }
-                                       
-                                       if ( eBrowse->getOffsetIsSet() )
-                                       {
-                                               offset = eBrowse->getOffset();
-                                       }
-                                       
-                                       if ( MEDIA_CONTENT_ERROR_NONE != media_filter_set_offset(filter, offset, count))
-                                       {
-                                               LoggerD("set limit or offset fail...");
-                                       }
-                               }
-                               
-                       }
-                       else
-                       {
-                               
-                               LoggerE("error ( media filter create ) : ");
-                               eBrowse->setResult(false);
-                       }
-               }
-
-               if ( eBrowse->getFolderIdIsSet())
-               {       
-                       string folderID = eBrowse->getFolderID();
-                       
-                       if ( MEDIA_CONTENT_ERROR_NONE !=  
-                               media_folder_foreach_media_from_db (folderID.c_str(), filter, mediaItemCallback, eBrowse.Get()))
-                       {       
-                               LoggerE("error ( media_folder_foreach_folder_from_db ) : " << ret);
-                               eBrowse->setResult(false);
-                       }
-                       else
-                       {       
-                               eBrowse->setResult(true);
-                       }
-               }
-               else
-               {
-                       if ( MEDIA_CONTENT_ERROR_NONE !=  
-                               media_info_foreach_media_from_db (filter, mediaItemCallback, eBrowse.Get()))
-                       {
-                               LoggerE("error ( media_folder_foreach_folder_from_db ) : " << ret);
-                               eBrowse->setResult(false);
-                       }
-                       else
-                       {
-                               eBrowse->setResult(true);
-                       }
-               }
-
-               //destory Filter
-               if(filter)
-               {
-                       if ( MEDIA_CONTENT_ERROR_NONE != media_filter_destroy(filter))
-                       {
-                               LoggerE("media_filter_create Error: " << ret);
-                       }
-               }
-
-       }
-       catch(const Exception &ex){
-                       LoggerE("Exception: " << ex.DumpToString());
-                       eBrowse->setResult(false);
-                       return;
-       }
+            if(eBrowse->getSortModesIsSet())
+            {
+                media_content_order_e order;
+                SortModePtr attr = eBrowse->getSortMode();
+
+                if ( attr )
+                {
+                    string attriName = attr->getAttributeName();
+                    attriName = visitor->getPlatformAttr(attriName);
+
+                    if (attriName.compare("") != 0)
+                    {
+                        if (attr->getOrder() == DeviceAPI::Tizen::ASCENDING_SORT_ORDER)
+                        {
+                            order = MEDIA_CONTENT_ORDER_ASC;
+                        }
+                        else
+                        {
+                            order = MEDIA_CONTENT_ORDER_DESC;
+                        }
+
+                        if ( MEDIA_CONTENT_ERROR_NONE !=
+                            media_filter_set_order(filter, order, attriName.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT ))          //set order
+                        {
+                            LoggerE("A platform error occurs in media_filter_set_order");
+                        }
+                    }
+                }
+
+            }
+
+            if (eBrowse->getLimitIsSet() ||eBrowse->getOffsetIsSet() )
+            {
+                int count = -1;
+                int offset = 0;
+
+                if ( eBrowse->getLimitIsSet() )
+                {
+                    count =  eBrowse->getLimit();
+                }
+
+                if ( eBrowse->getOffsetIsSet() )
+                {
+                    offset = eBrowse->getOffset();
+                }
+
+                if ( MEDIA_CONTENT_ERROR_NONE != media_filter_set_offset(filter, offset, count))
+                {
+                    LoggerE("A platform error occurs in media_filter_set_offset");
+                }
+            }
+        }
+        else
+        {
+            LoggerE("A platform error occurs in media_filter_create");
+            eBrowse->setResult(false);
+        }
 
+        if ( eBrowse->getFolderIdIsSet())
+        {
+            string folderID = eBrowse->getFolderID();
 
+            if ( MEDIA_CONTENT_ERROR_NONE !=  
+                media_folder_foreach_media_from_db (folderID.c_str(), filter, mediaItemCallback, eBrowse.Get()))
+            {
+                LoggerE("A platform error occurs in media_folder_foreach_media_from_db");
+                eBrowse->setResult(false);
+            }
+            else
+            {
+                eBrowse->setResult(true);
+            }
+        }
+        else
+        {
+            if ( MEDIA_CONTENT_ERROR_NONE !=  
+                media_info_foreach_media_from_db (filter, mediaItemCallback, eBrowse.Get()))
+            {
+                LoggerE("A platform error occurs in media_info_foreach_media_from_db");
+                eBrowse->setResult(false);
+            }
+            else
+            {
+                eBrowse->setResult(true);
+            }
+        }
 
+        //destory Filter
+        if(filter)
+        {
+            if ( MEDIA_CONTENT_ERROR_NONE != media_filter_destroy(filter))
+            {
+                LoggerE("A platform error occurs in media_filter_destroy");
+            }
+        }
+    }
+    catch(const Exception &ex)
+    {
+        LoggerE("Exception: " << ex.DumpToString());
+        eBrowse->setResult(false);
+        return;
+    }
 }
 
 bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
index 7850371..f9f965c 100644 (file)
@@ -21,6 +21,7 @@
 #include <Commons/Exception.h>
 #include "MsgServiceHandleMgr.h"
 #include "IMessaging.h"
+#include "EmailUtils.h"
 #include <email-api-mail.h>
 #include <time.h>
 
@@ -695,8 +696,9 @@ bool Conversation::makeConversationFromEmailThreadId(unsigned int emailTreadId)
                // from
                if (resultMail->full_address_from[0] != '\0')
                {
-                       m_from = resultMail->full_address_from;
-                       LoggerD(m_from);
+                       LoggerD("Header From " << resultMail->full_address_from);
+                       m_from = EmailUtils::stripAddress(resultMail->full_address_from);
+                       LoggerD("email From " << m_from);
                }
 
                // subject
@@ -709,19 +711,19 @@ bool Conversation::makeConversationFromEmailThreadId(unsigned int emailTreadId)
                if (mailData->full_address_to != NULL)
                {
                        LoggerD("Header To " << mailData->full_address_to);
-                       m_to.push_back(mailData->full_address_to);
+                       m_to = EmailUtils::stripAddressLine(mailData->full_address_to).getRecipients();
                }
 
                if (mailData->full_address_bcc != NULL)
                {
                        LoggerD("Header Bcc " << mailData->full_address_bcc);
-                       m_bcc.push_back(mailData->full_address_bcc);
+                       m_bcc = EmailUtils::stripAddressLine(mailData->full_address_bcc).getRecipients();
                }
 
                if (mailData->full_address_cc != NULL)
                {
                        LoggerD("Header CC " << mailData->full_address_cc);
-                       m_cc.push_back(mailData->full_address_cc);
+                       m_cc = EmailUtils::stripAddressLine(mailData->full_address_cc).getRecipients();
                }
                
                m_lastMessageId = resultMail->mail_id;
index 0848c61..970fb59 100644 (file)
@@ -456,13 +456,13 @@ void Email::readHeader()
     }
 
 #if 1
-    struct tm *t = NULL;
-    t = localtime(&m_mail->date_time);
-    struct tm timeinfo;
-       memset(&timeinfo, 0, sizeof(timeinfo));
-    memcpy(t, &timeinfo, sizeof(struct tm));
-    setDateTime(timeinfo);
-
+    LoggerD(" " << m_mail->date_time);
+    tm* time = localtime(&m_mail->date_time);
+    if (!time) {
+        LoggerE("localtime failed");
+        Throw(WrtDeviceApis::Commons::PlatformException);
+    }
+    setDateTime(*time);
 #else
 
        if (m_mail->datetime[0] != '\0')
@@ -977,7 +977,7 @@ void Email::addMessageToDraft()
     }
     else
     {
-               DPL::Mutex::ScopedLock mx(&m_updateMutex);
+               DPL::Mutex::ScopedLock mx(&m_updateMutex);
 
                EmailAccountInfo account = getEmailAccount();
                m_accountId = account.getIntId();       //set account ID
@@ -1019,55 +1019,76 @@ void Email::addMessageToDraft()
                        LoggerE("Failed to destroy mailbox: " << error);
                }
 
-               LoggerD("m_mail->from" << m_mail->full_address_from);
+               loadDraftMessage();
+    }
 
-               email_mail_data_t* result = NULL;
+    LOG_EXIT
+}
 
-               error = email_get_mail_data(m_mail->mail_id, &result);
-               if (EMAIL_ERROR_NONE != error) {
-                   ThrowMsg(WrtDeviceApis::Commons::PlatformException,
-                            "Couldn't find message " << m_mail->mail_id << ". [" << error << "]");
-               }
+void Email::loadDraftMessage()
+{
+    LOG_ENTER
 
-               if(result->body_download_status != 1)
-               {
-                       LoggerD("result->body_download_status " << result->body_download_status);
-                       int mail_id_count = 1;
-                       int mail_id_array[1];
-                       email_mail_attribute_type attribute_type;
-                       email_mail_attribute_value_t attribute_value;
+       email_mail_data_t* result = NULL;
+       std::string from;
+       
+       int error = email_get_mail_data(m_mail->mail_id, &result);
+       if (EMAIL_ERROR_NONE != error) {
+               ThrowMsg(WrtDeviceApis::Commons::PlatformException,
+                                "Couldn't find message " << m_mail->mail_id << ". [" << error << "]");
+       }
 
-                       mail_id_array[0] = m_mail->mail_id;
-                       attribute_type = EMAIL_MAIL_ATTRIBUTE_BODY_DOWNLOAD_STATUS;
-                       attribute_value.integer_type_value = 1;
+       if(result->body_download_status != 1)
+       {
+               LoggerD("result->body_download_status " << result->body_download_status);
+               int mail_id_count = 1;
+               int mail_id_array[1];
+               email_mail_attribute_type attribute_type;
+               email_mail_attribute_value_t attribute_value;
+
+               mail_id_array[0] = result->mail_id;
+               LoggerD("result->mail_id " << result->mail_id);
+               attribute_type = EMAIL_MAIL_ATTRIBUTE_BODY_DOWNLOAD_STATUS;
+               attribute_value.integer_type_value = 1;
+
+               email_update_mail_attribute(m_accountId, mail_id_array, 1, EMAIL_MAIL_ATTRIBUTE_BODY_DOWNLOAD_STATUS, attribute_value);
+       }
 
-                       email_update_mail_attribute(m_accountId, mail_id_array, 1, EMAIL_MAIL_ATTRIBUTE_BODY_DOWNLOAD_STATUS, attribute_value);
-               }
+    tm* time = localtime(&result->date_time);
+    if (!time) {
+        LoggerE("localtime failed");
+        Throw(WrtDeviceApis::Commons::PlatformException);
+    }
+    setDateTime(*time);
 
-               readHeader();
-               readInfo();
+       setReadStatus(result->flags_seen_field == 1);
 
-               if (m_mail->file_path_plain)
-                       free(m_mail->file_path_plain);
-               m_mail->file_path_plain = strdup(result->file_path_plain);
+       m_accountId = result->account_id;
+       setConvId(result->thread_id);
+       setPriority( EmailConverter::toMessagePriority( result->priority ) );
+       setSize(result->mail_size);
 
-               if ( m_mail->file_path_html)
-               {
-                       free(m_mail->file_path_html);
-               }
+       if (m_mail->file_path_plain)
+               free(m_mail->file_path_plain);
+       m_mail->file_path_plain = strdup(result->file_path_plain);
 
-               if(result->file_path_html)
-               {
-                       m_mail->file_path_html = strdup(result->file_path_html);
-               }
+       if ( m_mail->file_path_html)
+       {
+               free(m_mail->file_path_html);
+       }
 
-               error = email_free_mail_data(&result, 1);
-               if (EMAIL_ERROR_NONE != error) {
-                   ThrowMsg(WrtDeviceApis::Commons::PlatformException,
-                            "Couldn't find message " << m_mail->mail_id << ". [" << error << "]");
-               }
+       if(result->file_path_html)
+       {
+               m_mail->file_path_html = strdup(result->file_path_html);
+       }
+       from = EmailUtils::stripAddress(result->full_address_from);
+       setFrom(from);
 
-    }
+       error = email_free_mail_data(&result, 1);
+       if (EMAIL_ERROR_NONE != error) {
+               ThrowMsg(WrtDeviceApis::Commons::PlatformException,
+                                "Couldn't find message " << m_mail->mail_id << ". [" << error << "]");
+       }
 
     LOG_EXIT
 }
index d35bf32..076b489 100755 (executable)
@@ -126,6 +126,8 @@ class Email : public IEmail
     void updateMessage();      
        
     void addMessageToDraft();
+
+    void loadDraftMessage();
        
     void createSendMessage();          
        
index 6454250..45f442d 100644 (file)
@@ -590,9 +590,6 @@ JSObjectRef DLL_EXPORT JSMessage::constructor(JSContextRef context,
         DeviceAPI::Common::UnknownException err("UnknownError in Message constructor.");
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
-
-    return JSWebAPIErrorFactory::postException(context, exception,
-            DeviceAPI::Common::UnknownException("UnknownError in Message constructor."));
 }
 
 JSValueRef JSMessage::convertToType(JSContextRef context,
index c724a13..f5cb33a 100644 (file)
@@ -549,9 +549,6 @@ JSObjectRef DLL_EXPORT JSMessageAttachment::constructor(JSContextRef context,
                DeviceAPI::Common::UnknownException err("UnknownError in Message constructor.");
                return JSWebAPIErrorFactory::postException(context, exception, err);
        }
-
-       return JSWebAPIErrorFactory::postException(context, exception,
-                       DeviceAPI::Common::UnknownException("UnknownError in Message constructor."));
 }
 
 JSValueRef JSMessageAttachment::getProperty(JSContextRef context,
index e88d5a5..b487c55 100644 (file)
@@ -545,13 +545,13 @@ namespace DeviceAPI {
                                                retClause = emfAttributeName + " ='" + valueString + "'";
                                                break;
                                        }else if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_TO)==0) {
-                                               retClause = emfAttributeName + " ='<" + valueString + ">'";
+                                               retClause = emfAttributeName + " LIKE '%%<" + valueString +">%%'";
                                                break;
                                        }else if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_CC)==0) {
-                                               retClause = emfAttributeName + " ='<" + valueString + ">'";
+                                               retClause = emfAttributeName + " LIKE '%%<" + valueString +">%%'";
                                                break;
                                        }else if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_BCC)==0) {
-                                               retClause = emfAttributeName + " ='<" + valueString + ">'";
+                                               retClause = emfAttributeName + " LIKE '%%<" + valueString +">%%'";
                                                break;
                                        }
                                }else if(m_mode == MODE_SMS || m_mode == MODE_MMS ){
@@ -784,6 +784,8 @@ namespace DeviceAPI {
                        string initialValueStr;
                        string endValueStr;
 
+                       time_t time_temp;
+
                        if(initialValue == NULL || endValue == NULL)
                                return;
                        
@@ -796,7 +798,14 @@ namespace DeviceAPI {
                                        if( initialValue->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) {
                                                LoggerD("<<<initialValue->getType()[PrimitiveType_Time]");
                                                tm date = *initialValue->getDateTm();
-                                               initialValueStr = toDateDbStr(date);
+                                               time_temp = mktime(&date);
+                                               LoggerD("time_temp " << time_temp);
+
+                                               stringstream ss;
+                                               ss << time_temp;
+                                               string ts = ss.str();
+                                               initialValueStr = ts;
+                                               
                                                LoggerD("<<<valueStr[" << initialValueStr <<"]");
                                        }
                                        else {
@@ -809,21 +818,23 @@ namespace DeviceAPI {
                                        if( endValue->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) {
                                                LoggerD("<<<initialValue->getType()[PrimitiveType_Time]");
                                                tm date = *endValue->getDateTm();
-                                               endValueStr = toDateDbStr(date);
+
+                                               time_temp = mktime(&date);
+                                               LoggerD("time_temp " << time_temp);
+
+                                               stringstream ss;
+                                               ss << time_temp;
+                                               string ts = ss.str();
+                                               endValueStr = ts;
+                                               
+                                               LoggerD("<<<valueStr[" << endValueStr <<"]");
                                        } else {
                                                LoggerE("endValue->getType()");
                                                ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid endValue Type");
                                        }
                                }
 
-                               
-                               if(m_mode == MODE_EMAIL){
-                                       tmpStringBuffer.append(emfAttributeName + " BETWEEN " + initialValueStr + " AND " + endValueStr);
-                               }else if(m_mode == MODE_SMS || m_mode == MODE_MMS){
-                                       tmpStringBuffer.append(emfAttributeName + " BETWEEN " +
-                                                       createDateTimeTypeForSmsMms(initialValueStr) + " AND " +
-                                                       createDateTimeTypeForSmsMms(endValueStr));
-                               }
+                               tmpStringBuffer.append(emfAttributeName + " BETWEEN " + initialValueStr + " AND " + endValueStr);
                        }
 
                        m_queryVector.push_back(tmpStringBuffer);
index f86edb4..abe0907 100644 (file)
@@ -291,6 +291,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt
 
                vector<IMessagePtr> retVal;
                int tempInt;
+               int tempPreviousId = -1;
 //             int l_msgId = 0;
                MessageType webApiMsgType;              
                
@@ -325,10 +326,13 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt
                        {
                                ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get message id fail");
                        }
-
-                       IMessagePtr msg;
-                       msg = MessageFactory::createMessage(webApiMsgType, tempInt);
-                       retVal.push_back(msg);
+                       if( tempPreviousId != tempInt)
+                       {
+                               IMessagePtr msg;
+                               msg = MessageFactory::createMessage(webApiMsgType, tempInt);
+                               tempPreviousId = tempInt;
+                               retVal.push_back(msg);
+                       }
                }       //for
 
                LoggerD(">>>");
index 87db11a..4fdadd1 100755 (executable)
@@ -294,8 +294,8 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
             LoggerI("Set Notification Init Dictionary");
             //content
             JSValueRef contentValue = JSUtil::getProperty(context, notiInitDict, NOTIFICATION_CONTENT);
-           if (!JSValueIsUndefined(context, contentValue))
-            {          
+           if (!(JSValueIsUndefined(context, contentValue) || JSValueIsNull(context, contentValue)))
+            {  
                priv->setContent(JSUtil::JSValueToString(context, contentValue));
            }
                     
@@ -527,31 +527,34 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
 
     //Content
     JSValueRef contents = JSUtil::getProperty(context, object, NOTIFICATION_CONTENT);
-    priv->setContent( JSUtil::JSValueToString(context, contents));
+    if (!JSValueIsNull(context, contents))
+    {
+       priv->setContent( JSUtil::JSValueToString(context, contents));
+    }
 
     // iconPath
     JSValueRef iconPath = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_ICON_PATH);
-    if (!JSUtil::JSValueToString(context, iconPath).empty())
+    if ( !JSValueIsNull(context, contents) )
     {
         DeviceAPI::Filesystem::IPathPtr icon = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, iconPath));
         priv->setIconPath(icon->getFullPath());
     }
-    else
-    {
-        priv->setIconPath("");
-    }
+    //else
+    //{
+    //    priv->setIconPath("");
+    //}
 
     // subIconPath
     JSValueRef subIconPath = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_SUB_ICON_PATH);
-    if (!JSUtil::JSValueToString(context, subIconPath).empty())
+    if (!JSValueIsNull(context, subIconPath))
     {
         DeviceAPI::Filesystem::IPathPtr subIcon = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, subIconPath));
         priv->setSubIconPath(subIcon->getFullPath());
     }
-    else
-    {
-        priv->setSubIconPath("");
-    }
+    //else
+    //{
+    //    priv->setSubIconPath("");
+    //}
 
     // number
     JSValueRef number = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_NUMBER);
@@ -578,15 +581,15 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
     
     // backgroundImagePath
     JSValueRef backgroundImagePath = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_BACKGROUND_IMAGE_PATH);
-    if (!JSUtil::JSValueToString(context, backgroundImagePath).empty())
+    if (!JSValueIsNull(context, backgroundImagePath))
     {
         DeviceAPI::Filesystem::IPathPtr backgroundImage = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, backgroundImagePath));
         priv->setBackground(backgroundImage->getFullPath());
     }
-    else
-    {
-        priv->setBackground("");
-    }
+    //else
+    //{
+    //    priv->setBackground("");
+    //}
     
     // thumbnails
     JSValueRef thumbnails = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_THUMBNAILS);
@@ -606,15 +609,15 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
     
     // soundPath
     JSValueRef soundPath = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_SOUND_PATH);
-    if (!JSUtil::JSValueToString(context, soundPath).empty())
+    if (!JSValueIsNull(context, soundPath))
     {
         DeviceAPI::Filesystem::IPathPtr sound = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, soundPath));
         priv->setSoundPath(sound->getFullPath());
     }
-    else
-    {
-        priv->setSoundPath("");
-    }
+    //else
+    //{
+    //    priv->setSoundPath("");
+    //}
     
     // vibration
     JSValueRef vibration = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_VIBRATION);