2 * Copyright (C) 2013 Canonical, Ltd.
5 * Michael Zanetti <michael.zanetti@canonical.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20#include "launchermodel.h"
21#include "launcheritem.h"
23LauncherModel::LauncherModel(QObject *parent): LauncherModelInterface(parent)
25 // FIXME: Dummy data... Aggregate real data from backends
28 LauncherItem *item = new LauncherItem("/usr/share/applications/phone-app.desktop", "Phone", "phone-app");
30 item = new LauncherItem("/usr/share/applications/camera-app.desktop", "Camera", "camera");
32 item = new LauncherItem("/usr/share/applications/gallery-app.desktop", "Gallery", "gallery");
34 item = new LauncherItem("/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook");
36 item = new LauncherItem("/usr/share/applications/webbrowser-app.desktop", "Browser", "browser");
38 item = new LauncherItem("/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter");
40 item = new LauncherItem("/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail");
42 item = new LauncherItem("/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather");
44 item = new LauncherItem("/usr/share/applications/notes-app.desktop", "Notepad", "notepad");
46 item = new LauncherItem("/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar");
50LauncherModel::~LauncherModel()
52 while (!m_list.empty()) {
53 m_list.takeFirst()->deleteLater();
57int LauncherModel::rowCount(const QModelIndex &parent) const
60 return m_list.count();
63QVariant LauncherModel::data(const QModelIndex &index, int role) const
65 LauncherItem *item = m_list.at(index.row());
72 return item->favorite();
78unity::shell::launcher::LauncherItemInterface *LauncherModel::get(int index) const
80 if (index < 0 || index >= m_list.count()) {
83 return m_list.at(index);
86void LauncherModel::move(int oldIndex, int newIndex)
88 beginMoveRows(QModelIndex(), oldIndex, oldIndex, QModelIndex(), newIndex);
89 m_list.move(oldIndex, newIndex);
93QHash<int, QByteArray> LauncherModel::roleNames() const
95 QHash<int, QByteArray> roles;
96 roles.insert(RoleDesktopFile, "desktopFile");
97 roles.insert(RoleName, "name");
98 roles.insert(RoleIcon, "icon");
99 roles.insert(RoleFavorite, "favorite");
100 roles.insert(RoleRunning, "runnng");
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