X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fpkg-manager%2Fbackendlib.cpp;h=e5695610c3f181ef178cc2e18dc40f8e0db56747;hb=d4ea3ba261fc97db4b973fd66715fb211347d31c;hp=c7a58c3ed28e8cbef9f16de7a6592837ad9fd24d;hpb=ae944cb4e48008ab1a3991e91ab160a9451fe007;p=framework%2Fweb%2Fwrt-installer.git diff --git a/src/pkg-manager/backendlib.cpp b/src/pkg-manager/backendlib.cpp index c7a58c3..e569561 100644 --- a/src/pkg-manager/backendlib.cpp +++ b/src/pkg-manager/backendlib.cpp @@ -98,23 +98,23 @@ static int pkg_plugin_app_is_installed(const char *pkg_name) WrtDB::TizenAppId appid; - if ((regexec(®, pkg_name, + if (!(regexec(®, pkg_name, static_cast(0), NULL, 0) == 0)) { - WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name)); - appid = WidgetDAOReadOnly::getTzAppId(pkgid); - } else { - appid = DPL::FromUTF8String(pkg_name); + LogError("Invalid argument : " << pkg_name); + return FALSE; } - bool result = WidgetDAOReadOnly::isWidgetInstalled(appid); - WrtDB::WrtDatabase::detachFromThread(); - - if (result) { - return TRUE; - } else { + Try { + WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name)); + appid = WidgetDAOReadOnly::getTzAppId(pkgid); + LogDebug("appid : " << appid); + } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { + WrtDB::WrtDatabase::detachFromThread(); return FALSE; } + WrtDB::WrtDatabase::detachFromThread(); + return TRUE; } static int pkg_plugin_get_installed_apps_list(const char * /*category*/, @@ -173,9 +173,18 @@ static int pkg_plugin_get_app_detail_info( LogDebug("pkg_plugin_get_app_detail_info() is called"); WrtDB::WrtDatabase::attachToThreadRO(); - int handle = WidgetDAOReadOnly::getHandle( - DPL::FromUTF8String(pkg_name)); - WidgetDAOReadOnly widget(handle); + + WrtDB::TizenAppId appid; + Try { + WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name)); + appid = WidgetDAOReadOnly::getTzAppId(pkgid); + LogDebug("appid : " << appid); + } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { + WrtDB::WrtDatabase::detachFromThread(); + return FALSE; + } + + WidgetDAOReadOnly widget(appid); DPL::Optional version = widget.getVersion(); DPL::Optional id = widget.getGUID(); @@ -186,12 +195,14 @@ static int pkg_plugin_get_app_detail_info( DPL::ToUTF8String(*version).c_str(), PKG_VERSION_STRING_LEN_MAX - 1); } - snprintf(pkg_detail_info->optional_id, PKG_NAME_STRING_LEN_MAX, "%d", - handle); + snprintf(pkg_detail_info->pkgid, PKG_NAME_STRING_LEN_MAX, "%s", + pkg_name); + snprintf(pkg_detail_info->optional_id, PKG_NAME_STRING_LEN_MAX, "%s", + DPL::ToUTF8String(appid).c_str()); WidgetLocalizedInfo localizedInfo; if (locale.IsNull()) { - LogError("is NULL"); + LogDebug("locale is NULL"); DPL::String languageTag(L""); localizedInfo = widget.getLocalizedInfo(languageTag); } else { @@ -207,6 +218,11 @@ static int pkg_plugin_get_app_detail_info( strncpy(pkg_detail_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX); strncpy(pkg_detail_info->pkg_name, pkg_name, PKG_NAME_STRING_LEN_MAX - 1); + std::string min_version = DPL::ToUTF8String((*widget.getMinimumWacVersion())); + + strncpy(pkg_detail_info->min_platform_version, min_version.c_str(), + PKG_VERSION_STRING_LEN_MAX - 1); + /* set installed time */ pkg_detail_info->installed_time = widget.getInstallTime();