Commit e6dcdd20 authored by Dan Leinir Turthra Jensen's avatar Dan Leinir Turthra Jensen 🌈
Browse files

Add code to check updates during runtime as well as initialisation

While this is the wrong place to do it during initialisation, we still
want the ability to do it during runtime. So, pop in this bit of code
so the update applet can be allowed to work right as well.
parent 41b790f6
......@@ -267,6 +267,26 @@ void KNSBackend::fetchInstalled()
}
}
void KNSBackend::checkForUpdates()
{
// Since we load the updates during initialization already, don't overburden
// the machine with multiple of these, because that would just be silly.
if (m_initialized) {
auto updateChecker = new OneTimeAction([this]() {
Q_EMIT startingSearch();
m_onePage = true;
m_responsePending = true;
m_engine->checkForUpdates();
}, this);
if (m_responsePending) {
connect(this, &KNSBackend::availableForQueries, updateChecker, &OneTimeAction::trigger, Qt::QueuedConnection);
} else {
updateChecker->trigger();
}
}
}
void KNSBackend::setFetching(bool f)
{
if(m_fetching!=f) {
......
......@@ -62,7 +62,7 @@ public:
KNSCore::Engine* engine() const { return m_engine; }
void checkForUpdates() override {}
void checkForUpdates() override;
QString displayName() const override;
......
Markdown is supported
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