Tag: cws_src680_dba25 User: oj Date: 05/03/03 23:19:49 Modified: /dba/dbaccess/source/ui/browser/ dsbrowserDnD.cxx, unodatbr.cxx /dba/dbaccess/source/ui/dlg/ UserAdmin.cxx, UserAdmin.hxx, UserAdminDlg.cxx /dba/dbaccess/source/ui/relationdesign/ RelationController.cxx /dba/dbaccess/source/ui/uno/ UserSettingsDlg.cxx, unoDirectSql.cxx, unoDirectSql.hxx, unoadmin.cxx
Log: #i43912# use set connection as activeconnection File Changes: Directory: /dba/dbaccess/source/ui/browser/ =========================================== File [changed]: dsbrowserDnD.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/dsbrowserDnD.cxx?r1=1.68&r2=1.68.38.1 Delta lines: +5 -4 ------------------- --- dsbrowserDnD.cxx 21 Jan 2005 17:08:45 -0000 1.68 +++ dsbrowserDnD.cxx 4 Mar 2005 07:19:42 -0000 1.68.38.1 @@ -2,9 +2,9 @@ * * $RCSfile: dsbrowserDnD.cxx,v $ * - * $Revision: 1.68 $ + * $Revision: 1.68.38.1 $ * - * last change: $Author: kz $ $Date: 2005/01/21 17:08:45 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -363,6 +363,7 @@ Reference< ::com::sun::star::lang::XEventListener> xEvtL((::cppu::OWeakObject*)this,UNO_QUERY); xComponent->removeEventListener(xEvtL); } + if ( m_bOwnConnection ) ::comphelper::disposeComponent(pData->xObject); } File [changed]: unodatbr.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/unodatbr.cxx?r1=1.166&r2=1.166.4.1 Delta lines: +19 -14 --------------------- --- unodatbr.cxx 17 Feb 2005 11:06:48 -0000 1.166 +++ unodatbr.cxx 4 Mar 2005 07:19:43 -0000 1.166.4.1 @@ -2,9 +2,9 @@ * * $RCSfile: unodatbr.cxx,v $ * - * $Revision: 1.166 $ + * $Revision: 1.166.4.1 $ * - * last change: $Author: vg $ $Date: 2005/02/17 11:06:48 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -144,9 +144,6 @@ #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> #endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ -#include <com/sun/star/sdbc/XConnection.hpp> -#endif #ifndef _COM_SUN_STAR_FORM_XGRIDCOLUMNFACTORY_HPP_ #include <com/sun/star/form/XGridColumnFactory.hpp> #endif @@ -428,6 +425,7 @@ ,m_nBorder(1) ,m_aTableCopyHelper(this) ,m_nAsyncDrop(0) + ,m_bOwnConnection(sal_True) { DBG_CTOR(SbaTableQueryBrowser,NULL); } @@ -1160,7 +1158,8 @@ // ------------------------------------------------------------------------- SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataSource, const ::rtl::OUString& _rCommand, sal_Int32 _nCommandType, SvLBoxEntry** _ppDataSourceEntry, SvLBoxEntry** _ppContainerEntry, - sal_Bool _bExpandAncestors) + sal_Bool _bExpandAncestors + ,const Reference<XConnection>& _rxConnection) { if (_ppDataSourceEntry) *_ppDataSourceEntry = NULL; @@ -1186,7 +1185,7 @@ // add new entries to the list box model Image a, b, c; // not interested in reusing them String e, f; - implAddDatasource( _rDataSource, a, e, b, f, c ); + implAddDatasource( _rDataSource, a, e, b, f, c ,_rxConnection); pDataSource = m_pTreeView->getListBox()->GetEntryPosByName( sDisplayName, NULL, &aFilter ); DBG_ASSERT( pDataSource, "SbaTableQueryBrowser::getObjectEntry: hmm - did not find it again!" ); } @@ -2000,7 +1999,8 @@ } // ------------------------------------------------------------------------- void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDbImage, - String& _rQueryName, Image& _rQueryImage, String& _rTableName, Image& _rTableImage) + String& _rQueryName, Image& _rQueryImage, String& _rTableName, Image& _rTableImage + ,const Reference<XConnection>& _rxConnection) { vos::OGuard aGuard( Application::GetSolarMutex() ); // initialize the names/images if necessary @@ -2027,6 +2027,7 @@ DBTreeListModel::DBTreeListUserData* pDSData = new DBTreeListModel::DBTreeListUserData; pDSData->eType = etDatasource; pDSData->sAccessor = sDataSourceId; + pDSData->xObject = _rxConnection; pDatasourceEntry->SetUserData(pDSData); // the child for the queries container @@ -2059,7 +2060,7 @@ const ::rtl::OUString* pBegin = aDatasources.getConstArray(); const ::rtl::OUString* pEnd = pBegin + aDatasources.getLength(); for (; pBegin != pEnd; ++pBegin) - implAddDatasource(*pBegin, aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage); + implAddDatasource(*pBegin, aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage,NULL); } } // ------------------------------------------------------------------------- @@ -2367,7 +2368,7 @@ { SvLBoxEntry* pDataSource = NULL; SvLBoxEntry* pCommandType = NULL; - SvLBoxEntry* pCommand = getObjectEntry(_rDataSourceName, _rCommand, _nCommandType, &pDataSource, &pCommandType, sal_True); + SvLBoxEntry* pCommand = getObjectEntry(_rDataSourceName, _rCommand, _nCommandType, &pDataSource, &pCommandType, sal_True,_rxConnection); // if (pDataSource) // OJ change for the new app { @@ -2694,7 +2695,7 @@ // add new entries to the list box model Image a, b, c; // not interested in reusing them String e, f; - implAddDatasource(sNewDS, a, e, b, f, c); + implAddDatasource(sNewDS, a, e, b, f, c,NULL); } else SbaXDataBrowserController::elementInserted(_rEvent); @@ -3055,7 +3056,10 @@ else if (0 == aValue.Name.compareToAscii(PROPERTY_COMMAND)) aValue.Value >>= sInitialCommand; else if (0 == aValue.Name.compareToAscii(PROPERTY_ACTIVECONNECTION)) - ::cppu::extractInterface(xConnection,aValue.Value); + { + xConnection.set(aValue.Value,UNO_QUERY); + m_bOwnConnection = !xConnection.is(); + } else if (0 == aValue.Name.compareToAscii(PROPERTY_UPDATE_CATALOGNAME)) aValue.Value >>= aCatalogName; else if (0 == aValue.Name.compareToAscii(PROPERTY_UPDATE_SCHEMANAME)) @@ -3172,7 +3176,7 @@ Image aDBImage, aQueriesImage, aTablesImage; String sQueriesName, sTablesName; - implAddDatasource(sInitialDataSourceName, aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage); + implAddDatasource(sInitialDataSourceName, aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage,xConnection); m_pTreeView->getListBox()->Expand(m_pTreeView->getListBox()->First()); } } @@ -3276,6 +3280,7 @@ // connect _xConnection = connect( getDataSourceAcessor( _pDSEntry ), sConnectingContext, rtl::OUString(), sal_True); + m_bOwnConnection = _xConnection.is(); // remember the connection static_cast< DBTreeListModel::DBTreeListUserData* >( pData )->xObject = _xConnection; Directory: /dba/dbaccess/source/ui/dlg/ ======================================= File [changed]: UserAdmin.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/UserAdmin.cxx?r1=1.13&r2=1.13.38.1 Delta lines: +16 -23 --------------------- --- UserAdmin.cxx 21 Jan 2005 17:13:22 -0000 1.13 +++ UserAdmin.cxx 4 Mar 2005 07:19:44 -0000 1.13.38.1 @@ -2,9 +2,9 @@ * * $RCSfile: UserAdmin.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.13.38.1 $ * - * last change: $Author: kz $ $Date: 2005/01/21 17:13:22 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -384,13 +384,6 @@ return m_LB_USER.GetSelectEntry(); } // ----------------------------------------------------------------------------- -int OUserAdmin::DeactivatePage(SfxItemSet* _pSet) -{ - int nResult = OGenericAdministrationPage::DeactivatePage(_pSet); - ::comphelper::disposeComponent(m_xConnection); - return nResult; -} -// ----------------------------------------------------------------------------- void OUserAdmin::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) { } @@ -406,22 +399,22 @@ { if ( !m_xConnection.is() && m_pAdminDialog ) { + m_xConnection = m_pAdminDialog->createConnection().first; + Reference< XTablesSupplier > xTablesSup(m_xConnection,UNO_QUERY); + Reference<XUsersSupplier> xUsersSup(xTablesSup,UNO_QUERY); + if ( !xUsersSup.is() ) + { Reference< XDataDefinitionSupplier > xDriver(m_pAdminDialog->getDriver(),UNO_QUERY); if ( xDriver.is() ) { - m_xConnection = m_pAdminDialog->createConnection().first; - if ( m_xConnection.is() ) - { - // now set the tables supplier at the table control - Reference< XTablesSupplier > xTablesSup = xDriver->getDataDefinitionByConnection(m_xConnection); - - Reference<XUsersSupplier> xUsersSup(xTablesSup,UNO_QUERY); + xUsersSup.set(xDriver->getDataDefinitionByConnection(m_xConnection),UNO_QUERY); + xTablesSup.set(xUsersSup,UNO_QUERY); + } + } if ( xUsersSup.is() ) { m_TableCtrl.setTablesSupplier(xTablesSup); m_xUsers = xUsersSup->getUsers(); - } - } } } FillUserNames(); File [changed]: UserAdmin.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/UserAdmin.hxx?r1=1.3&r2=1.3.102.1 Delta lines: +3 -4 ------------------- --- UserAdmin.hxx 2 Aug 2004 15:41:57 -0000 1.3 +++ UserAdmin.hxx 4 Mar 2005 07:19:44 -0000 1.3.102.1 @@ -2,9 +2,9 @@ * * $RCSfile: UserAdmin.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.102.1 $ * - * last change: $Author: hr $ $Date: 2004/08/02 15:41:57 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -121,7 +121,6 @@ DECL_LINK( UserHdl, PushButton * ); void FillUserNames(); - virtual int DeactivatePage(SfxItemSet* _pSet); OUserAdmin( Window* pParent, const SfxItemSet& _rCoreAttrs); public: File [changed]: UserAdminDlg.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/UserAdminDlg.cxx?r1=1.3&r2=1.3.38.1 Delta lines: +31 -19 --------------------- --- UserAdminDlg.cxx 21 Jan 2005 17:13:36 -0000 1.3 +++ UserAdminDlg.cxx 4 Mar 2005 07:19:44 -0000 1.3.38.1 @@ -2,9 +2,9 @@ * * $RCSfile: UserAdminDlg.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.38.1 $ * - * last change: $Author: kz $ $Date: 2005/01/21 17:13:36 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -132,9 +132,12 @@ OUserAdminDlg::OUserAdminDlg(Window* _pParent , SfxItemSet* _pItems ,const Reference< XMultiServiceFactory >& _rxORB - ,const ::com::sun::star::uno::Any& _aDataSourceName) + ,const ::com::sun::star::uno::Any& _aDataSourceName + ,const Reference< XConnection >& _xConnection) :SfxTabDialog(_pParent, ModuleRes(DLG_DATABASE_USERADMIN), _pItems) ,m_pItemSet(_pItems) + ,m_xConnection(_xConnection) + ,m_bOwnConnection(!_xConnection.is()) { m_pImpl = ::std::auto_ptr<ODbDataSourceAdministrationHelper>(new ODbDataSourceAdministrationHelper(_rxORB,_pParent,this)); m_pImpl->setCurrentDataSourceName(_aDataSourceName); @@ -155,6 +158,7 @@ // ----------------------------------------------------------------------- OUserAdminDlg::~OUserAdminDlg() { + if ( m_bOwnConnection ) try { ::comphelper::disposeComponent(m_xConnection); @@ -169,20 +173,25 @@ { try { + Reference<XUsersSupplier> xUsersSup(m_xConnection,UNO_QUERY); + sal_Bool bError = sal_False; + if ( !xUsersSup.is() ) + { Reference< XDataDefinitionSupplier > xDriver(getDriver(),UNO_QUERY); - sal_Bool bError = !xDriver.is(); + bError = !xDriver.is(); if ( !bError ) { m_xConnection = createConnection().first; - if ( m_xConnection.is() ) + + if ( !(bError = !m_xConnection.is()) ) { // now set the tables supplier at the table control - Reference< XTablesSupplier > xTablesSup = xDriver->getDataDefinitionByConnection(m_xConnection); - - Reference<XUsersSupplier> xUsersSup(xTablesSup,UNO_QUERY); + Reference<XUsersSupplier> xUsersSup(xDriver->getDataDefinitionByConnection(m_xConnection),UNO_QUERY); bError = !xUsersSup.is(); } } + } + if ( bError ) { String sError(ModuleRes(STR_USERADMIN_NOT_AVAILABLE)); @@ -227,7 +236,10 @@ ::std::pair< Reference<XConnection>,sal_Bool> OUserAdminDlg::createConnection() { if ( !m_xConnection.is() ) + { m_xConnection = m_pImpl->createConnection().first; + m_bOwnConnection = m_xConnection.is(); + } return ::std::pair< Reference<XConnection>,sal_Bool> (m_xConnection,sal_False); } // ----------------------------------------------------------------------------- Directory: /dba/dbaccess/source/ui/relationdesign/ ================================================== File [changed]: RelationController.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/relationdesign/RelationController.cxx?r1=1.38&r2=1.38.4.1 Delta lines: +14 -5 -------------------- --- RelationController.cxx 17 Feb 2005 11:09:22 -0000 1.38 +++ RelationController.cxx 4 Mar 2005 07:19:45 -0000 1.38.4.1 @@ -2,9 +2,9 @@ * * $RCSfile: RelationController.cxx,v $ * - * $Revision: 1.38 $ + * $Revision: 1.38.4.1 $ * - * last change: $Author: vg $ $Date: 2005/02/17 11:09:22 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,9 @@ #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" #endif +#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#include <toolkit/unohlp.hxx> +#endif #ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> #endif @@ -342,8 +345,14 @@ { { String aMessage(ModuleRes(RID_STR_CONNECTION_LOST)); - ODataView* pWindow = getView(); - InfoBox(pWindow, aMessage).Execute(); + Reference< ::com::sun::star::awt::XWindow> xWindow = getTopMostContainerWindow(); + Window* pWin = NULL; + if ( xWindow.is() ) + pWin = VCLUnoHelper::GetWindow(xWindow); + if ( !pWin ) + pWin = getView()->Window::GetParent(); + + InfoBox(pWin, aMessage).Execute(); } throw SQLException(); } Directory: /dba/dbaccess/source/ui/uno/ ======================================= File [changed]: UserSettingsDlg.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/uno/UserSettingsDlg.cxx?r1=1.2&r2=1.2.102.1 Delta lines: +3 -3 ------------------- --- UserSettingsDlg.cxx 2 Aug 2004 16:22:05 -0000 1.2 +++ UserSettingsDlg.cxx 4 Mar 2005 07:19:45 -0000 1.2.102.1 @@ -2,9 +2,9 @@ * * $RCSfile: UserSettingsDlg.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.102.1 $ * - * last change: $Author: hr $ $Date: 2004/08/02 16:22:05 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -154,7 +154,7 @@ //------------------------------------------------------------------------------ Dialog* OUserSettingsDialog::createDialog(Window* _pParent) { - OUserAdminDlg* pDlg = new OUserAdminDlg(_pParent, m_pDatasourceItems, m_xORB,m_aInitialSelection); + OUserAdminDlg* pDlg = new OUserAdminDlg(_pParent, m_pDatasourceItems, m_xORB,m_aInitialSelection,m_xActiveConnection); return pDlg; } File [changed]: unoDirectSql.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/uno/unoDirectSql.cxx?r1=1.2&r2=1.2.102.1 Delta lines: +19 -13 --------------------- --- unoDirectSql.cxx 2 Aug 2004 16:24:12 -0000 1.2 +++ unoDirectSql.cxx 4 Mar 2005 07:19:46 -0000 1.2.102.1 @@ -2,9 +2,9 @@ * * $RCSfile: unoDirectSql.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.102.1 $ * - * last change: $Author: hr $ $Date: 2004/08/02 16:24:12 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,7 +133,9 @@ Dialog* ODirectSQLDialog::createDialog(Window* _pParent) { // obtain all the objects needed for the dialog - Reference< XConnection > xConnection; + Reference< XConnection > xConnection = m_xActiveConnection; + if ( !xConnection.is() ) + { try { // the connection the row set is working with @@ -144,7 +146,7 @@ { OSL_ENSURE( sal_False, "ODirectSQLDialog::createDialog: caught an exception!" ); } - + } if ( !xConnection.is() ) // can't create the dialog if I have improper settings return NULL; @@ -160,6 +162,10 @@ if (0 == aProperty.Name.compareToAscii("InitialSelection")) { aProperty.Value >>= m_sInitialSelection; + } + else if (0 == aProperty.Name.compareToAscii("ActiveConnection")) + { + m_xActiveConnection.set(aProperty.Value,UNO_QUERY); } } ODirectSQLDialog_BASE::implInitialize(_rValue); File [changed]: unoDirectSql.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/uno/unoDirectSql.hxx?r1=1.2&r2=1.2.102.1 Delta lines: +6 -2 ------------------- --- unoDirectSql.hxx 2 Aug 2004 16:24:24 -0000 1.2 +++ unoDirectSql.hxx 4 Mar 2005 07:19:46 -0000 1.2.102.1 @@ -2,9 +2,9 @@ * * $RCSfile: unoDirectSql.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.102.1 $ * - * last change: $Author: hr $ $Date: 2004/08/02 16:24:24 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,9 @@ #ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_ #include <com/sun/star/sdbc/XRowSet.hpp> #endif +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif //......................................................................... namespace dbaui @@ -99,6 +102,7 @@ ,public OModuleClient { ::rtl::OUString m_sInitialSelection; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xActiveConnection; protected: ODirectSQLDialog(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); virtual ~ODirectSQLDialog(); File [changed]: unoadmin.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/uno/unoadmin.cxx?r1=1.13&r2=1.13.102.1 Delta lines: +8 -5 ------------------- --- unoadmin.cxx 2 Aug 2004 16:24:38 -0000 1.13 +++ unoadmin.cxx 4 Mar 2005 07:19:46 -0000 1.13.102.1 @@ -2,9 +2,9 @@ * * $RCSfile: unoadmin.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.13.102.1 $ * - * last change: $Author: hr $ $Date: 2004/08/02 16:24:38 $ + * last change: $Author: oj $ $Date: 2005/03/04 07:19:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -155,8 +155,11 @@ { m_aInitialSelection = aProperty.Value; } + else if (0 == aProperty.Name.compareToAscii("ActiveConnection")) + { + m_xActiveConnection.set(aProperty.Value,UNO_QUERY); + } } - else ODatabaseAdministrationDialogBase::implInitialize(_rValue); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
