2 * Copyright 2013 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * Michael Zanetti <michael.zanetti@canonical.com>
20#include "MockLauncherModel.h"
21#include "MockLauncherItem.h"
23MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(parent)
25 LauncherItemInterface *item = new MockLauncherItem("/usr/share/applications/phone-app.desktop", "Phone", "phone-app");
27 item = new MockLauncherItem("/usr/share/applications/camera-app.desktop", "Camera", "camera");
29 item = new MockLauncherItem("/usr/share/applications/gallery-app.desktop", "Gallery", "gallery");
31 item = new MockLauncherItem("/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook");
33 item = new MockLauncherItem("/usr/share/applications/webbrowser-app.desktop", "Browser", "browser");
35 item = new MockLauncherItem("/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter");
37 item = new MockLauncherItem("/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail");
39 item = new MockLauncherItem("/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather");
41 item = new MockLauncherItem("/usr/share/applications/notes-app.desktop", "Notepad", "notepad");
43 item = new MockLauncherItem("/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar");
47MockLauncherModel::~MockLauncherModel()
49 while (!m_list.empty())
51 m_list.takeFirst()->deleteLater();
55// cppcheck-suppress unusedFunction
56int MockLauncherModel::rowCount(const QModelIndex& parent) const
59 return m_list.count();
62QVariant MockLauncherModel::data(const QModelIndex& index, int role) const
64 LauncherItemInterface *item = m_list.at(index.row());
68 return item->desktopFile();
74 return item->favorite();
76 return item->running();
78 return item->recent();
80 return item->progress();
88unity::shell::launcher::LauncherItemInterface *MockLauncherModel::get(int index) const
90 if (index < 0 || index >= m_list.count())
94 return m_list.at(index);
97void MockLauncherModel::move(int oldIndex, int newIndex)
99 beginMoveRows(QModelIndex(), oldIndex, oldIndex, QModelIndex(), newIndex);
100 m_list.move(oldIndex, newIndex);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list