Kaydet (Commit) 53d58215 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld OGeneralSpecialJDBCDetailsPage

Change-Id: I0db0801167d36a04ebbe467b29862efcbb54e599
Reviewed-on: https://gerrit.libreoffice.org/62289Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst fbc37c3b
...@@ -494,22 +494,21 @@ namespace dbaui ...@@ -494,22 +494,21 @@ namespace dbaui
} }
// OMySQLJDBCDetailsPage // OMySQLJDBCDetailsPage
OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, bool bShowSocket ) OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs ,sal_uInt16 _nPortId, bool bShowSocket)
:OCommonBehaviourTabPage(pParent, "GeneralSpecialJDBCDetails", "dbaccess/ui/generalspecialjdbcdetailspage.ui", _rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset) : DBOCommonBehaviourTabPage(pParent, "dbaccess/ui/generalspecialjdbcdetailspage.ui", "GeneralSpecialJDBCDetails",
,m_nPortId(_nPortId) rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset)
,m_bUseClass(true) , m_nPortId(_nPortId)
{ , m_bUseClass(true)
get(m_pEDHostname, "hostNameEntry"); , m_xEDHostname(m_xBuilder->weld_entry("hostNameEntry"))
get(m_pNFPortNumber, "portNumberSpinbutton"); , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumberSpinbutton"))
m_pNFPortNumber->SetUseThousandSep(false); , m_xFTSocket(m_xBuilder->weld_label("socketLabel"))
get(m_pFTSocket, "socketLabel"); , m_xEDSocket(m_xBuilder->weld_entry("socketEntry"))
get(m_pEDSocket, "socketEntry"); , m_xFTDriverClass(m_xBuilder->weld_label("driverClassLabel"))
get(m_pFTDriverClass, "driverClassLabel"); , m_xEDDriverClass(m_xBuilder->weld_entry("jdbcDriverClassEntry"))
get(m_pEDDriverClass, "jdbcDriverClassEntry"); , m_xTestJavaDriver(m_xBuilder->weld_button("testDriverClassButton"))
get(m_pTestJavaDriver, "testDriverClassButton"); {
const SfxStringItem* pUrlItem = rCoreAttrs.GetItem<SfxStringItem>(DSID_CONNECTURL);
const SfxStringItem* pUrlItem = _rCoreAttrs.GetItem<SfxStringItem>(DSID_CONNECTURL); const DbuTypeCollectionItem* pTypesItem = rCoreAttrs.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
const DbuTypeCollectionItem* pTypesItem = _rCoreAttrs.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : nullptr; ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : nullptr;
if (pTypeCollection && pUrlItem && pUrlItem->GetValue().getLength() ) if (pTypeCollection && pUrlItem && pUrlItem->GetValue().getLength() )
{ {
...@@ -517,24 +516,23 @@ namespace dbaui ...@@ -517,24 +516,23 @@ namespace dbaui
} }
if ( m_sDefaultJdbcDriverName.getLength() ) if ( m_sDefaultJdbcDriverName.getLength() )
{ {
m_pEDDriverClass->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl)); m_xEDDriverClass->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
m_pEDDriverClass->SetModifyHdl(LINK(this, OGeneralSpecialJDBCDetailsPage, OnControlEditModifyHdl)); m_xTestJavaDriver->connect_clicked(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
m_pTestJavaDriver->SetClickHdl(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
} }
else else
{ {
m_bUseClass = false; m_bUseClass = false;
m_pFTDriverClass->Show(false); m_xFTDriverClass->show(false);
m_pEDDriverClass->Show(false); m_xEDDriverClass->show(false);
m_pTestJavaDriver->Show(false); m_xTestJavaDriver->show(false);
} }
m_pFTSocket->Show(bShowSocket && !m_bUseClass); m_xFTSocket->show(bShowSocket && !m_bUseClass);
m_pEDSocket->Show(bShowSocket && !m_bUseClass); m_xEDSocket->show(bShowSocket && !m_bUseClass);
m_pEDHostname->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl)); m_xEDHostname->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
m_pNFPortNumber->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl)); m_xNFPortNumber->connect_value_changed(LINK(this,OGenericAdministrationPage,OnControlSpinButtonModifyHdl));
m_pEDSocket->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl)); m_xEDSocket->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
} }
OGeneralSpecialJDBCDetailsPage::~OGeneralSpecialJDBCDetailsPage() OGeneralSpecialJDBCDetailsPage::~OGeneralSpecialJDBCDetailsPage()
...@@ -542,26 +540,14 @@ namespace dbaui ...@@ -542,26 +540,14 @@ namespace dbaui
disposeOnce(); disposeOnce();
} }
void OGeneralSpecialJDBCDetailsPage::dispose()
{
m_pEDHostname.clear();
m_pNFPortNumber.clear();
m_pFTSocket.clear();
m_pEDSocket.clear();
m_pFTDriverClass.clear();
m_pEDDriverClass.clear();
m_pTestJavaDriver.clear();
OCommonBehaviourTabPage::dispose();
}
bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet* _rSet ) bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet* _rSet )
{ {
bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet); bool bChangedSomething = DBOCommonBehaviourTabPage::FillItemSet(_rSet);
if ( m_bUseClass ) if ( m_bUseClass )
fillString(*_rSet,m_pEDDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething); fillString(*_rSet,m_xEDDriverClass.get(),DSID_JDBCDRIVERCLASS,bChangedSomething);
fillString(*_rSet,m_pEDHostname,DSID_CONN_HOSTNAME,bChangedSomething); fillString(*_rSet,m_xEDHostname.get(),DSID_CONN_HOSTNAME,bChangedSomething);
fillString(*_rSet,m_pEDSocket,DSID_CONN_SOCKET,bChangedSomething); fillString(*_rSet,m_xEDSocket.get(),DSID_CONN_SOCKET,bChangedSomething);
fillInt32(*_rSet,m_pNFPortNumber,m_nPortId,bChangedSomething ); fillInt32(*_rSet,m_xNFPortNumber.get(),m_nPortId,bChangedSomething );
return bChangedSomething; return bChangedSomething;
} }
...@@ -580,30 +566,30 @@ namespace dbaui ...@@ -580,30 +566,30 @@ namespace dbaui
{ {
if ( m_bUseClass ) if ( m_bUseClass )
{ {
m_pEDDriverClass->SetText(pDrvItem->GetValue()); m_xEDDriverClass->set_text(pDrvItem->GetValue());
m_pEDDriverClass->ClearModifyFlag(); m_xEDDriverClass->save_value();
} }
m_pEDHostname->SetText(pHostName->GetValue()); m_xEDHostname->set_text(pHostName->GetValue());
m_pEDHostname->ClearModifyFlag(); m_xEDHostname->save_value();
m_pNFPortNumber->SetValue(pPortNumber->GetValue()); m_xNFPortNumber->set_value(pPortNumber->GetValue());
m_pNFPortNumber->ClearModifyFlag(); m_xNFPortNumber->save_value();
m_pEDSocket->SetText(pSocket->GetValue()); m_xEDSocket->set_text(pSocket->GetValue());
m_pEDSocket->ClearModifyFlag(); m_xEDSocket->save_value();
} }
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); DBOCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
// to get the correct value when saveValue was called by base class // to get the correct value when saveValue was called by base class
if ( m_bUseClass && m_pEDDriverClass->GetText().trim().isEmpty() ) if ( m_bUseClass && m_xEDDriverClass->get_text().trim().isEmpty() )
{ {
m_pEDDriverClass->SetText(m_sDefaultJdbcDriverName); m_xEDDriverClass->set_text(m_sDefaultJdbcDriverName);
m_pEDDriverClass->SetModifyFlag(); m_xEDDriverClass->save_value();
} }
} }
IMPL_LINK_NOARG(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, Button*, void) IMPL_LINK_NOARG(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, weld::Button&, void)
{ {
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF"); OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
OSL_ENSURE(m_bUseClass,"Who called me?"); OSL_ENSURE(m_bUseClass,"Who called me?");
...@@ -612,12 +598,12 @@ namespace dbaui ...@@ -612,12 +598,12 @@ namespace dbaui
#if HAVE_FEATURE_JAVA #if HAVE_FEATURE_JAVA
try try
{ {
if ( !m_pEDDriverClass->GetText().trim().isEmpty() ) if (!m_xEDDriverClass->get_text().trim().isEmpty())
{ {
// TODO change jvmaccess // TODO change jvmaccess
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() ); ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
m_pEDDriverClass->SetText(m_pEDDriverClass->GetText().trim()); // fdo#68341 m_xEDDriverClass->set_text(m_xEDDriverClass->get_text().trim()); // fdo#68341
bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_pEDDriverClass->GetText()); bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_xEDDriverClass->get_text());
} }
} }
catch(Exception&) catch(Exception&)
...@@ -632,8 +618,8 @@ namespace dbaui ...@@ -632,8 +618,8 @@ namespace dbaui
void OGeneralSpecialJDBCDetailsPage::callModifiedHdl(void* pControl) void OGeneralSpecialJDBCDetailsPage::callModifiedHdl(void* pControl)
{ {
if ( m_bUseClass && pControl == m_pEDDriverClass ) if (m_bUseClass && pControl == m_xEDDriverClass.get())
m_pTestJavaDriver->Enable( !m_pEDDriverClass->GetText().trim().isEmpty() ); m_xTestJavaDriver->set_sensitive(!m_xEDDriverClass->get_text().trim().isEmpty());
// tell the listener we were modified // tell the listener we were modified
OGenericAdministrationPage::callModifiedHdl(); OGenericAdministrationPage::callModifiedHdl();
...@@ -728,7 +714,7 @@ namespace dbaui ...@@ -728,7 +714,7 @@ namespace dbaui
VclPtr<SfxTabPage> ODriversSettings::CreateMySQLJDBC( TabPageParent pParent, const SfxItemSet* _rAttrSet ) VclPtr<SfxTabPage> ODriversSettings::CreateMySQLJDBC( TabPageParent pParent, const SfxItemSet* _rAttrSet )
{ {
return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create( pParent.pParent, *_rAttrSet,DSID_MYSQL_PORTNUMBER ); return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create(pParent, *_rAttrSet,DSID_MYSQL_PORTNUMBER);
} }
VclPtr<SfxTabPage> ODriversSettings::CreateMySQLNATIVE( TabPageParent pParent, const SfxItemSet* _rAttrSet ) VclPtr<SfxTabPage> ODriversSettings::CreateMySQLNATIVE( TabPageParent pParent, const SfxItemSet* _rAttrSet )
...@@ -736,9 +722,9 @@ namespace dbaui ...@@ -736,9 +722,9 @@ namespace dbaui
return VclPtr<MySQLNativePage>::Create( pParent.pParent, *_rAttrSet ); return VclPtr<MySQLNativePage>::Create( pParent.pParent, *_rAttrSet );
} }
VclPtr<SfxTabPage> ODriversSettings::CreateOracleJDBC( TabPageParent pParent, const SfxItemSet* _rAttrSet ) VclPtr<SfxTabPage> ODriversSettings::CreateOracleJDBC(TabPageParent pParent, const SfxItemSet* _rAttrSet)
{ {
return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create( pParent.pParent, *_rAttrSet,DSID_ORACLE_PORTNUMBER, false); return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create(pParent, *_rAttrSet,DSID_ORACLE_PORTNUMBER, false);
} }
// OLDAPDetailsPage // OLDAPDetailsPage
......
...@@ -202,16 +202,14 @@ namespace dbaui ...@@ -202,16 +202,14 @@ namespace dbaui
}; };
// OGeneralSpecialJDBCDetailsPage // OGeneralSpecialJDBCDetailsPage
class OGeneralSpecialJDBCDetailsPage final : public OCommonBehaviourTabPage class OGeneralSpecialJDBCDetailsPage final : public DBOCommonBehaviourTabPage
{ {
public: public:
OGeneralSpecialJDBCDetailsPage( vcl::Window* pParent OGeneralSpecialJDBCDetailsPage(TabPageParent pParent,
, const SfxItemSet& _rCoreAttrs const SfxItemSet& _rCoreAttrs,
, sal_uInt16 _nPortId sal_uInt16 _nPortId,
, bool bShowSocket = true bool bShowSocket = true);
);
virtual ~OGeneralSpecialJDBCDetailsPage() override; virtual ~OGeneralSpecialJDBCDetailsPage() override;
virtual void dispose() override;
private: private:
...@@ -219,20 +217,19 @@ namespace dbaui ...@@ -219,20 +217,19 @@ namespace dbaui
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
virtual void callModifiedHdl(void* pControl = nullptr) override; virtual void callModifiedHdl(void* pControl = nullptr) override;
DECL_LINK(OnTestJavaClickHdl, Button*, void); DECL_LINK(OnTestJavaClickHdl, weld::Button&, void);
VclPtr<Edit> m_pEDHostname;
VclPtr<NumericField> m_pNFPortNumber;
VclPtr<FixedText> m_pFTSocket;
VclPtr<Edit> m_pEDSocket;
VclPtr<FixedText> m_pFTDriverClass;
VclPtr<Edit> m_pEDDriverClass;
VclPtr<PushButton> m_pTestJavaDriver;
OUString m_sDefaultJdbcDriverName; OUString m_sDefaultJdbcDriverName;
sal_uInt16 m_nPortId; sal_uInt16 m_nPortId;
bool m_bUseClass; bool m_bUseClass;
std::unique_ptr<weld::Entry> m_xEDHostname;
std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
std::unique_ptr<weld::Label> m_xFTSocket;
std::unique_ptr<weld::Entry> m_xEDSocket;
std::unique_ptr<weld::Label> m_xFTDriverClass;
std::unique_ptr<weld::Entry> m_xEDDriverClass;
std::unique_ptr<weld::Button> m_xTestJavaDriver;
}; };
// MySQLNativePage // MySQLNativePage
......
<?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="GtkAdjustment" id="adjustment1">
<property name="upper">65535</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkBox" id="GeneralSpecialJDBCDetails"> <object class="GtkBox" id="GeneralSpecialJDBCDetails">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
...@@ -35,10 +39,10 @@ ...@@ -35,10 +39,10 @@
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<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">1</property>
<property name="label" translatable="yes" context="generalspecialjdbcdetailspage|label2">_Host name:</property> <property name="label" translatable="yes" context="generalspecialjdbcdetailspage|label2">_Host name:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">hostNameEntry</property> <property name="mnemonic_widget">hostNameEntry</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -49,10 +53,10 @@ ...@@ -49,10 +53,10 @@
<object class="GtkLabel" id="label3"> <object class="GtkLabel" id="label3">
<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">1</property>
<property name="label" translatable="yes" context="generalspecialjdbcdetailspage|label3">_Port number:</property> <property name="label" translatable="yes" context="generalspecialjdbcdetailspage|label3">_Port number:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">portNumberSpinbutton</property> <property name="mnemonic_widget">portNumberSpinbutton</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -64,6 +68,7 @@ ...@@ -64,6 +68,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
...@@ -74,8 +79,8 @@ ...@@ -74,8 +79,8 @@
<object class="GtkLabel" id="socketLabel"> <object class="GtkLabel" id="socketLabel">
<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">1</property>
<property name="label" translatable="yes" context="generalspecialjdbcdetailspage|socketLabel">Socket:</property> <property name="label" translatable="yes" context="generalspecialjdbcdetailspage|socketLabel">Socket:</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -86,10 +91,10 @@ ...@@ -86,10 +91,10 @@
<object class="GtkLabel" id="driverClassLabel"> <object class="GtkLabel" id="driverClassLabel">
<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">1</property>
<property name="label" translatable="yes" context="generalspecialjdbcdetailspage|driverClassLabel">MySQL JDBC d_river class:</property> <property name="label" translatable="yes" context="generalspecialjdbcdetailspage|driverClassLabel">MySQL JDBC d_river class:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">jdbcDriverClassEntry</property> <property name="mnemonic_widget">jdbcDriverClassEntry</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -101,6 +106,7 @@ ...@@ -101,6 +106,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
...@@ -124,6 +130,7 @@ ...@@ -124,6 +130,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
...@@ -135,6 +142,7 @@ ...@@ -135,6 +142,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="adjustment">adjustment1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
...@@ -206,7 +214,7 @@ ...@@ -206,7 +214,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="dbulo-CharSetListBox" id="charset"> <object class="GtkComboBox" id="charset">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment