diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-07-29 20:47:09 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-07-30 09:54:26 +0200 |
commit | 6833539b466e21bebb77e247275dc50de1f36c43 (patch) | |
tree | 996642d75d47249e0a422eec4d549bda11f0d5c2 /cui | |
parent | 5a6a718d0e99bbd3311fdcd87648420fcec9f5b2 (diff) |
weld SvxOnlineUpdateTabPage
Change-Id: I0043ba0b088f0b9ae8e5716c64e424419993cb96
Reviewed-on: https://gerrit.libreoffice.org/76568
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optupdt.cxx | 172 | ||||
-rw-r--r-- | cui/source/options/optupdt.hxx | 40 | ||||
-rw-r--r-- | cui/uiconfig/ui/optonlineupdatepage.ui | 3 |
3 files changed, 97 insertions, 118 deletions
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 63c6a2959189..8477f07fa8f1 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -45,27 +45,28 @@ using namespace ::css; -SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(vcl::Window* pParent, const SfxItemSet& rSet) - : SfxTabPage(pParent, "OptOnlineUpdatePage", "cui/ui/optonlineupdatepage.ui", &rSet) +SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(TabPageParent pParent, const SfxItemSet& rSet) + : SfxTabPage(pParent, "cui/ui/optonlineupdatepage.ui", "OptOnlineUpdatePage", &rSet) + , m_xNeverChecked(m_xBuilder->weld_label("neverchecked")) + , m_xAutoCheckCheckBox(m_xBuilder->weld_check_button("autocheck")) + , m_xEveryDayButton(m_xBuilder->weld_radio_button("everyday")) + , m_xEveryWeekButton(m_xBuilder->weld_radio_button("everyweek")) + , m_xEveryMonthButton(m_xBuilder->weld_radio_button("everymonth")) + , m_xCheckNowButton(m_xBuilder->weld_button("checknow")) + , m_xAutoDownloadCheckBox(m_xBuilder->weld_check_button("autodownload")) + , m_xDestPathLabel(m_xBuilder->weld_label("destpathlabel")) + , m_xDestPath(m_xBuilder->weld_label("destpath")) + , m_xChangePathButton(m_xBuilder->weld_button("changepath")) + , m_xLastChecked(m_xBuilder->weld_label("lastchecked")) + , m_xExtrasCheckBox(m_xBuilder->weld_check_button("extrabits")) + , m_xUserAgentLabel(m_xBuilder->weld_label("useragent")) { - m_aNeverChecked = get<FixedText>("neverchecked")->GetText(); - get(m_pAutoCheckCheckBox, "autocheck"); - get(m_pEveryDayButton, "everyday"); - get(m_pEveryWeekButton, "everyweek"); - get(m_pEveryMonthButton, "everymonth"); - get(m_pCheckNowButton, "checknow"); - get(m_pAutoDownloadCheckBox, "autodownload"); - get(m_pDestPathLabel, "destpathlabel"); - get(m_pDestPath, "destpath"); - get(m_pChangePathButton, "changepath"); - get(m_pLastChecked, "lastchecked"); - get(m_pExtrasCheckBox, "extrabits"); - get(m_pUserAgentLabel, "useragent"); - - m_pAutoCheckCheckBox->SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, AutoCheckHdl_Impl ) ); - m_pExtrasCheckBox->SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl ) ); - m_pCheckNowButton->SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) ); - m_pChangePathButton->SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) ); + m_aNeverChecked = m_xNeverChecked->get_label(); + + m_xAutoCheckCheckBox->connect_toggled( LINK( this, SvxOnlineUpdateTabPage, AutoCheckHdl_Impl ) ); + m_xExtrasCheckBox->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl ) ); + m_xCheckNowButton->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) ); + m_xChangePathButton->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) ); uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); @@ -75,16 +76,12 @@ SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(vcl::Window* pParent, const SfxIt bool bDownloadSupported = false; m_xUpdateAccess->getByName( "DownloadSupported" ) >>= bDownloadSupported; - WinBits nStyle = m_pDestPath->GetStyle(); - nStyle |= WB_PATHELLIPSIS; - m_pDestPath->SetStyle(nStyle); - - m_pAutoDownloadCheckBox->Show(bDownloadSupported); - m_pDestPathLabel->Show(bDownloadSupported); - m_pDestPath->Show(bDownloadSupported); - m_pChangePathButton->Show(bDownloadSupported); + m_xAutoDownloadCheckBox->set_visible(bDownloadSupported); + m_xDestPathLabel->set_visible(bDownloadSupported); + m_xDestPath->set_visible(bDownloadSupported); + m_xChangePathButton->set_visible(bDownloadSupported); - m_aLastCheckedTemplate = m_pLastChecked->GetText(); + m_aLastCheckedTemplate = m_xLastChecked->get_label(); UpdateLastCheckedText(); UpdateUserAgent(); @@ -92,25 +89,6 @@ SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(vcl::Window* pParent, const SfxIt SvxOnlineUpdateTabPage::~SvxOnlineUpdateTabPage() { - disposeOnce(); -} - -void SvxOnlineUpdateTabPage::dispose() -{ - m_pAutoCheckCheckBox.clear(); - m_pEveryDayButton.clear(); - m_pEveryWeekButton.clear(); - m_pEveryMonthButton.clear(); - m_pCheckNowButton.clear(); - m_pAutoDownloadCheckBox.clear(); - m_pDestPathLabel.clear(); - m_pDestPath.clear(); - m_pChangePathButton.clear(); - m_pLastChecked.clear(); - m_pExtrasCheckBox.clear(); - m_pUserAgentLabel.clear(); - - SfxTabPage::dispose(); } void SvxOnlineUpdateTabPage::UpdateLastCheckedText() @@ -166,7 +144,7 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText() aText = aText.replaceAt( nIndex, 6, aTimeStr ); } - m_pLastChecked->SetText( aText ); + m_xLastChecked->set_label(aText); } void SvxOnlineUpdateTabPage::UpdateUserAgent() @@ -178,7 +156,7 @@ void SvxOnlineUpdateTabPage::UpdateUserAgent() css::uno::UNO_QUERY_THROW ); OUString aPseudoURL = "useragent:normal"; - if( m_pExtrasCheckBox->IsChecked() ) + if( m_xExtrasCheckBox->get_active() ) aPseudoURL = "useragent:extended"; uno::Sequence< beans::StringPair > aHeaders = xDav->getUserRequestHeaders( aPseudoURL, ucb::WebDAVHTTPMethod(0) ); @@ -190,7 +168,7 @@ void SvxOnlineUpdateTabPage::UpdateUserAgent() OUString aText = aHeader.Second; aText = aText.replaceAll(";", ";\n"); aText = aText.replaceAll("(", "\n("); - m_pUserAgentLabel->SetText( aText ); + m_xUserAgentLabel->set_label(aText); break; } } @@ -203,7 +181,7 @@ void SvxOnlineUpdateTabPage::UpdateUserAgent() VclPtr<SfxTabPage> SvxOnlineUpdateTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet ) { - return VclPtr<SvxOnlineUpdateTabPage>::Create( pParent.pParent, *rAttrSet ); + return VclPtr<SvxOnlineUpdateTabPage>::Create( pParent, *rAttrSet ); } bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* ) @@ -213,27 +191,27 @@ bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* ) bool bValue; sal_Int64 nValue; - if( m_pAutoCheckCheckBox->IsValueChangedFromSaved() ) + if( m_xAutoCheckCheckBox->get_state_changed_from_saved() ) { - bValue = m_pAutoCheckCheckBox->IsChecked(); + bValue = m_xAutoCheckCheckBox->get_active(); m_xUpdateAccess->replaceByName( "AutoCheckEnabled", uno::Any( bValue ) ); bModified = true; } nValue = 0; - if( m_pEveryDayButton->IsChecked() ) + if( m_xEveryDayButton->get_active() ) { - if( !m_pEveryDayButton->GetSavedValue() ) + if( !m_xEveryDayButton->get_saved_state() ) nValue = 86400; } - else if( m_pEveryWeekButton->IsChecked() ) + else if( m_xEveryWeekButton->get_active() ) { - if( !m_pEveryWeekButton->GetSavedValue() ) + if( !m_xEveryWeekButton->get_saved_state() ) nValue = 604800; } - else if( m_pEveryMonthButton->IsChecked() ) + else if( m_xEveryMonthButton->get_active() ) { - if( !m_pEveryMonthButton->GetSavedValue() ) + if( !m_xEveryMonthButton->get_saved_state() ) nValue = 2592000; } @@ -243,9 +221,9 @@ bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* ) bModified = true; } - if( m_pAutoDownloadCheckBox->IsValueChangedFromSaved() ) + if( m_xAutoDownloadCheckBox->get_state_changed_from_saved() ) { - bValue = m_pAutoDownloadCheckBox->IsChecked(); + bValue = m_xAutoDownloadCheckBox->get_active(); m_xUpdateAccess->replaceByName( "AutoDownloadEnabled", uno::Any( bValue ) ); bModified = true; } @@ -253,16 +231,16 @@ bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* ) OUString sValue, aURL; m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue; - if( ( osl::FileBase::E_None == osl::FileBase::getFileURLFromSystemPath(m_pDestPath->GetText(), aURL) ) && + if( ( osl::FileBase::E_None == osl::FileBase::getFileURLFromSystemPath(m_xDestPath->get_label(), aURL) ) && ( aURL != sValue ) ) { m_xUpdateAccess->replaceByName( "DownloadDestination", uno::Any( aURL ) ); bModified = true; } - if( m_pExtrasCheckBox->IsValueChangedFromSaved() ) + if( m_xExtrasCheckBox->get_state_changed_from_saved() ) { - bValue = m_pExtrasCheckBox->IsChecked(); + bValue = m_xExtrasCheckBox->get_active(); m_xUpdateAccess->replaceByName( "ExtendedUserAgent", uno::Any( bValue ) ); bModified = true; } @@ -281,83 +259,83 @@ void SvxOnlineUpdateTabPage::Reset( const SfxItemSet* ) beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoCheckEnabled"); bool bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0; - m_pAutoCheckCheckBox->Check(bValue); - m_pAutoCheckCheckBox->Enable(!bReadOnly); + m_xAutoCheckCheckBox->set_active(bValue); + m_xAutoCheckCheckBox->set_sensitive(!bReadOnly); sal_Int64 nValue = 0; m_xUpdateAccess->getByName( "CheckInterval" ) >>= nValue; aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/CheckInterval"); bool bReadOnly2 = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0; - m_pEveryDayButton->Enable(bValue && !(bReadOnly || bReadOnly2)); - m_pEveryWeekButton->Enable(bValue && !(bReadOnly || bReadOnly2)); - m_pEveryMonthButton->Enable(bValue && !(bReadOnly || bReadOnly2)); + m_xEveryDayButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2)); + m_xEveryWeekButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2)); + m_xEveryMonthButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2)); if( nValue == 86400 ) - m_pEveryDayButton->Check(); + m_xEveryDayButton->set_active(true); else if( nValue == 604800 ) - m_pEveryWeekButton->Check(); + m_xEveryWeekButton->set_active(true); else - m_pEveryMonthButton->Check(); + m_xEveryMonthButton->set_active(true); - m_pAutoCheckCheckBox->SaveValue(); - m_pEveryDayButton->SaveValue(); - m_pEveryWeekButton->SaveValue(); - m_pEveryMonthButton->SaveValue(); + m_xAutoCheckCheckBox->save_state(); + m_xEveryDayButton->save_state(); + m_xEveryWeekButton->save_state(); + m_xEveryMonthButton->save_state(); m_xUpdateAccess->getByName( "AutoDownloadEnabled" ) >>= bValue; aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoDownloadEnabled"); bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0; - m_pAutoDownloadCheckBox->Check(bValue); - m_pAutoDownloadCheckBox->Enable(!bReadOnly); - m_pDestPathLabel->Enable(); - m_pDestPath->Enable(); + m_xAutoDownloadCheckBox->set_active(bValue); + m_xAutoDownloadCheckBox->set_sensitive(!bReadOnly); + m_xDestPathLabel->set_sensitive(true); + m_xDestPath->set_sensitive(true); OUString sValue, aPath; m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue; aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/DownloadDestination"); bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0; - m_pChangePathButton->Enable(!bReadOnly); + m_xChangePathButton->set_sensitive(!bReadOnly); if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(sValue, aPath) ) - m_pDestPath->SetText(aPath); + m_xDestPath->set_label(aPath); m_xUpdateAccess->getByName( "ExtendedUserAgent" ) >>= bValue; aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/ExtendedUserAgent"); bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0; - m_pExtrasCheckBox->Check(bValue); - m_pExtrasCheckBox->Enable(!bReadOnly); - m_pExtrasCheckBox->SaveValue(); + m_xExtrasCheckBox->set_active(bValue); + m_xExtrasCheckBox->set_sensitive(!bReadOnly); + m_xExtrasCheckBox->save_state(); UpdateUserAgent(); - m_pAutoDownloadCheckBox->SaveValue(); + m_xAutoDownloadCheckBox->save_state(); } void SvxOnlineUpdateTabPage::FillUserData() { } -IMPL_LINK( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, Button*, pBox, void ) +IMPL_LINK(SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, weld::ToggleButton&, rBox, void) { - bool bEnabled = static_cast<CheckBox*>(pBox)->IsChecked(); + bool bEnabled = rBox.get_active(); beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/CheckInterval"); bool bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0; - m_pEveryDayButton->Enable(bEnabled && !bReadOnly); - m_pEveryWeekButton->Enable(bEnabled && !bReadOnly); - m_pEveryMonthButton->Enable(bEnabled && !bReadOnly); + m_xEveryDayButton->set_sensitive(bEnabled && !bReadOnly); + m_xEveryWeekButton->set_sensitive(bEnabled && !bReadOnly); + m_xEveryMonthButton->set_sensitive(bEnabled && !bReadOnly); } -IMPL_LINK( SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl, Button*, , void ) +IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl, weld::Button&, void) { UpdateUserAgent(); } -IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, weld::Button&, void) { uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = ui::dialogs::FolderPicker::create(xContext); OUString aURL; - if( osl::FileBase::E_None != osl::FileBase::getFileURLFromSystemPath(m_pDestPath->GetText(), aURL) ) + if( osl::FileBase::E_None != osl::FileBase::getFileURLFromSystemPath(m_xDestPath->get_label(), aURL) ) osl::Security().getHomeDir(aURL); xFolderPicker->setDisplayDirectory( aURL ); @@ -367,11 +345,11 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, Button*, void) { OUString aFolder; if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(xFolderPicker->getDirectory(), aFolder)) - m_pDestPath->SetText( aFolder ); + m_xDestPath->set_label(aFolder); } } -IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, CheckNowHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, CheckNowHdl_Impl, weld::Button&, void) { uno::Reference < uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); diff --git a/cui/source/options/optupdt.hxx b/cui/source/options/optupdt.hxx index b9c844fa82a1..1f6923715f34 100644 --- a/cui/source/options/optupdt.hxx +++ b/cui/source/options/optupdt.hxx @@ -31,36 +31,37 @@ class SvxOnlineUpdateTabPage : public SfxTabPage { private: - VclPtr<CheckBox> m_pAutoCheckCheckBox; - VclPtr<RadioButton> m_pEveryDayButton; - VclPtr<RadioButton> m_pEveryWeekButton; - VclPtr<RadioButton> m_pEveryMonthButton; - VclPtr<PushButton> m_pCheckNowButton; - VclPtr<CheckBox> m_pAutoDownloadCheckBox; - VclPtr<FixedText> m_pDestPathLabel; - VclPtr<FixedText> m_pDestPath; - VclPtr<PushButton> m_pChangePathButton; - VclPtr<FixedText> m_pLastChecked; - VclPtr<CheckBox> m_pExtrasCheckBox; - VclPtr<FixedText> m_pUserAgentLabel; OUString m_aNeverChecked; OUString m_aLastCheckedTemplate; - DECL_LINK(FileDialogHdl_Impl, Button*, void); - DECL_LINK(CheckNowHdl_Impl, Button*, void); - DECL_LINK(AutoCheckHdl_Impl, Button*, void); - DECL_LINK(ExtrasCheckHdl_Impl, Button*, void); - css::uno::Reference< css::container::XNameReplace > m_xUpdateAccess; css::uno::Reference<css::configuration::XReadWriteAccess> m_xReadWriteAccess; + std::unique_ptr<weld::Label> m_xNeverChecked; + std::unique_ptr<weld::CheckButton> m_xAutoCheckCheckBox; + std::unique_ptr<weld::RadioButton> m_xEveryDayButton; + std::unique_ptr<weld::RadioButton> m_xEveryWeekButton; + std::unique_ptr<weld::RadioButton> m_xEveryMonthButton; + std::unique_ptr<weld::Button> m_xCheckNowButton; + std::unique_ptr<weld::CheckButton> m_xAutoDownloadCheckBox; + std::unique_ptr<weld::Label> m_xDestPathLabel; + std::unique_ptr<weld::Label> m_xDestPath; + std::unique_ptr<weld::Button> m_xChangePathButton; + std::unique_ptr<weld::Label> m_xLastChecked; + std::unique_ptr<weld::CheckButton> m_xExtrasCheckBox; + std::unique_ptr<weld::Label> m_xUserAgentLabel; + + DECL_LINK(FileDialogHdl_Impl, weld::Button&, void); + DECL_LINK(CheckNowHdl_Impl, weld::Button&, void); + DECL_LINK(AutoCheckHdl_Impl, weld::ToggleButton&, void); + DECL_LINK(ExtrasCheckHdl_Impl, weld::Button&, void); + void UpdateLastCheckedText(); void UpdateUserAgent(); public: - SvxOnlineUpdateTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); + SvxOnlineUpdateTabPage(TabPageParent pParent, const SfxItemSet& rSet); virtual ~SvxOnlineUpdateTabPage() override; - virtual void dispose() override; static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rSet ); @@ -69,7 +70,6 @@ public: virtual void FillUserData() override; }; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/uiconfig/ui/optonlineupdatepage.ui b/cui/uiconfig/ui/optonlineupdatepage.ui index 3a7c1d1b2f87..22986562451c 100644 --- a/cui/uiconfig/ui/optonlineupdatepage.ui +++ b/cui/uiconfig/ui/optonlineupdatepage.ui @@ -195,6 +195,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> + <property name="ellipsize">end</property> <property name="xalign">0</property> </object> <packing> @@ -232,7 +233,7 @@ </packing> </child> <child> - <object class="GtkHBox" id="hbox"> + <object class="GtkBox" id="hbox"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">8</property> |