on xenial help sign in
rename favoriteApps to storedApps in backend api
commit15b29efa5aa4e3e7711c78d17ea8ad8664b1181b authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 2 Jul 2013, 13:19 (13 years ago) parent89de181
3 files changed+18−16
plugins/Unity/Launcher/backend/launcherbackend.cpp+5−5 plugins/Unity/Launcher/backend/launcherbackend.h+5−5 plugins/Unity/Launcher/launchermodel.cpp+8−6
plugins/Unity/Launcher/backend/launcherbackend.cpp+5−5
@@ -8,7 +8,7 @@ LauncherBackend::LauncherBackend(QObject *parent):
88
99 // TODO: load default pinned ones from default config, instead of hardcoding here...
1010
11− m_favoriteApps <<
11+ m_storedApps <<
1212 QLatin1String("phone-app.desktop") <<
1313 QLatin1String("camera-app.desktop") <<
1414 QLatin1String("gallery-app.desktop") <<
@@ -26,14 +26,14 @@ LauncherBackend::~LauncherBackend()
2626
2727}
2828
29−QStringList LauncherBackend::favoriteApplications() const
29+QStringList LauncherBackend::storedApplications() const
3030{
31− return m_favoriteApps;
31+ return m_storedApps;
3232}
3333
34−void LauncherBackend::setFavoriteApplications(const QStringList &appIds)
34+void LauncherBackend::setStoredApplications(const QStringList &appIds)
3535{
36− m_favoriteApps = appIds;
36+ m_storedApps = appIds;
3737 // TODO: Cleanup pinned state from settings for apps not in list any more.
3838}
3939
plugins/Unity/Launcher/backend/launcherbackend.h+5−5
@@ -38,13 +38,13 @@ public:
3838 virtual ~LauncherBackend();
3939
4040 /**
41− * @brief Returns a list of favorite applications.
41+ * @brief Returns a list of stored applications.
4242 * @returns A list of application IDs.
4343 */
44− QStringList favoriteApplications() const;
44+ QStringList storedApplications() const;
4545
4646 /**
47− * @brief Set the list of favorite applications.
47+ * @brief Set the list of stored applications.
4848 *
4949 * Any previously stored information for apps not contained
5050 * in the list any more, e.g. the pinned state, will be
@@ -52,7 +52,7 @@ public:
5252 *
5353 * @param appIds The new list of stored applications.
5454 */
55− void setFavoriteApplications(const QStringList &appIds);
55+ void setStoredApplications(const QStringList &appIds);
5656
5757 /**
5858 * @brief Get the user friendly name of an application.
@@ -109,7 +109,7 @@ Q_SIGNALS:
109109 void countChanged(const QString &appId, int count);
110110
111111private:
112− QStringList m_favoriteApps;
112+ QStringList m_storedApps;
113113};
114114
115115#endif // LAUNCHERBACKEND_H
plugins/Unity/Launcher/launchermodel.cpp+8−6
@@ -27,7 +27,7 @@ LauncherModel::LauncherModel(QObject *parent):
2727 LauncherModelInterface(parent),
2828 m_backend(new LauncherBackend(this))
2929{
30− Q_FOREACH (const QString &entry, m_backend->favoriteApplications()) {
30+ Q_FOREACH (const QString &entry, m_backend->storedApplications()) {
3131 m_list.append(new LauncherItem(entry, m_backend->displayName(entry), m_backend->icon(entry), this));
3232 }
3333}
@@ -88,17 +88,19 @@ void LauncherModel::move(int oldIndex, int newIndex)
8888 // Store new order
8989 QStringList appIds;
9090 Q_FOREACH(LauncherItem *item, m_list) {
91− appIds << item->desktopFile();
91+ if (item->favorite() || item->recent()) {
92+ appIds << item->desktopFile();
93+ }
9294 }
93− m_backend->setFavoriteApplications(appIds);
95+ m_backend->setStoredApplications(appIds);
9496}
9597
9698void LauncherModel::pin(int index)
9799{
98100 QString appId = m_list.at(index)->desktopFile();
99− if (!m_backend->favoriteApplications().contains(appId)) {
100− QStringList oldList = m_backend->favoriteApplications();
101− m_backend->setFavoriteApplications(oldList << appId);
101+ if (!m_backend->storedApplications().contains(appId)) {
102+ QStringList oldList = m_backend->storedApplications();
103+ m_backend->setStoredApplications(oldList << appId);
102104 }
103105 if (!m_backend->isPinned(appId)) {
104106 m_backend->setPinned(appId, true);