From 4e27f3528a11b8f140747dddffa7af0a1ec27096 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Mon, 2 Mar 2026 10:26:32 +0100 Subject: [PATCH] add auto check for update on start config setting --- Linphone/core/App.cpp | 2 +- Linphone/core/setting/SettingsCore.cpp | 7 +++++++ Linphone/core/setting/SettingsCore.hpp | 2 ++ Linphone/model/setting/SettingsModel.cpp | 9 +++++++++ Linphone/model/setting/SettingsModel.hpp | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index 5c1d25138..831c5c0e9 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -860,7 +860,7 @@ void App::initCore() { Qt::SingleShotConnection); } } - checkForUpdate(); + if (mSettings->autoCheckForUpdateOnStart()) checkForUpdate(); setIsRestarting(false); window->show(); window->requestActivate(); diff --git a/Linphone/core/setting/SettingsCore.cpp b/Linphone/core/setting/SettingsCore.cpp index 974e9c495..289f1df6a 100644 --- a/Linphone/core/setting/SettingsCore.cpp +++ b/Linphone/core/setting/SettingsCore.cpp @@ -118,6 +118,7 @@ SettingsCore::SettingsCore(QObject *parent) : QObject(parent) { // Check for update mIsCheckForUpdateAvailable = settingsModel->isCheckForUpdateAvailable(); + mAutoCheckForUpdateOnStart = settingsModel->autoCheckForUpdateOnStart(); // Ui INIT_CORE_MEMBER(DisableChatFeature, settingsModel) @@ -314,6 +315,7 @@ void SettingsCore::reloadSettings() { // Check for update mIsCheckForUpdateAvailable = settingsModel->isCheckForUpdateAvailable(); + mAutoCheckForUpdateOnStart = settingsModel->autoCheckForUpdateOnStart(); setDisableChatFeature(settingsModel->getDisableChatFeature()); setDisableMeetingsFeature(settingsModel->getDisableMeetingsFeature()); @@ -1408,6 +1410,7 @@ void SettingsCore::writeFromModel(const std::shared_ptr &model) { // Check update mIsCheckForUpdateAvailable = model->isCheckForUpdateAvailable(); + mAutoCheckForUpdateOnStart = model->autoCheckForUpdateOnStart(); // UI mDisableChatFeature = model->getDisableChatFeature(); @@ -1445,6 +1448,10 @@ bool SettingsCore::isCheckForUpdateAvailable() const { return mIsCheckForUpdateAvailable; } +bool SettingsCore::autoCheckForUpdateOnStart() const { + return mAutoCheckForUpdateOnStart; +} + void SettingsCore::save() { mustBeInMainThread(getClassName() + Q_FUNC_INFO); SettingsCore *thisCopy = new SettingsCore(*this); diff --git a/Linphone/core/setting/SettingsCore.hpp b/Linphone/core/setting/SettingsCore.hpp index f966d710c..30df43734 100644 --- a/Linphone/core/setting/SettingsCore.hpp +++ b/Linphone/core/setting/SettingsCore.hpp @@ -278,6 +278,7 @@ public: void setCardDAVMinCharForResearch(int min); bool isCheckForUpdateAvailable() const; + bool autoCheckForUpdateOnStart() const; Q_INVOKABLE void save(); Q_INVOKABLE void undo(); @@ -489,6 +490,7 @@ private: // Check update bool mIsCheckForUpdateAvailable = false; + bool mAutoCheckForUpdateOnStart = false; DECLARE_ABSTRACT_OBJECT }; diff --git a/Linphone/model/setting/SettingsModel.cpp b/Linphone/model/setting/SettingsModel.cpp index 160fea1d5..d1d1e62bf 100644 --- a/Linphone/model/setting/SettingsModel.cpp +++ b/Linphone/model/setting/SettingsModel.cpp @@ -940,6 +940,15 @@ void SettingsModel::setShowPastMeetings(bool show) { emit showPastMeetingsChanged(show); } +bool SettingsModel::autoCheckForUpdateOnStart() const { + return !!mConfig->getInt(UiSection, "auto_check_for_update_on_start", isCheckForUpdateAvailable()); +} + +void SettingsModel::setAutoCheckForUpdateOnStart(bool check) { + mConfig->setInt(UiSection, "auto_check_for_update_on_start", check); + emit autoCheckForUpdateOnStartChanged(); +} + bool SettingsModel::isCheckForUpdateAvailable() const { #ifdef ENABLE_UPDATE_CHECK return true; diff --git a/Linphone/model/setting/SettingsModel.hpp b/Linphone/model/setting/SettingsModel.hpp index c908ef529..089b50d39 100644 --- a/Linphone/model/setting/SettingsModel.hpp +++ b/Linphone/model/setting/SettingsModel.hpp @@ -198,6 +198,8 @@ public: bool getShowPastMeetings() const; void setShowPastMeetings(bool show); + bool autoCheckForUpdateOnStart() const; + void setAutoCheckForUpdateOnStart(bool check); bool isCheckForUpdateAvailable() const; bool isCheckForUpdateEnabled() const; void setCheckForUpdateEnabled(bool enable); @@ -291,6 +293,7 @@ signals: void showPastMeetingsChanged(bool value); + void autoCheckForUpdateOnStartChanged(); void checkForUpdateEnabledChanged(); void versionCheckUrlChanged();