~stolowski/unity-scope-click/update-for-api-0.5.0

« back to all changes in this revision

Viewing changes to scope/clickstore/store-query.cpp

  • Committer: Pawel Stolowski
  • Date: 2014-06-18 16:23:50 UTC
  • Revision ID: pawel.stolowski@canonical.com-20140618162350-c9p597gvi2gsuqlu
More updates for new API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
 
94
94
struct click::Query::Private
95
95
{
96
 
    Private(const unity::scopes::CannedQuery& query, click::Index& index, const scopes::SearchMetadata& metadata)
97
 
        : query(query),
98
 
          index(index),
 
96
    Private(click::Index& index, const scopes::SearchMetadata& metadata)
 
97
        : index(index),
99
98
          meta(metadata)
100
99
    {
101
100
    }
102
 
    unity::scopes::CannedQuery query;
103
101
    click::Index& index;
104
102
    scopes::SearchMetadata meta;
105
103
    click::web::Cancellable search_operation;
106
104
};
107
105
 
108
106
click::Query::Query(unity::scopes::CannedQuery const& query, click::Index& index, scopes::SearchMetadata const& metadata)
109
 
    : impl(new Private(query, index, metadata))
 
107
    : unity::scopes::SearchQueryBase(query, metadata),
 
108
      impl(new Private(index, metadata))
110
109
{
111
110
}
112
111
 
117
116
 
118
117
void click::Query::cancelled()
119
118
{
120
 
    qDebug() << "cancelling search of" << QString::fromStdString(impl->query.query_string());
 
119
    qDebug() << "cancelling search of" << QString::fromStdString(query().query_string());
121
120
    impl->search_operation.cancel();
122
121
}
123
122
 
198
197
                this->finished(searchReply);
199
198
        };
200
199
 
201
 
            qDebug() << "starting search of" << QString::fromStdString(impl->query.query_string());
202
 
            impl->search_operation = impl->index.search(impl->query.query_string(), search_cb);
 
200
            qDebug() << "starting search of" << QString::fromStdString(query().query_string());
 
201
            impl->search_operation = impl->index.search(query().query_string(), search_cb);
203
202
    });
204
203
}
205
204
 
222
221
 
223
222
void click::Query::run(scopes::SearchReplyProxy const& searchReply)
224
223
{
225
 
    auto query = impl->query.query_string();
 
224
    auto q = query().query_string();
226
225
    std::string categoryTemplate = CATEGORY_APPS_SEARCH;
227
 
    if (query.empty()) {
 
226
    if (q.empty()) {
228
227
        categoryTemplate = CATEGORY_APPS_DISPLAY;
229
228
    }
230
229