From e46aba9da584338db8d8a1a8a487bdcc6cf84343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 18 Mar 2017 02:22:36 +0100 Subject: NOISSUE sanitize loading and downloading of metadata files --- application/pages/global/PackagesPage.cpp | 33 +++++-------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) (limited to 'application/pages') diff --git a/application/pages/global/PackagesPage.cpp b/application/pages/global/PackagesPage.cpp index 81ad4da1..e4967532 100644 --- a/application/pages/global/PackagesPage.cpp +++ b/application/pages/global/PackagesPage.cpp @@ -97,7 +97,7 @@ QIcon PackagesPage::icon() const void PackagesPage::on_refreshIndexBtn_clicked() { - ProgressDialog(this).execWithTask(ENV.metadataIndex()->remoteUpdateTask()); + ENV.metadataIndex()->load(); } void PackagesPage::on_refreshFileBtn_clicked() { @@ -106,7 +106,7 @@ void PackagesPage::on_refreshFileBtn_clicked() { return; } - ProgressDialog(this).execWithTask(list->remoteUpdateTask()); + list->load(); } void PackagesPage::on_refreshVersionBtn_clicked() { @@ -115,7 +115,7 @@ void PackagesPage::on_refreshVersionBtn_clicked() { return; } - ProgressDialog(this).execWithTask(version->remoteUpdateTask()); + version->load(); } void PackagesPage::on_fileSearchEdit_textChanged(const QString &search) @@ -158,19 +158,7 @@ void PackagesPage::updateCurrentVersionList(const QModelIndex &index) ui->fileName->setText(list->name()); m_versionProxy->setSourceModel(list.get()); ui->refreshFileBtn->setText(tr("Refresh %1").arg(list->humanReadable())); - - if (!list->isLocalLoaded()) - { - std::unique_ptr task = list->localUpdateTask(); - connect(task.get(), &Task::finished, this, [this, list]() - { - if (list->count() == 0 && !list->isRemoteLoaded()) - { - ProgressDialog(this).execWithTask(list->remoteUpdateTask()); - } - }); - ProgressDialog(this).execWithTask(task); - } + list->load(); } else { @@ -227,16 +215,5 @@ void PackagesPage::updateVersion() void PackagesPage::opened() { - if (!ENV.metadataIndex()->isLocalLoaded()) - { - std::unique_ptr task = ENV.metadataIndex()->localUpdateTask(); - connect(task.get(), &Task::finished, this, [this]() - { - if (!ENV.metadataIndex()->isRemoteLoaded()) - { - ProgressDialog(this).execWithTask(ENV.metadataIndex()->remoteUpdateTask()); - } - }); - ProgressDialog(this).execWithTask(task); - } + ENV.metadataIndex()->load(); } -- cgit v1.2.3