on xenial help sign in
initial work to get the appmanager integrated with the launcher
commit81d910bb330e4c01e8e5fada51a71515cf636add authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 28 Aug 2013, 14:18 (13 years ago) parenta983f02
3 files changed+33
Shell.qml+9 plugins/Unity/Launcher/launchermodel.cpp+23 plugins/Unity/Launcher/launchermodel.h+1
Shell.qml+9
@@ -108,6 +108,15 @@ FocusScope {
108108 // potentially only in connection with a notification
109109 greeter.hide();
110110 shell.activateApplication(desktopFile);
111+
112+ }
113+
114+ onMainStageFocusedApplicationChanged: {
115+ var app = applicationManager.mainStageFocusedApplication
116+ print("***********************************focusing app", app);
117+ print("**************************************appId", app.icon, app.desktopFile);
118+
119+ LauncherModel.applicationFocused(app.desktopFile);
111120 }
112121 }
113122
plugins/Unity/Launcher/launchermodel.cpp+23
@@ -184,6 +184,29 @@ void LauncherModel::setUser(const QString &username)
184184 m_backend->setUser(username);
185185}
186186
187+void LauncherModel::applicationFocused(const QString &appId)
188+{
189+ int index = findApplication(appId);
190+
191+ if (index >= 0) {
192+ // TODO: Mark application as focued
193+ } else {
194+ // FIXME: The backend does not yet support this stuff
195+ // and currently the appId still is the desktopFile
196+ //QString desktopFile = m_backend->desktopFile(appId);
197+ QString desktopFile = appId;
198+
199+ QString appName = m_backend->displayName(appId);
200+ QString icon = m_backend->icon(appId);
201+
202+ LauncherItem *item = new LauncherItem(appId, desktopFile, appName, icon);
203+ beginInsertRows(QModelIndex(), m_list.count(), m_list.count());
204+ m_list.append(item);
205+ endInsertRows();
206+ storeAppList();
207+ }
208+}
209+
187210void LauncherModel::storeAppList()
188211{
189212 QStringList appIds;
plugins/Unity/Launcher/launchermodel.h+1
@@ -49,6 +49,7 @@ public:
4949 Q_INVOKABLE void requestRemove(const QString &appId);
5050 Q_INVOKABLE void quickListActionInvoked(const QString &appId, int actionIndex);
5151 Q_INVOKABLE void setUser(const QString &username);
52+ Q_INVOKABLE void applicationFocused(const QString &appId);
5253
5354private:
5455 void storeAppList();