~xavi-garcia-mena/unity-scopes-api/utils-qt

« back to all changes in this revision

Viewing changes to src/scopes/qt/internal/QSearchQueryBaseImpl.cpp

  • Committer: Xavi Garcia
  • Date: 2015-01-20 13:59:36 UTC
  • Revision ID: xavi.garcia.mena@canonical.com-20150120135936-cogxk8ok7g0gvo8g
Added Qt-bindings classes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
 
17
 */
 
18
 
 
19
#include <unity/scopes/qt/internal/QSearchQueryBaseImpl.h>
 
20
 
 
21
#include <unity/scopes/qt/QCannedQuery.h>
 
22
#include <unity/scopes/qt/QSearchQueryBaseAPI.h>
 
23
 
 
24
#include <unity/scopes/SearchMetadata.h>
 
25
#include <unity/scopes/SearchQueryBase.h>
 
26
 
 
27
#include <cassert>
 
28
 
 
29
using namespace unity::scopes::qt;
 
30
using namespace unity::scopes::qt::internal;
 
31
using namespace unity::scopes;
 
32
 
 
33
QSearchQueryBaseImpl::QSearchQueryBaseImpl()
 
34
    : query_api_(nullptr)
 
35
{
 
36
}
 
37
 
 
38
QCannedQuery QSearchQueryBaseImpl::query() const
 
39
{
 
40
    assert(query_api_);
 
41
    return QCannedQuery(query_api_->query());
 
42
}
 
43
 
 
44
// TODO change to QSearchMetadata
 
45
SearchMetadata QSearchQueryBaseImpl::search_metadata() const
 
46
{
 
47
    assert(query_api_);
 
48
    return query_api_->search_metadata();
 
49
}
 
50
 
 
51
void QSearchQueryBaseImpl::init(QSearchQueryBaseAPI* query_api)
 
52
{
 
53
    query_api_ = query_api;
 
54
}
 
55
 
 
56
QueryCtrlProxy QSearchQueryBaseImpl::subsearch(ScopeProxy const& scope,
 
57
                                               std::string const& query_string,
 
58
                                               SearchListenerBase::SPtr const& reply)
 
59
{
 
60
    return query_api_->subsearch(scope, query_string, reply);
 
61
}
 
62
 
 
63
QueryCtrlProxy QSearchQueryBaseImpl::subsearch(ScopeProxy const& scope,
 
64
                                               std::string const& query_string,
 
65
                                               FilterState const& filter_state,
 
66
                                               SearchListenerBase::SPtr const& reply)
 
67
{
 
68
    return query_api_->subsearch(scope, query_string, filter_state, reply);
 
69
}
 
70
 
 
71
QueryCtrlProxy QSearchQueryBaseImpl::subsearch(ScopeProxy const& scope,
 
72
                                               std::string const& query_string,
 
73
                                               std::string const& department_id,
 
74
                                               FilterState const& filter_state,
 
75
                                               SearchListenerBase::SPtr const& reply)
 
76
{
 
77
    return query_api_->subsearch(scope, query_string, department_id, filter_state, reply);
 
78
}
 
79
 
 
80
QueryCtrlProxy QSearchQueryBaseImpl::subsearch(ScopeProxy const& scope,
 
81
                                               std::string const& query_string,
 
82
                                               std::string const& department_id,
 
83
                                               FilterState const& filter_state,
 
84
                                               SearchMetadata const& hints,
 
85
                                               SearchListenerBase::SPtr const& reply)
 
86
{
 
87
    return query_api_->subsearch(scope, query_string, department_id, filter_state, hints, reply);
 
88
}