@@ -18,14 +18,16 @@
1818#include <QUrl>
1919
2020#include "fake_scope.h"
21+
2122#include "fake_department.h"
2223#include "fake_resultsmodel.h"
24+#include "fake_scopes.h"
2325
24−Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
26+Scope::Scope(Scopes* parent) : Scope(QString(), QString(), false, parent)
2527{
2628}
2729
28−Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent)
30+Scope::Scope(QString const& id, QString const& name, bool visible, Scopes* parent)
2931 : unity::shell::scopes::ScopeInterface(parent)
3032 , m_id(id)
3133 , m_name(name)
@@ -35,6 +37,7 @@ Scope::Scope(QString const& id, QString const& name, bool visible, QObject* pare
3537 , m_currentDeparment("root")
3638 , m_previewRendererName("preview-generic")
3739 , m_categories(new Categories(20, this))
40+ , m_openScope(nullptr)
3841{
3942}
4043
@@ -150,7 +153,12 @@ void Scope::setNoResultsHint(const QString& str)
150153
151154void Scope::activate(QVariant const& result)
152155{
153− qDebug() << "Called activate on scope" << m_id << "with result" << result;;
156+ qDebug() << "Called activate on scope" << m_id << "with result" << result;
157+ if (result.toString() == "Result.2.2") {
158+ Scopes *scopes = dynamic_cast<Scopes*>(parent());
159+ m_openScope = scopes->getScope("MockScope2");
160+ Q_EMIT openScope(m_openScope);
161+ }
154162}
155163
156164PreviewStack* Scope::preview(QVariant const& result)
@@ -166,9 +174,13 @@ void Scope::cancelActivation()
166174{
167175}
168176
169−void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)
177+void Scope::closeScope(unity::shell::scopes::ScopeInterface* scope)
170178{
171− qFatal("Scope::closeScope is not implemented");
179+ if (scope != m_openScope) {
180+ qDebug() << scope << m_openScope;
181+ qFatal("Scope::closeScope got wrong scope in closeScope");
182+ }
183+ m_openScope = nullptr;
172184}
173185
174186QString Scope::currentDepartmentId() const