}
}
+std::string prepareUrl(const std::string &url, const std::string &insert)
+{
+ std::string urlFixed = url;
+ if (urlFixed.find("file://") == 0) {
+ urlFixed.erase(0, 6);
+ }
+ //replace %s in url with given from appservice
+ int size = snprintf(NULL, 0, urlFixed.c_str(), insert.c_str()) + 1;
+ char buffer[size];
+ snprintf(buffer, size, urlFixed.c_str(), insert.c_str());
+ return std::string(buffer);
+}
+
std::string getCustomHandlerProtocolUri(
WidgetModel *widgetModel,
const std::string &schemeType,
CustomHandlerDB::Interface::detachDatabase();
if (handler) {
LogDebug("Found handler, url: " << handler->url);
- std::string url = DPL::ToUTF8String(handler->base_url) +
- DPL::ToUTF8String(handler->url);
- if (url.find("file://") == 0) {
- url.erase(0, 6);
- }
- //replace %s in url with given from appservice
- int size = snprintf(NULL, 0, url.c_str(), schemeValue.c_str()) + 1;
- char buffer[size];
- snprintf(buffer, size, url.c_str(), schemeValue.c_str());
- return std::string(buffer);
+ return prepareUrl(DPL::ToUTF8String(handler->base_url) +
+ DPL::ToUTF8String(handler->url), schemeValue);
+ }
+ return "";
+}
+
+std::string getCustomHandlerContentUri(
+ WidgetModel *widgetModel,
+ const std::string &mime,
+ const std::string &mimeValue)
+{
+ CustomHandlerDB::Interface::attachDatabaseRO();
+ CustomHandlerDB::CustomHandlerDAOReadOnly handlersDao(widgetModel->TizenId);
+ CustomHandlerDB::CustomHandlerPtr handler =
+ handlersDao.getActivContentHandler(
+ DPL::FromASCIIString(mime));
+ CustomHandlerDB::Interface::detachDatabase();
+ if (handler) {
+ LogDebug("Found handler, url: " << handler->url);
+ return prepareUrl(DPL::ToUTF8String(handler->base_url) +
+ DPL::ToUTF8String(handler->url), mimeValue);
}
return "";
}
return getCustomHandlerProtocolUri(
widgetModel, schemeParts[0], schemeParts[1]);
}
-
+ if (mime != "") {
+ value = appsvc_get_data(bundle, APPSVC_DATA_SELECTED);
+ if (value != NULL) {
+ LogDebug("Use mime type for: " << value);
+ return getCustomHandlerContentUri(
+ widgetModel, mime, std::string(value));
+ } else {
+ LogError("Selected file for mime is null, nothind to do");
+ }
+ }
LogDebug("no matching result");
return std::string("");
}