Kaydet (Commit) 94b38840 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

tdf#92528: Saving of usage info can happen very late in the tear down.

Change-Id: Id545f3447472a8e6ee137a6630ee14b45a45d673
üst b010e407
...@@ -598,11 +598,14 @@ class UsageInfo { ...@@ -598,11 +598,14 @@ class UsageInfo {
typedef std::map<OUString, int> UsageMap; 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 /// Command vs. how many times it was used
UsageMap maUsage; UsageMap maUsage;
public: public:
UsageInfo() UsageInfo() : mbIsCollecting(false)
{ {
} }
...@@ -616,6 +619,9 @@ public: ...@@ -616,6 +619,9 @@ public:
/// Save the usage data for the next session. /// Save the usage data for the next session.
void save(); void save();
/// Modify the flag whether we are collecting.
void setCollecting(bool bIsCollecting) { mbIsCollecting = bIsCollecting; }
}; };
void UsageInfo::increment(const OUString &rCommand) void UsageInfo::increment(const OUString &rCommand)
...@@ -630,7 +636,7 @@ void UsageInfo::increment(const OUString &rCommand) ...@@ -630,7 +636,7 @@ void UsageInfo::increment(const OUString &rCommand)
void UsageInfo::save() void UsageInfo::save()
{ {
if (!officecfg::Office::Common::Misc::CollectUsageInformation::get()) if (!mbIsCollecting)
return; return;
// TODO - do a real saving here, not only dump to the screen // TODO - do a real saving here, not only dump to the screen
...@@ -647,7 +653,9 @@ class theUsageInfo : public rtl::Static<UsageInfo, theUsageInfo> {}; ...@@ -647,7 +653,9 @@ class theUsageInfo : public rtl::Static<UsageInfo, theUsageInfo> {};
/// Extracts information about the command + args, and stores that. /// Extracts information about the command + args, and stores that.
void collectUsageInformation(const util::URL& rURL, const uno::Sequence<beans::PropertyValue>& rArgs) 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; return;
OUStringBuffer aBuffer; OUStringBuffer aBuffer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment