Applys file manager app-control logic changed.
authordukan.kim <dukan.kim@samsung.com>
Tue, 4 Jun 2013 11:00:17 +0000 (20:00 +0900)
committerdukan.kim <dukan.kim@samsung.com>
Tue, 4 Jun 2013 11:00:17 +0000 (20:00 +0900)
Change-Id: I6393719abe85370d9034208ff351cb97d6c07fcc
Signed-off-by: dukan.kim <dukan.kim@samsung.com>
project/src/ProfileForm.cpp

index d85b2f3..453a799 100755 (executable)
@@ -145,14 +145,28 @@ ProfileForm::OnAppControlCompleteResponseReceived (const AppId &appId, const Tiz
        {
                if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
                {
-                       String* filePath = (Tizen::Base::String*) pExtraData->GetValue(String(L"path"));
-
-                       // updates the file with the new image selected.
-                       bool bResult = ShowProfileImage(*filePath);
-                       if (bResult != null)
+                       IMapEnumerator* pEnum = pExtraData->GetMapEnumeratorN();
+                       while (pEnum->MoveNext() == E_SUCCESS)
                        {
-                               __pProfileManager->SetImagePath(*filePath);
+                               String* pKey = dynamic_cast<String*>(pEnum->GetKey());
+                               if (pKey->Equals(String(L"http://tizen.org/appcontrol/data/selected")))
+                               {
+                                       // The value is IList.
+                                       IList* pValueList = dynamic_cast<IList*>(pEnum->GetValue());
+                                       if (pValueList)
+                                       {
+                                               // Use the file path
+                                               String* filePath = dynamic_cast<String*>(pValueList->GetAt(0));
+                                               // updates the file with the new image selected.
+                                               bool bResult = ShowProfileImage(*filePath);
+                                               if (bResult != null)
+                                               {
+                                                       __pProfileManager->SetImagePath(*filePath);
+                                               }
+                                       }
+                               }
                        }
+                       delete pEnum;
                }
        }
 }
@@ -241,22 +255,19 @@ ProfileForm::ShowProfileImage(const String& filepath)
 void
 ProfileForm::ChangeProfileImage(void)
 {
-       __pAppControl = AppManager::FindAppControlN(L"tizen.filemanager",
+       String mime = L"image/*";
+       HashMap extraData;
+       extraData.Construct();
+       String selectKey = L"http://tizen.org/appcontrol/data/selection_mode";
+       String selectVal = L"single";
+       extraData.Add(&selectKey, &selectVal);
+
+       __pAppControl = AppManager::FindAppControlN(L"tizen.filemanager", 
                        L"http://tizen.org/appcontrol/operation/pick");
-
        if (__pAppControl != null)
        {
-               HashMap* pDataList = null;
-               pDataList = new (std::nothrow) HashMap();
-               pDataList->Construct();
-               pDataList->Add(new (std::nothrow) String(L"type"), new (std::nothrow) String(L"image"));
-               pDataList->Add(new (std::nothrow) String(L"selectionType"), new (std::nothrow) String(L"single"));
-
-               __pAppControl->Start(null, null, pDataList, this);
+               __pAppControl->Start(null, &mime, &extraData, this);
                delete __pAppControl;
                __pAppControl = null;
-
-               pDataList->RemoveAll(true);
-               delete pDataList;
        }
 }