fix crash problem on launching configuration screen
authorjungmin76.park <jungmin76.park@samsung.com>
Wed, 22 May 2013 13:58:49 +0000 (22:58 +0900)
committerjungmin76.park <jungmin76.park@samsung.com>
Wed, 22 May 2013 13:58:49 +0000 (22:58 +0900)
Change-Id: Ic78976a77d557299768dc8606791d7adbb263ff0
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
project/inc/AppWidgetViewerMainForm.h
project/src/AppWidgetViewer.cpp
project/src/AppWidgetViewerMainForm.cpp

index e0150ca..1cc771c 100644 (file)
@@ -20,7 +20,7 @@
 #include <FApp.h>
 #include <FBase.h>
 #include <FUi.h>
-#include <FShellAppWidgetProviderInfo.h>
+#include <FShell.h>
 
 class AppWidgetViewerMainForm
        : public Tizen::Ui::Controls::Form
index f635899..7b3c7e3 100644 (file)
@@ -15,9 +15,7 @@
 //
 
 #include <unique_ptr.h>
-#include <FShellAppWidgetManager.h>
-#include <FShellAppWidgetProviderInfo.h>
-#include <FShellAppWidgetSizeInfo.h>
+#include <FShell.h>
 
 #include "AppWidgetViewer.h"
 #include "AppWidgetViewerFrame.h"
index 3a47113..0230f6c 100644 (file)
 // limitations under the License.
 //
 
+#include <unique_ptr.h>
 #include <FApp.h>
 #include <FMedia.h>
-#include <FShellAppWidgetProviderInfo.h>
-#include <FShellAppWidgetManager.h>
-#include <FShellAppWidgetSizeInfo.h>
+#include <FShell.h>
 
 #include "AppWidgetViewerMainForm.h"
 #include "AppWidgetViewerFormFactory.h"
@@ -39,6 +38,13 @@ const int LIST_ITEM_MARGIN_LEFT = 26;
 const int LIST_ITEM_MARGIN_TOP = 32;
 const int LIST_ITEM_TEXT_HEIGHT = 50;
 
+const wchar_t OPERATION_APPWIDGET_CONFIG[]     = L"http://tizen.org/appcontrol/operation/appwidget/configuration";
+const wchar_t EXTRA_KEY_USER_INFO[] = L"http://tizen.org/appcontrol/data/user_info";
+const wchar_t EXTRA_KEY_PROVIDER_NAME[] = L"http://tizen.org/appcontrol/data/provider_name";
+
+
+
+
 AppWidgetViewerMainForm::AppWidgetViewerMainForm(void)
        : __pList(null)
        , __pAppWidgetProviderList(null)
@@ -177,7 +183,7 @@ AppWidgetViewerMainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListVie
                String configurationAppControlAppId = __pSelectedProviderInfo->GetConfigurationAppControlAppId();
                if(!configurationAppControlAppId.IsEmpty())
                {
-                       StartConfigurationAppControl(__pSelectedProviderInfo->GetConfigurationAppControlAppId(), __pSelectedProviderInfo->GetName());
+                       StartConfigurationAppControl(configurationAppControlAppId, __pSelectedProviderInfo->GetName());
                }
                else
                {
@@ -190,15 +196,23 @@ AppWidgetViewerMainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListVie
 void
 AppWidgetViewerMainForm::StartConfigurationAppControl(const Tizen::Base::String& appId, const Tizen::Base::String& providerName)
 {
-       AppControl* pAc = AppManager::FindAppControlN( appId, L"http://tizen.org/appcontrol/operation/livebox/configuration");
-       HashMap extra;
-       extra.Construct();
-       String key = L"ProviderName";
-       String value = providerName;
-       extra.Add(&key, &value);
-
-       pAc->Start(null, null, &extra, this);
-       delete pAc;
+       std::unique_ptr<AppControl> pAc( AppManager::FindAppControlN(appId, OPERATION_APPWIDGET_CONFIG) );
+       if (pAc)
+       {
+               HashMap extra;
+               extra.Construct();
+               String key = EXTRA_KEY_PROVIDER_NAME;
+               String value = providerName;
+               extra.Add(&key, &value);
+
+               pAc->Start(null, null, &extra, this);
+       }
+       else
+       {
+               Tizen::Shell::NotificationManager notiMgr;
+               notiMgr.Construct();
+               notiMgr.NotifyTextMessage(L"Failed to open setting screen for the selected Dynamic Box.");
+       }
 }
 
 void
@@ -283,9 +297,9 @@ AppWidgetViewerMainForm::OnAppControlCompleteResponseReceived(const AppId& appId
 
        if(pExtraData)
        {
-               String userInfokey(L"http://tizen.org/appcontrol/data/userinfo");
-               const String* pUserInfoValue = dynamic_cast<const String*>(pExtraData->GetValue(userInfokey) );
-               AppLog("%ls, %ls, %ls", appId.GetPointer(), operationId.GetPointer(), pUserInfoValue->GetPointer() );
+               String key = EXTRA_KEY_USER_INFO;
+               const String* pUserInfoValue = dynamic_cast<const String*>(pExtraData->GetValue(key) );
+               AppLog("appId:%ls, operationId:%ls, user info:%ls", appId.GetPointer(), operationId.GetPointer(), pUserInfoValue->GetPointer() );
 
                GoAppWidgetViewScene(__pSelectedProviderInfo->GetAppId(), __pSelectedProviderInfo->GetName(), __pSelectedProviderInfo->GetDisplayName(), *pUserInfoValue);
        }