[Merge] lp:~abreu-alexandre/webbrowser-app/add-scheme-filter-handler into lp:webbrowser-app
David Barth
david.barth at canonical.com
Wed Jul 29 15:40:31 UTC 2015
Also, some debug log for when the filter file can't be loaded would be nice
Diff comments:
>
> === modified file 'src/app/webcontainer/webapp-container.cpp'
> --- src/app/webcontainer/webapp-container.cpp 2015-06-24 13:37:05 +0000
> +++ src/app/webcontainer/webapp-container.cpp 2015-07-29 13:50:50 +0000
> @@ -204,28 +204,31 @@
> }
> }
>
> -void WebappContainer::setupLocalIntentFilterIfAny(QQmlContext* context)
> +void WebappContainer::setupLocalSchemeFilterIfAny(QQmlContext* context, const QString& webappSearchPath)
> {
> - if(!context)
> - {
> + if(!context) {
> return;
> }
>
> - QString localIntentFilterFileContent;
> - if (IntentFilter::isValidLocalIntentFilterFile(LOCAL_INTENT_FILTER_FILENAME))
> - {
> - QFile f(LOCAL_INTENT_FILTER_FILENAME);
> - if (f.open(QIODevice::ReadOnly))
> - {
> - localIntentFilterFileContent = QString(f.readAll());
> - }
> - f.close();
> -
> - qDebug() << "Using local intent filter file:"
> - << LOCAL_INTENT_FILTER_FILENAME;
> + QDir searchPath(webappSearchPath.isEmpty()
> + ? QDir::currentPath()
> + : webappSearchPath);
> +
> + bool hasValidLocalSchemeFilterFile = false;
> +
> + QMap<QString, QString> content =
> + SchemeFilter::parseValidLocalSchemeFilterFile(
> + hasValidLocalSchemeFilterFile,
> + searchPath.filePath(LOCAL_SCHEME_FILTER_FILENAME));
> +
> + if (hasValidLocalSchemeFilterFile) {
If the filter file is malformated, it's worth logging that as well in a debug statement
> + qDebug() << "Using local scheme filter file:"
> + << LOCAL_SCHEME_FILTER_FILENAME;
> }
> - m_intentFilter.reset(new IntentFilter(localIntentFilterFileContent, NULL));
> - context->setContextProperty("webappIntentFilter", m_intentFilter.data());
> +
> + m_schemeFilter.reset(new SchemeFilter(content));
> +
> + context->setContextProperty("webappSchemeFilter", m_schemeFilter.data());
> }
>
> bool WebappContainer::isValidLocalApplicationRunningContext() const
--
https://code.launchpad.net/~abreu-alexandre/webbrowser-app/add-scheme-filter-handler/+merge/265265
Your team Ubuntu Phablet Team is subscribed to branch lp:webbrowser-app.
More information about the Ubuntu-reviews
mailing list