on xenial help sign in
some const fixes
commitc2140b7c6701ae3cb3e15e00364592930a487e68 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 9 Jun 2015, 16:40 (11 years ago) parenta2958f0
1 file changed+9−8
plugins/Unity/Launcher/launchermodel.cpp+9−8
plugins/Unity/Launcher/launchermodel.cpp+9−8
@@ -180,7 +180,7 @@ void LauncherModel::quickListActionInvoked(const QString &appId, int actionIndex
180180 LauncherItem *item = m_list.at(index);
181181 QuickListModel *model = qobject_cast<QuickListModel*>(item->quickList());
182182 if (model) {
183− QString actionId = model->get(actionIndex).actionId();
183+ const QString actionId = model->get(actionIndex).actionId();
184184
185185 // Check if this is one of the launcher actions we handle ourselves
186186 if (actionId == "pin_item") {
@@ -191,7 +191,8 @@ void LauncherModel::quickListActionInvoked(const QString &appId, int actionIndex
191191 }
192192 } else if (actionId == "launch_item") {
193193 QDesktopServices::openUrl(getUrlForAppId(appId));
194−
194+ } else if (actionId == "stop_item") { // Quit
195+ m_appManager->stopApplication(appId);
195196 // Nope, we don't know this action, let the backend forward it to the application
196197 } else {
197198 // TODO: forward quicklist action to app, possibly via m_dbusIface
@@ -289,7 +290,7 @@ void LauncherModel::storeAppList()
289290
290291void LauncherModel::unpin(const QString &appId)
291292{
292− int index = findApplication(appId);
293+ const int index = findApplication(appId);
293294 if (index < 0) {
294295 return;
295296 }
@@ -320,7 +321,7 @@ int LauncherModel::findApplication(const QString &appId)
320321
321322void LauncherModel::progressChanged(const QString &appId, int progress)
322323{
323− int idx = findApplication(appId);
324+ const int idx = findApplication(appId);
324325 if (idx >= 0) {
325326 LauncherItem *item = m_list.at(idx);
326327 item->setProgress(progress);
@@ -330,7 +331,7 @@ void LauncherModel::progressChanged(const QString &appId, int progress)
330331
331332void LauncherModel::countChanged(const QString &appId, int count)
332333{
333− int idx = findApplication(appId);
334+ const int idx = findApplication(appId);
334335 if (idx >= 0) {
335336 LauncherItem *item = m_list.at(idx);
336337 item->setCount(count);
@@ -405,7 +406,7 @@ void LauncherModel::refresh()
405406
406407 // Now walk through settings and see if we need to add something
407408 for (int settingsIndex = 0; settingsIndex < m_settings->storedApplications().count(); ++settingsIndex) {
408− QString entry = m_settings->storedApplications().at(settingsIndex);
409+ const QString entry = m_settings->storedApplications().at(settingsIndex);
409410 int itemIndex = -1;
410411 for (int i = 0; i < m_list.count(); ++i) {
411412 if (m_list.at(i)->appId() == entry) {
@@ -468,7 +469,7 @@ void LauncherModel::applicationAdded(const QModelIndex &parent, int row)
468469 return;
469470 }
470471
471− int itemIndex = findApplication(app->appId());
472+ const int itemIndex = findApplication(app->appId());
472473 if (itemIndex != -1) {
473474 LauncherItem *item = m_list.at(itemIndex);
474475 if (!item->recent()) {
@@ -511,7 +512,7 @@ void LauncherModel::applicationRemoved(const QModelIndex &parent, int row)
511512
512513void LauncherModel::focusedAppIdChanged()
513514{
514− QString appId = m_appManager->focusedApplicationId();
515+ const QString appId = m_appManager->focusedApplicationId();
515516 for (int i = 0; i < m_list.count(); ++i) {
516517 LauncherItem *item = m_list.at(i);
517518 if (!item->focused() && item->appId() == appId) {