From b7238399ea4f1ca51d8f7b8f9220af3da0913edf Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 29 Apr 2019 22:08:59 +0200 Subject: New upstream version 2.1.0~rc5+repack --- LotWUsers.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'LotWUsers.cpp') diff --git a/LotWUsers.cpp b/LotWUsers.cpp index 877e7054..fd1b5746 100644 --- a/LotWUsers.cpp +++ b/LotWUsers.cpp @@ -42,11 +42,12 @@ public: { } - void load (QString const& url, bool forced_fetch) + void load (QString const& url, bool fetch, bool forced_fetch) { - auto csv_file_name = csv_file_.fileName (); abort (); // abort any active download - if (!QFileInfo::exists (csv_file_name) || forced_fetch) + auto csv_file_name = csv_file_.fileName (); + auto exists = QFileInfo::exists (csv_file_name); + if (fetch && (!exists || forced_fetch)) { current_url_.setUrl (url); if (current_url_.isValid () && !QSslSocket::supportsSsl ()) @@ -58,8 +59,11 @@ public: } else { - // load the database asynchronously - future_load_ = std::async (std::launch::async, &LotWUsers::impl::load_dictionary, this, csv_file_name); + if (exists) + { + // load the database asynchronously + future_load_ = std::async (std::launch::async, &LotWUsers::impl::load_dictionary, this, csv_file_name); + } } } @@ -254,9 +258,9 @@ void LotWUsers::set_local_file_path (QString const& path) m_->csv_file_.setFileName (path); } -void LotWUsers::load (QString const& url, bool force_download) +void LotWUsers::load (QString const& url, bool fetch, bool force_download) { - m_->load (url, force_download); + m_->load (url, fetch, force_download); } void LotWUsers::set_age_constraint (qint64 uploaded_since_days) -- cgit v1.2.3