~dobey/keeper/cleanup

« back to all changes in this revision

Viewing changes to src/helper/data-dir-registry.cpp

  • Committer: Bileto Bot
  • Author(s): Charles Kerr, Xavi Garcia Mena, Xavi Garcia
  • Date: 2017-02-13 08:57:25 UTC
  • mfrom: (126.1.21 keeper-tests-charles)
  • Revision ID: ci-train-bot@canonical.com-20170213085725-rpsp9eg86dk2zlvi
Adds integration tests for restore and restore cancellation.

Approved by: Charles Kerr, unity-api-1-bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
    {
64
64
        QStringList ret;
65
65
 
66
 
        QString type;
67
 
        if (task.get_property(Metadata::TYPE_KEY, type))
 
66
        auto type = task.get_type();
 
67
        if (!type.isEmpty())
68
68
        {
69
69
            auto it = registry_.find(std::make_pair(type,prop));
70
70
            if (it == registry_.end())
89
89
    QStringList perform_url_substitution(Metadata const& task, QStringList const& urls_in)
90
90
    {
91
91
        std::array<QString,6> keys = {
92
 
            Metadata::TYPE_KEY,
93
 
            Metadata::SUBTYPE_KEY,
94
 
            Metadata::NAME_KEY,
95
 
            Metadata::PACKAGE_KEY,
96
 
            Metadata::TITLE_KEY,
97
 
            Metadata::VERSION_KEY
 
92
            keeper::Item::TYPE_KEY,
 
93
            keeper::Item::SUBTYPE_KEY,
 
94
            keeper::Item::NAME_KEY,
 
95
            keeper::Item::PACKAGE_KEY,
 
96
            keeper::Item::TITLE_KEY,
 
97
            keeper::Item::VERSION_KEY
98
98
        };
99
99
 
100
100
        QStringList urls {urls_in};
101
101
 
102
102
        for (auto const& key : keys)
103
103
        {
104
 
            QString after;
105
 
            if (task.get_property(key, after))
 
104
            QVariant after = task.get_property_value(key);
 
105
            if (after.isValid())
106
106
            {
107
107
                QString before = QStringLiteral("${%1}").arg(key);
108
108
                for (auto& url : urls)
109
 
                    url.replace(before, after);
 
109
                    url.replace(before, after.toString());
110
110
            }
111
111
        }
112
112