cui/source/dialogs/tipofthedaydlg.cxx | 10 +++++----- cui/source/inc/tipofthedaydlg.hxx | 1 - 2 files changed, 5 insertions(+), 6 deletions(-)
New commits: commit 9108fc6fe0b21ba06f155942f556275219f4eac0 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Thu Oct 7 11:13:49 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Oct 8 10:20:25 2021 +0200 Resolves tdf#144693 - TipOfTheDay does not progress Follow-up to I94cd34aa031e133d8c229a0de78582fda1dbdf4a Change-Id: I29a91a188fb9783074491271c37b49a1f2cf13ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123206 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> (cherry picked from commit 1b6b2eff9ac386fd994e3ae120882f646268a80b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123158 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx index c4d1f876f935..34193bff90de 100644 --- a/cui/source/dialogs/tipofthedaydlg.cxx +++ b/cui/source/dialogs/tipofthedaydlg.cxx @@ -73,19 +73,19 @@ TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent) } const auto t0 = std::chrono::system_clock::now().time_since_epoch(); - m_nDay = std::chrono::duration_cast<std::chrono::hours>(t0).count() / 24; + sal_Int32 nDay = std::chrono::duration_cast<std::chrono::hours>(t0).count() / 24; + //show next tip after one day + if (nDay > officecfg::Office::Common::Misc::LastTipOfTheDayShown::get()) + m_nCurrentTip++; // save this time to the config now instead of in the dtor otherwise we // end up with multiple copies of this dialog every time we open a new // document if the first one isn't closed std::shared_ptr<comphelper::ConfigurationChanges> xChanges( comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::Misc::LastTipOfTheDayShown::set(m_nDay, xChanges); + officecfg::Office::Common::Misc::LastTipOfTheDayShown::set(nDay, xChanges); xChanges->commit(); - if (m_nDay > officecfg::Office::Common::Misc::LastTipOfTheDayShown::get()) - m_nCurrentTip++; - UpdateTip(); } diff --git a/cui/source/inc/tipofthedaydlg.hxx b/cui/source/inc/tipofthedaydlg.hxx index f5f0ef999420..69af1996e454 100644 --- a/cui/source/inc/tipofthedaydlg.hxx +++ b/cui/source/inc/tipofthedaydlg.hxx @@ -36,7 +36,6 @@ private: std::unique_ptr<weld::CustomWeld> m_pPreview; sal_Int32 m_nCurrentTip; - sal_Int32 m_nDay; void UpdateTip(); DECL_LINK(OnNextClick, weld::Button&, void); DECL_LINK(OnLinkClick, weld::LinkButton&, bool);