weld OUserAdminDlg

Change-Id: I3e190db7c00ebff55296fe1ffb8999d9892c7723
Reviewed-on: https://gerrit.libreoffice.org/62329
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2018-10-25 09:59:10 +02:00
parent 6d5791332d
commit 0fdf02b805
4 changed files with 62 additions and 45 deletions
+21 -33
View File
@@ -46,24 +46,24 @@ namespace dbaui
using namespace ::com::sun::star::sdbcx;
// OUserAdminDlg
OUserAdminDlg::OUserAdminDlg(vcl::Window* _pParent
, SfxItemSet* _pItems
,const Reference< XComponentContext >& _rxORB
,const css::uno::Any& _aDataSourceName
,const Reference< XConnection >& _xConnection)
: SfxTabDialog(_pParent, "UserAdminDialog", "dbaccess/ui/useradmindialog.ui", _pItems)
, m_pItemSet(_pItems)
, m_xConnection(_xConnection)
, m_bOwnConnection(!_xConnection.is())
OUserAdminDlg::OUserAdminDlg(weld::Window* pParent,
SfxItemSet* pItems,
const Reference< XComponentContext >& rxORB,
const css::uno::Any& rDataSourceName,
const Reference< XConnection >& xConnection)
: SfxTabDialogController(pParent, "dbaccess/ui/useradmindialog.ui", "UserAdminDialog", pItems)
, m_pParent(pParent)
, m_pItemSet(pItems)
, m_xConnection(xConnection)
, m_bOwnConnection(!xConnection.is())
{
m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,GetFrameWeld(),_pParent ? _pParent->GetFrameWeld() : nullptr, this));
m_pImpl->setDataSourceOrName(_aDataSourceName);
m_pImpl.reset(new ODbDataSourceAdministrationHelper(rxORB, m_xDialog.get(), pParent, this));
m_pImpl->setDataSourceOrName(rDataSourceName);
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
m_pImpl->translateProperties(xDatasource, *_pItems);
SetInputSet(_pItems);
m_pImpl->translateProperties(xDatasource, *pItems);
SetInputSet(pItems);
// propagate this set as our new input set and reset the example set
delete m_pExampleSet;
m_pExampleSet = new SfxItemSet(*GetInputSetImpl());
m_xExampleSet.reset(new SfxItemSet(*GetInputSetImpl()));
AddTabPage("settings", OUserAdmin::Create, nullptr);
@@ -72,11 +72,6 @@ namespace dbaui
}
OUserAdminDlg::~OUserAdminDlg()
{
disposeOnce();
}
void OUserAdminDlg::dispose()
{
if ( m_bOwnConnection )
{
@@ -90,11 +85,9 @@ namespace dbaui
}
SetInputSet(nullptr);
DELETEZ(m_pExampleSet);
SfxTabDialog::dispose();
}
short OUserAdminDlg::Execute()
short OUserAdminDlg::run()
{
try
{
@@ -107,29 +100,24 @@ namespace dbaui
}
catch(const SQLException&)
{
::dbtools::showError(::dbtools::SQLExceptionInfo(::cppu::getCaughtException()), VCLUnoHelper::GetInterface(GetParent()), getORB());
::dbtools::showError(::dbtools::SQLExceptionInfo(::cppu::getCaughtException()), m_pParent->GetXWindow(), getORB());
return RET_CANCEL;
}
catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
short nRet = SfxTabDialog::Execute();
short nRet = SfxTabDialogController::run();
if ( nRet == RET_OK )
m_pImpl->saveChanges(*GetOutputItemSet());
return nRet;
}
void OUserAdminDlg::PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage)
void OUserAdminDlg::PageCreated(const OString& rId, SfxTabPage& _rPage)
{
// register ourself as modified listener
static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory( m_pImpl->getORB() );
static_cast<OGenericAdministrationPage&>(_rPage).SetAdminDialog(this,this);
vcl::Window *pWin = GetViewWindow();
if(pWin)
pWin->Invalidate();
SfxTabDialog::PageCreated(_nId, _rPage);
SfxTabDialogController::PageCreated(rId, _rPage);
}
const SfxItemSet* OUserAdminDlg::getOutputSet() const
{
@@ -166,7 +154,7 @@ namespace dbaui
}
void OUserAdminDlg::setTitle(const OUString& _sTitle)
{
SetText(_sTitle);
m_xDialog->set_title(_sTitle);
}
void OUserAdminDlg::enableConfirmSettings( bool ) {}
void OUserAdminDlg::saveDatasource()
+8 -9
View File
@@ -41,28 +41,27 @@ namespace dbaui
/** implements the user admin dialog
*/
class OUserAdminDlg : public SfxTabDialog, public IItemSetHelper, public IDatabaseSettingsDialog
class OUserAdminDlg : public SfxTabDialogController, public IItemSetHelper, public IDatabaseSettingsDialog
{
weld::Window* m_pParent;
std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
SfxItemSet* m_pItemSet;
css::uno::Reference< css::sdbc::XConnection> m_xConnection;
bool m_bOwnConnection;
protected:
virtual void PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage) override;
virtual void PageCreated(const OString& rId, SfxTabPage& _rPage) override;
public:
OUserAdminDlg( vcl::Window* _pParent
,SfxItemSet* _pItems
,const css::uno::Reference< css::uno::XComponentContext >& _rxORB
,const css::uno::Any& _aDataSourceName
,const css::uno::Reference< css::sdbc::XConnection>& _xConnection);
OUserAdminDlg(weld::Window* pParent, SfxItemSet* pItems,
const css::uno::Reference< css::uno::XComponentContext >& rxORB,
const css::uno::Any& rDataSourceName,
const css::uno::Reference< css::sdbc::XConnection>& rConnection);
virtual ~OUserAdminDlg() override;
virtual void dispose() override;
virtual const SfxItemSet* getOutputSet() const override;
virtual SfxItemSet* getWriteOutputSet() override;
virtual short Execute() override;
virtual short run() override;
// forwards to ODbDataSourceAdministrationHelper
virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override;
+1 -1
View File
@@ -94,7 +94,7 @@ Reference<XPropertySetInfo> SAL_CALL OUserSettingsDialog::getPropertySetInfo()
svt::OGenericUnoDialog::Dialog OUserSettingsDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
{
return svt::OGenericUnoDialog::Dialog(VclPtr<OUserAdminDlg>::Create(VCLUnoHelper::GetWindow(rParent), m_pDatasourceItems.get(), m_aContext, m_aInitialSelection, m_xActiveConnection));
return svt::OGenericUnoDialog::Dialog(o3tl::make_unique<OUserAdminDlg>(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), m_aContext, m_aInitialSelection, m_xActiveConnection));
}
} // namespace dbaui
+32 -2
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="dba">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="UserAdminDialog">
@@ -7,7 +7,13 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="useradmindialog|UserAdminDialog">User Administration</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -73,7 +79,7 @@
<child>
<object class="GtkNotebook" id="tabcontrol">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="scrollable">True</property>
@@ -85,6 +91,30 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="tab">