Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/updatecheck/UpdateChecker.cpp')
-rw-r--r--src/updatecheck/UpdateChecker.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/updatecheck/UpdateChecker.cpp b/src/updatecheck/UpdateChecker.cpp
index c36879707..3d3387585 100644
--- a/src/updatecheck/UpdateChecker.cpp
+++ b/src/updatecheck/UpdateChecker.cpp
@@ -42,7 +42,12 @@ UpdateChecker::~UpdateChecker()
void UpdateChecker::checkForUpdates(bool manuallyRequested)
{
- auto nextCheck = config()->get("GUI/CheckForUpdatesNextCheck", 0).toULongLong();
+ // Skip update if we are already performing one
+ if (m_reply) {
+ return;
+ }
+
+ auto nextCheck = config()->get(Config::GUI_CheckForUpdatesNextCheck).toULongLong();
m_isManuallyRequested = manuallyRequested;
if (m_isManuallyRequested || Clock::currentSecondsSinceEpoch() >= nextCheck) {
@@ -50,7 +55,7 @@ void UpdateChecker::checkForUpdates(bool manuallyRequested)
QString apiUrlStr = QString("https://api.github.com/repos/keepassxreboot/keepassxc/releases");
- if (!config()->get("GUI/CheckForUpdatesIncludeBetas", false).toBool()) {
+ if (!config()->get(Config::GUI_CheckForUpdatesIncludeBetas).toBool()) {
apiUrlStr += "/latest";
}
@@ -85,7 +90,7 @@ void UpdateChecker::fetchFinished()
QJsonDocument jsonResponse = QJsonDocument::fromJson(m_bytesReceived);
QJsonObject jsonObject = jsonResponse.object();
- if (config()->get("GUI/CheckForUpdatesIncludeBetas", false).toBool()) {
+ if (config()->get(Config::GUI_CheckForUpdatesIncludeBetas).toBool()) {
QJsonArray jsonArray = jsonResponse.array();
jsonObject = jsonArray.at(0).toObject();
}
@@ -97,7 +102,7 @@ void UpdateChecker::fetchFinished()
// Check again in 7 days
// TODO: change to toSecsSinceEpoch() when min Qt >= 5.8
- config()->set("GUI/CheckForUpdatesNextCheck", Clock::currentDateTime().addDays(7).toTime_t());
+ config()->set(Config::GUI_CheckForUpdatesNextCheck, Clock::currentDateTime().addDays(7).toTime_t());
} else {
version = "error";
}