[Merge] lp:~abreu-alexandre/webbrowser-app/flexible-lifecycle-click-hook into lp:webbrowser-app

Alexandre Abreu alexandre.abreu at canonical.com
Thu Dec 10 20:30:53 UTC 2015



Diff comments:

> === modified file 'click-hooks/hook-utils.cpp'
> --- click-hooks/hook-utils.cpp	2014-11-19 14:25:36 +0000
> +++ click-hooks/hook-utils.cpp	2015-12-04 16:26:26 +0000
> @@ -36,6 +36,61 @@
>      return components.join('_');
>  }
>  
> +QString stringFromClickLifeCyclePhase(
> +        HookUtils::WebappHookParser::ClickLifeCyclePhase phase)
> +{
> +    using namespace HookUtils;
> +    switch(phase) {
> +    case WebappHookParser::CLICK_LIFECYCLE_PHASE_INSTALL:
> +        return "install";
> +        break;
> +    case WebappHookParser::CLICK_LIFECYCLE_PHASE_UNINSTALL:
> +        return "uninstall";
> +        break;
> +    case WebappHookParser::CLICK_LIFECYCLE_PHASE_UPDATE:
> +        return "update";
> +        break;
> +    }
> +    return QString();
> +}
> +
> +void executeHookDirectives(const QString& hookFilename
> +                           , HookUtils::WebappHookParser::ClickLifeCyclePhase phase) {
> +    QFileInfo fileInfo(hookFilename);
> +    if (!fileInfo.exists() || !fileInfo.isFile())
> +    {
> +        qDebug() << "Cannot execute directives for" << hookFilename;
> +        return;
> +    }
> +
> +    qDebug() << "Handling" << hookFilename;
> +
> +    HookUtils::WebappHookParser webappHookParser;
> +    HookUtils::WebappHookParser::Data data =
> +            webappHookParser.parseContent(
> +                hookFilename,
> +                phase);
> +
> +    QString appIdNoVersion = fileInfo.fileName();
> +
> +    if (data.shouldDeleteCacheOnUninstall)

no, that's the goal, open it to other phases to. The  name is misleading though, I updated it.

> +    {
> +        QDir dir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)
> +                 + "/" + shortAppIdFromUnversionedAppId(appIdNoVersion));
> +        dir.removeRecursively();
> +
> +        qDebug() << "Removing cache from" << dir.absolutePath();
> +    }
> +    if (data.shouldDeleteCookiesOnUninstall)
> +    {
> +        QDir dir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
> +                 + "/" + shortAppIdFromUnversionedAppId(appIdNoVersion));
> +        dir.removeRecursively();
> +
> +        qDebug() << "Removing cookies from" << dir.absolutePath();
> +    }
> +}
> +
>  }
>  
>  


-- 
https://code.launchpad.net/~abreu-alexandre/webbrowser-app/flexible-lifecycle-click-hook/+merge/279508
Your team Ubuntu Phablet Team is subscribed to branch lp:webbrowser-app.



More information about the Ubuntu-reviews mailing list