Kaydet (Commit) 175a1d13 authored tarafından Nickson Thanda's avatar Nickson Thanda Kaydeden (comit) Mike Kaganski

tdf#114875 Added an option to not show "No offline help installed" popup

Change-Id: I8067c0c374af57f5ad8e6f5fffd3a9783521824f
Reviewed-on: https://gerrit.libreoffice.org/55254Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 7ed40b18
...@@ -258,6 +258,7 @@ OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet) ...@@ -258,6 +258,7 @@ OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
: SfxTabPage(pParent, "OptGeneralPage", "cui/ui/optgeneralpage.ui", &rSet) : SfxTabPage(pParent, "OptGeneralPage", "cui/ui/optgeneralpage.ui", &rSet)
{ {
get(m_pExtHelpCB, "exthelp"); get(m_pExtHelpCB, "exthelp");
get(m_pPopUpNoHelpCB,"popupnohelp");
if (!lcl_HasSystemFilePicker()) if (!lcl_HasSystemFilePicker())
get<VclContainer>("filedlgframe")->Hide(); get<VclContainer>("filedlgframe")->Hide();
#if ! ENABLE_GTK #if ! ENABLE_GTK
...@@ -322,6 +323,7 @@ void OfaMiscTabPage::dispose() ...@@ -322,6 +323,7 @@ void OfaMiscTabPage::dispose()
m_pCollectUsageInfo.clear(); m_pCollectUsageInfo.clear();
m_pQuickStarterFrame.clear(); m_pQuickStarterFrame.clear();
m_pQuickLaunchCB.clear(); m_pQuickLaunchCB.clear();
m_pPopUpNoHelpCB.clear();
SfxTabPage::dispose(); SfxTabPage::dispose();
} }
...@@ -336,7 +338,10 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) ...@@ -336,7 +338,10 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
SvtHelpOptions aHelpOptions; SvtHelpOptions aHelpOptions;
if ( m_pExtHelpCB->IsChecked() != (m_pExtHelpCB->GetSavedValue() == TRISTATE_TRUE) ) if ( m_pPopUpNoHelpCB->IsValueChangedFromSaved() )
aHelpOptions.SetOfflineHelpPopUp( m_pPopUpNoHelpCB->IsChecked() );
if ( m_pExtHelpCB->IsValueChangedFromSaved() )
aHelpOptions.SetExtendedHelp( m_pExtHelpCB->IsChecked() ); aHelpOptions.SetExtendedHelp( m_pExtHelpCB->IsChecked() );
if ( m_pFileDlgCB->IsValueChangedFromSaved() ) if ( m_pFileDlgCB->IsValueChangedFromSaved() )
...@@ -390,7 +395,8 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet ) ...@@ -390,7 +395,8 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
SvtHelpOptions aHelpOptions; SvtHelpOptions aHelpOptions;
m_pExtHelpCB->Check( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() ); m_pExtHelpCB->Check( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() );
m_pExtHelpCB->SaveValue(); m_pExtHelpCB->SaveValue();
m_pPopUpNoHelpCB->Check( aHelpOptions.IsOfflineHelpPopUp() );
m_pPopUpNoHelpCB->SaveValue();
SvtMiscOptions aMiscOpt; SvtMiscOptions aMiscOpt;
m_pFileDlgCB->Check( !aMiscOpt.UseSystemFileDialog() ); m_pFileDlgCB->Check( !aMiscOpt.UseSystemFileDialog() );
m_pFileDlgCB->SaveValue(); m_pFileDlgCB->SaveValue();
......
...@@ -41,6 +41,7 @@ class OfaMiscTabPage : public SfxTabPage ...@@ -41,6 +41,7 @@ class OfaMiscTabPage : public SfxTabPage
{ {
using TabPage::DeactivatePage; using TabPage::DeactivatePage;
private: private:
VclPtr<CheckBox> m_pPopUpNoHelpCB;
VclPtr<CheckBox> m_pExtHelpCB; VclPtr<CheckBox> m_pExtHelpCB;
VclPtr<FixedImage> m_pFileDlgROImage; VclPtr<FixedImage> m_pFileDlgROImage;
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 --> <!-- Generated with glade 3.18.3 -->
<interface domain="cui"> <interface domain="cui">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="adjustment1"> <object class="GtkAdjustment" id="adjustment1">
...@@ -27,14 +27,38 @@ ...@@ -27,14 +27,38 @@
<property name="top_padding">6</property> <property name="top_padding">6</property>
<property name="left_padding">12</property> <property name="left_padding">12</property>
<child> <child>
<object class="GtkCheckButton" id="exthelp"> <object class="GtkGrid" id="grid2">
<property name="label" translatable="yes" context="optgeneralpage|exthelp">_Extended tips</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">False</property>
<property name="receives_default">False</property> <child>
<property name="use_underline">True</property> <object class="GtkCheckButton" id="exthelp">
<property name="xalign">0</property> <property name="label" translatable="yes" context="optgeneralpage|exthelp">_Extended tips</property>
<property name="draw_indicator">True</property> <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="popupnohelp">
<property name="label" translatable="yes" context="optgeneralpage|popupnohelp">Show "No offline help installed" popup</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object> </object>
</child> </child>
</object> </object>
......
...@@ -40,6 +40,8 @@ public: ...@@ -40,6 +40,8 @@ public:
bool IsExtendedHelp() const; bool IsExtendedHelp() const;
void SetHelpTips( bool b ); void SetHelpTips( bool b );
bool IsHelpTips() const; bool IsHelpTips() const;
void SetOfflineHelpPopUp(bool b);
bool IsOfflineHelpPopUp() const;
const OUString& GetHelpStyleSheet()const; const OUString& GetHelpStyleSheet()const;
void SetHelpStyleSheet(const OUString& rStyleSheet); void SetHelpStyleSheet(const OUString& rStyleSheet);
......
...@@ -3554,6 +3554,12 @@ ...@@ -3554,6 +3554,12 @@
</info> </info>
<value>false</value> <value>false</value>
</prop> </prop>
<prop oor:name="BuiltInHelpNotInstalledPopUp" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Activates "Built-in help is not installed" pop-up</desc>
</info>
<value>true</value>
</prop>
<prop oor:name="HelpStyleSheet" oor:type="xs:string" oor:nillable="false"> <prop oor:name="HelpStyleSheet" oor:type="xs:string" oor:nillable="false">
<info> <info>
<desc>Specifies the name of the stylesheet used to display help <desc>Specifies the name of the stylesheet used to display help
......
...@@ -820,16 +820,23 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const ...@@ -820,16 +820,23 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
if ( !impl_hasHelpInstalled() ) if ( !impl_hasHelpInstalled() )
{ {
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWindow ? pWindow->GetFrameWeld() : nullptr, "sfx/ui/helpmanual.ui")); SvtHelpOptions aHelpOptions;
std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual")); bool bShowOfflineHelpPopUp = aHelpOptions.IsOfflineHelpPopUp();
LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag(); if(bShowOfflineHelpPopUp)
OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() ); {
OUString sPrimText = xQueryBox->get_primary_text(); std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWindow ? pWindow->GetFrameWeld() : nullptr, "sfx/ui/helpmanual.ui"));
xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString)); std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual"));
short OnlineHelpBox = xQueryBox->run(); std::unique_ptr<weld::CheckButton> m_xHideOfflineHelpCB(xBuilder->weld_check_button("hidedialog"));
LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag();
if(OnlineHelpBox == RET_OK) OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() );
OUString sPrimText = xQueryBox->get_primary_text();
xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString));
short OnlineHelpBox = xQueryBox->run();
bShowOfflineHelpPopUp = OnlineHelpBox != RET_OK;
aHelpOptions.SetOfflineHelpPopUp(!m_xHideOfflineHelpCB->get_state());
}
if(!bShowOfflineHelpPopUp)
{ {
if ( impl_showOnlineHelp( aHelpURL ) ) if ( impl_showOnlineHelp( aHelpURL ) )
return true; return true;
...@@ -844,7 +851,6 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const ...@@ -844,7 +851,6 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
{ {
return false; return false;
} }
} }
// old-help to display // old-help to display
Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
...@@ -962,19 +968,25 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt ...@@ -962,19 +968,25 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt
if ( !impl_hasHelpInstalled() ) if ( !impl_hasHelpInstalled() )
{ {
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWidget, "sfx/ui/helpmanual.ui")); SvtHelpOptions aHelpOptions;
std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual")); bool bShowOfflineHelpPopUp = aHelpOptions.IsOfflineHelpPopUp();
LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag(); if(bShowOfflineHelpPopUp)
OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() ); {
OUString sPrimText = xQueryBox->get_primary_text(); std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWidget, "sfx/ui/helpmanual.ui"));
xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString)); std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual"));
xQueryBox->connect_help(LINK(nullptr, NoHelpErrorBox, HelpRequestHdl)); std::unique_ptr<weld::CheckButton> m_xHideOfflineHelpCB(xBuilder->weld_check_button("hidedialog"));
short OnlineHelpBox = xQueryBox->run(); LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag();
xQueryBox->hide(); OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() );
if (OnlineHelpBox == RET_OK) OUString sPrimText = xQueryBox->get_primary_text();
xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString));
short OnlineHelpBox = xQueryBox->run();
bShowOfflineHelpPopUp = OnlineHelpBox != RET_OK;
aHelpOptions.SetOfflineHelpPopUp(!m_xHideOfflineHelpCB->get_state());
}
if(!bShowOfflineHelpPopUp)
{ {
if (impl_showOnlineHelp( aHelpURL ) ) if ( impl_showOnlineHelp( aHelpURL ) )
return true; return true;
else else
{ {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 --> <!-- Generated with glade 3.18.3 -->
<interface domain="sfx"> <interface domain="sfx">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkMessageDialog" id="onlinehelpmanual"> <object class="GtkMessageDialog" id="onlinehelpmanual">
...@@ -55,6 +55,24 @@ ...@@ -55,6 +55,24 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="hidedialog">
<property name="label" translatable="yes" context="helpmanual|hidedialog">Do not show this dialog again</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="margin_left">100</property>
<property name="hexpand">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
</child> </child>
<action-widgets> <action-widgets>
......
...@@ -47,13 +47,15 @@ enum class HelpProperty ...@@ -47,13 +47,15 @@ enum class HelpProperty
HelpTips = 1, HelpTips = 1,
Locale = 2, Locale = 2,
System = 3, System = 3,
StyleSheet = 4 StyleSheet = 4,
OfflineHelpPopUp = 5
}; };
class SvtHelpOptions_Impl : public utl::ConfigItem class SvtHelpOptions_Impl : public utl::ConfigItem
{ {
bool bExtendedHelp; bool bExtendedHelp;
bool bHelpTips; bool bHelpTips;
bool bOfflineHelpPopUp;
OUString aLocale; OUString aLocale;
OUString aSystem; OUString aSystem;
OUString sHelpStyleSheet; OUString sHelpStyleSheet;
...@@ -73,7 +75,8 @@ public: ...@@ -73,7 +75,8 @@ public:
bool IsExtendedHelp() const { return bExtendedHelp; } bool IsExtendedHelp() const { return bExtendedHelp; }
void SetHelpTips( bool b ) { bHelpTips = b; SetModified(); } void SetHelpTips( bool b ) { bHelpTips = b; SetModified(); }
bool IsHelpTips() const { return bHelpTips; } bool IsHelpTips() const { return bHelpTips; }
void SetOfflineHelpPopUp(bool b) { bOfflineHelpPopUp = b; SetModified();}
bool IsOfflineHelpPopUp() const { return bOfflineHelpPopUp;}
const OUString& GetSystem() const { return aSystem; } const OUString& GetSystem() const { return aSystem; }
const OUString& GetHelpStyleSheet()const{return sHelpStyleSheet;} const OUString& GetHelpStyleSheet()const{return sHelpStyleSheet;}
...@@ -90,7 +93,8 @@ Sequence< OUString > const & SvtHelpOptions_Impl::GetPropertyNames() ...@@ -90,7 +93,8 @@ Sequence< OUString > const & SvtHelpOptions_Impl::GetPropertyNames()
"Tip", "Tip",
"Locale", "Locale",
"System", "System",
"HelpStyleSheet" "HelpStyleSheet",
"BuiltInHelpNotInstalledPopUp"
}; };
return aNames; return aNames;
...@@ -107,6 +111,7 @@ SvtHelpOptions_Impl::SvtHelpOptions_Impl() ...@@ -107,6 +111,7 @@ SvtHelpOptions_Impl::SvtHelpOptions_Impl()
: ConfigItem( "Office.Common/Help" ) : ConfigItem( "Office.Common/Help" )
, bExtendedHelp( false ) , bExtendedHelp( false )
, bHelpTips( true ) , bHelpTips( true )
, bOfflineHelpPopUp( true)
{ {
Sequence< OUString > aNames = GetPropertyNames(); Sequence< OUString > aNames = GetPropertyNames();
Load( aNames ); Load( aNames );
...@@ -148,7 +153,7 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames) ...@@ -148,7 +153,7 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames)
OUString aTmpStr; OUString aTmpStr;
sal_Int32 nTmpInt = 0; sal_Int32 nTmpInt = 0;
if ( pValues[nProp] >>= bTmp ) if ( pValues[nProp] >>= bTmp )
{ {
switch ( static_cast< HelpProperty >( switch ( static_cast< HelpProperty >(
lcl_MapPropertyName(rPropertyNames[nProp], aInternalPropertyNames) ) ) lcl_MapPropertyName(rPropertyNames[nProp], aInternalPropertyNames) ) )
{ {
...@@ -158,6 +163,9 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames) ...@@ -158,6 +163,9 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames)
case HelpProperty::HelpTips: case HelpProperty::HelpTips:
bHelpTips = bTmp; bHelpTips = bTmp;
break; break;
case HelpProperty::OfflineHelpPopUp:
bOfflineHelpPopUp = bTmp;
break;
default: default:
SAL_WARN( "svtools.config", "Wrong Member!" ); SAL_WARN( "svtools.config", "Wrong Member!" );
break; break;
...@@ -225,6 +233,9 @@ void SvtHelpOptions_Impl::ImplCommit() ...@@ -225,6 +233,9 @@ void SvtHelpOptions_Impl::ImplCommit()
case HelpProperty::StyleSheet: case HelpProperty::StyleSheet:
pValues[nProp] <<= sHelpStyleSheet; pValues[nProp] <<= sHelpStyleSheet;
break; break;
case HelpProperty::OfflineHelpPopUp:
pValues[nProp] <<= bOfflineHelpPopUp;
break;
} }
} }
...@@ -268,7 +279,15 @@ bool SvtHelpOptions::IsExtendedHelp() const ...@@ -268,7 +279,15 @@ bool SvtHelpOptions::IsExtendedHelp() const
{ {
return pImpl->IsExtendedHelp(); return pImpl->IsExtendedHelp();
} }
void SvtHelpOptions::SetOfflineHelpPopUp (bool b )
{
pImpl->SetOfflineHelpPopUp( b );
}
bool SvtHelpOptions::IsOfflineHelpPopUp() const
{
return pImpl->IsOfflineHelpPopUp();
}
void SvtHelpOptions::SetHelpTips( bool b ) void SvtHelpOptions::SetHelpTips( bool b )
{ {
pImpl->SetHelpTips( b ); pImpl->SetHelpTips( b );
......
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