summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-08-18 15:51:35 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-08-19 12:11:51 +0200
commit7d81ad58fd6fccec02ddf2523f41716663e32dd0 (patch)
tree50a132ff2c1274b2fcab5059bdf7ad58cfd1b274 /cui
parent8c099c96936f136a1f76ac76259e14416e866980 (diff)
save LastTipOfTheDayShown when the dialog is shown not in its dtor
Otherwise if a tip dialog is left open then its considered not to be have be shown and new ones will constantly open on every new document. Especially problematic in impress if you leave the first one open and select a template to open from the template dialog then you get two of them in the same frame. Change-Id: I94cd34aa031e133d8c229a0de78582fda1dbdf4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120638 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/tipofthedaydlg.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx
index 8356f6f0e36f..c4d1f876f935 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -74,6 +74,15 @@ 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;
+
+ // 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);
+ xChanges->commit();
+
if (m_nDay > officecfg::Office::Common::Misc::LastTipOfTheDayShown::get())
m_nCurrentTip++;
@@ -90,7 +99,6 @@ TipOfTheDayDialog::~TipOfTheDayDialog()
{
std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Misc::LastTipOfTheDayShown::set(m_nDay, xChanges);
officecfg::Office::Common::Misc::LastTipOfTheDayID::set(m_nCurrentTip, xChanges);
officecfg::Office::Common::Misc::ShowTipOfTheDay::set(m_pShowTip->get_active(), xChanges);
xChanges->commit();