weld OGeneralPage and OGeneralPageWizard
Change-Id: I7caa08a5e060371c9b80ff83b141c27af09246bf Reviewed-on: https://gerrit.libreoffice.org/76817 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -57,11 +57,10 @@ namespace dbaui
|
|||||||
using ::com::sun::star::ui::XImageManager;
|
using ::com::sun::star::ui::XImageManager;
|
||||||
using ::com::sun::star::graphic::XGraphic;
|
using ::com::sun::star::graphic::XGraphic;
|
||||||
|
|
||||||
Image GetCommandIcon( const sal_Char* _pCommandURL, const OUString& _rModuleName )
|
Reference< XGraphic> GetCommandIcon( const sal_Char* _pCommandURL, const OUString& _rModuleName )
|
||||||
{
|
{
|
||||||
Image aIcon;
|
|
||||||
if ( !_pCommandURL || !*_pCommandURL )
|
if ( !_pCommandURL || !*_pCommandURL )
|
||||||
return aIcon;
|
return nullptr;
|
||||||
|
|
||||||
OUString sCommandURL = OUString::createFromAscii( _pCommandURL );
|
OUString sCommandURL = OUString::createFromAscii( _pCommandURL );
|
||||||
try
|
try
|
||||||
@@ -88,27 +87,24 @@ namespace dbaui
|
|||||||
if ( !xIconList.hasElements() )
|
if ( !xIconList.hasElements() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
aIcon = Image(Graphic(xIconList[0]).GetBitmapEx());
|
return xIconList[0];
|
||||||
}
|
}
|
||||||
while ( false );
|
while ( false );
|
||||||
}
|
}
|
||||||
catch ( Exception& ) {}
|
catch ( Exception& ) {}
|
||||||
|
|
||||||
return aIcon;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenButton
|
// OpenButton
|
||||||
|
|
||||||
OpenDocumentButton::OpenDocumentButton( vcl::Window* _pParent, const sal_Char* _pAsciiModuleName )
|
OpenDocumentButton::OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const sal_Char* _pAsciiModuleName)
|
||||||
:PushButton( _pParent )
|
: m_xControl(std::move(xControl))
|
||||||
{
|
{
|
||||||
impl_init( _pAsciiModuleName );
|
impl_init( _pAsciiModuleName );
|
||||||
}
|
}
|
||||||
|
|
||||||
VCL_BUILDER_FACTORY_ARGS( OpenDocumentButton, "com.sun.star.sdb.OfficeDatabaseDocument" );
|
|
||||||
|
|
||||||
void OpenDocumentButton::impl_init( const sal_Char* _pAsciiModuleName )
|
void OpenDocumentButton::impl_init( const sal_Char* _pAsciiModuleName )
|
||||||
{
|
{
|
||||||
OSL_ENSURE( _pAsciiModuleName, "OpenDocumentButton::impl_init: invalid module name!" );
|
OSL_ENSURE( _pAsciiModuleName, "OpenDocumentButton::impl_init: invalid module name!" );
|
||||||
@@ -116,26 +112,20 @@ namespace dbaui
|
|||||||
|
|
||||||
// our label should equal the UI text of the "Open" command
|
// our label should equal the UI text of the "Open" command
|
||||||
OUString sLabel(vcl::CommandInfoProvider::GetLabelForCommand(".uno:Open", m_sModule));
|
OUString sLabel(vcl::CommandInfoProvider::GetLabelForCommand(".uno:Open", m_sModule));
|
||||||
SetText(" " + sLabel.replaceAll("~", ""));
|
m_xControl->set_label(" " + sLabel.replaceAll("~", ""));
|
||||||
|
|
||||||
// Place icon left of text and both centered in the button.
|
// Place icon left of text and both centered in the button.
|
||||||
SetModeImage( GetCommandIcon( ".uno:Open", m_sModule ) );
|
m_xControl->set_image(GetCommandIcon(".uno:Open", m_sModule));
|
||||||
EnableImageDisplay( true );
|
|
||||||
EnableTextDisplay( true );
|
|
||||||
SetImageAlign( ImageAlign::Left );
|
|
||||||
SetStyle( GetStyle() | WB_CENTER );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenDocumentListBox
|
// OpenDocumentListBox
|
||||||
|
|
||||||
OpenDocumentListBox::OpenDocumentListBox( vcl::Window* _pParent, const sal_Char* _pAsciiModuleName )
|
OpenDocumentListBox::OpenDocumentListBox(std::unique_ptr<weld::ComboBox> xControl, const sal_Char* _pAsciiModuleName )
|
||||||
:ListBox( _pParent, WB_BORDER | WB_DROPDOWN )
|
: m_xControl(std::move(xControl))
|
||||||
{
|
{
|
||||||
impl_init( _pAsciiModuleName );
|
impl_init( _pAsciiModuleName );
|
||||||
}
|
}
|
||||||
|
|
||||||
VCL_BUILDER_FACTORY_ARGS( OpenDocumentListBox, "com.sun.star.sdb.OfficeDatabaseDocument" );
|
|
||||||
|
|
||||||
void OpenDocumentListBox::impl_init( const sal_Char* _pAsciiModuleName )
|
void OpenDocumentListBox::impl_init( const sal_Char* _pAsciiModuleName )
|
||||||
{
|
{
|
||||||
OSL_ENSURE( _pAsciiModuleName, "OpenDocumentListBox::impl_init: invalid module name!" );
|
OSL_ENSURE( _pAsciiModuleName, "OpenDocumentListBox::impl_init: invalid module name!" );
|
||||||
@@ -179,8 +169,8 @@ namespace dbaui
|
|||||||
|
|
||||||
OUString sDecodedURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
|
OUString sDecodedURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
|
||||||
|
|
||||||
sal_Int32 nPos = InsertEntry( sTitle );
|
m_xControl->append_text(sTitle);
|
||||||
m_aURLs.emplace( nPos, StringPair( sDecodedURL, sFilter ) );
|
m_aURLs.emplace_back(StringPair(sDecodedURL, sFilter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( Exception& ) {}
|
catch( Exception& ) {}
|
||||||
@@ -190,50 +180,23 @@ namespace dbaui
|
|||||||
OUString OpenDocumentListBox::GetSelectedDocumentURL() const
|
OUString OpenDocumentListBox::GetSelectedDocumentURL() const
|
||||||
{
|
{
|
||||||
OUString sURL;
|
OUString sURL;
|
||||||
sal_Int32 nSelected = GetSelectedEntryPos();
|
sal_Int32 nSelected = m_xControl->get_active();
|
||||||
if ( LISTBOX_ENTRY_NOTFOUND != GetSelectedEntryPos() )
|
if (nSelected != -1)
|
||||||
sURL = impl_getDocumentAtIndex( nSelected ).first;
|
sURL = impl_getDocumentAtIndex( nSelected ).first;
|
||||||
return sURL;
|
return sURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenDocumentListBox::StringPair OpenDocumentListBox::impl_getDocumentAtIndex( sal_uInt16 _nListIndex, bool _bSystemNotation ) const
|
OpenDocumentListBox::StringPair OpenDocumentListBox::impl_getDocumentAtIndex( sal_uInt16 _nListIndex, bool _bSystemNotation ) const
|
||||||
{
|
{
|
||||||
MapIndexToStringPair::const_iterator pos = m_aURLs.find( _nListIndex );
|
StringPair aDocumentDescriptor = m_aURLs[_nListIndex];
|
||||||
OSL_ENSURE( pos != m_aURLs.end(), "OpenDocumentListBox::impl_getDocumentAtIndex: invalid index!" );
|
if ( _bSystemNotation && !aDocumentDescriptor.first.isEmpty() )
|
||||||
|
|
||||||
StringPair aDocumentDescriptor;
|
|
||||||
if ( pos != m_aURLs.end() )
|
|
||||||
{
|
{
|
||||||
aDocumentDescriptor = pos->second;
|
::svt::OFileNotation aNotation( aDocumentDescriptor.first );
|
||||||
if ( _bSystemNotation && !aDocumentDescriptor.first.isEmpty() )
|
aDocumentDescriptor.first = aNotation.get( ::svt::OFileNotation::N_SYSTEM );
|
||||||
{
|
|
||||||
::svt::OFileNotation aNotation( aDocumentDescriptor.first );
|
|
||||||
aDocumentDescriptor.first = aNotation.get( ::svt::OFileNotation::N_SYSTEM );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return aDocumentDescriptor;
|
return aDocumentDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenDocumentListBox::RequestHelp( const HelpEvent& _rHEvt )
|
|
||||||
{
|
|
||||||
if( !( _rHEvt.GetMode() & HelpEventMode::QUICK ) )
|
|
||||||
return;
|
|
||||||
if ( !IsEnabled() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
Point aRequestPos( ScreenToOutputPixel( _rHEvt.GetMousePosPixel() ) );
|
|
||||||
sal_Int32 nItemIndex = LISTBOX_ENTRY_NOTFOUND;
|
|
||||||
if ( GetIndexForPoint( aRequestPos, nItemIndex ) != -1 )
|
|
||||||
{
|
|
||||||
tools::Rectangle aItemRect( GetBoundingRectangle( nItemIndex ) );
|
|
||||||
aItemRect = tools::Rectangle(
|
|
||||||
OutputToScreenPixel( aItemRect.TopLeft() ),
|
|
||||||
OutputToScreenPixel( aItemRect.BottomRight() ) );
|
|
||||||
OUString sHelpText = impl_getDocumentAtIndex( nItemIndex, true ).first;
|
|
||||||
Help::ShowQuickHelp( this, aItemRect, sHelpText, QuickHelpFlags::Left | QuickHelpFlags::VCenter );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace dbaui
|
} // namespace dbaui
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -53,17 +53,14 @@ namespace dbaui
|
|||||||
using namespace ::com::sun::star::container;
|
using namespace ::com::sun::star::container;
|
||||||
|
|
||||||
// OGeneralPage
|
// OGeneralPage
|
||||||
OGeneralPage::OGeneralPage( vcl::Window* pParent, const OUString& _rUIXMLDescription, const SfxItemSet& _rItems )
|
OGeneralPage::OGeneralPage(TabPageParent pParent, const OUString& _rUIXMLDescription, const SfxItemSet& _rItems)
|
||||||
:OGenericAdministrationPage( pParent, "PageGeneral", _rUIXMLDescription, _rItems )
|
: OGenericAdministrationPage(pParent, _rUIXMLDescription, "PageGeneral", _rItems)
|
||||||
,m_pSpecialMessage ( nullptr )
|
, m_xSpecialMessage(m_xBuilder->weld_label("specialMessage"))
|
||||||
,m_eLastMessage ( smNone )
|
, m_eLastMessage(smNone)
|
||||||
,m_bInitTypeList ( true )
|
, m_bInitTypeList(true)
|
||||||
,m_pDatasourceType ( nullptr )
|
, m_xDatasourceType(m_xBuilder->weld_combo_box("datasourceType"))
|
||||||
,m_pCollection ( nullptr )
|
, m_pCollection(nullptr)
|
||||||
{
|
{
|
||||||
get( m_pDatasourceType, "datasourceType" );
|
|
||||||
get( m_pSpecialMessage, "specialMessage" );
|
|
||||||
|
|
||||||
// extract the datasource type collection from the item set
|
// extract the datasource type collection from the item set
|
||||||
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>( _rItems.GetItem(DSID_TYPECOLLECTION) );
|
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>( _rItems.GetItem(DSID_TYPECOLLECTION) );
|
||||||
if (pCollectionItem)
|
if (pCollectionItem)
|
||||||
@@ -71,19 +68,11 @@ namespace dbaui
|
|||||||
SAL_WARN_IF(!m_pCollection, "dbaccess.ui.generalpage", "OGeneralPage::OGeneralPage : really need a DSN type collection !");
|
SAL_WARN_IF(!m_pCollection, "dbaccess.ui.generalpage", "OGeneralPage::OGeneralPage : really need a DSN type collection !");
|
||||||
|
|
||||||
// do some knittings
|
// do some knittings
|
||||||
m_pDatasourceType->SetSelectHdl(LINK(this, OGeneralPage, OnDatasourceTypeSelected));
|
m_xDatasourceType->connect_changed(LINK(this, OGeneralPage, OnDatasourceTypeSelected));
|
||||||
}
|
}
|
||||||
|
|
||||||
OGeneralPage::~OGeneralPage()
|
OGeneralPage::~OGeneralPage()
|
||||||
{
|
{
|
||||||
disposeOnce();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OGeneralPage::dispose()
|
|
||||||
{
|
|
||||||
m_pSpecialMessage.clear();
|
|
||||||
m_pDatasourceType.clear();
|
|
||||||
OGenericAdministrationPage::dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -111,7 +100,7 @@ namespace dbaui
|
|||||||
if ( m_bInitTypeList )
|
if ( m_bInitTypeList )
|
||||||
{
|
{
|
||||||
m_bInitTypeList = false;
|
m_bInitTypeList = false;
|
||||||
m_pDatasourceType->Clear();
|
m_xDatasourceType->clear();
|
||||||
|
|
||||||
if ( m_pCollection )
|
if ( m_pCollection )
|
||||||
{
|
{
|
||||||
@@ -131,8 +120,8 @@ namespace dbaui
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
OUString sDisplayName = aTypeLoop.getDisplayName();
|
OUString sDisplayName = aTypeLoop.getDisplayName();
|
||||||
if ( m_pDatasourceType->GetEntryPos( sDisplayName ) == LISTBOX_ENTRY_NOTFOUND
|
if (m_xDatasourceType->find_text(sDisplayName) == -1 &&
|
||||||
&& approveDatasourceType( sURLPrefix, sDisplayName ) )
|
approveDatasourceType(sURLPrefix, sDisplayName))
|
||||||
{
|
{
|
||||||
aDisplayedTypes.emplace_back( sURLPrefix, sDisplayName );
|
aDisplayedTypes.emplace_back( sURLPrefix, sDisplayName );
|
||||||
}
|
}
|
||||||
@@ -150,7 +139,7 @@ namespace dbaui
|
|||||||
if ( m_bInitEmbeddedDBList )
|
if ( m_bInitEmbeddedDBList )
|
||||||
{
|
{
|
||||||
m_bInitEmbeddedDBList = false;
|
m_bInitEmbeddedDBList = false;
|
||||||
m_pEmbeddedDBType->Clear();
|
m_xEmbeddedDBType->clear();
|
||||||
|
|
||||||
if ( m_pCollection )
|
if ( m_pCollection )
|
||||||
{
|
{
|
||||||
@@ -166,8 +155,8 @@ namespace dbaui
|
|||||||
if ( !sURLPrefix.isEmpty() )
|
if ( !sURLPrefix.isEmpty() )
|
||||||
{
|
{
|
||||||
OUString sDisplayName = aTypeLoop.getDisplayName();
|
OUString sDisplayName = aTypeLoop.getDisplayName();
|
||||||
if ( m_pEmbeddedDBType->GetEntryPos( sDisplayName ) == LISTBOX_ENTRY_NOTFOUND
|
if (m_xEmbeddedDBType->find_text(sDisplayName) == -1 &&
|
||||||
&& dbaccess::ODsnTypeCollection::isEmbeddedDatabase( sURLPrefix ) )
|
dbaccess::ODsnTypeCollection::isEmbeddedDatabase(sURLPrefix))
|
||||||
{
|
{
|
||||||
aDisplayedTypes.emplace_back( sURLPrefix, sDisplayName );
|
aDisplayedTypes.emplace_back( sURLPrefix, sDisplayName );
|
||||||
}
|
}
|
||||||
@@ -201,7 +190,7 @@ namespace dbaui
|
|||||||
if ( pResId )
|
if ( pResId )
|
||||||
sMessage = DBA_RES(pResId);
|
sMessage = DBA_RES(pResId);
|
||||||
|
|
||||||
m_pSpecialMessage->SetText( sMessage );
|
m_xSpecialMessage->set_label( sMessage );
|
||||||
m_eLastMessage = eMessage;
|
m_eLastMessage = eMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,7 +209,7 @@ namespace dbaui
|
|||||||
{
|
{
|
||||||
initializeTypeList();
|
initializeTypeList();
|
||||||
|
|
||||||
m_pDatasourceType->SelectEntry( getDatasourceName( _rSet ) );
|
m_xDatasourceType->set_active_text(getDatasourceName(_rSet));
|
||||||
|
|
||||||
// notify our listener that our type selection has changed (if so)
|
// notify our listener that our type selection has changed (if so)
|
||||||
// FIXME: how to detect that it did not changed? (fdo#62937)
|
// FIXME: how to detect that it did not changed? (fdo#62937)
|
||||||
@@ -254,8 +243,7 @@ namespace dbaui
|
|||||||
|
|
||||||
// select the correct datasource type
|
// select the correct datasource type
|
||||||
if ( dbaccess::ODsnTypeCollection::isEmbeddedDatabase( m_eCurrentSelection )
|
if ( dbaccess::ODsnTypeCollection::isEmbeddedDatabase( m_eCurrentSelection )
|
||||||
&& ( LISTBOX_ENTRY_NOTFOUND == m_pEmbeddedDBType->GetEntryPos( sDisplayName ) )
|
&& m_xEmbeddedDBType->find_text(sDisplayName) == -1 )
|
||||||
)
|
|
||||||
{ // this indicates it's really a type which is known in general, but not supported on the current platform
|
{ // this indicates it's really a type which is known in general, but not supported on the current platform
|
||||||
// show a message saying so
|
// show a message saying so
|
||||||
// eSpecialMessage = smUnsupportedType;
|
// eSpecialMessage = smUnsupportedType;
|
||||||
@@ -293,9 +281,8 @@ namespace dbaui
|
|||||||
}
|
}
|
||||||
|
|
||||||
// select the correct datasource type
|
// select the correct datasource type
|
||||||
if ( approveDatasourceType( m_eCurrentSelection, sDisplayName )
|
if ( approveDatasourceType( m_eCurrentSelection, sDisplayName )
|
||||||
&& ( LISTBOX_ENTRY_NOTFOUND == m_pDatasourceType->GetEntryPos( sDisplayName ) )
|
&& m_xDatasourceType->find_text(sDisplayName) == -1 )
|
||||||
)
|
|
||||||
{ // this indicates it's really a type which is known in general, but not supported on the current platform
|
{ // this indicates it's really a type which is known in general, but not supported on the current platform
|
||||||
// show a message saying so
|
// show a message saying so
|
||||||
// eSpecialMessage = smUnsupportedType;
|
// eSpecialMessage = smUnsupportedType;
|
||||||
@@ -336,29 +323,25 @@ namespace dbaui
|
|||||||
void OGeneralPage::insertDatasourceTypeEntryData(const OUString& _sType, const OUString& sDisplayName)
|
void OGeneralPage::insertDatasourceTypeEntryData(const OUString& _sType, const OUString& sDisplayName)
|
||||||
{
|
{
|
||||||
// insert a (temporary) entry
|
// insert a (temporary) entry
|
||||||
const sal_Int32 nPos = m_pDatasourceType->InsertEntry(sDisplayName);
|
m_xDatasourceType->append_text(sDisplayName);
|
||||||
if ( static_cast<size_t>(nPos) >= m_aURLPrefixes.size() )
|
m_aURLPrefixes.push_back(_sType);
|
||||||
m_aURLPrefixes.resize(nPos+1);
|
|
||||||
m_aURLPrefixes[nPos] = _sType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGeneralPageWizard::insertEmbeddedDBTypeEntryData(const OUString& _sType, const OUString& sDisplayName)
|
void OGeneralPageWizard::insertEmbeddedDBTypeEntryData(const OUString& _sType, const OUString& sDisplayName)
|
||||||
{
|
{
|
||||||
// insert a (temporary) entry
|
// insert a (temporary) entry
|
||||||
const sal_Int32 nPos = m_pEmbeddedDBType->InsertEntry(sDisplayName);
|
m_xEmbeddedDBType->append_text(sDisplayName);
|
||||||
if ( static_cast<size_t>(nPos) >= m_aEmbeddedURLPrefixes.size() )
|
m_aEmbeddedURLPrefixes.push_back(_sType);
|
||||||
m_aEmbeddedURLPrefixes.resize(nPos+1);
|
|
||||||
m_aEmbeddedURLPrefixes[nPos] = _sType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGeneralPage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
|
void OGeneralPage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
|
||||||
{
|
{
|
||||||
_rControlList.emplace_back( new ODisableWrapper<FixedText>( m_pSpecialMessage ) );
|
_rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xSpecialMessage.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGeneralPage::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
|
void OGeneralPage::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
|
||||||
{
|
{
|
||||||
_rControlList.emplace_back( new OSaveValueWrapper<ListBox>( m_pDatasourceType ) );
|
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ComboBox>(m_xDatasourceType.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGeneralPage::implSetCurrentType( const OUString& _eType )
|
void OGeneralPage::implSetCurrentType( const OUString& _eType )
|
||||||
@@ -378,10 +361,10 @@ namespace dbaui
|
|||||||
OGenericAdministrationPage::Reset(_rCoreAttrs);
|
OGenericAdministrationPage::Reset(_rCoreAttrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPL_LINK( OGeneralPageWizard, OnEmbeddedDBTypeSelected, ListBox&, _rBox, void )
|
IMPL_LINK( OGeneralPageWizard, OnEmbeddedDBTypeSelected, weld::ComboBox&, _rBox, void )
|
||||||
{
|
{
|
||||||
// get the type from the entry data
|
// get the type from the entry data
|
||||||
const sal_Int32 nSelected = _rBox.GetSelectedEntryPos();
|
const sal_Int32 nSelected = _rBox.get_active();
|
||||||
if (static_cast<size_t>(nSelected) >= m_aEmbeddedURLPrefixes.size() )
|
if (static_cast<size_t>(nSelected) >= m_aEmbeddedURLPrefixes.size() )
|
||||||
{
|
{
|
||||||
SAL_WARN("dbaccess.ui.generalpage", "Got out-of-range value '" << nSelected << "' from the DatasourceType selection ListBox's GetSelectedEntryPos(): no corresponding URL prefix");
|
SAL_WARN("dbaccess.ui.generalpage", "Got out-of-range value '" << nSelected << "' from the DatasourceType selection ListBox's GetSelectedEntryPos(): no corresponding URL prefix");
|
||||||
@@ -396,11 +379,11 @@ namespace dbaui
|
|||||||
callModifiedHdl();
|
callModifiedHdl();
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPL_LINK( OGeneralPage, OnDatasourceTypeSelected, ListBox&, _rBox, void )
|
IMPL_LINK( OGeneralPage, OnDatasourceTypeSelected, weld::ComboBox&, _rBox, void )
|
||||||
{
|
{
|
||||||
// get the type from the entry data
|
// get the type from the entry data
|
||||||
const sal_Int32 nSelected = _rBox.GetSelectedEntryPos();
|
const sal_Int32 nSelected = _rBox.get_active();
|
||||||
if ( nSelected == LISTBOX_ENTRY_NOTFOUND)
|
if (nSelected == -1)
|
||||||
return;
|
return;
|
||||||
if (static_cast<size_t>(nSelected) >= m_aURLPrefixes.size() )
|
if (static_cast<size_t>(nSelected) >= m_aURLPrefixes.size() )
|
||||||
{
|
{
|
||||||
@@ -440,17 +423,17 @@ namespace dbaui
|
|||||||
bool bValid, bReadonly;
|
bool bValid, bReadonly;
|
||||||
getFlags(_rSet, bValid, bReadonly );
|
getFlags(_rSet, bValid, bReadonly );
|
||||||
|
|
||||||
m_pDatasourceType->Enable( bValid );
|
m_xDatasourceType->set_sensitive( bValid );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OGeneralPageDialog::FillItemSet( SfxItemSet* _rCoreAttrs )
|
bool OGeneralPageDialog::FillItemSet( SfxItemSet* _rCoreAttrs )
|
||||||
{
|
{
|
||||||
bool bChangedSomething = false;
|
bool bChangedSomething = false;
|
||||||
|
|
||||||
const sal_Int32 nEntry = m_pDatasourceType->GetSelectedEntryPos();
|
const sal_Int32 nEntry = m_xDatasourceType->get_active();
|
||||||
OUString sURLPrefix = m_aURLPrefixes[ nEntry ];
|
OUString sURLPrefix = m_aURLPrefixes[ nEntry ];
|
||||||
|
|
||||||
if ( m_pDatasourceType->IsValueChangedFromSaved() )
|
if (m_xDatasourceType->get_value_changed_from_saved())
|
||||||
{
|
{
|
||||||
_rCoreAttrs->Put( SfxStringItem( DSID_CONNECTURL, sURLPrefix ) );
|
_rCoreAttrs->Put( SfxStringItem( DSID_CONNECTURL, sURLPrefix ) );
|
||||||
bChangedSomething = true;
|
bChangedSomething = true;
|
||||||
@@ -461,27 +444,18 @@ namespace dbaui
|
|||||||
|
|
||||||
// OGeneralPageWizard
|
// OGeneralPageWizard
|
||||||
OGeneralPageWizard::OGeneralPageWizard( vcl::Window* pParent, const SfxItemSet& _rItems )
|
OGeneralPageWizard::OGeneralPageWizard( vcl::Window* pParent, const SfxItemSet& _rItems )
|
||||||
:OGeneralPage( pParent, "dbaccess/ui/generalpagewizard.ui", _rItems )
|
: OGeneralPage( pParent, "dbaccess/ui/generalpagewizard.ui", _rItems )
|
||||||
,m_pRB_CreateDatabase ( nullptr )
|
, m_xRB_CreateDatabase(m_xBuilder->weld_radio_button("createDatabase"))
|
||||||
,m_pRB_OpenExistingDatabase ( nullptr )
|
, m_xRB_OpenExistingDatabase(m_xBuilder->weld_radio_button("openExistingDatabase"))
|
||||||
,m_pRB_ConnectDatabase ( nullptr )
|
, m_xRB_ConnectDatabase(m_xBuilder->weld_radio_button("connectDatabase"))
|
||||||
,m_pFT_EmbeddedDBLabel ( nullptr )
|
, m_xFT_EmbeddedDBLabel(m_xBuilder->weld_label("embeddeddbLabel"))
|
||||||
,m_pEmbeddedDBType ( nullptr )
|
, m_xEmbeddedDBType(m_xBuilder->weld_combo_box("embeddeddbList"))
|
||||||
,m_pFT_DocListLabel ( nullptr )
|
, m_xFT_DocListLabel(m_xBuilder->weld_label("docListLabel"))
|
||||||
,m_pLB_DocumentList ( nullptr )
|
, m_xLB_DocumentList(new OpenDocumentListBox(m_xBuilder->weld_combo_box("documentList"), "com.sun.star.sdb.OfficeDatabaseDocument"))
|
||||||
,m_pPB_OpenDatabase ( nullptr )
|
, m_xPB_OpenDatabase(new OpenDocumentButton(m_xBuilder->weld_button("openDatabase"), "com.sun.star.sdb.OfficeDatabaseDocument"))
|
||||||
,m_eOriginalCreationMode ( eCreateNew )
|
, m_eOriginalCreationMode(eCreateNew)
|
||||||
,m_bInitEmbeddedDBList ( true )
|
, m_bInitEmbeddedDBList(true)
|
||||||
{
|
{
|
||||||
get( m_pRB_CreateDatabase, "createDatabase" );
|
|
||||||
get( m_pRB_OpenExistingDatabase, "openExistingDatabase" );
|
|
||||||
get( m_pRB_ConnectDatabase, "connectDatabase" );
|
|
||||||
get( m_pFT_EmbeddedDBLabel, "embeddeddbLabel" );
|
|
||||||
get( m_pEmbeddedDBType, "embeddeddbList" );
|
|
||||||
get( m_pFT_DocListLabel, "docListLabel" );
|
|
||||||
get( m_pLB_DocumentList, "documentList" );
|
|
||||||
get( m_pPB_OpenDatabase, "openDatabase" );
|
|
||||||
|
|
||||||
// If no driver for embedded DBs is installed, and no dBase driver, then hide the "Create new database" option
|
// If no driver for embedded DBs is installed, and no dBase driver, then hide the "Create new database" option
|
||||||
sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() );
|
sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() );
|
||||||
if ( nCreateNewDBIndex == -1 )
|
if ( nCreateNewDBIndex == -1 )
|
||||||
@@ -500,44 +474,30 @@ namespace dbaui
|
|||||||
|
|
||||||
if ( bHideCreateNew )
|
if ( bHideCreateNew )
|
||||||
{
|
{
|
||||||
m_pRB_CreateDatabase->Hide();
|
m_xRB_CreateDatabase->hide();
|
||||||
m_pRB_ConnectDatabase->Check();
|
m_xRB_ConnectDatabase->set_active(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_pRB_CreateDatabase->Check();
|
m_xRB_CreateDatabase->set_active(true);
|
||||||
|
|
||||||
// do some knittings
|
// do some knittings
|
||||||
m_pEmbeddedDBType->SetSelectHdl(LINK(this, OGeneralPageWizard, OnEmbeddedDBTypeSelected));
|
m_xEmbeddedDBType->connect_changed(LINK(this, OGeneralPageWizard, OnEmbeddedDBTypeSelected));
|
||||||
m_pRB_CreateDatabase->SetClickHdl( LINK( this, OGeneralPageWizard, OnCreateDatabaseModeSelected ) );
|
m_xRB_CreateDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnCreateDatabaseModeSelected ) );
|
||||||
m_pRB_ConnectDatabase->SetClickHdl( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
|
m_xRB_ConnectDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
|
||||||
m_pRB_OpenExistingDatabase->SetClickHdl( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
|
m_xRB_OpenExistingDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
|
||||||
m_pLB_DocumentList->SetSelectHdl( LINK( this, OGeneralPageWizard, OnDocumentSelected ) );
|
m_xLB_DocumentList->connect_changed( LINK( this, OGeneralPageWizard, OnDocumentSelected ) );
|
||||||
m_pPB_OpenDatabase->SetClickHdl( LINK( this, OGeneralPageWizard, OnOpenDocument ) );
|
m_xPB_OpenDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnOpenDocument ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
OGeneralPageWizard::~OGeneralPageWizard()
|
OGeneralPageWizard::~OGeneralPageWizard()
|
||||||
{
|
{
|
||||||
disposeOnce();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OGeneralPageWizard::dispose()
|
|
||||||
{
|
|
||||||
m_pRB_CreateDatabase.clear();
|
|
||||||
m_pRB_OpenExistingDatabase.clear();
|
|
||||||
m_pRB_ConnectDatabase.clear();
|
|
||||||
m_pFT_EmbeddedDBLabel.clear();
|
|
||||||
m_pEmbeddedDBType.clear();
|
|
||||||
m_pFT_DocListLabel.clear();
|
|
||||||
m_pLB_DocumentList.clear();
|
|
||||||
m_pPB_OpenDatabase.clear();
|
|
||||||
OGeneralPage::dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OGeneralPageWizard::CreationMode OGeneralPageWizard::GetDatabaseCreationMode() const
|
OGeneralPageWizard::CreationMode OGeneralPageWizard::GetDatabaseCreationMode() const
|
||||||
{
|
{
|
||||||
if ( m_pRB_CreateDatabase->IsChecked() )
|
if ( m_xRB_CreateDatabase->get_active() )
|
||||||
return eCreateNew;
|
return eCreateNew;
|
||||||
if ( m_pRB_ConnectDatabase->IsChecked() )
|
if ( m_xRB_ConnectDatabase->get_active() )
|
||||||
return eConnectExternal;
|
return eConnectExternal;
|
||||||
return eOpenExisting;
|
return eOpenExisting;
|
||||||
}
|
}
|
||||||
@@ -545,10 +505,10 @@ namespace dbaui
|
|||||||
void OGeneralPageWizard::GetFocus()
|
void OGeneralPageWizard::GetFocus()
|
||||||
{
|
{
|
||||||
OGeneralPage::GetFocus();
|
OGeneralPage::GetFocus();
|
||||||
if ( m_pLB_DocumentList && m_pLB_DocumentList->IsEnabled() )
|
if ( m_xLB_DocumentList && m_xLB_DocumentList->get_sensitive() )
|
||||||
m_pLB_DocumentList->GrabFocus();
|
m_xLB_DocumentList->grab_focus();
|
||||||
else if ( m_pDatasourceType && m_pDatasourceType->IsEnabled() )
|
else if ( m_xDatasourceType && m_xDatasourceType->get_sensitive() )
|
||||||
m_pDatasourceType->GrabFocus();
|
m_xDatasourceType->grab_focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGeneralPageWizard::implInitControls( const SfxItemSet& _rSet, bool _bSaveValue )
|
void OGeneralPageWizard::implInitControls( const SfxItemSet& _rSet, bool _bSaveValue )
|
||||||
@@ -556,7 +516,7 @@ namespace dbaui
|
|||||||
OGeneralPage::implInitControls( _rSet, _bSaveValue );
|
OGeneralPage::implInitControls( _rSet, _bSaveValue );
|
||||||
|
|
||||||
initializeEmbeddedDBList();
|
initializeEmbeddedDBList();
|
||||||
m_pEmbeddedDBType->SelectEntry( getEmbeddedDBName( _rSet ) );
|
m_xEmbeddedDBType->set_active_text(getEmbeddedDBName(_rSet));
|
||||||
|
|
||||||
// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
|
// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
|
||||||
bool bValid, bReadonly;
|
bool bValid, bReadonly;
|
||||||
@@ -564,27 +524,24 @@ namespace dbaui
|
|||||||
|
|
||||||
SetText( OUString() );
|
SetText( OUString() );
|
||||||
|
|
||||||
LayoutHelper::positionBelow( *m_pRB_ConnectDatabase, *m_pDatasourceType, INDENT_BELOW_RADIO );
|
|
||||||
|
|
||||||
if ( !bValid || bReadonly )
|
if ( !bValid || bReadonly )
|
||||||
{
|
{
|
||||||
m_pFT_EmbeddedDBLabel->Enable( false );
|
m_xFT_EmbeddedDBLabel->set_sensitive( false );
|
||||||
m_pDatasourceType->Enable( false );
|
m_xDatasourceType->set_sensitive( false );
|
||||||
m_pPB_OpenDatabase->Enable( false );
|
m_xPB_OpenDatabase->set_sensitive( false );
|
||||||
m_pFT_DocListLabel->Enable( false );
|
m_xFT_DocListLabel->set_sensitive( false );
|
||||||
m_pLB_DocumentList->Enable( false );
|
m_xLB_DocumentList->set_sensitive( false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pDatasourceType->Enable( false );
|
m_xDatasourceType->set_sensitive( false );
|
||||||
m_pPB_OpenDatabase->Enable( false );
|
m_xPB_OpenDatabase->set_sensitive( false );
|
||||||
m_pFT_DocListLabel->Enable( false );
|
m_xFT_DocListLabel->set_sensitive( false );
|
||||||
m_pLB_DocumentList->Enable( false );
|
m_xLB_DocumentList->set_sensitive( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pLB_DocumentList->SetDropDownLineCount( 20 );
|
if (m_xLB_DocumentList->get_count())
|
||||||
if ( m_pLB_DocumentList->GetEntryCount() )
|
m_xLB_DocumentList->set_active(0);
|
||||||
m_pLB_DocumentList->SelectEntryPos( 0 );
|
|
||||||
|
|
||||||
m_eOriginalCreationMode = GetDatabaseCreationMode();
|
m_eOriginalCreationMode = GetDatabaseCreationMode();
|
||||||
}
|
}
|
||||||
@@ -592,7 +549,7 @@ namespace dbaui
|
|||||||
OUString OGeneralPageWizard::getDatasourceName(const SfxItemSet& _rSet)
|
OUString OGeneralPageWizard::getDatasourceName(const SfxItemSet& _rSet)
|
||||||
{
|
{
|
||||||
// Sets the default selected database on startup.
|
// Sets the default selected database on startup.
|
||||||
if (m_pRB_CreateDatabase->IsChecked() )
|
if (m_xRB_CreateDatabase->get_active() )
|
||||||
{
|
{
|
||||||
return m_pCollection->getTypeDisplayName( "sdbc:firebird:" );
|
return m_pCollection->getTypeDisplayName( "sdbc:firebird:" );
|
||||||
}
|
}
|
||||||
@@ -622,15 +579,15 @@ namespace dbaui
|
|||||||
|
|
||||||
bool bCommitTypeSelection = true;
|
bool bCommitTypeSelection = true;
|
||||||
|
|
||||||
if ( m_pRB_CreateDatabase->IsChecked() )
|
if ( m_xRB_CreateDatabase->get_active() )
|
||||||
{
|
{
|
||||||
_rCoreAttrs->Put( SfxStringItem( DSID_CONNECTURL, "sdbc:dbase:" ) );
|
_rCoreAttrs->Put( SfxStringItem( DSID_CONNECTURL, "sdbc:dbase:" ) );
|
||||||
bChangedSomething = true;
|
bChangedSomething = true;
|
||||||
bCommitTypeSelection = false;
|
bCommitTypeSelection = false;
|
||||||
}
|
}
|
||||||
else if ( m_pRB_OpenExistingDatabase->IsChecked() )
|
else if ( m_xRB_OpenExistingDatabase->get_active() )
|
||||||
{
|
{
|
||||||
if ( m_pRB_OpenExistingDatabase->IsValueChangedFromSaved() )
|
if ( m_xRB_OpenExistingDatabase->get_state_changed_from_saved() )
|
||||||
bChangedSomething = true;
|
bChangedSomething = true;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
@@ -639,10 +596,10 @@ namespace dbaui
|
|||||||
|
|
||||||
if ( bCommitTypeSelection )
|
if ( bCommitTypeSelection )
|
||||||
{
|
{
|
||||||
const sal_Int32 nEntry = m_pDatasourceType->GetSelectedEntryPos();
|
const sal_Int32 nEntry = m_xDatasourceType->get_active();
|
||||||
OUString sURLPrefix = m_aURLPrefixes[nEntry];
|
OUString sURLPrefix = m_aURLPrefixes[nEntry];
|
||||||
|
|
||||||
if ( m_pDatasourceType->IsValueChangedFromSaved()
|
if ( m_xDatasourceType->get_value_changed_from_saved()
|
||||||
|| ( GetDatabaseCreationMode() != m_eOriginalCreationMode )
|
|| ( GetDatabaseCreationMode() != m_eOriginalCreationMode )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -660,56 +617,56 @@ namespace dbaui
|
|||||||
if ( !m_aBrowsedDocumentURL.isEmpty() )
|
if ( !m_aBrowsedDocumentURL.isEmpty() )
|
||||||
return m_aBrowsedDocumentURL;
|
return m_aBrowsedDocumentURL;
|
||||||
else
|
else
|
||||||
return m_pLB_DocumentList->GetSelectedDocumentURL();
|
return m_xLB_DocumentList->GetSelectedDocumentURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPL_LINK_NOARG( OGeneralPageWizard, OnCreateDatabaseModeSelected, Button*, void )
|
IMPL_LINK_NOARG( OGeneralPageWizard, OnCreateDatabaseModeSelected, weld::Button&, void )
|
||||||
{
|
{
|
||||||
m_aCreationModeHandler.Call( *this );
|
m_aCreationModeHandler.Call( *this );
|
||||||
|
|
||||||
OnEmbeddedDBTypeSelected( *m_pEmbeddedDBType );
|
OnEmbeddedDBTypeSelected( *m_xEmbeddedDBType );
|
||||||
|
|
||||||
bool bValid, bReadonly;
|
bool bValid, bReadonly;
|
||||||
getFlags( GetItemSet(), bValid, bReadonly );
|
getFlags( GetItemSet(), bValid, bReadonly );
|
||||||
if ( bValid && !bReadonly )
|
if ( bValid && !bReadonly )
|
||||||
{
|
{
|
||||||
m_pEmbeddedDBType->Enable(m_pRB_CreateDatabase->IsChecked());
|
m_xEmbeddedDBType->set_sensitive(m_xRB_CreateDatabase->get_active());
|
||||||
m_pFT_EmbeddedDBLabel->Enable(m_pRB_CreateDatabase->IsChecked());
|
m_xFT_EmbeddedDBLabel->set_sensitive(m_xRB_CreateDatabase->get_active());
|
||||||
m_pDatasourceType->Enable(m_pRB_ConnectDatabase->IsChecked());
|
m_xDatasourceType->set_sensitive(m_xRB_ConnectDatabase->get_active());
|
||||||
m_pPB_OpenDatabase->Enable(m_pRB_OpenExistingDatabase->IsChecked());
|
m_xPB_OpenDatabase->set_sensitive(m_xRB_OpenExistingDatabase->get_active());
|
||||||
m_pFT_DocListLabel->Enable(m_pRB_OpenExistingDatabase->IsChecked());
|
m_xFT_DocListLabel->set_sensitive(m_xRB_OpenExistingDatabase->get_active());
|
||||||
m_pLB_DocumentList->Enable(m_pRB_OpenExistingDatabase->IsChecked());
|
m_xLB_DocumentList->set_sensitive(m_xRB_OpenExistingDatabase->get_active());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPL_LINK_NOARG( OGeneralPageWizard, OnSetupModeSelected, Button*, void )
|
IMPL_LINK_NOARG( OGeneralPageWizard, OnSetupModeSelected, weld::Button&, void )
|
||||||
{
|
{
|
||||||
m_aCreationModeHandler.Call( *this );
|
m_aCreationModeHandler.Call( *this );
|
||||||
OnDatasourceTypeSelected(*m_pDatasourceType);
|
OnDatasourceTypeSelected(*m_xDatasourceType);
|
||||||
|
|
||||||
bool bValid, bReadonly;
|
bool bValid, bReadonly;
|
||||||
getFlags( GetItemSet(), bValid, bReadonly );
|
getFlags( GetItemSet(), bValid, bReadonly );
|
||||||
if ( bValid && !bReadonly )
|
if ( bValid && !bReadonly )
|
||||||
{
|
{
|
||||||
m_pEmbeddedDBType->Enable(m_pRB_CreateDatabase->IsChecked());
|
m_xEmbeddedDBType->set_sensitive(m_xRB_CreateDatabase->get_active());
|
||||||
m_pFT_EmbeddedDBLabel->Enable(m_pRB_CreateDatabase->IsChecked());
|
m_xFT_EmbeddedDBLabel->set_sensitive(m_xRB_CreateDatabase->get_active());
|
||||||
m_pDatasourceType->Enable(m_pRB_ConnectDatabase->IsChecked());
|
m_xDatasourceType->set_sensitive(m_xRB_ConnectDatabase->get_active());
|
||||||
m_pPB_OpenDatabase->Enable(m_pRB_OpenExistingDatabase->IsChecked());
|
m_xPB_OpenDatabase->set_sensitive(m_xRB_OpenExistingDatabase->get_active());
|
||||||
m_pFT_DocListLabel->Enable(m_pRB_OpenExistingDatabase->IsChecked());
|
m_xFT_DocListLabel->set_sensitive(m_xRB_OpenExistingDatabase->get_active());
|
||||||
m_pLB_DocumentList->Enable(m_pRB_OpenExistingDatabase->IsChecked());
|
m_xLB_DocumentList->set_sensitive(m_xRB_OpenExistingDatabase->get_active());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPL_LINK_NOARG( OGeneralPageWizard, OnDocumentSelected, ListBox&, void )
|
IMPL_LINK_NOARG( OGeneralPageWizard, OnDocumentSelected, weld::ComboBox&, void )
|
||||||
{
|
{
|
||||||
m_aDocumentSelectionHandler.Call( *this );
|
m_aDocumentSelectionHandler.Call( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPL_LINK_NOARG( OGeneralPageWizard, OnOpenDocument, Button*, void )
|
IMPL_LINK_NOARG( OGeneralPageWizard, OnOpenDocument, weld::Button&, void )
|
||||||
{
|
{
|
||||||
::sfx2::FileDialogHelper aFileDlg(
|
::sfx2::FileDialogHelper aFileDlg(
|
||||||
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
|
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
|
||||||
FileDialogFlags::NONE, "sdatabase", SfxFilterFlags::NONE, SfxFilterFlags::NONE, GetFrameWeld());
|
FileDialogFlags::NONE, "sdatabase", SfxFilterFlags::NONE, SfxFilterFlags::NONE, GetDialogFrameWeld());
|
||||||
std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
|
std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
|
||||||
if ( pFilter )
|
if ( pFilter )
|
||||||
{
|
{
|
||||||
@@ -724,12 +681,12 @@ namespace dbaui
|
|||||||
if ( !pFilter->GetWildcard().Matches(sPath) )
|
if ( !pFilter->GetWildcard().Matches(sPath) )
|
||||||
{
|
{
|
||||||
OUString sMessage(DBA_RES(STR_ERR_USE_CONNECT_TO));
|
OUString sMessage(DBA_RES(STR_ERR_USE_CONNECT_TO));
|
||||||
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
|
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetDialogFrameWeld(),
|
||||||
VclMessageType::Info, VclButtonsType::Ok,
|
VclMessageType::Info, VclButtonsType::Ok,
|
||||||
sMessage));
|
sMessage));
|
||||||
xInfoBox->run();
|
xInfoBox->run();
|
||||||
m_pRB_ConnectDatabase->Check();
|
m_xRB_ConnectDatabase->set_active(true);
|
||||||
OnSetupModeSelected( m_pRB_ConnectDatabase );
|
OnSetupModeSelected( *m_xRB_ConnectDatabase );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_aBrowsedDocumentURL = sPath;
|
m_aBrowsedDocumentURL = sPath;
|
||||||
|
@@ -32,12 +32,12 @@ namespace dbaui
|
|||||||
class OGeneralPage : public OGenericAdministrationPage
|
class OGeneralPage : public OGenericAdministrationPage
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
OGeneralPage( vcl::Window* pParent, const OUString& _rUIXMLDescription, const SfxItemSet& _rItems );
|
OGeneralPage(TabPageParent pParent, const OUString& _rUIXMLDescription, const SfxItemSet& _rItems);
|
||||||
|
|
||||||
OUString m_eCurrentSelection; /// currently selected type
|
OUString m_eCurrentSelection; /// currently selected type
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VclPtr<FixedText> m_pSpecialMessage;
|
std::unique_ptr<weld::Label> m_xSpecialMessage;
|
||||||
|
|
||||||
enum SPECIAL_MESSAGE
|
enum SPECIAL_MESSAGE
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ namespace dbaui
|
|||||||
void insertDatasourceTypeEntryData( const OUString& _sType, const OUString& sDisplayName );
|
void insertDatasourceTypeEntryData( const OUString& _sType, const OUString& sDisplayName );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VclPtr<ListBox> m_pDatasourceType;
|
std::unique_ptr<weld::ComboBox> m_xDatasourceType;
|
||||||
|
|
||||||
::dbaccess::ODsnTypeCollection*
|
::dbaccess::ODsnTypeCollection*
|
||||||
m_pCollection; /// the DSN type collection instance
|
m_pCollection; /// the DSN type collection instance
|
||||||
@@ -62,7 +62,6 @@ namespace dbaui
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~OGeneralPage() override;
|
virtual ~OGeneralPage() override;
|
||||||
virtual void dispose() override;
|
|
||||||
|
|
||||||
/// set a handler which gets called every time the user selects a new type
|
/// set a handler which gets called every time the user selects a new type
|
||||||
void SetTypeSelectHandler( const Link<OGeneralPage&,void>& _rHandler ) { m_aTypeSelectHandler = _rHandler; }
|
void SetTypeSelectHandler( const Link<OGeneralPage&,void>& _rHandler ) { m_aTypeSelectHandler = _rHandler; }
|
||||||
@@ -98,7 +97,7 @@ namespace dbaui
|
|||||||
/// sets the title of the parent dialog
|
/// sets the title of the parent dialog
|
||||||
virtual void setParentTitle( const OUString& _sURLPrefix );
|
virtual void setParentTitle( const OUString& _sURLPrefix );
|
||||||
|
|
||||||
DECL_LINK(OnDatasourceTypeSelected, ListBox&, void);
|
DECL_LINK(OnDatasourceTypeSelected, weld::ComboBox&, void);
|
||||||
};
|
};
|
||||||
|
|
||||||
// OGeneralPageDialog
|
// OGeneralPageDialog
|
||||||
@@ -120,7 +119,6 @@ namespace dbaui
|
|||||||
public:
|
public:
|
||||||
OGeneralPageWizard( vcl::Window* pParent, const SfxItemSet& _rItems );
|
OGeneralPageWizard( vcl::Window* pParent, const SfxItemSet& _rItems );
|
||||||
virtual ~OGeneralPageWizard() override;
|
virtual ~OGeneralPageWizard() override;
|
||||||
virtual void dispose() override;
|
|
||||||
|
|
||||||
enum CreationMode
|
enum CreationMode
|
||||||
{
|
{
|
||||||
@@ -131,16 +129,16 @@ namespace dbaui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// dialog controls
|
// dialog controls
|
||||||
VclPtr<RadioButton> m_pRB_CreateDatabase;
|
std::unique_ptr<weld::RadioButton> m_xRB_CreateDatabase;
|
||||||
VclPtr<RadioButton> m_pRB_OpenExistingDatabase;
|
std::unique_ptr<weld::RadioButton> m_xRB_OpenExistingDatabase;
|
||||||
VclPtr<RadioButton> m_pRB_ConnectDatabase;
|
std::unique_ptr<weld::RadioButton> m_xRB_ConnectDatabase;
|
||||||
|
|
||||||
VclPtr<FixedText> m_pFT_EmbeddedDBLabel;
|
std::unique_ptr<weld::Label> m_xFT_EmbeddedDBLabel;
|
||||||
VclPtr<ListBox> m_pEmbeddedDBType;
|
std::unique_ptr<weld::ComboBox> m_xEmbeddedDBType;
|
||||||
|
|
||||||
VclPtr<FixedText> m_pFT_DocListLabel;
|
std::unique_ptr<weld::Label> m_xFT_DocListLabel;
|
||||||
VclPtr<OpenDocumentListBox> m_pLB_DocumentList;
|
std::unique_ptr<OpenDocumentListBox> m_xLB_DocumentList;
|
||||||
VclPtr<OpenDocumentButton> m_pPB_OpenDatabase;
|
std::unique_ptr<OpenDocumentButton> m_xPB_OpenDatabase;
|
||||||
|
|
||||||
// state
|
// state
|
||||||
OUString m_aBrowsedDocumentURL;
|
OUString m_aBrowsedDocumentURL;
|
||||||
@@ -176,11 +174,11 @@ namespace dbaui
|
|||||||
OUString getEmbeddedDBName( const SfxItemSet& _rSet );
|
OUString getEmbeddedDBName( const SfxItemSet& _rSet );
|
||||||
void initializeEmbeddedDBList();
|
void initializeEmbeddedDBList();
|
||||||
|
|
||||||
DECL_LINK( OnEmbeddedDBTypeSelected, ListBox&, void );
|
DECL_LINK( OnEmbeddedDBTypeSelected, weld::ComboBox&, void );
|
||||||
DECL_LINK( OnCreateDatabaseModeSelected, Button*, void );
|
DECL_LINK( OnCreateDatabaseModeSelected, weld::Button&, void );
|
||||||
DECL_LINK( OnSetupModeSelected, Button*, void );
|
DECL_LINK( OnSetupModeSelected, weld::Button&, void );
|
||||||
DECL_LINK( OnDocumentSelected, ListBox&, void );
|
DECL_LINK( OnDocumentSelected, weld::ComboBox&, void );
|
||||||
DECL_LINK( OnOpenDocument, Button*, void );
|
DECL_LINK( OnOpenDocument, weld::Button&, void );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dbaui
|
} // namespace dbaui
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
#define INCLUDED_DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
|
#define INCLUDED_DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
|
||||||
|
|
||||||
#include <vcl/button.hxx>
|
#include <vcl/button.hxx>
|
||||||
#include <vcl/lstbox.hxx>
|
#include <vcl/weld.hxx>
|
||||||
#include <rtl/ustring.hxx>
|
#include <rtl/ustring.hxx>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@@ -34,35 +34,46 @@ namespace dbaui
|
|||||||
The text of the button is the same as for the "Open" command in the application
|
The text of the button is the same as for the "Open" command in the application
|
||||||
UI. Additionally, the icon for this command is also displayed on the button.
|
UI. Additionally, the icon for this command is also displayed on the button.
|
||||||
*/
|
*/
|
||||||
class OpenDocumentButton final : public PushButton
|
class OpenDocumentButton
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
OUString m_sModule;
|
OUString m_sModule;
|
||||||
|
|
||||||
|
std::unique_ptr<weld::Button> m_xControl;
|
||||||
public:
|
public:
|
||||||
OpenDocumentButton( vcl::Window* _pParent, const sal_Char* _pAsciiModuleName );
|
OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const sal_Char* _pAsciiModuleName);
|
||||||
|
|
||||||
|
void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
|
||||||
|
bool get_sensitive() const { return m_xControl->get_sensitive(); }
|
||||||
|
void connect_clicked(const Link<weld::Button&, void>& rLink) { m_xControl->connect_clicked(rLink); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void impl_init( const sal_Char* _pAsciiModuleName );
|
void impl_init( const sal_Char* _pAsciiModuleName );
|
||||||
};
|
};
|
||||||
|
|
||||||
// OpenDocumentListBox
|
// OpenDocumentListBox
|
||||||
class OpenDocumentListBox final : public ListBox
|
class OpenDocumentListBox
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef std::pair< OUString, OUString > StringPair;
|
typedef std::pair< OUString, OUString > StringPair;
|
||||||
typedef std::map< sal_uInt16, StringPair > MapIndexToStringPair;
|
|
||||||
|
|
||||||
MapIndexToStringPair m_aURLs;
|
std::vector<StringPair> m_aURLs;
|
||||||
|
|
||||||
|
std::unique_ptr<weld::ComboBox> m_xControl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OpenDocumentListBox( vcl::Window* _pParent, const sal_Char* _pAsciiModuleName );
|
OpenDocumentListBox(std::unique_ptr<weld::ComboBox> xControl, const sal_Char* _pAsciiModuleName);
|
||||||
|
|
||||||
OUString GetSelectedDocumentURL() const;
|
OUString GetSelectedDocumentURL() const;
|
||||||
|
|
||||||
private:
|
void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
|
||||||
virtual void RequestHelp( const HelpEvent& _rHEvt ) override;
|
bool get_sensitive() const { return m_xControl->get_sensitive(); }
|
||||||
|
void grab_focus() { m_xControl->grab_focus(); }
|
||||||
|
int get_count() { return m_xControl->get_count(); }
|
||||||
|
void set_active(int nPos) { m_xControl->set_active(nPos); }
|
||||||
|
void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
|
||||||
|
|
||||||
|
private:
|
||||||
StringPair impl_getDocumentAtIndex( sal_uInt16 _nListIndex, bool _bSystemNotation = false ) const;
|
StringPair impl_getDocumentAtIndex( sal_uInt16 _nListIndex, bool _bSystemNotation = false ) const;
|
||||||
|
|
||||||
void impl_init( const sal_Char* _pAsciiModuleName );
|
void impl_init( const sal_Char* _pAsciiModuleName );
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.18.3 -->
|
<!-- Generated with glade 3.22.1 -->
|
||||||
<interface domain="dba">
|
<interface domain="dba">
|
||||||
<requires lib="gtk+" version="3.18"/>
|
<requires lib="gtk+" version="3.18"/>
|
||||||
<requires lib="LibreOffice" version="1.0"/>
|
|
||||||
<object class="GtkBox" id="PageGeneral">
|
<object class="GtkBox" id="PageGeneral">
|
||||||
<property name="width_request">400</property>
|
<property name="width_request">400</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -14,9 +13,9 @@
|
|||||||
<object class="GtkLabel" id="headerText">
|
<object class="GtkLabel" id="headerText">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes" context="generalpagewizard|headerText">Welcome to the %PRODUCTNAME Database Wizard</property>
|
<property name="label" translatable="yes" context="generalpagewizard|headerText">Welcome to the %PRODUCTNAME Database Wizard</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="weight" value="bold"/>
|
<attribute name="weight" value="bold"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
@@ -31,10 +30,11 @@
|
|||||||
<object class="GtkLabel" id="helpText">
|
<object class="GtkLabel" id="helpText">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes" context="generalpagewizard|helpText">Use the Database Wizard to create a new database, open an existing database file, or connect to a database stored on a server.</property>
|
<property name="label" translatable="yes" context="generalpagewizard|helpText">Use the Database Wizard to create a new database, open an existing database file, or connect to a database stored on a server.</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
|
<property name="width_chars">72</property>
|
||||||
<property name="max_width_chars">72</property>
|
<property name="max_width_chars">72</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -46,9 +46,9 @@
|
|||||||
<object class="GtkLabel" id="sourceTypeHeader">
|
<object class="GtkLabel" id="sourceTypeHeader">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes" context="generalpagewizard|sourceTypeHeader">What do you want to do?</property>
|
<property name="label" translatable="yes" context="generalpagewizard|sourceTypeHeader">What do you want to do?</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -84,10 +84,10 @@
|
|||||||
<object class="GtkLabel" id="embeddeddbLabel">
|
<object class="GtkLabel" id="embeddeddbLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes" context="generalpagewizard|embeddeddbLabel">_Embedded database:</property>
|
<property name="label" translatable="yes" context="generalpagewizard|embeddeddbLabel">_Embedded database:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="mnemonic_widget">embeddeddbList</property>
|
<property name="mnemonic_widget">embeddeddbList</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -142,10 +142,10 @@
|
|||||||
<object class="GtkLabel" id="docListLabel">
|
<object class="GtkLabel" id="docListLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes" context="generalpagewizard|docListLabel">_Recently used:</property>
|
<property name="label" translatable="yes" context="generalpagewizard|docListLabel">_Recently used:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="mnemonic_widget">documentList</property>
|
<property name="mnemonic_widget">documentList</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -154,12 +154,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="dbulo-OpenDocumentListBox" id="documentList">
|
<object class="GtkComboBoxText" id="documentList">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="entry_text_column">0</property>
|
|
||||||
<property name="id_column">1</property>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -175,7 +173,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="dbulo-OpenDocumentButton" id="openDatabase">
|
<object class="GtkButton" id="openDatabase">
|
||||||
<property name="label" translatable="yes" context="generalpagewizard|openDatabase">Open</property>
|
<property name="label" translatable="yes" context="generalpagewizard|openDatabase">Open</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
@@ -218,10 +218,6 @@
|
|||||||
generic-name="LanguageBox" parent="VclComboBoxText"
|
generic-name="LanguageBox" parent="VclComboBoxText"
|
||||||
icon-name="widget-gtk-combobox"/>
|
icon-name="widget-gtk-combobox"/>
|
||||||
|
|
||||||
<glade-widget-class title="Open Document ListBox" name="dbulo-OpenDocumentListBox"
|
|
||||||
generic-name="Open Document ListBox" parent="GtkComboBox"
|
|
||||||
icon-name="widget-gtk-combobox"/>
|
|
||||||
|
|
||||||
<glade-widget-class title="Fill Type ListBox" name="svxlo-SvxFillTypeBox"
|
<glade-widget-class title="Fill Type ListBox" name="svxlo-SvxFillTypeBox"
|
||||||
generic-name="Fill Type ListBox" parent="GtkComboBox"
|
generic-name="Fill Type ListBox" parent="GtkComboBox"
|
||||||
icon-name="widget-gtk-combobox"/>
|
icon-name="widget-gtk-combobox"/>
|
||||||
@@ -246,10 +242,6 @@
|
|||||||
generic-name="Same Content Preset ListBox" parent="GtkComboBox"
|
generic-name="Same Content Preset ListBox" parent="GtkComboBox"
|
||||||
icon-name="widget-gtk-combobox"/>
|
icon-name="widget-gtk-combobox"/>
|
||||||
|
|
||||||
<glade-widget-class title="Open Document Button" name="dbulo-OpenDocumentButton"
|
|
||||||
generic-name="Open Document Button" parent="GtkButton"
|
|
||||||
icon-name="widget-gtk-button"/>
|
|
||||||
|
|
||||||
<glade-widget-class title="Relation Control" name="dbulo-ORelationControl"
|
<glade-widget-class title="Relation Control" name="dbulo-ORelationControl"
|
||||||
generic-name="Relation Control" parent="GtkTreeView"
|
generic-name="Relation Control" parent="GtkTreeView"
|
||||||
icon-name="widget-gtk-treeview"/>
|
icon-name="widget-gtk-treeview"/>
|
||||||
|
@@ -32,7 +32,7 @@ dbaccess/uiconfig/ui/generalpagedialog.ui://GtkLabel[@id='specialMessage'] orpha
|
|||||||
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='headerText'] orphan-label
|
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='headerText'] orphan-label
|
||||||
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='helpText'] orphan-label
|
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='helpText'] orphan-label
|
||||||
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='sourceTypeHeader'] orphan-label
|
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='sourceTypeHeader'] orphan-label
|
||||||
dbaccess/uiconfig/ui/generalpagewizard.ui://dbulo-OpenDocumentButton[@id='openDatabase'] no-labelled-by
|
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkButton[@id='openDatabase'] no-labelled-by
|
||||||
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkComboBoxText[@id='datasourceType'] no-labelled-by
|
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkComboBoxText[@id='datasourceType'] no-labelled-by
|
||||||
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='specialMessage'] orphan-label
|
dbaccess/uiconfig/ui/generalpagewizard.ui://GtkLabel[@id='specialMessage'] orphan-label
|
||||||
dbaccess/uiconfig/ui/generalspecialjdbcdetailspage.ui://GtkLabel[@id='socketLabel'] orphan-label
|
dbaccess/uiconfig/ui/generalspecialjdbcdetailspage.ui://GtkLabel[@id='socketLabel'] orphan-label
|
||||||
|
Reference in New Issue
Block a user