on xenial help sign in
make it compile
427ce88Michael Zanetti
tests/mocks/Unity/Application/ApplicationManager.cpp+26
@@ -43,6 +43,7 @@ ApplicationManager *ApplicationManager::singleton()
43ApplicationManager::ApplicationManager(QObject *parent)
43ApplicationManager::ApplicationManager(QObject *parent)
44 : ApplicationManagerInterface(parent)
44 : ApplicationManagerInterface(parent)
45 , m_suspended(false)
45 , m_suspended(false)
46+ , m_dashActive(false)
46{
47{
47 m_roleNames.insert(RoleSession, "session");
48 m_roleNames.insert(RoleSession, "session");
48 m_roleNames.insert(RoleFullscreen, "fullscreen");
49 m_roleNames.insert(RoleFullscreen, "fullscreen");
@@ -292,6 +293,31 @@ void ApplicationManager::setSuspended(bool suspended)
292 Q_EMIT suspendedChanged();
293 Q_EMIT suspendedChanged();
293}
294}
294
295
296+bool ApplicationManager::dashActive() const
297+{
298+ return m_dashActive;
299+}
300+
301+void ApplicationManager::setDashActive(bool dashActive)
302+{
303+ if (m_dashActive == dashActive) {
304+ return;
305+ }
306+
307+ ApplicationInfo *dash = findApplication("unity8-dash");
308+ if (dash) {
309+ if (dashActive) {
310+ dash->setState(ApplicationInfo::Running);
311+ } else {
312+ if (!dash->focused()) {
313+ dash->setState(ApplicationInfo::Suspended);
314+ }
315+ }
316+ }
317+ m_dashActive = dashActive;
318+ Q_EMIT dashActiveChanged();
319+}
320+
295bool ApplicationManager::focusApplication(const QString &appId)
321bool ApplicationManager::focusApplication(const QString &appId)
296{
322{
297 ApplicationInfo *application = findApplication(appId);
323 ApplicationInfo *application = findApplication(appId);
tests/mocks/Unity/Application/ApplicationManager.h+4
@@ -102,6 +102,9 @@ class ApplicationManager : public ApplicationManagerInterface {
102 bool suspended() const;
102 bool suspended() const;
103 void setSuspended(bool suspended);
103 void setSuspended(bool suspended);
104
104
105+ bool dashActive() const;
106+ void setDashActive(bool dashActive);
107+
105 // Only for testing
108 // Only for testing
106 Q_INVOKABLE QStringList availableApplications();
109 Q_INVOKABLE QStringList availableApplications();
107 Q_INVOKABLE ApplicationInfo* add(QString appId);
110 Q_INVOKABLE ApplicationInfo* add(QString appId);
@@ -124,6 +127,7 @@ class ApplicationManager : public ApplicationManagerInterface {
124 void buildListOfAvailableApplications();
127 void buildListOfAvailableApplications();
125 void onWindowCreated();
128 void onWindowCreated();
126 bool m_suspended;
129 bool m_suspended;
130+ bool m_dashActive;
127 QList<ApplicationInfo*> m_runningApplications;
131 QList<ApplicationInfo*> m_runningApplications;
128 QList<ApplicationInfo*> m_availableApplications;
132 QList<ApplicationInfo*> m_availableApplications;
129 QTimer m_windowCreatedTimer;
133 QTimer m_windowCreatedTimer;
tests/plugins/Unity/Launcher/launchermodeltest.cpp+2
@@ -100,6 +100,8 @@ public:
100 bool requestFocusApplication(const QString &appId) { Q_UNUSED(appId); return true; }
100 bool requestFocusApplication(const QString &appId) { Q_UNUSED(appId); return true; }
101 bool suspended() const { return false; }
101 bool suspended() const { return false; }
102 void setSuspended(bool) {}
102 void setSuspended(bool) {}
103+ bool dashActive() const { return false; }
104+ void setDashActive(bool) {}
103
105
104private:
106private:
105 QList<MockApp*> m_list;
107 QList<MockApp*> m_list;