Commit f7ca239a authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[applets/comic] Update providers list after (un)installing provider

parent 05db635c
Pipeline #207389 passed with stage
in 1 minute and 40 seconds
......@@ -818,6 +818,11 @@ bool ComicApplet::isTabHighlighted(const QString &id) const
return false;
}
void ComicApplet::loadProviders()
{
mModel->load();
}
K_PLUGIN_CLASS(ComicApplet)
#include "comic.moc"
......@@ -158,10 +158,7 @@ public Q_SLOTS:
slotTabChanged(newIdentifier);
}
Q_INVOKABLE void loadProviders()
{
mEngine->loadProviders();
}
Q_INVOKABLE void loadProviders();
Q_INVOKABLE void positionFullView(QWindow *window);
private:
......
......@@ -16,9 +16,11 @@
ComicModel::ComicModel(ComicEngine *engine, const QStringList &usedComics, QObject *parent)
: QAbstractTableModel(parent)
, mUsedComics(usedComics)
, mEngine(engine)
{
Q_ASSERT(engine);
mComics = engine->loadProviders();
load();
}
QHash<int, QByteArray> ComicModel::roleNames() const
......@@ -72,3 +74,10 @@ Qt::ItemFlags ComicModel::flags(const QModelIndex &index) const
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
void ComicModel::load()
{
beginResetModel();
mComics = mEngine->loadProviders();
endResetModel();
}
......@@ -28,9 +28,12 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::CheckStateRole) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
void load();
private:
QList<ComicProviderInfo> mComics;
QStringList mUsedComics;
ComicEngine *mEngine;
};
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment