fix AppControl E_MAX_EXCEEDED result
[platform/framework/native/app-controls.git] / src / calendar-app-control / CalendarAppControlDllEntry.cpp
index ad0722f..283c787 100644 (file)
@@ -67,6 +67,7 @@ static const char __allowedAppControlPickTable[][2][96] =
        {"osp.appcontrol.provider.calendar", "osp.appcontrol.operation.pick"},
        {"tizen.calendar", "http://tizen.org/appcontrol/operation/pick"},
        {"tizen.calendar", "http://tizen.org/appcontrol/operation/social/pick"},
+       {"tizen.todo", "http://tizen.org/appcontrol/operation/social/pick"},
 };
 
 static const char __allowedAppControlViewTable[][2][96] =
@@ -74,6 +75,7 @@ static const char __allowedAppControlViewTable[][2][96] =
        {"osp.appcontrol.CALENDAR", "osp.appcontrol.operation.VIEW"},
        {"osp.appcontrol.provider.calendar", "osp.appcontrol.operation.view"},
        {"tizen.calendar", "http://tizen.org/appcontrol/operation/social/view"},
+       {"tizen.todo", "http://tizen.org/appcontrol/operation/social/view"},
 };
 
 static const char __allowedAppControlEditTable[][2][96] =
@@ -84,6 +86,7 @@ static const char __allowedAppControlEditTable[][2][96] =
 static const char __allowedAppControlVcsViewTable[][2][96] =
 {
        {"tizen.calendar", "http://tizen.org/appcontrol/operation/view"},
+       {"tizen.todo", "http://tizen.org/appcontrol/operation/view"},
 };
 
 result
@@ -96,9 +99,9 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr
 
        __req = req;
 
-       const bool isCalendarVcsView = _AppControlManager::IsAllowedAppControl(__allowedAppControlVcsViewTable, 1, aId, oId);
-       const bool isCalendarView = _AppControlManager::IsAllowedAppControl(__allowedAppControlViewTable, 3, aId, oId);
-       const bool isCalendarPick = _AppControlManager::IsAllowedAppControl(__allowedAppControlPickTable, 4, aId, oId);
+       const bool isCalendarVcsView = _AppControlManager::IsAllowedAppControl(__allowedAppControlVcsViewTable, 2, aId, oId);
+       const bool isCalendarView = _AppControlManager::IsAllowedAppControl(__allowedAppControlViewTable, 4, aId, oId);
+       const bool isCalendarPick = _AppControlManager::IsAllowedAppControl(__allowedAppControlPickTable, 5, aId, oId);
        const bool isCalendarEdit = _AppControlManager::IsAllowedAppControl(__allowedAppControlEditTable, 1, aId, oId);
 
        SysTryReturnResult(NID_APP, isCalendarPick || isCalendarEdit || isCalendarView || isCalendarVcsView, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
@@ -108,6 +111,7 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr
 
        AppSvcResFn pCb = NULL;
 
+       String providerAppId;
        String package;
        String operation;
        String uri;
@@ -137,6 +141,7 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr
 #endif
 
                pCb = OnAppControlResultTizen;
+               providerAppId = L"tizen.calendar_list";
                operation = L"http://tizen.org/appcontrol/operation/social/pick";
 
                const String& tmpItemType = msg.GetValue(L"itemType");
@@ -172,6 +177,7 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr
                
                hasOutput = true;
                pCb = OnAppControlResultTizen;
+               providerAppId = L"tizen.calendar_edit";
                operation = L"http://tizen.org/appcontrol/operation/social/edit";
 
                msg.AddData(CALENDAR_ITEM_TYPE, L"event");
@@ -188,6 +194,8 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr
                        }
                }
 
+               providerAppId = L"tizen.calendar_detail";
+
                if (pActualUri)
                {
                        SysLog(NID_APP, "Calendar AppControl : VIEW operation (vcs).");
@@ -199,7 +207,7 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr
 
                        operation = L"http://tizen.org/appcontrol/operation/social/view";
 
-                       const String& tmpItemType = msg.GetValue(L"itemType");
+                       const String& tmpItemType = msg.GetValue(L"viewType");
                        if (!tmpItemType.IsEmpty())
                        {
                                msg.AddData(CALENDAR_ITEM_TYPE, tmpItemType);
@@ -213,30 +221,33 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr
                                msg.AddData(CALENDAR_ITEM_TYPE, L"event");
                        }
 
-                       const String& tmp = msg.GetValue(L"eventId");
-                       if (!tmp.IsEmpty())
+                       const String& tmpEventId = msg.GetValue(L"eventId");
+                       const String& tmpTodoId = msg.GetValue(L"todoId");
+                       if (!tmpEventId.IsEmpty())
+                       {
+                               msg.AddData(CALENDAR_ITEM_ID, tmpEventId);
+                       }
+                       else if (!tmpTodoId.IsEmpty())
                        {
-                               msg.AddData(CALENDAR_ITEM_ID, tmp);
+                               msg.AddData(CALENDAR_ITEM_ID, tmpTodoId);
                        }
                }
        }
-       else
-       {
-               operation = oId;
-       }
 
-       package = _AppControlManager::GetAliasAppId(aId);
-       SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
+       package = _AppControlManager::GetAliasAppId(providerAppId);
+       SysLog(NID_APP, "Actual app is %ls.", package.GetPointer());
 
        __req = req; 
        __processId = _AppControlManager::GetInstance()->Launch(msg, package, operation, pActualUri, pMime, pCb, 0);
 
-       SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Calendar AppControl is failed.");
+       r = GetLastResult();
+       SysTryReturnResult(NID_APP, __processId >= 0, r, "StartAppControl: Launching Calendar AppControl is failed.");
 
        SysLog(NID_APP, "StartAppControl: Launching Calendar AppControl succeeded");
 
        return E_SUCCESS;
 
+#if 0
 CATCH:
 
        if (hasOutput)
@@ -246,6 +257,7 @@ CATCH:
 
        __req = -1;
        return r;
+#endif
 }
 
 result