1/* Copyright (C) 2013 Canonical, Ltd.
4 * Michael Zanetti <michael.zanetti@canonical.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19#ifndef LAUNCHERBACKEND_H
20#define LAUNCHERBACKEND_H
22#include "common/quicklistentry.h"
31 * @brief An interface that provides all the data needed by the launcher.
34class LauncherBackendItem;
36class LauncherBackend : public QObject
42 LauncherBackend(bool useStorage = true, QObject *parent = 0);
43 virtual ~LauncherBackend();
46 * @brief Returns a list of stored applications.
47 * @returns A list of application IDs.
49 QStringList storedApplications() const;
52 * @brief Set the list of stored applications.
54 * Any previously stored information for apps not contained
55 * in the list any more, e.g. the pinned state, will be
58 * @param appIds The new list of stored applications.
60 void setStoredApplications(const QStringList &appIds);
63 * @brief Get the full path to the .desktop file.
65 * The application does not need to be in the list of stored applications.
67 * @returns The full path to the .dekstop file.
69 QString desktopFile(const QString &appId) const;
72 * @brief Get the user friendly name of an application.
74 * The application does not need to be in the list of stored applications.
76 * @param appId The ID of the application.
77 * @returns The user friendly name of the application.
79 QString displayName(const QString &appId) const;
82 * @brief Get the icon of an application.
84 * The application does not need to be in the list of stored applications.
86 * @param appId The ID of the application.
87 * @returns The full path to the icon for the application.
89 QString icon(const QString &appId) const;
92 * @brief Is the app manually pinned?
93 * @returns true if pinned, otherwise false.
95 bool isPinned(const QString &appId) const;
98 * @brief Change the pinned state of an application.
99 * @param appId The application where the pinned flag should be set.
100 * @param pinned true if pinned, otherwise false.
102 void setPinned(const QString &appId, bool pinned);
104 //TODO: Fill in getters for all the other things needed from the .desktop file.
107 * @brief Get the QuickList for an application.
108 * @param appId The ID of the application.
109 * @returns A QuickListModelInterface containing the QuickList.
111 QList<QuickListEntry> quickList(const QString &appId) const;
114 * @brief Execute an action from the quickList
115 * @param appId The app ID for which the action was triggered
116 * @param the quicklist ID of the action that was triggered
118 void triggerQuickListAction(const QString &appId, const QString &entryId);
121 * @brief Get the progress for the progress overlay of an application.
122 * @param appId The ID of the application.
123 * @returns The percentage of the overlay progress bar. -1 if no progress bar available.
125 int progress(const QString &appId) const;
128 * @brief Get the count of the count overlay of an application.
129 * @param appId The ID of the application.
130 * @returns The number to be displayed in the overlay. -1 if no count overlay is available.
132 int count(const QString &appId) const;
135 * @brief Sets the username for which to look up launcher items.
136 * @param username The username to use.
138 void setUser(const QString &username);
141 void quickListChanged(const QString &appId, const QList<QuickListEntry> &quickList);
142 void progressChanged(const QString &appId, int progress);
143 void countChanged(const QString &appId, int count);
146 QString findDesktopFile(const QString &appId) const;
147 LauncherBackendItem* parseDesktopFile(const QString &desktopFile) const;
149 QVariantMap itemToVariant(const QString &appId) const;
150 void loadFromVariant(const QVariantMap &details);
152 bool isDefaultsItem(const QList<QVariantMap> &apps) const;
153 void syncFromAccounts();
154 void syncToAccounts();
156 QList<QString> m_storedApps;
157 mutable QHash<QString, LauncherBackendItem*> m_itemCache;
159 AccountsService *m_accounts;
163#endif // LAUNCHERBACKEND_H
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