#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/localization/localization_utils.h>
-#include <dpl/log/log.h>
+#include <dpl/log/wrt_log.h>
#include <dpl/string.h>
-#include <dpl/optional.h>
#include <dpl/foreach.h>
#include <LanguageTagsProvider.h>
const DPL::String APP_URI_BEGIN = L"app://";
const DPL::String LOCALE_PREFIX = L"locales/";
-DPL::Optional<std::string> GetFilePathInWidgetPackageInternal(
+DPL::OptionalStdString GetFilePathInWidgetPackageInternal(
const std::string& basePath,
std::string filePath)
{
- LogDebug("Looking for file: " << filePath << " in: " << basePath);
+ WrtLogD("Looking for file: %s in: %s", filePath.c_str(), basePath.c_str());
const LanguageTags& ltags =
LanguageTagsProviderSingleton::Instance().getLanguageTags();
//Check if string isn't empty
if (filePath.size() == 0) {
- return DPL::Optional<std::string>::Null;
+ return DPL::OptionalStdString();
}
//Removing preceding '/'
if (filePath[0] == '/') {
}
//Check if string isn't empty
if (filePath.size() == 0) {
- return DPL::Optional<std::string>::Null;
+ return DPL::OptionalStdString();
}
- LogDebug("locales size = " << ltags.size());
+ WrtLogD("locales size = %i", ltags.size());
for (LanguageTags::const_iterator it = ltags.begin();
it != ltags.end();
++it)
{
- LogDebug("Trying locale: " << *it);
+ WrtLogD("Trying locale: %ls", it->c_str());
std::string path = basePath;
if (path[path.size() - 1] == '/') {
path.erase(path.size() - 1);
path += "/locales/" + DPL::ToUTF8String(*it) + "/" + filePath;
}
- LogDebug("Trying locale: " << *it << " | " << path);
+ WrtLogD("Trying locale: %ls | %s", it->c_str(), path.c_str());
struct stat buf;
if (0 == stat(path.c_str(), &buf)) {
if ((buf.st_mode & S_IFMT) == S_IFREG) {
path.erase(0, basePath.length());
- return DPL::Optional<std::string>(path);
+ return DPL::OptionalStdString(path);
}
}
}
- return DPL::Optional<std::string>::Null;
+ return DPL::OptionalStdString();
}
-DPL::Optional<DPL::String> GetFilePathInWidgetPackageInternal(
+DPL::OptionalString GetFilePathInWidgetPackageInternal(
const DPL::String& basePath,
const DPL::String& filePath)
{
- DPL::Optional<std::string> path =
+ DPL::OptionalStdString path =
GetFilePathInWidgetPackageInternal(DPL::ToUTF8String(basePath),
DPL::ToUTF8String(filePath));
- DPL::Optional<DPL::String> dplPath;
+ DPL::OptionalString dplPath;
if (!!path) {
dplPath = DPL::FromUTF8String(*path);
}
if (workingUrl.compare(0, DOUBLE_ROOT.length(), DOUBLE_ROOT) == 0)
{
workingUrl.erase(0, 1);
- LogDebug("workingUrl: " << workingUrl);
+ WrtLogD("workingUrl: %s", workingUrl.c_str());
}
// remove src path
}
else
{
- LogError("Tizen id does not match, ignoring");
+ WrtLogE("Tizen id does not match, ignoring");
return "";
}
}
if (workingUrl.empty())
{
- LogError("URL Localization Error!");
+ WrtLogE("URL Localization Error!");
return "";
}
return workingUrl;
}
-DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
+DPL::OptionalString getFilePathInWidgetPackageFromUrl(
const WrtDB::TizenAppId &tzAppId,
const DPL::String &url)
{
url);
}
-DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
+DPL::OptionalString getFilePathInWidgetPackageFromUrl(
WrtDB::WidgetDAOReadOnlyPtr dao,
const DPL::String &url)
{
DPL::String id = dao->getTizenAppId();
if(req.substr(0, id.size()) != id)
{
- LogError("Tizen id does not match, ignoring");
- return DPL::Optional<DPL::String>::Null;
+ WrtLogE("Tizen id does not match, ignoring");
+ return DPL::OptionalString();
}
req.erase(0, id.length());
} else {
- LogDebug("Unknown path format, ignoring");
- return DPL::Optional<DPL::String>::Null;
+ WrtLogD("Unknown path format, ignoring");
+ return DPL::OptionalString();
}
auto widgetPath = dao->getPath();
- LogDebug("Required path: " << req);
- DPL::Optional<DPL::String> found =
+ WrtLogD("Required path: %ls", req.c_str());
+ DPL::OptionalString found =
GetFilePathInWidgetPackageInternal(widgetPath, req);
if (!found) {
- LogError("Path not found within current locale in current widget");
- return DPL::Optional<DPL::String>::Null;
+ WrtLogE("Path not found within current locale in current widget");
+ return DPL::OptionalString();
}
found = widgetPath + *found + suffix;
return found;
}
-DPL::Optional<DPL::String> getFilePathInWidgetPackage(
+DPL::OptionalString getFilePathInWidgetPackage(
const WrtDB::TizenAppId &tzAppId,
const DPL::String& file)
{
file);
}
-DPL::Optional<DPL::String> getFilePathInWidgetPackage(
+DPL::OptionalString getFilePathInWidgetPackage(
WrtDB::WidgetDAOReadOnlyPtr dao,
const DPL::String& file)
{
}
}
- return DPL::OptionalString::Null;
+ return DPL::OptionalString();
}
OptionalWidgetIcon getIcon(const WrtDB::TizenAppId & tzAppId)
}
}
- return OptionalWidgetIcon::Null;
+ return OptionalWidgetIcon();
}
WidgetIconList getValidIconsList(const WrtDB::TizenAppId &tzAppId)
FOREACH(it, list)
{
- LogDebug(":" << it->iconSrc);
+ WrtLogD(":%ls", it->iconSrc.c_str());
if (!!getFilePathInWidgetPackage(dao->getTizenAppId(),
it->iconSrc))
{
}
}
- return OptionalWidgetStartFileInfo::Null;
+ return OptionalWidgetStartFileInfo();
}
WidgetLocalizedInfo getLocalizedInfo(const WrtDB::TizenAppId & tzAppId)