@@ -40,14 +40,15 @@ LauncherModel::LauncherModel(QObject *parent):
40 connect(m_dbusIface, &DBusInterface::refreshCalled, this, &LauncherModel::refresh);
40 connect(m_dbusIface, &DBusInterface::refreshCalled, this, &LauncherModel::refresh);
42 Q_FOREACH (const QString &entry, m_settings->storedApplications()) {
42 Q_FOREACH (const QString &entry, m_settings->storedApplications()) {
43− if (DesktopFileHandler::findDesktopFile(entry).isEmpty()) {
43+ DesktopFileHandler desktopFile(entry);
44+ if (!desktopFile.isValid()) {
44 qWarning() << "Couldn't find a .desktop file for" << entry << ". Skipping...";
45 qWarning() << "Couldn't find a .desktop file for" << entry << ". Skipping...";
48 LauncherItem *item = new LauncherItem(entry,
49 LauncherItem *item = new LauncherItem(entry,
49− DesktopFileHandler::displayName(entry),
50+ desktopFile.displayName(),
50− DesktopFileHandler::icon(entry),
51+ desktopFile.icon(),
52 item->setPinned(true);
53 item->setPinned(true);
53 m_list.append(item);
54 m_list.append(item);
@@ -150,15 +151,16 @@ void LauncherModel::pin(const QString &appId, int index)
150 index = m_list.count();
151 index = m_list.count();
153− if (DesktopFileHandler::findDesktopFile(appId).isEmpty()) {
154+ DesktopFileHandler desktopFile(appId);
155+ if (!desktopFile.isValid()) {
154 qWarning() << "Can't pin this application, there is no .destkop file available.";
156 qWarning() << "Can't pin this application, there is no .destkop file available.";
158 beginInsertRows(QModelIndex(), index, index);
160 beginInsertRows(QModelIndex(), index, index);
159 LauncherItem *item = new LauncherItem(appId,
161 LauncherItem *item = new LauncherItem(appId,
160− DesktopFileHandler::displayName(appId),
162+ desktopFile.displayName(),
161− DesktopFileHandler::icon(appId),
163+ desktopFile.icon(),
163 item->setPinned(true);
165 item->setPinned(true);
164 m_list.insert(index, item);
166 m_list.insert(index, item);
@@ -342,10 +344,11 @@ void LauncherModel::countVisibleChanged(const QString &appId, int countVisible)
344 // Need to create a new LauncherItem and show the highlight
346 // Need to create a new LauncherItem and show the highlight
345− if (countVisible && !DesktopFileHandler::findDesktopFile(appId).isEmpty()) {
347+ DesktopFileHandler desktopFile(appId);
348+ if (countVisible && desktopFile.isValid()) {
346 LauncherItem *item = new LauncherItem(appId,
349 LauncherItem *item = new LauncherItem(appId,
347− DesktopFileHandler::displayName(appId),
350+ desktopFile.displayName(),
348− DesktopFileHandler::icon(appId));
351+ desktopFile.icon());
349 item->setCountVisible(true);
352 item->setCountVisible(true);
350 beginInsertRows(QModelIndex(), m_list.count(), m_list.count());
353 beginInsertRows(QModelIndex(), m_list.count(), m_list.count());
351 m_list.append(item);
354 m_list.append(item);
@@ -358,12 +361,13 @@ void LauncherModel::refresh()
359 QList<LauncherItem*> toBeRemoved;
362 QList<LauncherItem*> toBeRemoved;
360 Q_FOREACH (LauncherItem* item, m_list) {
363 Q_FOREACH (LauncherItem* item, m_list) {
361− if (DesktopFileHandler::findDesktopFile(item->appId()).isEmpty()) {
364+ DesktopFileHandler desktopFile(item->appId());
365+ if (!desktopFile.isValid()) {
362 toBeRemoved << item;
366 toBeRemoved << item;
364 int idx = m_list.indexOf(item);
368 int idx = m_list.indexOf(item);
365− item->setName(DesktopFileHandler::displayName(item->appId()));
369+ item->setName(desktopFile.displayName());
366− item->setIcon(DesktopFileHandler::icon(item->appId()));
370+ item->setIcon(desktopFile.icon());
367 Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleName << RoleIcon);
371 Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleName << RoleIcon);