on xenial help sign in
make it compile
commit427ce884baca07a78f57bc65718455e1e2ddb8b4 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 19 Sep 2014, 18:06 (12 years ago) parent3356128
3 files changed+32
tests/mocks/Unity/Application/ApplicationManager.cpp+26 tests/mocks/Unity/Application/ApplicationManager.h+4 tests/plugins/Unity/Launcher/launchermodeltest.cpp+2
tests/mocks/Unity/Application/ApplicationManager.cpp+26
@@ -43,6 +43,7 @@ ApplicationManager *ApplicationManager::singleton()
4343ApplicationManager::ApplicationManager(QObject *parent)
4444 : ApplicationManagerInterface(parent)
4545 , m_suspended(false)
46+ , m_dashActive(false)
4647{
4748 m_roleNames.insert(RoleSession, "session");
4849 m_roleNames.insert(RoleFullscreen, "fullscreen");
@@ -292,6 +293,31 @@ void ApplicationManager::setSuspended(bool suspended)
292293 Q_EMIT suspendedChanged();
293294}
294295
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+
295321bool ApplicationManager::focusApplication(const QString &appId)
296322{
297323 ApplicationInfo *application = findApplication(appId);
tests/mocks/Unity/Application/ApplicationManager.h+4
@@ -102,6 +102,9 @@ class ApplicationManager : public ApplicationManagerInterface {
102102 bool suspended() const;
103103 void setSuspended(bool suspended);
104104
105+ bool dashActive() const;
106+ void setDashActive(bool dashActive);
107+
105108 // Only for testing
106109 Q_INVOKABLE QStringList availableApplications();
107110 Q_INVOKABLE ApplicationInfo* add(QString appId);
@@ -124,6 +127,7 @@ class ApplicationManager : public ApplicationManagerInterface {
124127 void buildListOfAvailableApplications();
125128 void onWindowCreated();
126129 bool m_suspended;
130+ bool m_dashActive;
127131 QList<ApplicationInfo*> m_runningApplications;
128132 QList<ApplicationInfo*> m_availableApplications;
129133 QTimer m_windowCreatedTimer;
tests/plugins/Unity/Launcher/launchermodeltest.cpp+2
@@ -100,6 +100,8 @@ public:
100100 bool requestFocusApplication(const QString &appId) { Q_UNUSED(appId); return true; }
101101 bool suspended() const { return false; }
102102 void setSuspended(bool) {}
103+ bool dashActive() const { return false; }
104+ void setDashActive(bool) {}
103105
104106private:
105107 QList<MockApp*> m_list;