Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7a73f34c authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Block less on start

parent 6a606076
......@@ -64,17 +64,6 @@ PackageKitBackend::PackageKitBackend(QObject* parent)
, m_isFetching(0)
, m_reviews(AppStreamIntegration::global()->reviews())
{
bool b = m_appdata.load();
reloadPackageList();
if (!b && m_packages.packages.isEmpty()) {
qWarning() << "Could not open the AppStream metadata pool";
QTimer::singleShot(0, this, [this]() {
Q_EMIT passiveMessage(i18n("Please make sure that Appstream is properly set up on your system"));
});
}
QTimer* t = new QTimer(this);
connect(t, &QTimer::timeout, this, &PackageKitBackend::refreshDatabase);
t->setInterval(60 * 60 * 1000);
......@@ -100,12 +89,28 @@ PackageKitBackend::PackageKitBackend(QObject* parent)
connect(m_reviews.data(), &OdrsReviewsBackend::ratingsReady, this, &AbstractResourcesBackend::emitRatingsReady);
SourcesModel::global()->addSourcesBackend(new PackageKitSourcesBackend(this));
QTimer::singleShot(0, this, &PackageKitBackend::delayedInit);
}
PackageKitBackend::~PackageKitBackend()
{
}
void PackageKitBackend::delayedInit()
{
const bool b = m_appdata.load();
reloadPackageList();
if (!b && m_packages.packages.isEmpty()) {
qWarning() << "Could not open the AppStream metadata pool";
QTimer::singleShot(0, this, [this]() {
Q_EMIT passiveMessage(i18n("Please make sure that Appstream is properly set up on your system"));
});
}
}
QAction* PackageKitBackend::createActionForService(const QString &servicePath)
{
QAction* action = new QAction(this);
......
......@@ -89,6 +89,8 @@ class DISCOVERCOMMON_EXPORT PackageKitBackend : public AbstractResourcesBackend
void getUpdatesDetailsFinished(PackageKit::Transaction::Exit,uint);
private:
void delayedInit();
template <typename T>
T resourcesByPackageNames(const QStringList& names) const;
void fetchUpdates();
......
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