All Classes Functions Properties
launcherbackend.h
/* Copyright (C) 2013 Canonical, Ltd.
*
* Authors:
* Michael Zanetti <michael.zanetti@canonical.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LAUNCHERBACKEND_H
#define LAUNCHERBACKEND_H
#include "common/quicklistentry.h"
#include <QObject>
#include <QSettings>
#include <QStringList>
class AccountsServiceDBusAdaptor;
class LauncherBackendItem;
class LauncherBackend : public QObject
{
Q_OBJECT
public:
LauncherBackend(QObject *parent = 0);
virtual ~LauncherBackend();
QStringList storedApplications() const;
void setStoredApplications(const QStringList &appIds);
QString desktopFile(const QString &appId) const;
QString displayName(const QString &appId) const;
QString icon(const QString &appId) const;
QList<QuickListEntry> quickList(const QString &appId) const;
void triggerQuickListAction(const QString &appId, const QString &entryId);
int progress(const QString &appId) const;
int count(const QString &appId) const;
void setUser(const QString &username);
Q_SIGNALS:
void quickListChanged(const QString &appId, const QList<QuickListEntry> &quickList);
void progressChanged(const QString &appId, int progress);
void countChanged(const QString &appId, int count);
private:
QString findDesktopFile(const QString &appId) const;
LauncherBackendItem* parseDesktopFile(const QString &desktopFile) const;
QVariantMap itemToVariant(const QString &appId) const;
void loadFromVariant(const QVariantMap &details);
bool isDefaultsItem(const QList<QVariantMap> &apps) const;
void syncFromAccounts();
void syncToAccounts();
QList<QString> m_storedApps;
mutable QHash<QString, LauncherBackendItem*> m_itemCache;
AccountsServiceDBusAdaptor *m_accounts;
QString m_user;
};
#endif // LAUNCHERBACKEND_H