diff options
author | Csikós Tamás <csks.tomi@gmail.com> | 2013-07-29 19:54:43 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-30 13:48:40 +0000 |
commit | 471e5c1ed19afde8a92a91bfc1ccc71a2506cc01 (patch) | |
tree | 8ff7ee67f90a4b5bee904e3f4b391c95b9d193c5 /dbaccess | |
parent | d7b48d03e19d2c05ecf2143b1547ceab5ab89e5c (diff) |
modern .ui widgetlayout for directsql
Change-Id: I51140fe6abd2d321c5784b923f920ab9183f417e
Reviewed-on: https://gerrit.libreoffice.org/5171
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/UIConfig_dbaccess.mk | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/directsql.cxx | 66 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/directsql.hxx | 18 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/directsqldialog.ui | 277 |
4 files changed, 312 insertions, 50 deletions
diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk index eb979729ca3f..cace6a8cde5f 100644 --- a/dbaccess/UIConfig_dbaccess.mk +++ b/dbaccess/UIConfig_dbaccess.mk @@ -10,6 +10,7 @@ $(eval $(call gb_UIConfig_UIConfig,dbaccess)) $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \ + dbaccess/uiconfig/ui/directsqldialog \ dbaccess/uiconfig/ui/querypropertiesdialog \ dbaccess/uiconfig/ui/generalpagedialog \ dbaccess/uiconfig/ui/generalpagewizard \ diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index bb73d8adbf37..87b917321970 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -73,33 +73,25 @@ namespace dbaui DBG_NAME(DirectSQLDialog) //-------------------------------------------------------------------- DirectSQLDialog::DirectSQLDialog( Window* _pParent, const Reference< XConnection >& _rxConn ) - :ModalDialog(_pParent, ModuleRes(DLG_DIRECTSQL)) - ,m_aFrame (this, ModuleRes(FL_SQL)) - ,m_aSQLLabel (this, ModuleRes(FT_SQL)) - ,m_aSQL (this, ModuleRes(ME_SQL)) - ,m_aExecute (this, ModuleRes(PB_EXECUTE)) - ,m_aHistoryLabel (this, ModuleRes(FT_HISTORY)) - ,m_pSQLHistory(new LargeEntryListBox(this, ModuleRes(LB_HISTORY))) - ,m_aStatusFrame (this, ModuleRes(FL_STATUS)) - ,m_aStatus (this, ModuleRes(ME_STATUS)) - ,m_pShowOutput(new CheckBox(this, ModuleRes(CB_SHOWOUTPUT))) - ,m_aOutputFrame (this, ModuleRes(FL_OUTPUT)) - ,m_aOutput (this, ModuleRes(ME_OUTPUT)) - ,m_aButtonSeparator (this, ModuleRes(FL_BUTTONS)) - ,m_aHelp (this, ModuleRes(PB_HELP)) - ,m_aClose (this, ModuleRes(PB_CLOSE)) + :ModalDialog(_pParent, "DirectSQLDialog" , "dbaccess/ui/directsqldialog.ui") ,m_nHistoryLimit(20) ,m_nStatusCount(1) ,m_xConnection(_rxConn) { - DBG_CTOR(DirectSQLDialog,NULL); + get(m_pSQL,"sql"); + get(m_pExecute,"execute"); + get(m_pSQLHistory,"sqlhistory"); + get(m_pStatus,"status"); + get(m_pShowOutput,"showoutput"); + get(m_pOutput,"output"); + get(m_pClose,"close"); - FreeResource(); + DBG_CTOR(DirectSQLDialog,NULL); - m_aSQL.GrabFocus(); + m_pSQL->GrabFocus(); - m_aExecute.SetClickHdl(LINK(this, DirectSQLDialog, OnExecute)); - m_aClose.SetClickHdl(LINK(this, DirectSQLDialog, OnClose)); + m_pExecute->SetClickHdl(LINK(this, DirectSQLDialog, OnExecute)); + m_pClose->SetClickHdl(LINK(this, DirectSQLDialog, OnClose)); m_pSQLHistory->SetSelectHdl(LINK(this, DirectSQLDialog, OnListEntrySelected)); m_pSQLHistory->SetDropDownLineCount(10); @@ -109,8 +101,8 @@ DBG_NAME(DirectSQLDialog) if (xConnComp.is()) startComponentListening(xConnComp); - m_aSQL.SetModifyHdl(LINK(this, DirectSQLDialog, OnStatementModified)); - OnStatementModified(&m_aSQL); + m_pSQL->SetModifyHdl(LINK(this, DirectSQLDialog, OnStatementModified)); + OnStatementModified(m_pSQL); } //-------------------------------------------------------------------- @@ -120,8 +112,6 @@ DBG_NAME(DirectSQLDialog) ::osl::MutexGuard aGuard(m_aMutex); stopAllComponentListening(); } - delete m_pSQLHistory; - delete m_pShowOutput; DBG_DTOR(DirectSQLDialog,NULL); } @@ -226,7 +216,7 @@ DBG_NAME(DirectSQLDialog) OSL_ENSURE(xStatement.is(), "DirectSQLDialog::implExecuteStatement: no statement returned by the connection!"); // clear the output box - m_aOutput.SetText(OUString()); + m_pOutput->SetText(OUString()); if (xStatement.is()) { if (OUString(_rStatement).toAsciiUpperCase().startsWith("SELECT") && m_pShowOutput->IsChecked()) @@ -288,10 +278,10 @@ DBG_NAME(DirectSQLDialog) { OUString sAppendMessage = OUString::number(m_nStatusCount++) + ": " + _rMessage + "\n\n"; - OUString sCompleteMessage = m_aStatus.GetText() + sAppendMessage; - m_aStatus.SetText(sCompleteMessage); + OUString sCompleteMessage = m_pStatus->GetText() + sAppendMessage; + m_pStatus->SetText(sCompleteMessage); - m_aStatus.SetSelection(Selection(sCompleteMessage.getLength(), sCompleteMessage.getLength())); + m_pStatus->SetSelection(Selection(sCompleteMessage.getLength(), sCompleteMessage.getLength())); } //-------------------------------------------------------------------- @@ -300,9 +290,9 @@ DBG_NAME(DirectSQLDialog) String sAppendMessage = _rMessage; sAppendMessage += OUString("\n"); - String sCompleteMessage = m_aOutput.GetText(); + String sCompleteMessage = m_pOutput->GetText(); sCompleteMessage += sAppendMessage; - m_aOutput.SetText(sCompleteMessage); + m_pOutput->SetText(sCompleteMessage); } //-------------------------------------------------------------------- @@ -310,7 +300,7 @@ DBG_NAME(DirectSQLDialog) { CHECK_INVARIANTS("DirectSQLDialog::executeCurrent"); - String sStatement = m_aSQL.GetText(); + String sStatement = m_pSQL->GetText(); // execute implExecuteStatement(sStatement); @@ -318,8 +308,8 @@ DBG_NAME(DirectSQLDialog) // add the statement to the history implAddToStatementHistory(sStatement); - m_aSQL.SetSelection(Selection()); - m_aSQL.GrabFocus(); + m_pSQL->SetSelection(Selection()); + m_pSQL->GrabFocus(); } //-------------------------------------------------------------------- @@ -331,8 +321,8 @@ DBG_NAME(DirectSQLDialog) { // set the text in the statement editor String sStatement = m_aStatementHistory[_nHistoryPos]; - m_aSQL.SetText(sStatement); - OnStatementModified(&m_aSQL); + m_pSQL->SetText(sStatement); + OnStatementModified(m_pSQL); if (_bUpdateListBox) { @@ -342,8 +332,8 @@ DBG_NAME(DirectSQLDialog) "DirectSQLDialog::switchToHistory: inconsistent listbox entries!"); } - m_aSQL.GrabFocus(); - m_aSQL.SetSelection(Selection(sStatement.Len(), sStatement.Len())); + m_pSQL->GrabFocus(); + m_pSQL->SetSelection(Selection(sStatement.Len(), sStatement.Len())); } else OSL_FAIL("DirectSQLDialog::switchToHistory: invalid position!"); @@ -352,7 +342,7 @@ DBG_NAME(DirectSQLDialog) //-------------------------------------------------------------------- IMPL_LINK( DirectSQLDialog, OnStatementModified, void*, /*NOTINTERESTEDIN*/ ) { - m_aExecute.Enable(!m_aSQL.GetText().isEmpty()); + m_pExecute->Enable(!m_pSQL->GetText().isEmpty()); return 0L; } diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx index 0c10fc9b330d..3b59d315859b 100644 --- a/dbaccess/source/ui/inc/directsql.hxx +++ b/dbaccess/source/ui/inc/directsql.hxx @@ -51,20 +51,14 @@ namespace dbaui OModuleClient m_aModuleClient; ::osl::Mutex m_aMutex; - FixedLine m_aFrame; - FixedText m_aSQLLabel; - MultiLineEditSyntaxHighlight m_aSQL; - PushButton m_aExecute; - FixedText m_aHistoryLabel; + MultiLineEditSyntaxHighlight* m_pSQL; + PushButton* m_pExecute; ListBox* m_pSQLHistory; - FixedLine m_aStatusFrame; - MultiLineEdit m_aStatus; + MultiLineEdit* m_pStatus; CheckBox* m_pShowOutput; - FixedLine m_aOutputFrame; - MultiLineEdit m_aOutput; - FixedLine m_aButtonSeparator; - HelpButton m_aHelp; - PushButton m_aClose; + MultiLineEdit* m_pOutput; + HelpButton* m_pHelp; + PushButton* m_pClose; typedef ::std::deque< String > StringQueue; StringQueue m_aStatementHistory; // previous statements diff --git a/dbaccess/uiconfig/ui/directsqldialog.ui b/dbaccess/uiconfig/ui/directsqldialog.ui new file mode 100644 index 000000000000..b4ac7ec3b987 --- /dev/null +++ b/dbaccess/uiconfig/ui/directsqldialog.ui @@ -0,0 +1,277 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="DirectSQLDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Execute SQL Statement</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</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="layout_style">end</property> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_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="close"> + <property name="label">gtk-close</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">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="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="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <child> + <object class="svtlo-MultiLineEditSyntaxHighlight" id="sql:border"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="sql_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Command to execute</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">sql:border</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkCheckButton" id="showoutput"> + <property name="label" translatable="yes">_Show output of "select" statements</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="execute"> + <property name="label">_Execute</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="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="sqlhistory"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="sqlhistory_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Previous commands</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">sqlhistory</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</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">SQL command</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="svtlo-MultiLineEdit" id="status:border"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Status</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="svtlo-MultiLineEdit" id="output:border"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Output</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">help</action-widget> + <action-widget response="0">close</action-widget> + </action-widgets> + </object> +</interface> |