[Merge] lp:~abreu-alexandre/webbrowser-app/intent into lp:webbrowser-app

Olivier Tilloy olivier.tilloy at canonical.com
Mon Jan 26 09:35:57 UTC 2015


Why not make the parameter of parseIntentUri(…) a QUrl ?
This would make it much easier to parse the URI, without the need for regexpes. E.g.:

    QUrl url("intent://…");

    qDebug() << "URL:" << url;
    qDebug() << "scheme:" << url.scheme();
    qDebug() << "host:" << url.host();
    qDebug() << "path:" << url.path();
    qDebug() << "query:" << url.query();
    qDebug() << "fragment:" << url.fragment();

    QStringList fragments = url.fragment().split(";");
    assert(fragments.takeFirst() == "Intent");
    assert(fragments.takeLast() == "end");
    QMap<QString, QString> tokens;
    Q_FOREACH(const QString& fragment, fragments) {
        QStringList token = fragment.split("=");
        assert(token.size() == 2);
        tokens.insert(token[0], token[1]);
    }
    qDebug() << "tokens:" << tokens;

-- 
https://code.launchpad.net/~abreu-alexandre/webbrowser-app/intent/+merge/247421
Your team Ubuntu Phablet Team is subscribed to branch lp:webbrowser-app.



More information about the Ubuntu-reviews mailing list