diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-07-03 20:35:30 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-08-06 12:53:00 +0200 |
commit | 68a155bff5413a8b58fdd85f43b1d2e0fe710bf1 (patch) | |
tree | 1556dce4b8f0c74c1d77a06ec9e782788f79ba7f /sfx2 | |
parent | 1417638df98c53c66e5dadf5951d57b4dff6c21f (diff) |
tdf#92528: Saving of usage info can happen very late in the tear down.
Change-Id: Id545f3447472a8e6ee137a6630ee14b45a45d673
Reviewed-on: https://gerrit.libreoffice.org/16746
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 1ab2b53ca9d9..bba52c6f9722 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -598,11 +598,14 @@ class UsageInfo { typedef std::map<OUString, int> UsageMap; + /// Are we collecting the info? We cache the value because the call to save can happen very late. + bool mbIsCollecting; + /// Command vs. how many times it was used UsageMap maUsage; public: - UsageInfo() + UsageInfo() : mbIsCollecting(false) { } @@ -616,6 +619,9 @@ public: /// Save the usage data for the next session. void save(); + + /// Modify the flag whether we are collecting. + void setCollecting(bool bIsCollecting) { mbIsCollecting = bIsCollecting; } }; void UsageInfo::increment(const OUString &rCommand) @@ -630,7 +636,7 @@ void UsageInfo::increment(const OUString &rCommand) void UsageInfo::save() { - if (!officecfg::Office::Common::Misc::CollectUsageInformation::get()) + if (!mbIsCollecting) return; // TODO - do a real saving here, not only dump to the screen @@ -647,7 +653,9 @@ class theUsageInfo : public rtl::Static<UsageInfo, theUsageInfo> {}; /// Extracts information about the command + args, and stores that. void collectUsageInformation(const util::URL& rURL, const uno::Sequence<beans::PropertyValue>& rArgs) { - if (!officecfg::Office::Common::Misc::CollectUsageInformation::get()) + bool bCollecting = officecfg::Office::Common::Misc::CollectUsageInformation::get(); + theUsageInfo::get().setCollecting(bCollecting); + if (!bCollecting) return; OUStringBuffer aBuffer; |