1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "dsnItem.hxx"
21 #include "ConnectionHelper.hxx"
22 #include "dbu_dlg.hrc"
23 #include "dbu_misc.hrc"
24 #include <svl/itemset.hxx>
25 #include <unotools/moduleoptions.hxx>
26 #include <sfx2/fcontnr.hxx>
27 #include <unotools/pathoptions.hxx>
28 #include <svl/stritem.hxx>
29 #include <svl/eitem.hxx>
30 #include <svl/intitem.hxx>
31 #include "dsitems.hxx"
32 #include "dbaccess_helpid.hrc"
33 #include "localresaccess.hxx"
34 #include <osl/process.h>
35 #include <osl/diagnose.h>
36 #include <vcl/msgbox.hxx>
37 #include <sfx2/filedlghelper.hxx>
38 #include "dbadmin.hxx"
39 #include <comphelper/types.hxx>
40 #include <vcl/stdtext.hxx>
41 #include "sqlmessage.hxx"
42 #include "odbcconfig.hxx"
43 #include "dsselect.hxx"
44 #include <svl/filenotation.hxx>
45 #include "dbustrings.hrc"
46 #include <com/sun/star/ui/dialogs/FolderPicker.hpp>
47 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
48 #include <com/sun/star/sdbc/XRow.hpp>
49 #include <com/sun/star/awt/XWindow.hpp>
50 #include <com/sun/star/mozilla/MozillaBootstrap.hpp>
51 #include <com/sun/star/task/InteractionHandler.hpp>
52 #include <com/sun/star/ucb/XProgressHandler.hpp>
53 #include "UITools.hxx"
54 #include <unotools/localfilehelper.hxx>
55 #include <unotools/ucbhelper.hxx>
56 #include <ucbhelper/commandenvironment.hxx>
57 #include "finteraction.hxx"
58 #include <connectivity/CommonTools.hxx>
59 #include <tools/urlobj.hxx>
60 #include <tools/diagnose_ex.h>
61 #include <sfx2/docfilt.hxx>
64 #define _ADO_DATALINK_BROWSE_
67 #ifdef _ADO_DATALINK_BROWSE_
68 #include <vcl/sysdata.hxx>
69 #include "adodatalinks.hxx"
70 #endif //_ADO_DATALINK_BROWSE_
72 #include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
73 #include <comphelper/processfactory.hxx>
74 #include <comphelper/string.hxx>
78 using namespace ::com::sun::star
;
79 using namespace ::com::sun::star::uno
;
80 using namespace ::com::sun::star::ucb
;
81 using namespace ::com::sun::star::ui::dialogs
;
82 using namespace ::com::sun::star::sdbc
;
83 using namespace ::com::sun::star::beans
;
84 using namespace ::com::sun::star::lang
;
85 using namespace ::com::sun::star::container
;
86 using namespace ::com::sun::star::mozilla
;
87 using namespace ::dbtools
;
88 using namespace ::svt
;
90 OConnectionHelper::OConnectionHelper( vcl::Window
* pParent
, const OString
& _rId
, const OUString
& _rUIXMLDescription
, const SfxItemSet
& _rCoreAttrs
)
91 : OGenericAdministrationPage(pParent
, _rId
, _rUIXMLDescription
, _rCoreAttrs
)
92 , m_bUserGrabFocus(false)
95 get(m_pFT_Connection
, "browseurllabel");
96 get(m_pConnectionURL
, "browseurl");
97 get(m_pPB_Connection
, "browse");
98 get(m_pPB_CreateDB
, "create");
100 // extract the datasource type collection from the item set
101 const DbuTypeCollectionItem
* pCollectionItem
= PTR_CAST(DbuTypeCollectionItem
, _rCoreAttrs
.GetItem(DSID_TYPECOLLECTION
));
103 m_pCollection
= pCollectionItem
->getCollection();
104 m_pPB_Connection
->SetClickHdl(LINK(this, OConnectionHelper
, OnBrowseConnections
));
105 m_pPB_CreateDB
->SetClickHdl(LINK(this, OConnectionHelper
, OnCreateDatabase
));
106 OSL_ENSURE(m_pCollection
, "OConnectionHelper::OConnectionHelper : really need a DSN type collection !");
107 m_pConnectionURL
->SetTypeCollection(m_pCollection
);
110 OConnectionHelper::~OConnectionHelper()
115 void OConnectionHelper::dispose()
117 // FIXME: used to have an if (m_bDelete) ...
118 m_pFT_Connection
.disposeAndClear();
119 m_pConnectionURL
.disposeAndClear();
120 m_pPB_Connection
.disposeAndClear();
121 m_pPB_CreateDB
.disposeAndClear();
122 OGenericAdministrationPage::dispose();
125 void OConnectionHelper::implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
)
127 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
128 bool bValid
, bReadonly
;
129 getFlags(_rSet
, bValid
, bReadonly
);
131 m_pFT_Connection
->Show();
132 m_pConnectionURL
->Show();
133 m_pConnectionURL
->Resize();
134 m_pConnectionURL
->ShowPrefix( ::dbaccess::DST_JDBC
== m_pCollection
->determineType(m_eType
) );
136 bool bEnableBrowseButton
= m_pCollection
->supportsBrowsing( m_eType
);
137 m_pPB_Connection
->Show( bEnableBrowseButton
);
139 bool bEnableCreateButton
= m_pCollection
->supportsDBCreation( m_eType
);
140 m_pPB_CreateDB
->Show( bEnableCreateButton
);
142 SFX_ITEMSET_GET(_rSet
, pUrlItem
, SfxStringItem
, DSID_CONNECTURL
, true);
144 // forward the values to the controls
147 OUString sUrl
= pUrlItem
->GetValue();
150 checkTestConnection();
151 m_pConnectionURL
->ClearModifyFlag();
154 OGenericAdministrationPage::implInitControls(_rSet
, _bSaveValue
);
157 void OConnectionHelper::implUpdateURLDependentStates() const
159 OSL_PRECOND( m_pAdminDialog
&& m_pCollection
, "OConnectionHelper::implUpdateURLDependentStates: no admin dialog!" );
160 if ( !m_pAdminDialog
|| !m_pCollection
)
163 if ( m_pCollection
->isFileSystemBased(m_eType
) )
164 m_pAdminDialog
->enableConfirmSettings( !getURLNoPrefix().isEmpty() );
167 IMPL_LINK(OConnectionHelper
, OnBrowseConnections
, PushButton
*, /*_pButton*/)
169 OSL_ENSURE(m_pAdminDialog
,"No Admin dialog set! ->GPF");
170 const ::dbaccess::DATASOURCE_TYPE eType
= m_pCollection
->determineType(m_eType
);
173 case ::dbaccess::DST_DBASE
:
174 case ::dbaccess::DST_FLAT
:
178 Reference
< XFolderPicker2
> xFolderPicker
= FolderPicker::create(m_xORB
);
180 bool bDoBrowse
= false;
181 OUString sOldPath
= getURLNoPrefix();
184 if (!sOldPath
.isEmpty())
185 xFolderPicker
->setDisplayDirectory(sOldPath
);
186 if (0 == xFolderPicker
->execute())
187 // cancelled by the user
190 sOldPath
= xFolderPicker
->getDirectory();
191 switch (checkPathExistence(sOldPath
))
204 OUString sSelectedDirectory
= xFolderPicker
->getDirectory();
205 INetURLObject
aSelectedDirectory( sSelectedDirectory
, INetURLObject::WAS_ENCODED
, RTL_TEXTENCODING_UTF8
);
207 // for UI purpose, we don't want to have the path encoded
208 sSelectedDirectory
= aSelectedDirectory
.GetMainURL( INetURLObject::DECODE_WITH_CHARSET
, RTL_TEXTENCODING_UTF8
);
210 setURLNoPrefix( sSelectedDirectory
);
211 SetRoadmapStateValue(true);
214 catch( const Exception
& )
216 DBG_UNHANDLED_EXCEPTION();
220 case ::dbaccess::DST_CALC
:
222 SvtModuleOptions aModule
;
223 ::sfx2::FileDialogHelper
aFileDlg(
224 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION
,
226 aModule
.GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::CALC
)
227 ,SfxFilterFlags::IMPORT
);
228 askForFileName(aFileDlg
);
231 case ::dbaccess::DST_MSACCESS
:
233 const OUString
sExt("*.mdb");
234 OUString
sFilterName(ModuleRes (STR_MSACCESS_FILTERNAME
));
235 ::sfx2::FileDialogHelper
aFileDlg(
236 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION
,
238 aFileDlg
.AddFilter(sFilterName
,sExt
);
239 aFileDlg
.SetCurrentFilter(sFilterName
);
240 askForFileName(aFileDlg
);
243 case ::dbaccess::DST_MSACCESS_2007
:
245 const OUString
sAccdb("*.accdb");
246 OUString
sFilterName2(ModuleRes (STR_MSACCESS_2007_FILTERNAME
));
247 ::sfx2::FileDialogHelper
aFileDlg(
248 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION
,
250 aFileDlg
.AddFilter(sFilterName2
,sAccdb
);
251 aFileDlg
.SetCurrentFilter(sFilterName2
);
252 askForFileName(aFileDlg
);
255 case ::dbaccess::DST_MYSQL_ODBC
:
256 case ::dbaccess::DST_ODBC
:
258 // collect all ODBC data source names
259 OUString sCurrDatasource
= getURLNoPrefix();
260 OUString sDataSource
;
261 if ( getSelectedDataSource(sDataSource
,sCurrDatasource
) && !sDataSource
.isEmpty() )
263 setURLNoPrefix(sDataSource
);
264 SetRoadmapStateValue(true);
271 #ifdef _ADO_DATALINK_BROWSE_
272 case ::dbaccess::DST_ADO
:
274 OUString sOldDataSource
=getURLNoPrefix();
275 OUString sNewDataSource
;
276 HWND hWnd
= GetParent()->GetSystemData()->hWnd
;
277 sNewDataSource
= getAdoDatalink((LONG_PTR
)hWnd
,sOldDataSource
);
278 if ( !sNewDataSource
.isEmpty() )
280 setURLNoPrefix(sNewDataSource
);
281 SetRoadmapStateValue(sal_True
);
289 case ::dbaccess::DST_MOZILLA
:
290 case ::dbaccess::DST_THUNDERBIRD
:
292 MozillaProductType profileType
= MozillaProductType_Mozilla
;
293 if (eType
== ::dbaccess::DST_THUNDERBIRD
)
294 profileType
= MozillaProductType_Thunderbird
;
296 Reference
<XComponentContext
> xContext
= ::comphelper::getProcessComponentContext();
297 Reference
<XMozillaBootstrap
> xMozillaBootstrap
= MozillaBootstrap::create(xContext
);
299 // collect all Mozilla Profiles
300 ::com::sun::star::uno::Sequence
< OUString
> list
;
302 xMozillaBootstrap
->getProfileList( profileType
, list
);
303 const OUString
* pArray
= list
.getConstArray();
305 sal_Int32 count
= list
.getLength();
308 for (sal_Int32 index
=0; index
< count
; index
++)
309 aProfiles
.insert(pArray
[index
]);
311 // execute the select dialog
312 ScopedVclPtrInstance
< ODatasourceSelectDialog
> aSelector(GetParent(), aProfiles
);
313 OUString sOldProfile
=getURLNoPrefix();
315 if (!sOldProfile
.isEmpty())
316 aSelector
->Select(sOldProfile
);
318 aSelector
->Select(xMozillaBootstrap
->getDefaultProfile(profileType
));
320 if ( RET_OK
== aSelector
->Execute() )
321 setURLNoPrefix(aSelector
->GetSelected());
324 case ::dbaccess::DST_FIREBIRD
:
326 const OUString
sExt("*.fdb");
327 OUString
sFilterName(ModuleRes (STR_FIREBIRD_FILTERNAME
));
328 ::sfx2::FileDialogHelper
aFileDlg(
329 ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE
,
331 aFileDlg
.AddFilter(sFilterName
,sExt
);
332 aFileDlg
.SetCurrentFilter(sFilterName
);
333 askForFileName(aFileDlg
);
339 checkTestConnection();
344 IMPL_LINK(OConnectionHelper
, OnCreateDatabase
, PushButton
*, /*_pButton*/)
346 OSL_ENSURE(m_pAdminDialog
,"No Admin dialog set! ->GPF");
347 const ::dbaccess::DATASOURCE_TYPE eType
= m_pCollection
->determineType(m_eType
);
350 case ::dbaccess::DST_FIREBIRD
:
352 const OUString
sExt("*.fdb");
353 OUString
sFilterName(ModuleRes (STR_FIREBIRD_FILTERNAME
));
354 ::sfx2::FileDialogHelper
aFileDlg(
355 ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION
,
357 aFileDlg
.AddFilter(sFilterName
,sExt
);
358 aFileDlg
.SetCurrentFilter(sFilterName
);
359 askForFileName(aFileDlg
);
365 checkTestConnection();
370 bool OConnectionHelper::checkTestConnection()
375 void OConnectionHelper::impl_setURL( const OUString
& _rURL
, bool _bPrefix
)
377 OUString
sURL( comphelper::string::stripEnd(_rURL
, '*') );
378 OSL_ENSURE( m_pCollection
, "OConnectionHelper::impl_setURL: have no interpreter for the URLs!" );
380 if ( m_pCollection
&& !sURL
.isEmpty() )
382 if ( m_pCollection
->isFileSystemBased( m_eType
) )
384 // get the two parts: prefix and file URL
385 OUString sTypePrefix
, sFileURLEncoded
;
388 sTypePrefix
= m_pCollection
->getPrefix( m_eType
);
389 sFileURLEncoded
= m_pCollection
->cutPrefix( sURL
);
393 sFileURLEncoded
= sURL
;
396 // substitute any variables
397 sFileURLEncoded
= SvtPathOptions().SubstituteVariable( sFileURLEncoded
);
401 if ( !sFileURLEncoded
.isEmpty() )
403 OFileNotation
aFileNotation(sFileURLEncoded
);
404 // set this decoded URL as text
405 sURL
+= aFileNotation
.get(OFileNotation::N_SYSTEM
);
411 m_pConnectionURL
->SetText( sURL
);
413 m_pConnectionURL
->SetTextNoPrefix( sURL
);
415 implUpdateURLDependentStates();
418 OUString
OConnectionHelper::impl_getURL( bool _bPrefix
) const
421 OUString sURL
= _bPrefix
? m_pConnectionURL
->GetText() : OUString(m_pConnectionURL
->GetTextNoPrefix());
423 OSL_ENSURE( m_pCollection
, "OConnectionHelper::impl_getURL: have no interpreter for the URLs!" );
425 if ( m_pCollection
&& !sURL
.isEmpty() )
427 if ( m_pCollection
->isFileSystemBased( m_eType
) )
429 // get the two parts: prefix and file URL
430 OUString sTypePrefix
, sFileURLDecoded
;
433 sTypePrefix
= m_pCollection
->getPrefix( m_eType
);
434 sFileURLDecoded
= m_pCollection
->cutPrefix( sURL
);
438 sFileURLDecoded
= sURL
;
442 if ( !sFileURLDecoded
.isEmpty() )
444 OFileNotation
aFileNotation( sFileURLDecoded
, OFileNotation::N_SYSTEM
);
445 sURL
+= aFileNotation
.get( OFileNotation::N_URL
);
449 INetURLObject
aFileURL( sFileURLDecoded
, INetURLObject::ENCODE_ALL
, RTL_TEXTENCODING_UTF8
);
450 sFileURLDecoded
= aFileURL
.GetMainURL( INetURLObject::NO_DECODE
);
456 void OConnectionHelper::setURL( const OUString
& _rURL
)
458 impl_setURL( _rURL
, true );
461 OUString
OConnectionHelper::getURLNoPrefix( ) const
463 return impl_getURL( false );
466 void OConnectionHelper::setURLNoPrefix( const OUString
& _rURL
)
468 impl_setURL( _rURL
, false );
471 sal_Int32
OConnectionHelper::checkPathExistence(const OUString
& _rURL
)
473 IS_PATH_EXIST e_exists
= pathExists(_rURL
, false);
474 if (!m_pCollection
->supportsDBCreation(m_eType
) &&
475 (( e_exists
== PATH_NOT_EXIST
) || ( e_exists
== PATH_NOT_KNOWN
)))
477 OUString
sQuery(ModuleRes(STR_ASK_FOR_DIRECTORY_CREATION
));
478 OFileNotation
aTransformer(_rURL
);
479 sQuery
= sQuery
.replaceFirst("$path$", aTransformer
.get(OFileNotation::N_SYSTEM
));
481 m_bUserGrabFocus
= false;
482 ScopedVclPtrInstance
< QueryBox
> aQuery(GetParent(), WB_YES_NO
| WB_DEF_YES
, sQuery
);
483 sal_Int32 nQueryResult
= aQuery
->Execute();
484 m_bUserGrabFocus
= true;
486 switch (nQueryResult
)
490 bool bTryCreate
= false;
493 if ( !createDirectoryDeep(_rURL
) )
494 { // could not create the directory
495 sQuery
= ModuleRes(STR_COULD_NOT_CREATE_DIRECTORY
);
496 sQuery
= sQuery
.replaceFirst("$name$", aTransformer
.get(OFileNotation::N_SYSTEM
));
498 m_bUserGrabFocus
= false;
499 ScopedVclPtrInstance
< QueryBox
> aWhatToDo(GetParent(), WB_RETRY_CANCEL
| WB_DEF_RETRY
, sQuery
);
500 nQueryResult
= aWhatToDo
->Execute();
501 m_bUserGrabFocus
= true;
503 if (RET_RETRY
== nQueryResult
)
507 SetRoadmapStateValue(false);
523 SetRoadmapStateValue(false);
533 SetRoadmapStateValue(true);
538 IS_PATH_EXIST
OConnectionHelper::pathExists(const OUString
& _rURL
, bool bIsFile
) const
540 ::ucbhelper::Content aCheckExistence
;
541 IS_PATH_EXIST eExists
= PATH_NOT_EXIST
;
542 Reference
< ::com::sun::star::task::XInteractionHandler
> xInteractionHandler(
543 task::InteractionHandler::createWithParent(m_xORB
, 0), UNO_QUERY
);
544 OFilePickerInteractionHandler
* pHandler
= new OFilePickerInteractionHandler(xInteractionHandler
);
545 xInteractionHandler
= pHandler
;
547 Reference
< XCommandEnvironment
> xCmdEnv
= new ::ucbhelper::CommandEnvironment( xInteractionHandler
, Reference
< XProgressHandler
>() );
550 aCheckExistence
= ::ucbhelper::Content(_rURL
, xCmdEnv
, comphelper::getProcessComponentContext());
551 const bool bExists
= bIsFile
? aCheckExistence
.isDocument(): aCheckExistence
.isFolder();
552 eExists
= bExists
? PATH_EXIST
: PATH_NOT_EXIST
;
554 catch (const Exception
&)
556 eExists
= pHandler
->isDoesNotExist() ? PATH_NOT_EXIST
: (bIsFile
? PATH_NOT_EXIST
: PATH_NOT_KNOWN
);
560 bool OConnectionHelper::PreNotify( NotifyEvent
& _rNEvt
)
562 if ( m_pCollection
->isFileSystemBased(m_eType
) )
564 switch (_rNEvt
.GetType())
566 case MouseNotifyEvent::GETFOCUS
:
567 if (m_pConnectionURL
->IsWindowOrChild(_rNEvt
.GetWindow()) && m_bUserGrabFocus
)
568 { // a descendant of the URL edit field got the focus
569 m_pConnectionURL
->SaveValueNoPrefix();
573 case MouseNotifyEvent::LOSEFOCUS
:
574 if (m_pConnectionURL
->IsWindowOrChild(_rNEvt
.GetWindow()) && m_bUserGrabFocus
)
575 { // a descendant of the URL edit field lost the focus
577 return true; // handled
585 return OGenericAdministrationPage::PreNotify( _rNEvt
);
588 bool OConnectionHelper::createDirectoryDeep(const OUString
& _rPathURL
)
590 // get an URL object analyzing the URL for us ...
591 INetURLObject aParser
;
592 aParser
.SetURL(_rPathURL
);
594 INetProtocol eProtocol
= aParser
.GetProtocol();
596 ::std::vector
< OUString
> aToBeCreated
; // the to-be-created levels
598 // search a level which exists
599 IS_PATH_EXIST eParentExists
= PATH_NOT_EXIST
;
600 while ( eParentExists
== PATH_NOT_EXIST
&& aParser
.getSegmentCount())
602 aToBeCreated
.push_back(aParser
.getName()); // remember the local name for creation
603 aParser
.removeSegment(); // cut the local name
604 eParentExists
= pathExists(aParser
.GetMainURL(INetURLObject::NO_DECODE
), false);
607 if (!aParser
.getSegmentCount())
610 // create all the missing levels
613 // the parent content
614 Reference
< XCommandEnvironment
> xEmptyEnv
;
615 ::ucbhelper::Content
aParent(aParser
.GetMainURL(INetURLObject::NO_DECODE
), xEmptyEnv
, comphelper::getProcessComponentContext());
617 OUString sContentType
;
618 if ( INetProtocol::File
== eProtocol
)
620 sContentType
= "application/vnd.sun.staroffice.fsys-folder";
621 // the file UCP currently does not support the ContentType property
625 Any aContentType
= aParent
.getPropertyValue("ContentType");
626 aContentType
>>= sContentType
;
629 // the properties which need to be set on the new content
630 Sequence
< OUString
> aNewDirectoryProperties(1);
631 aNewDirectoryProperties
[0] = "Title";
633 // the values to be set
634 Sequence
< Any
> aNewDirectoryAttributes(1);
637 for ( ::std::vector
< OUString
>::reverse_iterator aLocalName
= aToBeCreated
.rbegin();
638 aLocalName
!= aToBeCreated
.rend();
642 aNewDirectoryAttributes
[0] <<= *aLocalName
;
643 if (!aParent
.insertNewContent(sContentType
, aNewDirectoryProperties
, aNewDirectoryAttributes
, aParent
))
647 catch ( const Exception
& )
649 DBG_UNHANDLED_EXCEPTION();
656 void OConnectionHelper::fillWindows(::std::vector
< ISaveValueWrapper
* >& _rControlList
)
658 _rControlList
.push_back(new ODisableWrapper
<FixedText
>(m_pFT_Connection
));
659 _rControlList
.push_back(new ODisableWrapper
<PushButton
>(m_pPB_Connection
));
660 _rControlList
.push_back(new ODisableWrapper
<PushButton
>(m_pPB_CreateDB
));
663 void OConnectionHelper::fillControls(::std::vector
< ISaveValueWrapper
* >& _rControlList
)
665 _rControlList
.push_back( new OSaveValueWrapper
<Edit
>( m_pConnectionURL
) );
668 bool OConnectionHelper::commitURL()
672 sOldPath
= m_pConnectionURL
->GetSavedValueNoPrefix();
673 sURL
= m_pConnectionURL
->GetTextNoPrefix();
675 if ( m_pCollection
->isFileSystemBased(m_eType
) )
677 if ( ( sURL
!= sOldPath
) && !sURL
.isEmpty() )
678 { // the text changed since entering the control
680 // the path may be in system notation ....
681 OFileNotation
aTransformer(sURL
);
682 sURL
= aTransformer
.get(OFileNotation::N_URL
);
684 const ::dbaccess::DATASOURCE_TYPE eType
= m_pCollection
->determineType(m_eType
);
686 if ( ( ::dbaccess::DST_CALC
== eType
) || ( ::dbaccess::DST_MSACCESS
== eType
) || ( ::dbaccess::DST_MSACCESS_2007
== eType
) )
688 if( pathExists(sURL
, true) == PATH_NOT_EXIST
)
690 OUString sFile
= ModuleRes( STR_FILE_DOES_NOT_EXIST
);
691 sFile
= sFile
.replaceFirst("$file$", aTransformer
.get(OFileNotation::N_SYSTEM
));
692 ScopedVclPtr
<OSQLWarningBox
>::Create( this, sFile
)->Execute();
693 setURLNoPrefix(sOldPath
);
694 SetRoadmapStateValue(false);
701 switch (checkPathExistence(sURL
))
704 m_bUserGrabFocus
= false;
705 m_pConnectionURL
->GrabFocus();
706 m_bUserGrabFocus
= true;
710 setURLNoPrefix(sOldPath
);
717 setURLNoPrefix(sURL
);
718 m_pConnectionURL
->SaveValueNoPrefix();
721 void OConnectionHelper::askForFileName(::sfx2::FileDialogHelper
& _aFileOpen
)
723 OUString sOldPath
= getURLNoPrefix();
724 if ( !sOldPath
.isEmpty() )
725 _aFileOpen
.SetDisplayDirectory(sOldPath
);
727 _aFileOpen
.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
728 if (0 == _aFileOpen
.Execute())
730 setURLNoPrefix(_aFileOpen
.GetPath());
731 SetRoadmapStateValue(checkTestConnection());
738 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */