Fix For New app control changes S_SE-31843 TDIs-5226
authorshivakumar jagalur matt <shiva.jm@samsung.com>
Mon, 15 Apr 2013 11:04:53 +0000 (16:34 +0530)
committershivakumar jagalur matt <shiva.jm@samsung.com>
Mon, 15 Apr 2013 11:04:53 +0000 (16:34 +0530)
Change-Id: I85312104c4b4b476b7a4b5a650565d5a314414fa
Signed-off-by: shivakumar jagalur matt <shiva.jm@samsung.com>
project/src/EmailForm.cpp
project/src/MmsForm.cpp

index f59a85c..c4326ed 100644 (file)
@@ -325,8 +325,8 @@ void
 EmailForm::InvokeMediaAppControl(void)
 {
        result r = E_SUCCESS;
-       String* pData = null;
-       String* pTempData = null;
+       String uri;
+       String mimeType("*/*");
        AppControl* pAc = null;
        MessageBox* pMessage = null;
        int ModalResult;
@@ -335,25 +335,14 @@ EmailForm::InvokeMediaAppControl(void)
        r = dataList.Construct();
        TryCatch(r == E_SUCCESS, , "Failed to construct data list");
 
-       pData = new (std::nothrow) String(L"all");
-       TryCatch(pData != null,;
-                       , "Failed to instantiate String");
-
-       r = dataList.Add(new (std::nothrow) String(L"type"), pData);
-       TryCatch(r == E_SUCCESS, , "Failed to add data to Array list");
-
-       pTempData = new (std::nothrow) String(L"multiple");
-       TryCatch(pTempData != null,;
-                       , "Failed to instantiate String");
-
-       r = dataList.Add(new (std::nothrow) String(L"selectionType"), pTempData);
+       r = dataList.Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/selection_mode"), new (std::nothrow) String(L"multiple"));
        TryCatch(r == E_SUCCESS, , "Failed to add data to Array list");
 
-       pAc = AppManager::FindAppControlN(String(L"tizen.filemanager"), L"http://tizen.org/appcontrol/operation/pick");
+       pAc = AppManager::FindAppControlN(String(L"tizen.filemanager"), String(L"http://tizen.org/appcontrol/operation/pick"));
        TryCatch(pAc != null,;
                        , "Failed FindAppControlN");
 
-       r = pAc->Start(null, null, &dataList, this);
+       r = pAc->Start(&uri, &mimeType, &dataList, this);
        TryCatch(r == E_SUCCESS,;
                        , "Failed to invoke ac");
        delete pAc;
@@ -394,29 +383,24 @@ EmailForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId,
        {
                if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
                {
+                       const String* pValue = null;
+                       const ArrayList* pResultList = dynamic_cast<const ArrayList*> (pExtraData->GetValue(String(L"http://tizen.org/appcontrol/data/selected")));
 
-                       String* pValue = (Tizen::Base::String*) pExtraData->GetValue(String(L"path"));
-                       if (pValue != NULL)
+                       if (pResultList != NULL)
                        {
-                               AppLog("Value is: %S", pValue->GetPointer());
-
-                               StringTokenizer strTok(*pValue, L";"); //get each file paths seperated by ;
-
                                int count = 0;
-                               count = strTok.GetTokenCount();
-
+                               count = pResultList->GetCount();
                                for (int index = 0; index < count; index++)
                                {
                                        AppLog("Media list success.");
-                                       String tokenValue;
-                                       strTok.GetNextToken(tokenValue);
+                                       pValue = static_cast<const String*>(pResultList->GetAt(index));
 
                                        //Add Attachment To Email
-                                       AppLog("Add Attachment : %ls", tokenValue.GetPointer());
-                                       r = __pEmailSend->SetEmailAttach(&tokenValue);
+                                       AppLog("Add Attachment : %ls", pValue->GetPointer());
+                                       r = __pEmailSend->SetEmailAttach(const_cast<String*>(pValue));
                                        if (!IsFailed(r))
                                        {
-                                               __pAttachList->AddItem(&tokenValue, (MmsAttachmentFormat) - 1);
+                                               __pAttachList->AddItem(const_cast<String*>(pValue), (MmsAttachmentFormat) - 1);
                                        }
                                        else
                                        {
index 15aa92a..4cea45f 100644 (file)
@@ -357,8 +357,8 @@ void
 MmsForm::InvokeMediaAppControl(int type)
 {
        result r = E_SUCCESS;
-       String* pData = null;
-       String* pTempData = null;
+       String uri;
+       String mimeType;
        AppControl* pAc = null;
        MessageBox* pMessage = null;
        int ModalResult;
@@ -370,33 +370,27 @@ MmsForm::InvokeMediaAppControl(int type)
        if (type == ID_ATTACH_IMAGE)
        {
                __attachmentFormat = MMS_IMAGE;
-               pData = new (std::nothrow) String(L"image");
+               mimeType.Append(L"image/*");
        }
        else if (type == ID_ATTACH_AUDIO)
        {
                __attachmentFormat = MMS_AUDIO;
-               pData = new (std::nothrow) String(L"audio");
+               mimeType.Append(L"audio/*");
        }
        else if (type == ID_ATTACH_VIDEO)
        {
                __attachmentFormat = MMS_VIDEO;
-               pData = new (std::nothrow) String(L"video");
+               mimeType.Append(L"video/*");
        }
-       TryCatch(pData != null, , "Failed to instantiate String");
 
-       r = dataList.Add(new (std::nothrow) String(L"type"), pData);
+       r = dataList.Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/selection_mode"), new (std::nothrow) String(L"single"));
        TryCatch(r == E_SUCCESS, , "Failed to add data to Array list");
 
-       pTempData = new (std::nothrow) String(L"single");
-       TryCatch(pTempData != null, , "Failed to instantiate String");
-
-       r = dataList.Add(new (std::nothrow) String(L"selectionType"), pTempData);
-       TryCatch(r == E_SUCCESS, , "Failed to add data to Array list");
-
-       pAc = AppManager::FindAppControlN(String(L"tizen.filemanager"), L"http://tizen.org/appcontrol/operation/pick");
+       pAc = AppManager::FindAppControlN(String(L"tizen.filemanager"), String(L"http://tizen.org/appcontrol/operation/pick"));
        TryCatch(pAc != null, , "Failed FindAppControlN");
 
-       r = pAc->Start(null, null, &dataList, this);
+       r = pAc->Start(&uri, &mimeType, &dataList, this);
+
        TryCatch(r == E_SUCCESS, , "Failed to invoke ac");
        delete pAc;
 
@@ -441,15 +435,25 @@ MmsForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, co
        {
                if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
                {
-                       String* pValue = (Tizen::Base::String*) pExtraData->GetValue(String(L"path"));
+                       const String* pValue = null;
+                       const ArrayList* pResultList = dynamic_cast<const ArrayList*> (pExtraData->GetValue(String(L"http://tizen.org/appcontrol/data/selected")));
+
+                       if (pResultList != null )
+                       {
+                               pValue = static_cast<const String*>(pResultList->GetAt(0));
+                       }
+                       else
+                       {
+                               pValue = static_cast<const String*>(pExtraData->GetValue(String(L"http://tizen.org/appcontrol/data/selected")));
+                       }
 
                        if (pValue != NULL)
                        {
                                AppLog("Value : %S", pValue->GetPointer());
-                               r = __pMmsSend->SetMmsAttach(__attachmentFormat, pValue);
+                               r = __pMmsSend->SetMmsAttach(__attachmentFormat, const_cast<String*>(pValue));
                                if (!IsFailed(r))
                                {
-                                       __pAttachList->AddItem(pValue, __attachmentFormat);
+                                       __pAttachList->AddItem(const_cast<String*>(pValue), __attachmentFormat);
                                        Invalidate(true);
                                }
                        }