summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx6
-rw-r--r--dbaccess/source/inc/dsntypes.hxx3
-rw-r--r--dbaccess/source/ui/dlg/AutoControls_tmpl.hrc10
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx46
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.hxx2
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.src5
-rw-r--r--dbaccess/source/ui/inc/dbu_dlg.hrc4
7 files changed, 73 insertions, 3 deletions
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 2d5844680b64..42c7ccf464f6 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -275,6 +275,12 @@ sal_Bool ODsnTypeCollection::supportsBrowsing(const OUString& _sURL) const
return aFeatures.getOrDefault("SupportsBrowsing",sal_False);
}
+sal_Bool ODsnTypeCollection::supportsDBCreation(const OUString& _sURL) const
+{
+ const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("SupportsDBCreation",sal_False);
+}
+
bool ODsnTypeCollection::needsJVM(const OUString& _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index f21f449839f3..a2106c22b681 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -147,6 +147,9 @@ public:
// check if a Browse button may be shown to insert connection url
sal_Bool supportsBrowsing(const OUString& _sURL) const;
+ // check if a Create New Database button may be shown to insert connection url
+ sal_Bool supportsDBCreation(const OUString& _sURL) const;
+
/// check if the given data source tyoe is based on the file system - i.e. the URL is a prefix plus a file URL
sal_Bool isFileSystemBased(const OUString& _sURL) const;
diff --git a/dbaccess/source/ui/dlg/AutoControls_tmpl.hrc b/dbaccess/source/ui/dlg/AutoControls_tmpl.hrc
index bf37c0dc2794..39dee2b3a990 100644
--- a/dbaccess/source/ui/dlg/AutoControls_tmpl.hrc
+++ b/dbaccess/source/ui/dlg/AutoControls_tmpl.hrc
@@ -58,6 +58,7 @@
#define PB_AUTOTESTDRIVERCLASS 80
#define PB_AUTOBROWSEURL 81
+#define PB_CREATEDB 82
#define CM_AUTOFIELDSEPARATOR 80
#define CM_AUTOTEXTSEPARATOR 81
@@ -132,6 +133,15 @@
HelpId = AUTO_HID2; \
TabStop = TRUE ; \
Text[ en-US ] = "Browse"; \
+ }; \
+ \
+ PushButton PB_CREATEDB \
+ { \
+ Pos = MAP_APPFONT ( AUTOPAGE_X - BUTTON_WIDTH - 6 , AUTO_Y - BUTTON_HEIGHT ) ; \
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; \
+ HelpId = AUTO_HID2; \
+ TabStop = TRUE ; \
+ Text[ en-US ] = "Create New"; \
};
// --------------------------------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 23da1dbbf26b..a0effcb51ceb 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -95,6 +95,7 @@ DBG_NAME(OConnectionHelper)
,m_aFT_Connection ( this, ResId( FT_AUTOBROWSEURL, *_rId.GetResMgr() ) )
,m_aConnectionURL ( this, ResId( ET_AUTOBROWSEURL, *_rId.GetResMgr() ) )
,m_aPB_Connection ( this, ResId( PB_AUTOBROWSEURL, *_rId.GetResMgr() ) )
+ ,m_aPB_CreateDB ( this, ResId( PB_CREATEDB, *_rId.GetResMgr() ) )
{
DBG_CTOR(OConnectionHelper,NULL);
@@ -103,6 +104,7 @@ DBG_NAME(OConnectionHelper)
if (pCollectionItem)
m_pCollection = pCollectionItem->getCollection();
m_aPB_Connection.SetClickHdl(LINK(this, OConnectionHelper, OnBrowseConnections));
+ m_aPB_CreateDB.SetClickHdl(LINK(this, OConnectionHelper, OnCreateDatabase));
OSL_ENSURE(m_pCollection, "OConnectionHelper::OConnectionHelper : really need a DSN type collection !");
m_aConnectionURL.SetTypeCollection(m_pCollection);
}
@@ -126,6 +128,9 @@ DBG_NAME(OConnectionHelper)
sal_Bool bEnableBrowseButton = m_pCollection->supportsBrowsing( m_eType );
m_aPB_Connection.Show( bEnableBrowseButton );
+ sal_Bool bEnableCreateButton = m_pCollection->supportsDBCreation( m_eType );
+ m_aPB_CreateDB.Show( bEnableCreateButton );
+
SFX_ITEMSET_GET(_rSet, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
// forward the values to the controls
@@ -308,6 +313,43 @@ DBG_NAME(OConnectionHelper)
setURLNoPrefix(aSelector.GetSelected());
break;
}
+ case ::dbaccess::DST_FIREBIRD:
+ {
+ const OUString sExt("*.fdb");
+ OUString sFilterName(ModuleRes (STR_FIREBIRD_FILTERNAME));
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ 0);
+ aFileDlg.AddFilter(sFilterName,sExt);
+ aFileDlg.SetCurrentFilter(sFilterName);
+ askForFileName(aFileDlg);
+ }
+ default:
+ break;
+ }
+
+ checkTestConnection();
+
+ return 0L;
+ }
+
+ IMPL_LINK(OConnectionHelper, OnCreateDatabase, PushButton*, /*_pButton*/)
+ {
+ OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
+ const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
+ switch ( eType )
+ {
+ case ::dbaccess::DST_FIREBIRD:
+ {
+ const OUString sExt("*.fdb");
+ OUString sFilterName(ModuleRes (STR_FIREBIRD_FILTERNAME));
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
+ 0);
+ aFileDlg.AddFilter(sFilterName,sExt);
+ aFileDlg.SetCurrentFilter(sFilterName);
+ askForFileName(aFileDlg);
+ }
default:
break;
}
@@ -421,7 +463,8 @@ DBG_NAME(OConnectionHelper)
sal_Int32 OConnectionHelper::checkPathExistence(const OUString& _rURL)
{
IS_PATH_EXIST e_exists = pathExists(_rURL, sal_False);
- if (( e_exists == PATH_NOT_EXIST) || ( e_exists == PATH_NOT_KNOWN))
+ if (!m_pCollection->supportsDBCreation(m_eType) &&
+ (( e_exists == PATH_NOT_EXIST) || ( e_exists == PATH_NOT_KNOWN)))
{
OUString sQuery(ModuleRes(STR_ASK_FOR_DIRECTORY_CREATION));
OFileNotation aTransformer(_rURL);
@@ -605,6 +648,7 @@ DBG_NAME(OConnectionHelper)
{
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFT_Connection));
_rControlList.push_back(new ODisableWrapper<PushButton>(&m_aPB_Connection));
+ _rControlList.push_back(new ODisableWrapper<PushButton>(&m_aPB_CreateDB));
}
void OConnectionHelper::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.hxx b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
index f478d14b9bed..5d6f5e2f74f9 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
@@ -45,6 +45,7 @@ namespace dbaui
FixedText m_aFT_Connection;
OConnectionURLEdit m_aConnectionURL;
PushButton m_aPB_Connection;
+ PushButton m_aPB_CreateDB;
OUString m_eType; // the type can't be changed in this class, so we hold it as member.
public:
@@ -90,6 +91,7 @@ namespace dbaui
private:
DECL_LINK(OnBrowseConnections, PushButton*);
+ DECL_LINK(OnCreateDatabase, PushButton*);
OUString impl_getURL( sal_Bool _bPrefix ) const;
void impl_setURL( const OUString& _rURL, sal_Bool _bPrefix );
void implUpdateURLDependentStates() const;
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.src b/dbaccess/source/ui/dlg/ConnectionPage.src
index 58be50218c79..34a14b82efa9 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.src
+++ b/dbaccess/source/ui/dlg/ConnectionPage.src
@@ -167,4 +167,9 @@ String STR_MSACCESS_2007_FILTERNAME
Text [ en-US ] = "MS Access 2007 file";
};
+String STR_FIREBIRD_FILTERNAME
+{
+ Text [ en-US ] = "Firebird Database";
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbu_dlg.hrc b/dbaccess/source/ui/inc/dbu_dlg.hrc
index afc45ab1a35a..dcf445016ec6 100644
--- a/dbaccess/source/ui/inc/dbu_dlg.hrc
+++ b/dbaccess/source/ui/inc/dbu_dlg.hrc
@@ -108,11 +108,11 @@
#define STR_EXCEPTION_INFO RID_STR_DLG_START + 64
#define STR_EXCEPTION_DETAILS RID_STR_DLG_START + 65
#define STR_MSACCESS_2007_FILTERNAME RID_STR_DLG_START + 66
-
+#define STR_FIREBIRD_FILTERNAME RID_STR_DLG_START + 67
// please adjust checking before insert new strings
-#define LAST_STR_HERE RID_STR_DLG_START + 67
+#define LAST_STR_HERE RID_STR_DLG_START + 68
#if LAST_STR_HERE > RID_STR_DLG_END
#error Resource-Id Overflow in #file, #line