diff options
| author | Christoph Berg <myon@debian.org> | 2019-04-29 22:08:59 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2019-04-29 22:08:59 +0200 |
| commit | b7238399ea4f1ca51d8f7b8f9220af3da0913edf (patch) | |
| tree | 9716c5c0a793b2f7cda83e9d8f840095a0e9358e /LotWUsers.cpp | |
| parent | 200de07a95209a55d6019ba87f0abc78d302bf4c (diff) | |
New upstream version 2.1.0~rc5+repackupstream/2.1.0_rc5+repack
Diffstat (limited to 'LotWUsers.cpp')
| -rw-r--r-- | LotWUsers.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
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) |
