some simple defaults in the lnf package

This commit is contained in:
Marco Martin 2019-09-16 19:13:52 +02:00
parent 4832735497
commit b658a10abf
4 changed files with 23 additions and 4 deletions

View file

@ -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<int, QByteArray> ApplicationListModel::roleNames() const
{
QHash<int, QByteArray> roleNames;

View file

@ -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);

View file

@ -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) {

View file

@ -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;