Modified appcontrol spec. of Contacts app.
authorDongseok JANG <dongseok.jang@samsung.com>
Thu, 18 Apr 2013 12:38:21 +0000 (21:38 +0900)
committerDongseok JANG <dongseok.jang@samsung.com>
Thu, 18 Apr 2013 12:38:21 +0000 (21:38 +0900)
Change-Id: I244195f35f3f86171ba41d4b7b0c2186b55871bf
Signed-off-by: Dongseok JANG <dongseok.jang@samsung.com>
src/CtContactListPanel.cpp
src/CtContactsApp.cpp
src/CtFavoriteListPanel.cpp
src/CtGroupContactListForm.cpp

index 7e4cc9d..7262d51 100644 (file)
@@ -751,17 +751,14 @@ ContactListPanel::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::Grouped
                {
                        AppCtrlResult appCtrlResult = APP_CTRL_RESULT_SUCCEEDED;
                        String vCardPath = __pPresentationModel->ExportToVcard(groupIndex, itemIndex);
+
                        if (vCardPath.IsEmpty())
                        {
                                appCtrlResult = APP_CTRL_RESULT_FAILED;
                        }
                        else
                        {
-                               ArrayList* pValueList = new (std::nothrow) ArrayList();
-                               pValueList->Construct();
-                               pValueList->Add(new (std::nothrow) String(vCardPath));
-
-                               pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PATH), pValueList);
+                               pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PATH), new (std::nothrow) String(vCardPath));
                        }
 
                        ReturnValues(pContactsApp->GetRequestId(), appCtrlResult, pReturnValue);
index 9e642d8..ef16061 100644 (file)
@@ -324,45 +324,32 @@ ContactsApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::Str
 
                String* pKey = null;
                const String* pValue = null;
-               const ArrayList* pArgList = null;
 
-               pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_PHONE)));
-               if (pArgList && pArgList->GetCount() > 0)
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_PHONE)));
+               if (pValue && pValue->GetPointer())
                {
-                       pValue = static_cast<const String*>(pArgList->GetAt(0));
-                       if (pValue && pValue->GetPointer())
-                       {
-                               pKey = new (std::nothrow) String(PHONE);
-                               pKey->Append(DELIMITER);
-                               pKey->Append(*pValue);
-                               pArgs->Add(pKey);
-                       }
+                       pKey = new (std::nothrow) String(PHONE);
+                       pKey->Append(DELIMITER);
+                       pKey->Append(*pValue);
+                       pArgs->Add(pKey);
                }
 
-               pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_EMAIL)));
-               if (pArgList && pArgList->GetCount() > 0)
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_EMAIL)));
+               if (pValue && pValue->GetPointer())
                {
-                       pValue = static_cast<const String*>(pArgList->GetAt(0));
-                       if (pValue && pValue->GetPointer())
-                       {
-                               pKey = new (std::nothrow) String(EMAIL);
-                               pKey->Append(DELIMITER);
-                               pKey->Append(*pValue);
-                               pArgs->Add(pKey);
-                       }
+                       pKey = new (std::nothrow) String(EMAIL);
+                       pKey->Append(DELIMITER);
+                       pKey->Append(*pValue);
+                       pArgs->Add(pKey);
                }
 
-               pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_URL)));
-               if (pArgList && pArgList->GetCount() > 0)
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_URL)));
+               if (pValue && pValue->GetPointer())
                {
-                       pValue = static_cast<const String*>(pArgList->GetAt(0));
-                       if (pValue && pValue->GetPointer())
-                       {
-                               pKey = new (std::nothrow) String(URL);
-                               pKey->Append(DELIMITER);
-                               pKey->Append(*pValue);
-                               pArgs->Add(pKey);
-                       }
+                       pKey = new (std::nothrow) String(URL);
+                       pKey->Append(DELIMITER);
+                       pKey->Append(*pValue);
+                       pArgs->Add(pKey);
                }
 
                __initialSceneId = IDSCN_CONTACT_EDITOR;
@@ -390,19 +377,8 @@ ContactsApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::Str
 
                String* pKey = null;
                const String* pValue = null;
-               const ArrayList* pArgList = null;
 
-               pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_ITEM_ID)));
-               if (pArgList == null || pArgList->GetCount() == 0)
-               {
-                       AppLogDebug("To launch AppControl by the edit operation, the item_id should be input.");
-                       AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, APP_CTRL_RESULT_FAILED, null);
-                       Terminate();
-
-                       return;
-               }
-
-               pValue = static_cast<const String*>(pArgList->GetAt(0));
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_ITEM_ID)));
                if (pValue == null || pValue->GetPointer() == null)
                {
                        AppLogDebug("To launch AppControl by the edit operation, the item_id should be input.");
@@ -417,43 +393,31 @@ ContactsApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::Str
                pKey->Append(*pValue);
                pArgs->Add(pKey);
 
-               pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_PHONE)));
-               if (pArgList && pArgList->GetCount() > 0)
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_PHONE)));
+               if (pValue && pValue->GetPointer())
                {
-                       pValue = static_cast<const String*>(pArgList->GetAt(0));
-                       if (pValue && pValue->GetPointer())
-                       {
-                               pKey = new (std::nothrow) String(PHONE);
-                               pKey->Append(DELIMITER);
-                               pKey->Append(*pValue);
-                               pArgs->Add(pKey);
-                       }
+                       pKey = new (std::nothrow) String(PHONE);
+                       pKey->Append(DELIMITER);
+                       pKey->Append(*pValue);
+                       pArgs->Add(pKey);
                }
 
-               pArgList = static_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_EMAIL)));
-               if (pArgList && pArgList->GetCount() > 0)
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_EMAIL)));
+               if (pValue && pValue->GetPointer())
                {
-                       pValue = static_cast<const String*>(pArgList->GetAt(0));
-                       if (pValue && pValue->GetPointer())
-                       {
-                               pKey = new (std::nothrow) String(EMAIL);
-                               pKey->Append(DELIMITER);
-                               pKey->Append(*pValue);
-                               pArgs->Add(pKey);
-                       }
+                       pKey = new (std::nothrow) String(EMAIL);
+                       pKey->Append(DELIMITER);
+                       pKey->Append(*pValue);
+                       pArgs->Add(pKey);
                }
 
-               pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_URL)));
-               if (pArgList && pArgList->GetCount() > 0)
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_URL)));
+               if (pValue && pValue->GetPointer())
                {
-                       pValue = static_cast<const String*>(pArgList->GetAt(0));
-                       if (pValue && pValue->GetPointer())
-                       {
-                               pKey = new (std::nothrow) String(URL);
-                               pKey->Append(DELIMITER);
-                               pKey->Append(*pValue);
-                               pArgs->Add(pKey);
-                       }
+                       pKey = new (std::nothrow) String(URL);
+                       pKey->Append(DELIMITER);
+                       pKey->Append(*pValue);
+                       pArgs->Add(pKey);
                }
 
                __initialSceneId = IDSCN_CONTACT_EDITOR;
@@ -481,45 +445,32 @@ ContactsApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::Str
 
                String* pKey = null;
                const String* pValue = null;
-               const ArrayList* pArgList = null;
 
-               pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_PHONE)));
-               if (pArgList && pArgList->GetCount() > 0)
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_PHONE)));
+               if (pValue && pValue->GetPointer())
                {
-                       pValue = static_cast<const String*>(pArgList->GetAt(0));
-                       if (pValue && pValue->GetPointer())
-                       {
-                               pKey = new (std::nothrow) String(PHONE);
-                               pKey->Append(DELIMITER);
-                               pKey->Append(*pValue);
-                               pArgs->Add(pKey);
-                       }
+                       pKey = new (std::nothrow) String(PHONE);
+                       pKey->Append(DELIMITER);
+                       pKey->Append(*pValue);
+                       pArgs->Add(pKey);
                }
 
-               pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_EMAIL)));
-               if (pArgList && pArgList->GetCount() > 0)
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_EMAIL)));
+               if (pValue && pValue->GetPointer())
                {
-                       pValue = static_cast<const String*>(pArgList->GetAt(0));
-                       if (pValue && pValue->GetPointer())
-                       {
-                               pKey = new (std::nothrow) String(EMAIL);
-                               pKey->Append(DELIMITER);
-                               pKey->Append(*pValue);
-                               pArgs->Add(pKey);
-                       }
+                       pKey = new (std::nothrow) String(EMAIL);
+                       pKey->Append(DELIMITER);
+                       pKey->Append(*pValue);
+                       pArgs->Add(pKey);
                }
 
-               pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_URL)));
-               if (pArgList != null && pArgList->GetCount() > 0)
+               pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_URL)));
+               if (pValue && pValue->GetPointer())
                {
-                       pValue = static_cast<const String*>(pArgList->GetAt(0));
-                       if (pValue && pValue->GetPointer())
-                       {
-                               pKey = new (std::nothrow) String(URL);
-                               pKey->Append(DELIMITER);
-                               pKey->Append(*pValue);
-                               pArgs->Add(pKey);
-                       }
+                       pKey = new (std::nothrow) String(URL);
+                       pKey->Append(DELIMITER);
+                       pKey->Append(*pValue);
+                       pArgs->Add(pKey);
                }
 
                __initialSceneId = IDSCN_CONTACT_LIST;
@@ -550,17 +501,7 @@ ContactsApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::Str
                pViewType->Append(VALUE_VIEW_TYPE_CONTACT);
                pArgs->Add(pViewType);
 
-               const ArrayList* pArgList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(CONTACT_KEY_ITEM_ID)));
-               if (pArgList == null || pArgList->GetCount() == 0)
-               {
-                       AppLogDebug("To launch AppControl by the edit operation, the item_id should be input.");
-                       AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, APP_CTRL_RESULT_FAILED, null);
-                       Terminate();
-
-                       return;
-               }
-
-               const String* pValue = static_cast<const String*>(pArgList->GetAt(0));
+               const String* pValue = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_ITEM_ID)));
                if (pValue == null || pValue->GetPointer() == null)
                {
                        AppLogDebug("To launch AppControl by the view operation, the itemId should be input.");
index fec68ad..9ac1cea 100644 (file)
@@ -435,14 +435,18 @@ FavoriteListPanel::OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListV
                }
                else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_VCARD)
                {
+                       AppCtrlResult appCtrlResult = APP_CTRL_RESULT_SUCCEEDED;
                        String vCardPath = __pPresentationModel->ExportToVcard(index);
-                       ArrayList* pValueList = new (std::nothrow) ArrayList();
-                       pValueList->Construct();
-                       pValueList->Add(new (std::nothrow) String(vCardPath));
-
-                       pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PATH), pValueList);
 
-                       ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_SUCCEEDED, pReturnValue);
+                       if (vCardPath.IsEmpty())
+                       {
+                               appCtrlResult = APP_CTRL_RESULT_FAILED;
+                       }
+                       else
+                       {
+                               pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PATH), new (std::nothrow) String(vCardPath));
+                       }
+                       ReturnValues(pContactsApp->GetRequestId(), appCtrlResult, pReturnValue);
 
                        return;
                }
index 392d283..71fffd2 100644 (file)
@@ -662,17 +662,14 @@ GroupContactListForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::Gro
                {
                        AppCtrlResult appCtrlResult = APP_CTRL_RESULT_SUCCEEDED;
                        String vCardPath = __pPresentationModel->ExportToVcard(groupIndex, itemIndex);
+
                        if (vCardPath.IsEmpty())
                        {
                                appCtrlResult = APP_CTRL_RESULT_FAILED;
                        }
                        else
                        {
-                               ArrayList* pValueList = new (std::nothrow) ArrayList();
-                               pValueList->Construct();
-                               pValueList->Add(new (std::nothrow) String(vCardPath));
-
-                               pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PATH), pValueList);
+                               pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PATH), new (std::nothrow) String(vCardPath));
                        }
 
                        ReturnValues(pContactsApp->GetRequestId(), appCtrlResult, pReturnValue);