[Libreoffice-commits] core.git: dbaccess/source

Andrzej J.R. Hunt andrzej at ahunt.org
Wed Aug 28 07:01:05 PDT 2013


 dbaccess/source/ui/dlg/generalpage.cxx |   31 ++++++++++++++++---------------
 dbaccess/source/ui/dlg/generalpage.hxx |   26 +++++++++++++++-----------
 2 files changed, 31 insertions(+), 26 deletions(-)

New commits:
commit c656482c5a1467d6dc21601e1296ba3711916d6b
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Wed Aug 28 09:22:37 2013 +0100

    fdo#68588 Move embeddeddbList into OGeneralPageWizard.
    
    embeddeddbList is only present in generalpagewizard.ui but not in
    generalpagedialog.ui, hence it should be controlled by
    OGeneralPageWizard and not OGeneralPage.
    
    Change-Id: I7c52493e12b40d9043d80fb023cfc9eb9c9e42ec
    Reviewed-on: https://gerrit.libreoffice.org/5654
    Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>
    Tested-by: Lionel Elie Mamane <lionel at mamane.lu>

diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index f9aac8f..ff6bd5d 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -54,18 +54,15 @@ namespace dbaui
     // OGeneralPage
     OGeneralPage::OGeneralPage( Window* pParent, const OUString& _rUIXMLDescription, const SfxItemSet& _rItems )
         :OGenericAdministrationPage( pParent, "PageGeneral", _rUIXMLDescription, _rItems )
-        ,m_pSpecialMessage              ( NULL )
         ,m_eNotSupportedKnownType       ( ::dbaccess::DST_UNKNOWN )
+        ,m_pSpecialMessage              ( NULL )
         ,m_eLastMessage                 ( smNone )
         ,m_bDisplayingInvalid           ( sal_False )
         ,m_bInitTypeList                ( true )
-        ,m_bInitEmbeddedDBList          ( true )
         ,m_pDatasourceType              ( NULL )
-        ,m_pEmbeddedDBType              ( NULL )
         ,m_pCollection                  ( NULL )
     {
         get( m_pDatasourceType, "datasourceType" );
-        get( m_pEmbeddedDBType, "embeddeddbList" );
         get( m_pSpecialMessage, "specialMessage" );
 
         // extract the datasource type collection from the item set
@@ -76,7 +73,6 @@ namespace dbaui
 
         // do some knittings
         m_pDatasourceType->SetSelectHdl(LINK(this, OGeneralPage, OnDatasourceTypeSelected));
-        m_pEmbeddedDBType->SetSelectHdl(LINK(this, OGeneralPage, OnEmbeddedDBTypeSelected));
     }
 
     OGeneralPage::~OGeneralPage()
@@ -142,7 +138,7 @@ namespace dbaui
         }
     }
 
-    void OGeneralPage::initializeEmbeddedDBList()
+    void OGeneralPageWizard::initializeEmbeddedDBList()
     {
         if ( m_bInitEmbeddedDBList )
         {
@@ -221,10 +217,8 @@ namespace dbaui
     void OGeneralPage::implInitControls( const SfxItemSet& _rSet, sal_Bool _bSaveValue )
     {
         initializeTypeList();
-        initializeEmbeddedDBList();
 
         m_pDatasourceType->SelectEntry( getDatasourceName( _rSet ) );
-        m_pEmbeddedDBType->SelectEntry( getEmbeddedDBName( _rSet ) );
 
         // notify our listener that our type selection has changed (if so)
         // FIXME: how to detect that it did not changed? (fdo#62937)
@@ -237,7 +231,7 @@ namespace dbaui
         OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue );
     }
 
-    OUString OGeneralPage::getEmbeddedDBName( const SfxItemSet& _rSet )
+    OUString OGeneralPageWizard::getEmbeddedDBName( const SfxItemSet& _rSet )
     {
         // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
         sal_Bool bValid, bReadonly;
@@ -245,7 +239,6 @@ namespace dbaui
 
         // if the selection is invalid, disable everything
         String sName,sConnectURL;
-        m_bDisplayingInvalid = !bValid;
         if ( bValid )
         {
             // collect some items and some values
@@ -276,10 +269,10 @@ namespace dbaui
         {   // this indicates it's really a type which is known in general, but not supported on the current platform
             // show a message saying so
             //  eSpecialMessage = smUnsupportedType;
-            insertDatasourceTypeEntryData( m_eCurrentSelection, sDisplayName );
+            insertEmbeddedDBTypeEntryData( m_eCurrentSelection, sDisplayName );
             // remember this type so we can show the special message again if the user selects this
             // type again (without changing the data source)
-            m_eNotSupportedKnownType = m_pCollection->determineType( m_eCurrentSelection );
+            m_eNotSupportedKnownType = m_pCollection->determineType( m_eCurrentSelection ); // TODO:
         }
 
         return sDisplayName;
@@ -370,7 +363,7 @@ namespace dbaui
         m_aURLPrefixes[nPos] = _sType;
     }
 
-    void OGeneralPage::insertEmbeddedDBTypeEntryData(const OUString& _sType, String sDisplayName)
+    void OGeneralPageWizard::insertEmbeddedDBTypeEntryData(const OUString& _sType, String sDisplayName)
     {
         // insert a (temporary) entry
         sal_uInt16 nPos = m_pEmbeddedDBType->InsertEntry(sDisplayName);
@@ -406,7 +399,7 @@ namespace dbaui
         OGenericAdministrationPage::Reset(_rCoreAttrs);
     }
 
-    IMPL_LINK( OGeneralPage, OnEmbeddedDBTypeSelected, ListBox*, _pBox )
+    IMPL_LINK( OGeneralPageWizard, OnEmbeddedDBTypeSelected, ListBox*, _pBox )
     {
         // get the type from the entry data
         sal_uInt16 nSelected = _pBox->GetSelectEntryPos();
@@ -498,10 +491,12 @@ namespace dbaui
         ,m_pRB_OpenExistingDatabase     ( NULL )
         ,m_pRB_ConnectDatabase          ( NULL )
         ,m_pFT_EmbeddedDBLabel          ( NULL )
+        ,m_pEmbeddedDBType              ( NULL )
         ,m_pFT_DocListLabel             ( NULL )
         ,m_pLB_DocumentList             ( NULL )
         ,m_pPB_OpenDatabase             ( NULL )
         ,m_eOriginalCreationMode        ( eCreateNew )
+        ,m_bInitEmbeddedDBList          ( true )
     {
         get( m_pFT_HeaderText, "headerText" );
         get( m_pFT_HelpText, "helpText" );
@@ -509,6 +504,7 @@ namespace dbaui
         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" );
@@ -538,6 +534,7 @@ namespace dbaui
             m_pRB_CreateDatabase->Check();
 
         // do some knittings
+        m_pEmbeddedDBType->SetSelectHdl(LINK(this, OGeneralPageWizard, OnEmbeddedDBTypeSelected));
         m_pRB_CreateDatabase->SetClickHdl( LINK( this, OGeneralPageWizard, OnCreateDatabaseModeSelected ) );
         m_pRB_ConnectDatabase->SetClickHdl( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
         m_pRB_OpenExistingDatabase->SetClickHdl( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
@@ -567,6 +564,9 @@ namespace dbaui
     {
         OGeneralPage::implInitControls( _rSet, _bSaveValue );
 
+        initializeEmbeddedDBList();
+        m_pEmbeddedDBType->SelectEntry( getEmbeddedDBName( _rSet ) );
+
         // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
         sal_Bool bValid, bReadonly;
         getFlags( _rSet, bValid, bReadonly );
@@ -682,7 +682,8 @@ namespace dbaui
     {
         if ( m_aCreationModeHandler.IsSet() )
             m_aCreationModeHandler.Call( this );
-        OnEmbeddedDBTypeSelected(m_pEmbeddedDBType);
+
+        OnEmbeddedDBTypeSelected( m_pEmbeddedDBType );
         return 1L;
     }
 
diff --git a/dbaccess/source/ui/dlg/generalpage.hxx b/dbaccess/source/ui/dlg/generalpage.hxx
index 2510cb3..71e0152 100644
--- a/dbaccess/source/ui/dlg/generalpage.hxx
+++ b/dbaccess/source/ui/dlg/generalpage.hxx
@@ -37,13 +37,13 @@ namespace dbaui
         OGeneralPage( Window* pParent, const OUString& _rUIXMLDescription, const SfxItemSet& _rItems );
         ~OGeneralPage();
 
-    private:
-        FixedText*          m_pSpecialMessage;
-
         OUString            m_eCurrentSelection;    /// currently selected type
         ::dbaccess::DATASOURCE_TYPE
                             m_eNotSupportedKnownType;   /// if a data source of an unsupported, but known type is encountered ....
 
+    private:
+        FixedText*          m_pSpecialMessage;
+
         enum SPECIAL_MESSAGE
         {
             smNone,
@@ -54,22 +54,17 @@ namespace dbaui
         Link                m_aTypeSelectHandler;   /// to be called if a new type is selected
         sal_Bool            m_bDisplayingInvalid : 1;   // the currently displayed data source is deleted
         bool                m_bInitTypeList : 1;
-        bool                m_bInitEmbeddedDBList : 1;
         bool                approveDatasourceType( const OUString& _sURLPrefix, OUString& _inout_rDisplayName );
         void                insertDatasourceTypeEntryData( const OUString& _sType, String sDisplayName );
-        void                insertEmbeddedDBTypeEntryData( const OUString& _sType, String sDisplayName );
 
     protected:
         ListBox*            m_pDatasourceType;
-        ListBox*            m_pEmbeddedDBType;
 
         ::dbaccess::ODsnTypeCollection*
                             m_pCollection;  /// the DSN type collection instance
 
         ::std::vector< OUString>
                             m_aURLPrefixes;
-        ::std::vector< OUString>
-                            m_aEmbeddedURLPrefixes;
 
     public:
         /// set a handler which gets called every time the user selects a new type
@@ -84,7 +79,6 @@ namespace dbaui
 
         virtual void implInitControls( const SfxItemSet& _rSet, sal_Bool _bSaveValue );
         virtual OUString getDatasourceName( const SfxItemSet& _rSet );
-        virtual OUString getEmbeddedDBName( const SfxItemSet& _rSet );
         virtual bool approveDatasourceType( ::dbaccess::DATASOURCE_TYPE eType, OUString& _inout_rDisplayName );
 
         // <method>OGenericAdministrationPage::fillControls</method>
@@ -94,7 +88,6 @@ namespace dbaui
 
         void onTypeSelected(const OUString& _sURLPrefix);
         void initializeTypeList();
-        void initializeEmbeddedDBList();
 
         void implSetCurrentType( const OUString& _eType );
 
@@ -104,7 +97,6 @@ namespace dbaui
         virtual void setParentTitle( const OUString& _sURLPrefix );
 
         DECL_LINK(OnDatasourceTypeSelected, ListBox*);
-        DECL_LINK(OnEmbeddedDBTypeSelected, ListBox*);
     };
 
     // OGeneralPageDialog
@@ -150,6 +142,8 @@ namespace dbaui
         RadioButton*            m_pRB_ConnectDatabase;
 
         FixedText*              m_pFT_EmbeddedDBLabel;
+        ListBox*                m_pEmbeddedDBType;
+
         FixedText*              m_pFT_DocListLabel;
         OpenDocumentListBox*    m_pLB_DocumentList;
         OpenDocumentButton*     m_pPB_OpenDatabase;
@@ -165,6 +159,9 @@ namespace dbaui
         ::svt::ControlDependencyManager
                                 m_aControlDependencies;
 
+        bool                    m_bInitEmbeddedDBList : 1;
+        void                    insertEmbeddedDBTypeEntryData( const OUString& _sType, String sDisplayName );
+
     public:
         void                    SetCreationModeHandler( const Link& _rHandler ) { m_aCreationModeHandler = _rHandler; }
         CreationMode            GetDatabaseCreationMode() const;
@@ -182,7 +179,14 @@ namespace dbaui
         virtual OUString getDatasourceName( const SfxItemSet& _rSet );
         virtual bool approveDatasourceType( ::dbaccess::DATASOURCE_TYPE eType, OUString& _inout_rDisplayName );
 
+        ::std::vector< OUString>
+                            m_aEmbeddedURLPrefixes;
+
+        virtual OUString getEmbeddedDBName( const SfxItemSet& _rSet );
+        void initializeEmbeddedDBList();
+
     protected:
+        DECL_LINK( OnEmbeddedDBTypeSelected, ListBox* );
         DECL_LINK( OnCreateDatabaseModeSelected, RadioButton* );
         DECL_LINK( OnSetupModeSelected, RadioButton* );
         DECL_LINK( OnDocumentSelected, ListBox* );


More information about the Libreoffice-commits mailing list