@@ -28,7 +28,7 @@
2828
2929#include <libintl.h>
3030
31−Lens::Lens(QObject *parent) :
31+Scope::Scope(QObject *parent) :
3232 QObject(parent)
3333{
3434 m_results = new DeeListModel(this);
@@ -37,77 +37,77 @@ Lens::Lens(QObject *parent) :
3737 m_categories->setResultModel(m_results);
3838}
3939
40−QString Lens::id() const
40+QString Scope::id() const
4141{
42− return QString::fromStdString(m_unityLens->id());
42+ return QString::fromStdString(m_unityScope->id());
4343}
4444
45−QString Lens::name() const
45+QString Scope::name() const
4646{
47− return QString::fromStdString(m_unityLens->name());
47+ return QString::fromStdString(m_unityScope->name());
4848}
4949
50−QString Lens::iconHint() const
50+QString Scope::iconHint() const
5151{
52− return QString::fromStdString(m_unityLens->icon_hint());
52+ return QString::fromStdString(m_unityScope->icon_hint());
5353}
5454
55−QString Lens::description() const
55+QString Scope::description() const
5656{
57− return QString::fromStdString(m_unityLens->description());
57+ return QString::fromStdString(m_unityScope->description());
5858}
5959
60−QString Lens::searchHint() const
60+QString Scope::searchHint() const
6161{
62− return QString::fromStdString(m_unityLens->search_hint());
62+ return QString::fromStdString(m_unityScope->search_hint());
6363}
6464
65−bool Lens::visible() const
65+bool Scope::visible() const
6666{
67− return m_unityLens->visible();
67+ return m_unityScope->visible();
6868}
6969
70−QString Lens::shortcut() const
70+QString Scope::shortcut() const
7171{
72− return QString::fromStdString(m_unityLens->shortcut());
72+ return QString::fromStdString(m_unityScope->shortcut());
7373}
7474
75−bool Lens::connected() const
75+bool Scope::connected() const
7676{
77− return m_unityLens->connected();
77+ return m_unityScope->connected();
7878}
7979
80−DeeListModel* Lens::results() const
80+DeeListModel* Scope::results() const
8181{
8282 return m_results;
8383}
8484
85−Categories* Lens::categories() const
85+Categories* Scope::categories() const
8686{
8787 return m_categories;
8888}
8989
90−Lens::ViewType Lens::viewType() const
90+Scope::ViewType Scope::viewType() const
9191{
92− return (Lens::ViewType) m_unityLens->view_type();
92+ return (Scope::ViewType) m_unityScope->view_type();
9393}
9494
95−QString Lens::searchQuery() const
95+QString Scope::searchQuery() const
9696{
9797 return m_searchQuery;
9898}
9999
100−QString Lens::noResultsHint() const
100+QString Scope::noResultsHint() const
101101{
102102 return m_noResultsHint;
103103}
104104
105−void Lens::setViewType(const Lens::ViewType& viewType)
105+void Scope::setViewType(const Scope::ViewType& viewType)
106106{
107− m_unityLens->view_type = (unity::dash::ScopeViewType) viewType;
107+ m_unityScope->view_type = (unity::dash::ScopeViewType) viewType;
108108}
109109
110−void Lens::setSearchQuery(const QString& search_query)
110+void Scope::setSearchQuery(const QString& search_query)
111111{
112112 /* Checking for m_searchQuery.isNull() which returns true only when the string
113113 has never been set is necessary because when search_query is the empty
@@ -116,31 +116,31 @@ void Lens::setSearchQuery(const QString& search_query)
116116 */
117117 if (m_searchQuery.isNull() || search_query != m_searchQuery) {
118118 m_searchQuery = search_query;
119− m_unityLens->Search(search_query.toStdString(), sigc::mem_fun(this, &Lens::searchFinished));
119+ m_unityScope->Search(search_query.toStdString(), sigc::mem_fun(this, &Scope::searchFinished));
120120 Q_EMIT searchQueryChanged();
121121 }
122122}
123123
124−void Lens::setNoResultsHint(const QString& hint) {
124+void Scope::setNoResultsHint(const QString& hint) {
125125 if (hint != m_noResultsHint) {
126126 m_noResultsHint = hint;
127127 Q_EMIT noResultsHintChanged();
128128 }
129129}
130130
131−void Lens::activate(const QString& uri)
131+void Scope::activate(const QString& uri)
132132{
133−// m_unityLens->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData()); FIXME pawel
133+// m_unityScope->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData()); FIXME pawel
134134}
135135
136−void Lens::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&)
136+void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&)
137137{
138138 if (type == unity::dash::NOT_HANDLED) {
139139 fallbackActivate(QString::fromStdString(result.uri));
140140 }
141141}
142142
143−void Lens::fallbackActivate(const QString& uri)
143+void Scope::fallbackActivate(const QString& uri)
144144{
145145 /* FIXME: stripping all content before the first column because for some
146146 reason the lenses give uri with junk content at their beginning.
@@ -174,110 +174,110 @@ void Lens::fallbackActivate(const QString& uri)
174174 QDesktopServices::openUrl(url);
175175}
176176
177−void Lens::setUnityLens(const unity::dash::Scope::Ptr& lens)
177+void Scope::setUnityScope(const unity::dash::Scope::Ptr& lens)
178178{
179− m_unityLens = lens;
179+ m_unityScope = lens;
180180
181− if (QString::fromStdString(m_unityLens->results()->swarm_name) == QString(":local")) {
182− m_results->setModel(m_unityLens->results()->model());
181+ if (QString::fromStdString(m_unityScope->results()->swarm_name) == QString(":local")) {
182+ m_results->setModel(m_unityScope->results()->model());
183183 } else {
184− m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
184+ m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
185185 }
186186
187− if (QString::fromStdString(m_unityLens->categories()->swarm_name) == QString(":local")) {
188− m_categories->setModel(m_unityLens->categories()->model());
187+ if (QString::fromStdString(m_unityScope->categories()->swarm_name) == QString(":local")) {
188+ m_categories->setModel(m_unityScope->categories()->model());
189189 } else {
190− m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
190+ m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
191191 }
192192
193193 /* Property change signals */
194− m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));
195− m_unityLens->name.changed.connect(sigc::mem_fun(this, &Lens::nameChanged));
196− m_unityLens->icon_hint.changed.connect(sigc::mem_fun(this, &Lens::iconHintChanged));
197− m_unityLens->description.changed.connect(sigc::mem_fun(this, &Lens::descriptionChanged));
198− m_unityLens->search_hint.changed.connect(sigc::mem_fun(this, &Lens::searchHintChanged));
199− m_unityLens->visible.changed.connect(sigc::mem_fun(this, &Lens::visibleChanged));
200− m_unityLens->shortcut.changed.connect(sigc::mem_fun(this, &Lens::shortcutChanged));
201− m_unityLens->connected.changed.connect(sigc::mem_fun(this, &Lens::connectedChanged));
202− m_unityLens->results.changed.connect(sigc::mem_fun(this, &Lens::onResultsChanged));
203− m_unityLens->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onResultsSwarmNameChanged));
204− m_unityLens->results()->model.changed.connect(sigc::mem_fun(this, &Lens::onResultsModelChanged));
205− m_unityLens->categories()->model.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesModelChanged));
206− m_unityLens->categories.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesChanged));
207− m_unityLens->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesSwarmNameChanged));
208− m_unityLens->view_type.changed.connect(sigc::mem_fun(this, &Lens::onViewTypeChanged));
194+ m_unityScope->id.changed.connect(sigc::mem_fun(this, &Scope::idChanged));
195+ m_unityScope->name.changed.connect(sigc::mem_fun(this, &Scope::nameChanged));
196+ m_unityScope->icon_hint.changed.connect(sigc::mem_fun(this, &Scope::iconHintChanged));
197+ m_unityScope->description.changed.connect(sigc::mem_fun(this, &Scope::descriptionChanged));
198+ m_unityScope->search_hint.changed.connect(sigc::mem_fun(this, &Scope::searchHintChanged));
199+ m_unityScope->visible.changed.connect(sigc::mem_fun(this, &Scope::visibleChanged));
200+ m_unityScope->shortcut.changed.connect(sigc::mem_fun(this, &Scope::shortcutChanged));
201+ m_unityScope->connected.changed.connect(sigc::mem_fun(this, &Scope::connectedChanged));
202+ m_unityScope->results.changed.connect(sigc::mem_fun(this, &Scope::onResultsChanged));
203+ m_unityScope->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Scope::onResultsSwarmNameChanged));
204+ m_unityScope->results()->model.changed.connect(sigc::mem_fun(this, &Scope::onResultsModelChanged));
205+ m_unityScope->categories()->model.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesModelChanged));
206+ m_unityScope->categories.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesChanged));
207+ m_unityScope->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesSwarmNameChanged));
208+ m_unityScope->view_type.changed.connect(sigc::mem_fun(this, &Scope::onViewTypeChanged));
209209
210210 /* Signals forwarding */
211211 connect(this, SIGNAL(searchFinished(const std::string &, unity::glib::HintsMap const &, unity::glib::Error const &)), SLOT(onSearchFinished(const std::string &, unity::glib::HintsMap const &)));
212212
213213 /* FIXME: signal should be forwarded instead of calling the handler directly */
214− m_unityLens->activated.connect(sigc::mem_fun(this, &Lens::onActivated));
214+ m_unityScope->activated.connect(sigc::mem_fun(this, &Scope::onActivated));
215215
216− /* Synchronize local states with m_unityLens right now and whenever
217− m_unityLens becomes connected */
216+ /* Synchronize local states with m_unityScope right now and whenever
217+ m_unityScope becomes connected */
218218 /* FIXME: should emit change notification signals for all properties */
219219 connect(this, SIGNAL(connectedChanged(bool)), SLOT(synchronizeStates()));
220220 synchronizeStates();
221221}
222222
223−unity::dash::Scope::Ptr Lens::unityLens() const
223+unity::dash::Scope::Ptr Scope::unityScope() const
224224{
225− return m_unityLens;
225+ return m_unityScope;
226226}
227227
228−void Lens::synchronizeStates()
228+void Scope::synchronizeStates()
229229{
230230 if (connected()) {
231− /* Forward local states to m_unityLens */
231+ /* Forward local states to m_unityScope */
232232 if (!m_searchQuery.isNull()) {
233− m_unityLens->Search(m_searchQuery.toStdString());
233+ m_unityScope->Search(m_searchQuery.toStdString());
234234 }
235235 }
236236}
237237
238−void Lens::onResultsSwarmNameChanged(const std::string& /* swarm_name */)
238+void Scope::onResultsSwarmNameChanged(const std::string& /* swarm_name */)
239239{
240− m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
240+ m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
241241}
242242
243−void Lens::onResultsChanged(const unity::dash::Results::Ptr& /* results */)
243+void Scope::onResultsChanged(const unity::dash::Results::Ptr& /* results */)
244244{
245− m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
245+ m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
246246}
247247
248−void Lens::onResultsModelChanged(unity::glib::Object<DeeModel> model)
248+void Scope::onResultsModelChanged(unity::glib::Object<DeeModel> model)
249249{
250− m_results->setModel(m_unityLens->results()->model());
250+ m_results->setModel(m_unityScope->results()->model());
251251}
252252
253−void Lens::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)
253+void Scope::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)
254254{
255− m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
255+ m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
256256}
257257
258−void Lens::onCategoriesChanged(const unity::dash::Categories::Ptr& /* categories */)
258+void Scope::onCategoriesChanged(const unity::dash::Categories::Ptr& /* categories */)
259259{
260260 qWarning() << "categories changed!";
261− m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
261+ m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
262262}
263263
264−void Lens::onCategoriesModelChanged(unity::glib::Object<DeeModel> model)
264+void Scope::onCategoriesModelChanged(unity::glib::Object<DeeModel> model)
265265{
266266 qWarning() << "categories model changed!";
267267 m_categories->setModel(model);
268268}
269269
270−void Lens::onViewTypeChanged(unity::dash::ScopeViewType viewType)
270+void Scope::onViewTypeChanged(unity::dash::ScopeViewType viewType)
271271{
272− Q_EMIT viewTypeChanged( (Lens::ViewType) viewType);
272+ Q_EMIT viewTypeChanged( (Scope::ViewType) viewType);
273273}
274274
275−void Lens::onSearchFinished(const std::string &query, unity::glib::HintsMap const &hints)
275+void Scope::onSearchFinished(const std::string &query, unity::glib::HintsMap const &hints)
276276{
277277 QString hint;
278278
279− qWarning() << "Result count:" << id() << m_unityLens->results()->count() << QString::fromStdString(m_unityLens->results()->swarm_name) << m_categories->rowCount();
280− if (!m_unityLens->results()->count()) {
279+ qWarning() << "Result count:" << id() << m_unityScope->results()->count() << QString::fromStdString(m_unityScope->results()->swarm_name) << m_categories->rowCount();
280+ if (!m_unityScope->results()->count()) {
281281 unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint");
282282 if (it != hints.end()) {
283283 hint = QString::fromStdString(it->second.GetString());