From 2da0d9c127505bef892cfb7e9ef89915f7905b13 Mon Sep 17 00:00:00 2001 From: sangsoo lee Date: Fri, 3 May 2013 14:02:58 +0900 Subject: [PATCH] fix main icon problem Change-Id: Ifab6134029ec0bd55a7714ab43d01ba451e62ccc --- inc/IstDetailForm.h | 2 ++ inc/IstInstallForm.h | 1 + src/IstDetailForm.cpp | 35 ++++++++++++++--------------------- src/IstInstallForm.cpp | 39 ++++++++++++++++++++++++++++++++------- 4 files changed, 49 insertions(+), 28 deletions(-) diff --git a/inc/IstDetailForm.h b/inc/IstDetailForm.h index f175aed..d599d91 100644 --- a/inc/IstDetailForm.h +++ b/inc/IstDetailForm.h @@ -88,7 +88,9 @@ private: Tizen::Graphics::Bitmap* __pCheckImage; Tizen::App::Package::PackageInfo* __pTargetPackageInfo; + Tizen::App::Package::PackageAppInfo* __pPackageAppInfo; Tizen::Base::Collection::IList* __pPrivilegeList; + Tizen::Base::String __targetFilePath; Tizen::Ui::Controls::Header* __pHeader; int __itemCount; diff --git a/inc/IstInstallForm.h b/inc/IstInstallForm.h index f7b8183..0b23571 100644 --- a/inc/IstInstallForm.h +++ b/inc/IstInstallForm.h @@ -76,6 +76,7 @@ private: Tizen::Base::String __packageOperationId; Tizen::Base::String __packageName; Tizen::App::AppManager* __pAppManager; + Tizen::App::Package::PackageAppInfo* __pPackageAppInfo; }; diff --git a/src/IstDetailForm.cpp b/src/IstDetailForm.cpp index 87b10a3..35578ad 100644 --- a/src/IstDetailForm.cpp +++ b/src/IstDetailForm.cpp @@ -157,14 +157,13 @@ result DetailForm::ParsingTPK() { PackageManager* pMgr = PackageManager::GetInstance(); - String filePath; String packageId; String localVersion; PackageInfo* pLocalPackageInfo; - filePath = static_cast(UiApp::GetInstance())->GetPackagePath(); + __targetFilePath = static_cast(UiApp::GetInstance())->GetPackagePath(); // 2. parsing tpk file with file-path - __pTargetPackageInfo = pMgr->GetPackageInfoFromFileN(filePath); + __pTargetPackageInfo = pMgr->GetPackageInfoFromFileN(__targetFilePath); TryReturn(__pTargetPackageInfo != null, GetLastResult(), "[%s] Package Path is not delivered", GetErrorMessage(GetLastResult())) String UNTRUSTED_SOURCE = L"UnknownSrc"; @@ -191,25 +190,22 @@ DetailForm::ParsingTPK() } else { - PackageAppInfo* packageAppInfo = __pTargetPackageInfo->GetPackageAppInfoN(__pTargetPackageInfo->GetMainAppId()); - if (packageAppInfo == null){ + __pPackageAppInfo = __pTargetPackageInfo->GetPackageAppInfoN(__pTargetPackageInfo->GetMainAppId()); + AppLog("[%s], GetPackageAppInfo", GetErrorMessage(GetLastResult())); + if (__pPackageAppInfo == null){ AppLogException("package app info is empty"); } - else if (packageAppInfo->GetAppMenuIconN() == null){ - AppLogException("App Main Icon is empty"); + else if (__pPackageAppInfo->GetAppMenuIconN() == null){ + AppLogException("[%s]App Main Icon is empty", GetErrorMessage(GetLastResult())); } else{ - __pHeader->SetTitleIcon(packageAppInfo->GetAppMenuIconN()); + AppLog("main icon set success"); + __pHeader->SetTitleIcon(__pPackageAppInfo->GetAppMenuIconN()); } - - delete packageAppInfo; } // is the package already installed on local - // =================================================================================== - // temporal modification about version checking. : allow to install lower version. __isInstalled = false; - // =================================================================================== __pPrivilegeList = __pTargetPackageInfo->GetPrivilegeListN(); result res = GetLastResult(); @@ -298,8 +294,7 @@ DetailForm::SetPopupControl() pButtonClose->AddActionEventListener(*this); InstallerApp* pUiApp = static_cast(UiApp::GetInstance()); - String packagePath = pUiApp->GetPackagePath(); - if (packagePath.IsEmpty() || pUiApp->IsValidAccess() == false || !__isValidPackage) + if (__targetFilePath.IsEmpty() || pUiApp->IsValidAccess() == false || !__isValidPackage) { if (!__isValidPackage){ pTextBox->SetText(L"Invalid Package."); @@ -408,12 +403,9 @@ DetailForm::OnTerminating(void) { result r = E_SUCCESS; - if (__pTargetPackageInfo){ - delete __pTargetPackageInfo; - } - if (__pPrivilegeList){ - delete __pPrivilegeList; - } + delete __pTargetPackageInfo; + delete __pPrivilegeList; + delete __pPackageAppInfo; return r; } @@ -431,6 +423,7 @@ DetailForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) IList* pArgs = null; pArgs = new (std::nothrow) ArrayList(); pArgs->Add(*(new (std::nothrow) String(__pTargetPackageInfo->GetDisplayName()))); + pArgs->Add(__targetFilePath); pSceneManager->GoForward(ForwardSceneTransition(SCENE_INSTALL_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs); } break; diff --git a/src/IstInstallForm.cpp b/src/IstInstallForm.cpp index 8dc38b2..8ce1a64 100644 --- a/src/IstInstallForm.cpp +++ b/src/IstInstallForm.cpp @@ -134,11 +134,6 @@ InstallForm::SetPopupControl() __pPopup->Construct(true, Dimension(popupWidth, UI_H_POPUP)); __pPopup->SetTitleTextColor(Color::GetColor(COLOR_ID_BLACK)); - Label* popUpLabel = new (std::nothrow) Label(); - popUpLabel->Construct(Rectangle(X_POPUP_LABLE, Y_POPUP_LABLE, __pPopup->GetBounds().width - GAP_BETWEEN_POPUP_LABEL*2, H_POPUP_LABLE), L"Application installation will be start."); - popUpLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); - popUpLabel->SetTextVerticalAlignment(ALIGNMENT_TOP); - __pPopupTextBox = new (std::nothrow) TextBox(); __pPopupTextBox->Construct(Rectangle(X_POPUP_LABLE, Y_POPUP_LABLE, __pPopup->GetBounds().width - GAP_BETWEEN_POPUP_LABEL*2, UI_H_POPUP - H_POPUP_TITLE), TEXT_BOX_BORDER_NONE); __pPopupTextBox->SetTextSize(33); @@ -189,6 +184,7 @@ InstallForm::OnTerminating(void) result r = E_SUCCESS; delete __pTimer; + delete __pPackageAppInfo; return r; } @@ -201,7 +197,8 @@ InstallForm::OnTimerExpired(Timer& timer) // wait closing install app until new app is running for smooth view change if (!__isInstalling) { - if (__pAppManager->IsRunning(__packageOperationId)){ + if (__pAppManager->IsRunning(__packageOperationId)) + { __pTimer->Cancel(); App::GetInstance()->Terminate(); } @@ -226,6 +223,7 @@ InstallForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection: TryReturnVoid(pLocalPackageInfo != null, "[PackageManager::GetPackageInfoN() return null] get package info error") __packageOperationId = pLocalPackageInfo->GetMainAppId(); + AppLog("__packageOperationId ; %ls", __packageOperationId.GetPointer()); AddFooterItem(); __pProgressLabel->SetText(POPUP_MSESSAGE_SUCCESS); @@ -272,7 +270,8 @@ InstallForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) { AppManager* pAppManager = AppManager::GetInstance(); - pAppManager->LaunchApplication(__packageOperationId); + result res = pAppManager->LaunchApplication(__packageOperationId); + AppLog("launch result : %s", GetErrorMessage(res)); // set timer for smooth view change __pTimer->StartAsRepeatable(500); } @@ -304,10 +303,36 @@ InstallForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId Bitmap* pHeaderImage = pAppResource->GetBitmapN(HEADER_IMAGE); String *packageName = (String*)pArgs->GetAt(0); + String *filePath = (String*)pArgs->GetAt(1); + __pHeader = GetHeader(); __pHeader->SetTitleText(*packageName); __pHeader->SetTitleIcon(pHeaderImage); + // Get Main Menu Icon of Application + AppLog("filePath : %ls", filePath->GetPointer()); + PackageInfo* pTargetPackageInfo; + PackageManager* pMgr = PackageManager::GetInstance(); + pTargetPackageInfo = pMgr->GetPackageInfoFromFileN(*filePath); + if (pTargetPackageInfo->GetId().IsEmpty()) + { + AppLogException("AppId Is Empty"); + } + else + { + __pPackageAppInfo = pTargetPackageInfo->GetPackageAppInfoN(pTargetPackageInfo->GetMainAppId()); + AppLog("[%s], GetPackageAppInfo", GetErrorMessage(GetLastResult())); + if (__pPackageAppInfo == null){ + AppLogException("package app info is empty"); + } + else if (__pPackageAppInfo->GetAppMenuIconN() == null){ + AppLogException("[%s]App Main Icon is empty", GetErrorMessage(GetLastResult())); + } + else{ + AppLog("main icon set!!"); + __pHeader->SetTitleIcon(__pPackageAppInfo->GetAppMenuIconN()); + } + } } void -- 2.7.4