Port away from deprecated features of QSet

This commit is contained in:
Jonah Brüchert 2019-12-06 22:04:33 +01:00 committed by Bhushan Shah
parent 40ece80841
commit 08e1e3a44c
2 changed files with 8 additions and 2 deletions

View file

@ -51,7 +51,12 @@ ApplicationListModel::~ApplicationListModel()
void ApplicationListModel::loadSettings()
{
m_favorites = m_homeScreen->config().readEntry("Favorites", QStringList());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
m_desktopItems = QSet<QString>(m_homeScreen->config().readEntry("DesktopItems", QStringList()).begin(),
m_homeScreen->config().readEntry("DesktopItems", QStringList()).end());
#else
m_desktopItems = m_homeScreen->config().readEntry("DesktopItems", QStringList()).toSet();
#endif
m_appOrder = m_homeScreen->config().readEntry("AppOrder", QStringList());
m_maxFavoriteCount = m_homeScreen->config().readEntry("MaxFavoriteCount", 5);
@ -264,12 +269,12 @@ void ApplicationListModel::setLocation(int row, LauncherLocation location)
// In Desktop
if (location == Desktop) {
m_desktopItems.insert(data.storageId);
m_homeScreen->config().writeEntry("DesktopItems", m_desktopItems.toList());
m_homeScreen->config().writeEntry("DesktopItems", m_desktopItems.values());
// Out of Desktop
} else if (data.location == Desktop) {
m_desktopItems.remove(data.storageId);
m_homeScreen->config().writeEntry("DesktopItems", m_desktopItems.toList());
m_homeScreen->config().writeEntry("DesktopItems", m_desktopItems.values());
}
data.location = location;

View file

@ -24,6 +24,7 @@
#include <QObject>
#include <QAbstractListModel>
#include <QList>
#include <QSet>
#include "homescreen.h"