diff options
author | Palenik Mihály <palenik.mihaly@gmail.com> | 2014-08-04 13:43:09 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-08-04 14:00:04 +0200 |
commit | b15c01e43071099c6cb631953e56e88e9961e29e (patch) | |
tree | 6ef56469871d0e4e29c4d3a87fa628b8b6d417fe /dbaccess | |
parent | dfd4b94a52698858ad8cd595f98d77bc21a11206 (diff) |
Convert DLG_PARAMETERS to .ui
Conflicts:
dbaccess/UIConfig_dbaccess.mk
Change-Id: Ib9e1c986e2f58b0095e69890664764d1cf8badb0
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/UIConfig_dbaccess.mk | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/paramdialog.cxx | 112 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/paramdialog.hxx | 12 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/parametersdialog.ui | 186 |
4 files changed, 247 insertions, 64 deletions
diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk index 0225fdb59e41..52d2bf404550 100644 --- a/dbaccess/UIConfig_dbaccess.mk +++ b/dbaccess/UIConfig_dbaccess.mk @@ -39,6 +39,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \ dbaccess/uiconfig/ui/migratepage \ dbaccess/uiconfig/ui/mysqlnativepage \ dbaccess/uiconfig/ui/mysqlnativesettings \ + dbaccess/uiconfig/ui/parametersdialog \ dbaccess/uiconfig/ui/password \ dbaccess/uiconfig/ui/preparepage \ dbaccess/uiconfig/ui/queryfilterdialog \ diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx index bd5d295d1337..c59e41597b16 100644 --- a/dbaccess/source/ui/dlg/paramdialog.cxx +++ b/dbaccess/source/ui/dlg/paramdialog.cxx @@ -54,19 +54,19 @@ namespace dbaui OParameterDialog::OParameterDialog( Window* pParent, const Reference< XIndexAccess > & rParamContainer, const Reference< XConnection > & _rxConnection, const Reference< XComponentContext >& rxContext) - :ModalDialog( pParent, ModuleRes(DLG_PARAMETERS)) - ,m_aNamesFrame (this, ModuleRes(FL_PARAMS)) - ,m_aAllParams (this, ModuleRes(LB_ALLPARAMS)) - ,m_aValueFrame (this, ModuleRes(FT_VALUE)) - ,m_aParam (this, ModuleRes(ET_PARAM)) - ,m_aTravelNext (this, ModuleRes(BT_TRAVELNEXT)) - ,m_aOKBtn (this, ModuleRes(BT_OK)) - ,m_aCancelBtn (this, ModuleRes(BT_CANCEL)) + :ModalDialog( pParent, "Parameters", "dbaccess/ui/parametersdialog.ui") ,m_nCurrentlySelected(LISTBOX_ENTRY_NOTFOUND) ,m_xConnection(_rxConnection) ,m_aPredicateInput( rxContext, _rxConnection, getParseContext() ) ,m_bNeedErrorOnCurrent(true) { + get(m_pAllParams, "allParamTreeview"); + get(m_pParam, "paramEntry"); + get(m_pTravelNext, "next"); + get(m_pOKBtn, "ok"); + get(m_pCancelBtn, "cancel"); + + set_height_request(200); if (rxContext.is()) m_xFormatter = Reference< XNumberFormatter>( NumberFormatter::create( rxContext ), UNO_QUERY_THROW); @@ -94,7 +94,7 @@ namespace dbaui if(!xParamAsSet.is()) continue; pValues->Name = ::comphelper::getString(xParamAsSet->getPropertyValue(PROPERTY_NAME)); - m_aAllParams.InsertEntry(pValues->Name); + m_pAllParams->InsertEntry(pValues->Name); if (!pValues->Value.hasValue()) // it won't have a value, 'cause it's default constructed. But may be later we support @@ -116,8 +116,6 @@ namespace dbaui Construct(); m_aResetVisitFlag.SetTimeoutHdl(LINK(this, OParameterDialog, OnVisitedTimeout)); - - FreeResource(); } OParameterDialog::~OParameterDialog() @@ -129,31 +127,31 @@ namespace dbaui void OParameterDialog::Construct() { - m_aAllParams.SetSelectHdl(LINK(this, OParameterDialog, OnEntrySelected)); - m_aParam.SetLoseFocusHdl(LINK(this, OParameterDialog, OnValueLoseFocus)); - m_aParam.SetModifyHdl(LINK(this, OParameterDialog, OnValueModified)); - m_aTravelNext.SetClickHdl(LINK(this, OParameterDialog, OnButtonClicked)); - m_aOKBtn.SetClickHdl(LINK(this, OParameterDialog, OnButtonClicked)); - m_aCancelBtn.SetClickHdl(LINK(this, OParameterDialog, OnButtonClicked)); - - if (m_aAllParams.GetEntryCount()) + m_pAllParams->SetSelectHdl(LINK(this, OParameterDialog, OnEntrySelected)); + m_pParam->SetLoseFocusHdl(LINK(this, OParameterDialog, OnValueLoseFocus)); + m_pParam->SetModifyHdl(LINK(this, OParameterDialog, OnValueModified)); + m_pTravelNext->SetClickHdl(LINK(this, OParameterDialog, OnButtonClicked)); + m_pOKBtn->SetClickHdl(LINK(this, OParameterDialog, OnButtonClicked)); + m_pCancelBtn->SetClickHdl(LINK(this, OParameterDialog, OnButtonClicked)); + + if (m_pAllParams->GetEntryCount()) { - m_aAllParams.SelectEntryPos(0); - LINK(this, OParameterDialog, OnEntrySelected).Call(&m_aAllParams); + m_pAllParams->SelectEntryPos(0); + LINK(this, OParameterDialog, OnEntrySelected).Call(m_pAllParams); - if (m_aAllParams.GetEntryCount() == 1) + if (m_pAllParams->GetEntryCount() == 1) { - m_aTravelNext.Enable(false); + m_pTravelNext->Enable(false); } - if (m_aAllParams.GetEntryCount() > 1) + if (m_pAllParams->GetEntryCount() > 1) { - m_aOKBtn.SetStyle(m_aOKBtn.GetStyle() & ~WB_DEFBUTTON); - m_aTravelNext.SetStyle(m_aTravelNext.GetStyle() | WB_DEFBUTTON); + m_pOKBtn->SetStyle(m_pOKBtn->GetStyle() & ~WB_DEFBUTTON); + m_pTravelNext->SetStyle(m_pTravelNext->GetStyle() | WB_DEFBUTTON); } } - m_aParam.GrabFocus(); + m_pParam->GrabFocus(); } IMPL_LINK(OParameterDialog, OnValueLoseFocus, Control*, /*pSource*/) @@ -171,9 +169,9 @@ namespace dbaui { if (m_xConnection.is() && m_xFormatter.is()) { - OUString sParamValue( m_aParam.GetText() ); + OUString sParamValue( m_pParam->GetText() ); bool bValid = m_aPredicateInput.normalizePredicateString( sParamValue, xParamAsSet ); - m_aParam.SetText( sParamValue ); + m_pParam->SetText( sParamValue ); if ( bValid ) { // with this the value isn't dirty anymore @@ -204,7 +202,7 @@ namespace dbaui } sMessage = sMessage.replaceAll( "$name$", sName ); ErrorBox(NULL, WB_OK, sMessage).Execute(); - m_aParam.GrabFocus(); + m_pParam->GrabFocus(); return 1L; } } @@ -215,18 +213,18 @@ namespace dbaui IMPL_LINK(OParameterDialog, OnButtonClicked, PushButton*, pButton) { - if (&m_aCancelBtn == pButton) + if (m_pCancelBtn == pButton) { // no interpreting of the given values anymore .... - m_aParam.SetLoseFocusHdl(Link()); // no direct call from the control anymore ... + m_pParam->SetLoseFocusHdl(Link()); // no direct call from the control anymore ... m_bNeedErrorOnCurrent = false; // in case of any indirect calls -> no error message - m_aCancelBtn.SetClickHdl(Link()); - m_aCancelBtn.Click(); + m_pCancelBtn->SetClickHdl(Link()); + m_pCancelBtn->Click(); } - else if (&m_aOKBtn == pButton) + else if (m_pOKBtn == pButton) { // transfer the current values into the Any - if (LINK(this, OParameterDialog, OnEntrySelected).Call(&m_aAllParams) != 0L) + if (LINK(this, OParameterDialog, OnEntrySelected).Call(m_pAllParams) != 0L) { // there was an error interpreting the current text m_bNeedErrorOnCurrent = true; // we're are out of the complex web :) of direct and indirect calls to OnValueLoseFocus now, @@ -258,13 +256,13 @@ namespace dbaui } // to close the dialog (which is more code than a simple EndDialog) - m_aOKBtn.SetClickHdl(Link()); - m_aOKBtn.Click(); + m_pOKBtn->SetClickHdl(Link()); + m_pOKBtn->Click(); } - else if (&m_aTravelNext == pButton) + else if (m_pTravelNext == pButton) { - sal_Int32 nCurrent = m_aAllParams.GetSelectEntryPos(); - sal_Int32 nCount = m_aAllParams.GetEntryCount(); + sal_Int32 nCurrent = m_pAllParams->GetSelectEntryPos(); + sal_Int32 nCount = m_pAllParams->GetEntryCount(); OSL_ENSURE(static_cast<size_t>(nCount) == m_aVisitedParams.size(), "OParameterDialog::OnButtonClicked : inconsistent lists !"); // search the next entry in list we haven't visited yet @@ -276,8 +274,8 @@ namespace dbaui // there is no such "not visited yet" entry -> simpy take the next one nNext = (nCurrent + 1) % nCount; - m_aAllParams.SelectEntryPos(nNext); - LINK(this, OParameterDialog, OnEntrySelected).Call(&m_aAllParams); + m_pAllParams->SelectEntryPos(nNext); + LINK(this, OParameterDialog, OnEntrySelected).Call(m_pAllParams); m_bNeedErrorOnCurrent = true; // we're are out of the complex web :) of direct and indirect calls to OnValueLoseFocus now, // so the next time it is called we need an error message, again .... @@ -298,20 +296,20 @@ namespace dbaui if (m_nCurrentlySelected != LISTBOX_ENTRY_NOTFOUND) { // do the transformation of the current text - if (LINK(this, OParameterDialog, OnValueLoseFocus).Call(&m_aParam) != 0L) + if (LINK(this, OParameterDialog, OnValueLoseFocus).Call(m_pParam) != 0L) { // there was an error interpreting the text - m_aAllParams.SelectEntryPos(m_nCurrentlySelected); + m_pAllParams->SelectEntryPos(m_nCurrentlySelected); return 1L; } - m_aFinalValues[m_nCurrentlySelected].Value <<= OUString(m_aParam.GetText()); + m_aFinalValues[m_nCurrentlySelected].Value <<= OUString(m_pParam->GetText()); } // initialize the controls with the new values - sal_Int32 nSelected = m_aAllParams.GetSelectEntryPos(); + sal_Int32 nSelected = m_pAllParams->GetSelectEntryPos(); OSL_ENSURE(nSelected != LISTBOX_ENTRY_NOTFOUND, "OParameterDialog::OnEntrySelected : no current entry !"); - m_aParam.SetText(::comphelper::getString(m_aFinalValues[nSelected].Value)); + m_pParam->SetText(::comphelper::getString(m_aFinalValues[nSelected].Value)); m_nCurrentlySelected = nSelected; // with this the value isn't dirty @@ -344,28 +342,28 @@ namespace dbaui } if (aIter == m_aVisitedParams.end()) { // yes, there isn't another one -> change the "default button" - m_aTravelNext.SetStyle(m_aTravelNext.GetStyle() & ~WB_DEFBUTTON); - m_aOKBtn.SetStyle(m_aOKBtn.GetStyle() | WB_DEFBUTTON); + m_pTravelNext->SetStyle(m_pTravelNext->GetStyle() & ~WB_DEFBUTTON); + m_pOKBtn->SetStyle(m_pOKBtn->GetStyle() | WB_DEFBUTTON); // set to focus to one of the buttons temporary (with this their "default"-state is really updated) Window* pOldFocus = Application::GetFocusWindow(); // if the old focus window is the value edit do some preparations ... Selection aSel; - if (pOldFocus == &m_aParam) + if (pOldFocus == m_pParam) { - m_aParam.SetLoseFocusHdl(Link()); - aSel = m_aParam.GetSelection(); + m_pParam->SetLoseFocusHdl(Link()); + aSel = m_pParam->GetSelection(); } - m_aTravelNext.GrabFocus(); + m_pTravelNext->GrabFocus(); if (pOldFocus) pOldFocus->GrabFocus(); // restore the settings for the value edit - if (pOldFocus == &m_aParam) + if (pOldFocus == m_pParam) { - m_aParam.SetLoseFocusHdl(LINK(this, OParameterDialog, OnValueLoseFocus)); - m_aParam.SetSelection(aSel); + m_pParam->SetLoseFocusHdl(LINK(this, OParameterDialog, OnValueLoseFocus)); + m_pParam->SetSelection(aSel); } } diff --git a/dbaccess/source/ui/inc/paramdialog.hxx b/dbaccess/source/ui/inc/paramdialog.hxx index 02648b005ed8..71b1f4b347e9 100644 --- a/dbaccess/source/ui/inc/paramdialog.hxx +++ b/dbaccess/source/ui/inc/paramdialog.hxx @@ -52,13 +52,11 @@ namespace dbaui { protected: // the controls - FixedLine m_aNamesFrame; - ListBox m_aAllParams; - FixedText m_aValueFrame; - Edit m_aParam; - PushButton m_aTravelNext; - OKButton m_aOKBtn; - CancelButton m_aCancelBtn; + ListBox* m_pAllParams; + Edit* m_pParam; + PushButton* m_pTravelNext; + OKButton* m_pOKBtn; + CancelButton* m_pCancelBtn; sal_Int32 m_nCurrentlySelected; diff --git a/dbaccess/uiconfig/ui/parametersdialog.ui b/dbaccess/uiconfig/ui/parametersdialog.ui new file mode 100644 index 000000000000..206bee39783c --- /dev/null +++ b/dbaccess/uiconfig/ui/parametersdialog.ui @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="Parameters"> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Parameter Input</property> + <property name="type_hint">dialog</property> + <property name="gravity">north</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="layout_style">start</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkTreeView" id="allParamTreeview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection1"/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">_Value</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">paramEntry</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkEntry" id="paramEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="next"> + <property name="label" translatable="yes">_Next</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Parameters</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">allParamTreeview</property> + <attributes> + <attribute name="weight" value="semibold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + </action-widgets> + </object> +</interface> |