@@ -14,24 +14,26 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include <QUrl>
18#include <QUrl>
19#include "fake_scope.h"
20#include "fake_scope.h"
20−#include "fake_department.h"
21+#include "fake_navigation.h"
21#include "fake_resultsmodel.h"
22#include "fake_resultsmodel.h"
23Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
24Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
27−Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent, int categories)
28+Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories)
28 : unity::shell::scopes::ScopeInterface(parent)
29 : unity::shell::scopes::ScopeInterface(parent)
29 , m_id(id)
30 , m_id(id)
30 , m_name(name)
31 , m_name(name)
32 , m_searching(false)
32 , m_searching(false)
33+ , m_favorite(favorite)
33 , m_isActive(false)
34 , m_isActive(false)
34− , m_currentDeparment("root")
35+ , m_currentNavigationId("root")
36+ , m_currentAltNavigationId("altroot")
35 , m_previewRendererName("preview-generic")
37 , m_previewRendererName("preview-generic")
36 , m_categories(new Categories(categories, this))
38 , m_categories(new Categories(categories, this))
@@ -77,6 +79,11 @@ bool Scope::searchInProgress() const
77 return m_searching;
79 return m_searching;
82+bool Scope::favorite() const
80unity::shell::scopes::CategoriesInterface* Scope::categories() const
87unity::shell::scopes::CategoriesInterface* Scope::categories() const
82 return m_categories;
89 return m_categories;
@@ -97,11 +104,6 @@ QString Scope::formFactor() const
97 return m_formFactor;
104 return m_formFactor;
100−bool Scope::visible() const
105bool Scope::isActive() const
107bool Scope::isActive() const
107 return m_isActive;
109 return m_isActive;
@@ -131,6 +133,13 @@ void Scope::setActive(const bool active)
136+void Scope::setFavorite(const bool favorite)
138+ if (favorite != m_favorite) {
139+ m_favorite = favorite;
140+ Q_EMIT favoriteChanged();
134void Scope::setSearchInProgress(const bool inProg)
143void Scope::setSearchInProgress(const bool inProg)
136 if (inProg != m_searching) {
145 if (inProg != m_searching) {
@@ -170,16 +179,31 @@ void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)
170 qFatal("Scope::closeScope is not implemented");
179 qFatal("Scope::closeScope is not implemented");
173−QString Scope::currentDepartmentId() const
182+QString Scope::currentNavigationId() const
175− return m_currentDeparment;
184+ return m_currentNavigationId;
178−bool Scope::hasDepartments() const
187+bool Scope::hasNavigation() const
180 return true;
189 return true;
192+QString Scope::currentAltNavigationId() const
194+ return m_currentAltNavigationId;
197+bool Scope::hasAltNavigation() const
202+Scope::Status Scope::status() const
204+ return Status::Okay;
183QVariantMap Scope::customizations() const
207QVariantMap Scope::customizations() const
185 QVariantMap m, h;
209 QVariantMap m, h;
@@ -196,7 +220,7 @@ QVariantMap Scope::customizations() const
196 return m;
220 return m;
199−unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
223+unity::shell::scopes::NavigationInterface* Scope::getNavigation(const QString& id)
201 if (id.isEmpty())
225 if (id.isEmpty())
202 return nullptr;
226 return nullptr;
@@ -210,11 +234,34 @@ unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& i
210 parentId = id.mid(5, 7);
234 parentId = id.mid(5, 7);
211 parentLabel = parentId;
235 parentLabel = parentId;
237+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
240+unity::shell::scopes::NavigationInterface* Scope::getAltNavigation(QString const& id)
246+ QString parentLabel;
247+ if (id.startsWith("altmiddle")) {
248+ parentId = "altroot";
249+ parentLabel = "altroot";
213− return new Department(id, id, "all"+id, parentId, parentLabel, this);
251+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
216−void Scope::loadDepartment(const QString& id)
254+void Scope::performQuery(const QString& query)
218− m_currentDeparment = id;
256+ if (query.startsWith("navigation:/")) {
219− Q_EMIT currentDepartmentIdChanged();
257+ QString navigationId = query;
258+ navigationId.remove(0, QString("navigation:/").length());
259+ if (navigationId.startsWith("alt")) {
260+ m_currentAltNavigationId = navigationId;
261+ Q_EMIT currentAltNavigationIdChanged();
263+ m_currentNavigationId = navigationId;
264+ Q_EMIT currentNavigationIdChanged();