[Libreoffice-commits] core.git: cui/source cui/uiconfig officecfg/registry sfx2/source
Jeff Huang (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 23 11:29:55 UTC 2021
cui/source/options/optgdlg.cxx | 14 -
cui/source/options/optgdlg.hxx | 2
cui/uiconfig/ui/optgeneralpage.ui | 20 -
officecfg/registry/schema/org/openoffice/Office/Common.xcs | 8
sfx2/source/control/unoctitm.cxx | 142 -------------
5 files changed, 4 insertions(+), 182 deletions(-)
New commits:
commit 2c0b84dc65739bfc47dca684e819717eb9cce387
Author: Jeff Huang <jeff at mail.ossii.com.tw>
AuthorDate: Mon Jul 19 17:00:17 2021 +0800
Commit: Heiko Tietze <heiko.tietze at documentfoundation.org>
CommitDate: Fri Jul 23 13:29:22 2021 +0200
tdf#140107 Remove all collect usage data code.
Remove all collect usage data code because we
don't really use them.
Change-Id: I8d83d57220bed8f8c15bd012584943cd0913500d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119166
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 3870a3df3ca8..83fd85d8a074 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -161,9 +161,9 @@ OfaMiscTabPage::OfaMiscTabPage(weld::Container* pPage, weld::DialogController* p
, m_xYearFrame(m_xBuilder->weld_widget("yearframe"))
, m_xYearValueField(m_xBuilder->weld_spin_button("year"))
, m_xToYearFT(m_xBuilder->weld_label("toyear"))
- , m_xCollectUsageInfo(m_xBuilder->weld_check_button("collectusageinfo"))
, m_xCrashReport(m_xBuilder->weld_check_button("crashreport"))
, m_xQuickStarterFrame(m_xBuilder->weld_widget("quickstarter"))
+ , m_xHelpImproveLabel(m_xBuilder->weld_label("label7")) //"Help Improve"
#if defined(UNX)
, m_xQuickLaunchCB(m_xBuilder->weld_check_button("systray"))
#else
@@ -188,6 +188,8 @@ OfaMiscTabPage::OfaMiscTabPage(weld::Container* pPage, weld::DialogController* p
//Only available in Win or if building the gtk systray
#if !defined(_WIN32)
m_xQuickStarterFrame->hide();
+ //Hide frame label in case of no content
+ m_xHelpImproveLabel->hide();
#endif
#if defined(_WIN32)
@@ -251,12 +253,6 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
rSet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, nNum ) );
}
- if (m_xCollectUsageInfo->get_state_changed_from_saved())
- {
- officecfg::Office::Common::Misc::CollectUsageInformation::set(m_xCollectUsageInfo->get_active(), batch);
- bModified = true;
- }
-
#if HAVE_FEATURE_BREAKPAD
if (m_xCrashReport->get_state_changed_from_saved())
{
@@ -309,10 +305,6 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
else
m_xYearFrame->set_sensitive(false);
- m_xCollectUsageInfo->set_active(officecfg::Office::Common::Misc::CollectUsageInformation::get());
- m_xCollectUsageInfo->set_sensitive(!officecfg::Office::Common::Misc::CollectUsageInformation::isReadOnly());
- m_xCollectUsageInfo->save_state();
-
#if HAVE_FEATURE_BREAKPAD
m_xCrashReport->set_active(officecfg::Office::Common::Misc::CrashReport::get() && CrashReporter::IsDumpEnable());
m_xCrashReport->set_sensitive(!officecfg::Office::Common::Misc::CrashReport::isReadOnly() && CrashReporter::IsDumpEnable());
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index 38731cefd043..3d4c342a73a6 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -44,9 +44,9 @@ private:
std::unique_ptr<weld::Widget> m_xYearFrame;
std::unique_ptr<weld::SpinButton> m_xYearValueField;
std::unique_ptr<weld::Label> m_xToYearFT;
- std::unique_ptr<weld::CheckButton> m_xCollectUsageInfo;
std::unique_ptr<weld::CheckButton> m_xCrashReport;
std::unique_ptr<weld::Widget> m_xQuickStarterFrame;
+ std::unique_ptr<weld::Label> m_xHelpImproveLabel;
std::unique_ptr<weld::CheckButton> m_xQuickLaunchCB;
#if defined(_WIN32)
std::unique_ptr<weld::Widget> m_xFileAssocFrame;
diff --git a/cui/uiconfig/ui/optgeneralpage.ui b/cui/uiconfig/ui/optgeneralpage.ui
index 6d9512d72cab..363ed4633a76 100644
--- a/cui/uiconfig/ui/optgeneralpage.ui
+++ b/cui/uiconfig/ui/optgeneralpage.ui
@@ -279,26 +279,6 @@
<property name="can_focus">False</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
- <child>
- <object class="GtkCheckButton" id="collectusageinfo">
- <property name="label" translatable="yes" context="optgeneralpage|collectusageinfo">Collect usage data and send it to The Document Foundation</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="margin_top">1</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="collectusageinfo-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip | collectusageinfo">Send usage data to help The Document Foundation improve the software usability.</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
<child>
<object class="GtkCheckButton" id="crashreport">
<property name="label" translatable="yes" context="optgeneralpage|crashreport">Sen_d crash reports to The Document Foundation</property>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d74a9411ca3c..c9940001b573 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5663,14 +5663,6 @@
</info>
<value>false</value>
</prop>
- <prop oor:name="CollectUsageInformation" oor:type="xs:boolean" oor:nillable="false">
- <info>
- <desc>Determines whether the usage information (like what actions
- the user has performed) can be collected, and potentially sent for
- examination.</desc>
- </info>
- <value>false</value>
- </prop>
<prop oor:name="CrashReport" oor:type="xs:boolean" oor:nillable="false">
<!-- UIHints: Tools - Options - General -->
<info>
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index cf6985ecedda..1eb2726f212a 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -504,147 +504,6 @@ OUString SfxDispatchController_Impl::getSlaveCommand( const css::util::URL& rURL
namespace {
-/// Class that collects the usage information - how many times what .uno: command was used.
-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;
-
- /// config path, get it long before atexit time
- OUString msConfigPath;
-
-public:
- UsageInfo() : mbIsCollecting(false)
- {
- }
-
- ~UsageInfo()
- {
- save();
- }
-
- /// Increment command's use.
- void increment(const OUString &rCommand);
-
- /// Save the usage data for the next session.
- void save();
-
- /// Modify the flag whether we are collecting.
- void setCollecting(bool bIsCollecting)
- {
- mbIsCollecting = bIsCollecting;
- if (mbIsCollecting)
- {
- msConfigPath = SvtPathOptions().GetConfigPath();
- msConfigPath += "usage/";
- }
- }
-};
-
-void UsageInfo::increment(const OUString &rCommand)
-{
- UsageMap::iterator it = maUsage.find(rCommand);
-
- if (it != maUsage.end())
- ++(it->second);
- else
- maUsage[rCommand] = 1;
-}
-
-void UsageInfo::save()
-{
- if (!mbIsCollecting)
- return;
-
- osl::Directory::createPath(msConfigPath);
-
- //get system time information.
- TimeValue systemTime;
- TimeValue localTime;
- oslDateTime localDateTime;
- osl_getSystemTime( &systemTime );
- osl_getLocalTimeFromSystemTime( &systemTime, &localTime );
- osl_getDateTimeFromTimeValue( &localTime, &localDateTime );
-
- char time[1024];
- sprintf(time,"%4i-%02i-%02iT%02i_%02i_%02i", localDateTime.Year, localDateTime.Month, localDateTime.Day, localDateTime.Hours, localDateTime.Minutes, localDateTime.Seconds);
-
- //filename type: usage-YYYY-MM-DDTHH_MM_SS.csv
- OUString filename = "usage-" + OUString::createFromAscii(time) + ".csv";
- OUString path = msConfigPath + filename;
-
- osl::File file(path);
-
- if( file.open(osl_File_OpenFlag_Read | osl_File_OpenFlag_Write | osl_File_OpenFlag_Create) == osl::File::E_None )
- {
- OStringBuffer aUsageInfoMsg("Document Type;Command;Count");
-
- for (auto const& elem : maUsage)
- aUsageInfoMsg.append("\n" + elem.first.toUtf8() + ";" + OString::number(elem.second));
-
- sal_uInt64 written = 0;
- auto s = aUsageInfoMsg.makeStringAndClear();
- file.write(s.getStr(), s.getLength(), written);
- file.close();
- }
-}
-
-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)
-{
- bool bCollecting = getenv("LO_COLLECT_USAGE") || officecfg::Office::Common::Misc::CollectUsageInformation::get();
- theUsageInfo::get().setCollecting(bCollecting);
- if (!bCollecting)
- return;
-
- OUStringBuffer aBuffer;
-
- // app identification [uh, several UNO calls :-(]
- uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
- uno::Reference<frame::XModuleManager2> xModuleManager(frame::ModuleManager::create(xContext));
- uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(xContext);
- uno::Reference<frame::XFrame> xFrame = xDesktop->getCurrentFrame();
-
- OUString aModule(xModuleManager->identify(xFrame));
- sal_Int32 nLastDot = aModule.lastIndexOf('.');
- if (nLastDot >= 0)
- aModule = aModule.copy(nLastDot + 1);
-
- aBuffer.append(aModule);
- aBuffer.append(';');
-
- // command
- aBuffer.append(rURL.Protocol);
- aBuffer.append(rURL.Path);
- sal_Int32 nCount = rArgs.getLength();
-
- // parameters - only their names, not the values (could be sensitive!)
- if (nCount > 0)
- {
- aBuffer.append('(');
- for (sal_Int32 n = 0; n < nCount; n++)
- {
- const css::beans::PropertyValue& rProp = rArgs[n];
- if (n > 0)
- aBuffer.append(',');
- aBuffer.append(rProp.Name);
- }
- aBuffer.append(')');
- }
-
- OUString aCommand(aBuffer.makeStringAndClear());
-
- // store
- theUsageInfo::get().increment(aCommand);
-}
-
void collectUIInformation(const util::URL& rURL, const css::uno::Sequence< css::beans::PropertyValue >& rArgs)
{
static const char* pFile = std::getenv("LO_COLLECT_UIINFO");
@@ -664,7 +523,6 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
{
CrashReporter::logUnoCommand(aURL.Path);
}
- collectUsageInformation(aURL, aArgs);
collectUIInformation(aURL, aArgs);
SolarMutexGuard aGuard;
More information about the Libreoffice-commits
mailing list