on xenial help sign in
remove debug output
9b3e5daMichael Zanetti
plugins/Unity/Launcher/backend/launcherbackend.cpp−16
@@ -25,7 +25,6 @@
25#include <QDBusArgument>
25#include <QDBusArgument>
26#include <QFileInfo>
26#include <QFileInfo>
27#include <QGSettings>
27#include <QGSettings>
28−#include <QDebug>
29
28
30class LauncherBackendItem
29class LauncherBackendItem
31{
30{
@@ -107,10 +106,8 @@ QString LauncherBackend::displayName(const QString &appId) const
107
106
108QString LauncherBackend::icon(const QString &appId) const
107QString LauncherBackend::icon(const QString &appId) const
109{
108{
110− qDebug() << "searching for icon >>>>>>>>>>>>>>>>>>>>" << appId;
111 QString iconName;
109 QString iconName;
112 if (m_itemCache.contains(appId)) {
110 if (m_itemCache.contains(appId)) {
113− qDebug() << "found icon in cache" << m_itemCache.value(appId)->icon;
114 iconName = m_itemCache.value(appId)->icon;
111 iconName = m_itemCache.value(appId)->icon;
115 } else {
112 } else {
116 QString df = findDesktopFile(appId);
113 QString df = findDesktopFile(appId);
@@ -147,7 +144,6 @@ bool LauncherBackend::isPinned(const QString &appId) const
147void LauncherBackend::setPinned(const QString &appId, bool pinned)
144void LauncherBackend::setPinned(const QString &appId, bool pinned)
148{
145{
149 if (!m_storedApps.contains(appId)) {
146 if (!m_storedApps.contains(appId)) {
150− qDebug() << "Cannot pin item. Unknown appId";
151 return;
147 return;
152 }
148 }
153
149
@@ -204,25 +200,19 @@ void LauncherBackend::syncFromAccounts()
204
200
205 m_storedApps.clear();
201 m_storedApps.clear();
206
202
207− qDebug() << "syncing from accounts" << m_user << m_accounts;
208 if (m_accounts && m_user.isEmpty()) {
203 if (m_accounts && m_user.isEmpty()) {
209− qDebug() << "loading from user" << m_user << m_accounts;
210 QVariant variant = m_accounts->getUserProperty(m_user, "launcher-items");
204 QVariant variant = m_accounts->getUserProperty(m_user, "launcher-items");
211− qDebug() << "loaded launcher-items" << variant;
212 apps = qdbus_cast<QList<QVariantMap>>(variant.value<QDBusArgument>());
205 apps = qdbus_cast<QList<QVariantMap>>(variant.value<QDBusArgument>());
213 defaults = isDefaultsItem(apps);
206 defaults = isDefaultsItem(apps);
214 }
207 }
215
208
216 if (m_accounts && defaults) { // Checking accounts as it'll be null when !useStorage
209 if (m_accounts && defaults) { // Checking accounts as it'll be null when !useStorage
217 QGSettings gSettings("com.canonical.Unity.Launcher", "/com/canonical/unity/launcher/");
210 QGSettings gSettings("com.canonical.Unity.Launcher", "/com/canonical/unity/launcher/");
218− qDebug() << "Got launcher gSettings" << gSettings.get("favorites");
219 Q_FOREACH(const QString &entry, gSettings.get("favorites").toStringList()) {
211 Q_FOREACH(const QString &entry, gSettings.get("favorites").toStringList()) {
220 if (entry.startsWith("application://")) {
212 if (entry.startsWith("application://")) {
221 QString appId = entry;
213 QString appId = entry;
222 appId.remove("application://");
214 appId.remove("application://");
223− qDebug() << "searching for" << entry << appId;
224 QString df = findDesktopFile(appId);
215 QString df = findDesktopFile(appId);
225− qDebug() << "desktop file path" << df;
226
216
227 if (!df.isEmpty()) {
217 if (!df.isEmpty()) {
228 m_storedApps << appId;
218 m_storedApps << appId;
@@ -243,7 +233,6 @@ void LauncherBackend::syncFromAccounts()
243
233
244void LauncherBackend::syncToAccounts()
234void LauncherBackend::syncToAccounts()
245{
235{
246− qDebug() << "syncing to accounts";
247 if (m_accounts && !m_user.isEmpty()) {
236 if (m_accounts && !m_user.isEmpty()) {
248 QList<QVariantMap> items;
237 QList<QVariantMap> items;
249
238
@@ -286,7 +275,6 @@ LauncherBackendItem* LauncherBackend::parseDesktopFile(const QString &desktopFil
286 item->displayName = settings.value("Desktop Entry/Name").toString();
275 item->displayName = settings.value("Desktop Entry/Name").toString();
287 item->icon = settings.value("Desktop Entry/Icon").toString();
276 item->icon = settings.value("Desktop Entry/Icon").toString();
288 item->pinned = false;
277 item->pinned = false;
289− qDebug() << "reading file" << desktopFile << settings.value("Desktop Entry/Name") << item->icon;
290 return item;
278 return item;
291}
279}
292
280
@@ -329,9 +317,5 @@ bool LauncherBackend::isDefaultsItem(const QList<QVariantMap> &apps) const
329 // To differentiate between an empty list and a list that hasn't been set
317 // To differentiate between an empty list and a list that hasn't been set
330 // yet (and should thus be populated with the defaults), we use a special
318 // yet (and should thus be populated with the defaults), we use a special
331 // list of one item with the 'defaults' field set to true.
319 // list of one item with the 'defaults' field set to true.
332− qDebug() << apps.size();
333− if (apps.size() == 1)
334− qDebug() << apps[0].value("defaults").toBool();
335−
336 return (apps.size() == 1 && apps[0].value("defaults").toBool());
320 return (apps.size() == 1 && apps[0].value("defaults").toBool());
337}
321}