#include "WidgetFeature.h"
-namespace { // anonymous
- const int INVALID_WIDGET_HANDLE = -1;
-} // namespace
namespace WrtDeviceApis {
namespace WidgetDB {
const WrtDB::WidgetGUID w_guid =
WrtDB::WidgetGUID(DPL::FromUTF8String(gid));
- WrtDB::DbWidgetHandle widgetHandle = INVALID_WIDGET_HANDLE;
+ try {
+ WrtDB::DbWidgetHandle widgetHandle =
+ WrtDB::WidgetDAOReadOnly::getHandle(w_guid);
- WrtDB::DbWidgetHandleList widgetList = WrtDB::WidgetDAOReadOnly
- ::getHandleList();
-
- FOREACH(iterator, widgetList) {
- WrtDB::WidgetDAOReadOnly dao(*iterator);
- WrtDB::WidgetGUID d_guid = dao.getGUID();
- if (w_guid == d_guid) {
- widgetHandle = *iterator;
- }
- }
-
- // TODO check name
- if (INVALID_WIDGET_HANDLE == widgetHandle) {
- outStatus = Api::InstallationStatus::STATUS_UNINSTALLED;
- } else {
WrtDB::WidgetDAOReadOnly dao(widgetHandle);
DPL::OptionalString ver = dao.getVersion();
if (!ver || version > DPL::ToUTF8String(*ver)) {
} else {
outStatus = Api::InstallationStatus::STATUS_LATEST;
}
+ }catch (WrtDB::WidgetDAOReadOnly::Exception::WidgetNotExist) {
+ outStatus = Api::InstallationStatus::STATUS_UNINSTALLED;
}
}
Catch(DPL::Exception)