From 9319ea5b5321e33b0f7bfa85e2064bc794d3b465 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 8 May 2014 17:23:21 +0100 Subject: convert FinalPage to .ui Change-Id: I3e7728da37d36bdf7f9a24bbc70bae856a85d9c4 --- extensions/source/abpilot/abpfinalpage.cxx | 70 ++++++++++++------------ extensions/source/abpilot/abpfinalpage.hxx | 21 ++++---- extensions/source/abpilot/abpresid.hrc | 13 +---- extensions/source/abpilot/abspilot.src | 86 ------------------------------ 4 files changed, 46 insertions(+), 144 deletions(-) (limited to 'extensions/source/abpilot') diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx index 8fd56ab149d3..337b7329fbc6 100644 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ b/extensions/source/abpilot/abpfinalpage.cxx @@ -43,32 +43,33 @@ namespace abp } //= FinalPage - - FinalPage::FinalPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_FINAL)) - ,m_aExplanation ( this, ModuleRes( FT_FINISH_EXPL ) ) - ,m_aLocationLabel ( this, ModuleRes( FT_LOCATION ) ) - ,m_aLocation ( this, ModuleRes( CBB_LOCATION ) ) - ,m_aBrowse ( this, ModuleRes( PB_BROWSE ) ) - ,m_aRegisterName ( this, ModuleRes( CB_REGISTER_DS ) ) - ,m_aNameLabel ( this, ModuleRes( FT_NAME_EXPL ) ) - ,m_aName ( this, ModuleRes( ET_DATASOURCENAME ) ) - ,m_aDuplicateNameError ( this, ModuleRes( FT_DUPLICATENAME ) ) - ,m_aLocationController( _pParent->getORB(), m_aLocation, m_aBrowse ) + : AddressBookSourcePage(_pParent, "DataSourcePage", + "modules/sabpilot/ui/datasourcepage.ui") { - FreeResource(); - - m_aName.SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); - m_aLocation.SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); - m_aRegisterName.SetClickHdl( LINK( this, FinalPage, OnRegister ) ); - m_aRegisterName.Check(true); + get(m_pLocation, "location"); + get(m_pBrowse, "browse"); + get(m_pRegisterName, "available"); + get(m_pNameLabel, "nameft"); + get(m_pName, "name"); + get(m_pDuplicateNameError, "warning"); + m_pLocationController = new ::svx::DatabaseLocationInputController(_pParent->getORB(), + *m_pLocation, *m_pBrowse); + + m_pName->SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); + m_pLocation->SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); + m_pRegisterName->SetClickHdl( LINK( this, FinalPage, OnRegister ) ); + m_pRegisterName->Check(true); } + FinalPage::~FinalPage() + { + delete m_pLocationController; + } bool FinalPage::isValidName() const { - OUString sCurrentName(m_aName.GetText()); + OUString sCurrentName(m_pName->GetText()); if (sCurrentName.isEmpty()) // the name must not be empty @@ -81,7 +82,6 @@ namespace abp return true; } - void FinalPage::setFields() { AddressSettings& rSettings = getSettings(); @@ -104,16 +104,16 @@ namespace abp } OSL_ENSURE( aURL.GetProtocol() != INET_PROT_NOT_VALID ,"No valid file name!"); rSettings.sDataSourceName = aURL.GetMainURL( INetURLObject::NO_DECODE ); - m_aLocationController.setURL( rSettings.sDataSourceName ); + m_pLocationController->setURL( rSettings.sDataSourceName ); OUString sName = aURL.getName( ); sal_Int32 nPos = sName.indexOf(aURL.GetExtension()); if ( nPos != -1 ) { sName = sName.replaceAt(nPos-1, 4, ""); } - m_aName.SetText(sName); + m_pName->SetText(sName); - OnRegister(&m_aRegisterName); + OnRegister(m_pRegisterName); } @@ -131,15 +131,15 @@ namespace abp return false; if ( ( ::svt::WizardTypes::eTravelBackward != _eReason ) - && ( !m_aLocationController.prepareCommit() ) + && ( !m_pLocationController->prepareCommit() ) ) return false; AddressSettings& rSettings = getSettings(); - rSettings.sDataSourceName = m_aLocationController.getURL(); - rSettings.bRegisterDataSource = m_aRegisterName.IsChecked(); + rSettings.sDataSourceName = m_pLocationController->getURL(); + rSettings.bRegisterDataSource = m_pRegisterName->IsChecked(); if ( rSettings.bRegisterDataSource ) - rSettings.sRegisteredDataSourceName = m_aName.GetText(); + rSettings.sRegisteredDataSourceName = m_pName->GetText(); return true; } @@ -154,7 +154,7 @@ namespace abp aContext.getDataSourceNames( m_aInvalidDataSourceNames ); // give the name edit the focus - m_aLocation.GrabFocus(); + m_pLocation->GrabFocus(); // default the finish button getDialog()->defaultButton( WZB_FINISH ); @@ -181,14 +181,14 @@ namespace abp void FinalPage::implCheckName() { bool bValidName = isValidName(); - bool bEmptyName = m_aName.GetText().isEmpty(); - bool bEmptyLocation = m_aLocation.GetText().isEmpty(); + bool bEmptyName = m_pName->GetText().isEmpty(); + bool bEmptyLocation = m_pLocation->GetText().isEmpty(); // enable or disable the finish button - getDialog()->enableButtons( WZB_FINISH, !bEmptyLocation && (!m_aRegisterName.IsChecked() || bValidName) ); + getDialog()->enableButtons( WZB_FINISH, !bEmptyLocation && (!m_pRegisterName->IsChecked() || bValidName) ); // show the error message for an invalid name - m_aDuplicateNameError.Show( !bValidName && !bEmptyName ); + m_pDuplicateNameError->Show( !bValidName && !bEmptyName ); } @@ -201,9 +201,9 @@ namespace abp IMPL_LINK_NOARG(FinalPage, OnRegister) { - bool bEnable = m_aRegisterName.IsChecked(); - m_aNameLabel.Enable(bEnable); - m_aName.Enable(bEnable); + bool bEnable = m_pRegisterName->IsChecked(); + m_pNameLabel->Enable(bEnable); + m_pName->Enable(bEnable); implCheckName(); return 0L; } diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx index d972c46ef628..6c8c3296d3f1 100644 --- a/extensions/source/abpilot/abpfinalpage.hxx +++ b/extensions/source/abpilot/abpfinalpage.hxx @@ -38,22 +38,21 @@ namespace abp class FinalPage : public AddressBookSourcePage { protected: - FixedText m_aExplanation; - FixedText m_aLocationLabel; - ::svt::OFileURLControl m_aLocation; - PushButton m_aBrowse; - CheckBox m_aRegisterName; - FixedText m_aNameLabel; - Edit m_aName; - FixedText m_aDuplicateNameError; - - ::svx::DatabaseLocationInputController - m_aLocationController; + ::svt::OFileURLControl* m_pLocation; + PushButton* m_pBrowse; + CheckBox* m_pRegisterName; + FixedText* m_pNameLabel; + Edit* m_pName; + FixedText* m_pDuplicateNameError; + + ::svx::DatabaseLocationInputController* + m_pLocationController; StringBag m_aInvalidDataSourceNames; public: FinalPage( OAddessBookSourcePilot* _pParent ); + ~FinalPage(); protected: // OWizardPage overridables diff --git a/extensions/source/abpilot/abpresid.hrc b/extensions/source/abpilot/abpresid.hrc index 2e4b02c1992a..ae197674c5a9 100644 --- a/extensions/source/abpilot/abpresid.hrc +++ b/extensions/source/abpilot/abpresid.hrc @@ -45,10 +45,9 @@ // tab pages #define RID_PAGE_ADMININVOKATION ( RID_PAGE_START + 1 ) -#define RID_PAGE_FINAL ( RID_PAGE_START + 4 ) // please adjust RID_PAGE_END (below) when adding new tab pages -#define RID_PAGE_END RID_PAGE_FINAL +#define RID_PAGE_END RID_PAGE_ADMININVOKATION // strings @@ -130,18 +129,8 @@ #define FT_ADMINEXPLANATION 3 #define FT_NAME_EXPL 4 #define FT_ERROR 5 -#define FT_FINISH_EXPL 9 -#define FT_DUPLICATENAME 10 -#define FT_LOCATION 11 - -#define ET_DATASOURCENAME 1 #define PB_INVOKE_ADMIN_DIALOG 1 -#define PB_BROWSE 3 - -#define CB_REGISTER_DS 1 - -#define CBB_LOCATION 1 #define STR_SELECT_ABTYPE 1 #define STR_INVOKE_ADMIN_DIALOG 2 diff --git a/extensions/source/abpilot/abspilot.src b/extensions/source/abpilot/abspilot.src index f3f65bc21b18..04e700c26f6f 100644 --- a/extensions/source/abpilot/abspilot.src +++ b/extensions/source/abpilot/abspilot.src @@ -93,92 +93,6 @@ TabPage RID_PAGE_ADMININVOKATION }; }; -TabPage RID_PAGE_FINAL -{ - HelpID = "extensions:TabPage:RID_PAGE_FINAL"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FT_FINISH_EXPL - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 40 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "That was all the information necessary to integrate your address data into %PRODUCTNAME.\n\nNow, just enter the name under which you want to register the data source in %PRODUCTNAME."; - }; - - FixedText FT_LOCATION - { - Pos = MAP_APPFONT ( BORDER_X, 53 ) ; - Size = MAP_APPFONT ( 50, 8 ) ; - Group = TRUE; - - Text [ en-US ] = "Location"; - }; - - ComboBox CBB_LOCATION - { - HelpID = "extensions:ComboBox:RID_PAGE_FINAL:CBB_LOCATION"; - Pos = MAP_APPFONT ( BORDER_X , 64 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 53 - BORDER_X - BORDER_X, 12) ; - SVLook = TRUE; - Border = TRUE; - DropDown = TRUE ; - AutoHScroll = TRUE ; - }; - - PushButton PB_BROWSE - { - HelpID = "extensions:PushButton:RID_PAGE_FINAL:PB_BROWSE"; - Pos = MAP_APPFONT ( WINDOW_SIZE_X - 50 - BORDER_X , 63 ) ; - Size = MAP_APPFONT ( 50, 14) ; - SVLook = TRUE; - Group = FALSE; - - Text [ en-US ] = "Browse..."; - }; - - CheckBox CB_REGISTER_DS - { - HelpID = "extensions:CheckBox:RID_PAGE_FINAL:CB_REGISTER_DS"; - Pos = MAP_APPFONT ( BORDER_X, 82 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - BORDER_X - BORDER_X, 8) ; - SVLook = TRUE; - Group = TRUE; - - Text [ en-US ] = "Make this address book available to all modules in %PRODUCTNAME."; - }; - FixedText FT_NAME_EXPL - { - Pos = MAP_APPFONT ( BORDER_X + 10, 93 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - BORDER_X - BORDER_X - 10, 8 ) ; - - Text [ en-US ] = "Address book name"; - }; - - Edit ET_DATASOURCENAME - { - HelpID = "extensions:Edit:RID_PAGE_FINAL:ET_DATASOURCENAME"; - Pos = MAP_APPFONT ( BORDER_X + 10, 104 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 56 - BORDER_X - BORDER_X - 10, 12) ; - SVLook = TRUE; - Border = TRUE; - }; - - FixedText FT_DUPLICATENAME - { - Pos = MAP_APPFONT ( BORDER_X + 10, WINDOW_SIZE_Y - HEADER_SIZE_Y - 7 - 24 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 24) ; - WordBreak = TRUE; - Hide = TRUE; - Group = FALSE; - - Text [ en-US ] = "Another data source already has this name. As data sources have to have globally unique names, you need to choose another one."; - }; -}; - - ErrorBox RID_ERR_NEEDTYPESELECTION { Buttons = WB_OK; -- cgit