diff --git a/containments/homescreen/applicationlistmodel.cpp b/containments/homescreen/applicationlistmodel.cpp index 513681f4..b4b844c3 100644 --- a/containments/homescreen/applicationlistmodel.cpp +++ b/containments/homescreen/applicationlistmodel.cpp @@ -45,6 +45,15 @@ ApplicationListModel::ApplicationListModel(HomeScreen *parent) //can't use the new syntax as this signal is overloaded connect(KSycoca::self(), SIGNAL(databaseChanged(const QStringList &)), this, SLOT(sycocaDbChanged(const QStringList &))); + + loadSettings(); +} + +ApplicationListModel::~ApplicationListModel() += default; + +void ApplicationListModel::loadSettings() +{ m_favorites = m_homeScreen->config().readEntry("Favorites", QStringList()); m_desktopItems = m_homeScreen->config().readEntry("DesktopItems", QStringList()).toSet(); m_appOrder = m_homeScreen->config().readEntry("AppOrder", QStringList()); @@ -55,13 +64,10 @@ ApplicationListModel::ApplicationListModel(HomeScreen *parent) m_appPositions[app] = i; ++i; } - //here or delayed? + loadApplications(); } -ApplicationListModel::~ApplicationListModel() -= default; - QHash ApplicationListModel::roleNames() const { QHash roleNames; diff --git a/containments/homescreen/applicationlistmodel.h b/containments/homescreen/applicationlistmodel.h index 7e3f1ad4..571aaa41 100644 --- a/containments/homescreen/applicationlistmodel.h +++ b/containments/homescreen/applicationlistmodel.h @@ -68,6 +68,8 @@ public: ApplicationListModel(HomeScreen *parent = nullptr); ~ApplicationListModel() override; + void loadSettings(); + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; void moveRow(const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild); diff --git a/containments/homescreen/homescreen.cpp b/containments/homescreen/homescreen.cpp index 8932d62f..0cb26abc 100644 --- a/containments/homescreen/homescreen.cpp +++ b/containments/homescreen/homescreen.cpp @@ -35,6 +35,14 @@ HomeScreen::HomeScreen(QObject *parent, const QVariantList &args) HomeScreen::~HomeScreen() = default; +void HomeScreen::configChanged() +{ + Plasma::Containment::configChanged(); + if (m_applicationListModel) { + m_applicationListModel->loadSettings(); + } +} + ApplicationListModel *HomeScreen::applicationListModel() { if (!m_applicationListModel) { diff --git a/containments/homescreen/homescreen.h b/containments/homescreen/homescreen.h index 1387b81e..f99492e8 100644 --- a/containments/homescreen/homescreen.h +++ b/containments/homescreen/homescreen.h @@ -41,6 +41,9 @@ public: Q_INVOKABLE void stackBefore(QQuickItem *item1, QQuickItem *item2); Q_INVOKABLE void stackAfter(QQuickItem *item1, QQuickItem *item2); +protected: + // void configChanged() override; + private: ApplicationListModel *m_applicationListModel = nullptr;