diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-14 13:22:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-14 13:24:56 +0000 |
commit | 19007d5b1881e30ed5de671a0b84fe0592f8ccf4 (patch) | |
tree | 69261f0b40de6fb95eb004af64b38fff4991ce40 /padmin | |
parent | 5bbaf3739a3d95ea3fe95e9cd25aead0c8f75709 (diff) |
convert fax (etc) query dialog to .ui
Change-Id: I7de45a208d27ed1b680214808c64e090d9a199f4
Diffstat (limited to 'padmin')
-rw-r--r-- | padmin/UIConfig_spa.mk | 1 | ||||
-rw-r--r-- | padmin/source/helper.cxx | 41 | ||||
-rw-r--r-- | padmin/source/helper.hxx | 12 | ||||
-rw-r--r-- | padmin/source/padialog.hrc | 7 | ||||
-rw-r--r-- | padmin/source/padialog.src | 43 | ||||
-rw-r--r-- | padmin/uiconfig/ui/querydialog.ui | 109 |
6 files changed, 127 insertions, 86 deletions
diff --git a/padmin/UIConfig_spa.mk b/padmin/UIConfig_spa.mk index 565f0cc57536..6ac5ba26e87b 100644 --- a/padmin/UIConfig_spa.mk +++ b/padmin/UIConfig_spa.mk @@ -13,6 +13,7 @@ $(eval $(call gb_UIConfig_add_uifiles,spa,\ padmin/uiconfig/ui/printerdevicepage \ padmin/uiconfig/ui/printerpaperpage \ padmin/uiconfig/ui/printerpropertiesdialog \ + padmin/uiconfig/ui/querydialog \ )) # vim: set noet sw=4 ts=4: diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx index 848da22e32a9..fdb974cd14c6 100644 --- a/padmin/source/helper.cxx +++ b/padmin/source/helper.cxx @@ -181,33 +181,18 @@ bool DelListBox::Notify( NotifyEvent& rEvent ) * QueryString */ -QueryString::QueryString( Window* pParent, OUString& rQuery, OUString& rRet, const ::std::list< OUString >& rChoices ) : - ModalDialog( pParent, PaResId( RID_STRINGQUERYDLG ) ), - m_aOKButton( this, PaResId( RID_STRQRY_BTN_OK ) ), - m_aCancelButton( this, PaResId( RID_STRQRY_BTN_CANCEL ) ), - m_aFixedText( this, PaResId( RID_STRQRY_TXT_RENAME ) ), - m_aEdit( this, PaResId( RID_STRQRY_EDT_NEWNAME ) ), - m_aComboBox( this, PaResId( RID_STRQRY_BOX_NEWNAME ) ), - m_rReturnValue( rRet ) +QueryString::QueryString(Window* pParent, OUString& rQuery, OUString& rRet) + : ModalDialog(pParent, "QueryDialog", + "spa/ui/querydialog.ui" ) + , m_rReturnValue( rRet ) { - FreeResource(); - m_aOKButton.SetClickHdl( LINK( this, QueryString, ClickBtnHdl ) ); - m_aFixedText.SetText( rQuery ); - if( rChoices.begin() != rChoices.end() ) - { - m_aComboBox.SetText( m_rReturnValue ); - m_aComboBox.InsertEntry( m_rReturnValue ); - for( ::std::list<OUString>::const_iterator it = rChoices.begin(); it != rChoices.end(); ++it ) - m_aComboBox.InsertEntry( *it ); - m_aEdit.Show( false ); - m_bUseEdit = false; - } - else - { - m_aEdit.SetText( m_rReturnValue ); - m_aComboBox.Show( false ); - m_bUseEdit = true; - } + get(m_pOKButton, "ok"); + get(m_pFixedText, "label"); + get(m_pEdit, "entry"); + + m_pOKButton->SetClickHdl( LINK( this, QueryString, ClickBtnHdl ) ); + m_pFixedText->SetText( rQuery ); + m_pEdit->SetText( m_rReturnValue ); SetText( Application::GetDisplayName() ); } @@ -217,9 +202,9 @@ QueryString::~QueryString() IMPL_LINK( QueryString, ClickBtnHdl, Button*, pButton ) { - if( pButton == &m_aOKButton ) + if (pButton == m_pOKButton) { - m_rReturnValue = m_bUseEdit ? m_aEdit.GetText() : m_aComboBox.GetText(); + m_rReturnValue = m_pEdit->GetText(); EndDialog( 1 ); } else diff --git a/padmin/source/helper.hxx b/padmin/source/helper.hxx index d229766c1836..5a1279aadf8f 100644 --- a/padmin/source/helper.hxx +++ b/padmin/source/helper.hxx @@ -82,19 +82,15 @@ public: class QueryString : public ModalDialog { private: - OKButton m_aOKButton; - CancelButton m_aCancelButton; - FixedText m_aFixedText; - Edit m_aEdit; - ComboBox m_aComboBox; - + OKButton* m_pOKButton; + FixedText* m_pFixedText; + Edit* m_pEdit; OUString& m_rReturnValue; - bool m_bUseEdit; DECL_LINK( ClickBtnHdl, Button* ); public: - QueryString( Window*, OUString &, OUString &, const ::std::list< OUString >& rChoices = ::std::list<OUString>() ); + QueryString(Window*, OUString &, OUString &); // parent window, Query text, initial value ~QueryString(); }; diff --git a/padmin/source/padialog.hrc b/padmin/source/padialog.hrc index 206c6d82c92c..f438d0586d09 100644 --- a/padmin/source/padialog.hrc +++ b/padmin/source/padialog.hrc @@ -46,13 +46,6 @@ #define RID_PA_FL_CUPSUSAGE 23 #define RID_PA_CB_CUPSUSAGE 23 -#define RID_STRINGQUERYDLG 1003 -#define RID_STRQRY_TXT_RENAME 1 -#define RID_STRQRY_EDT_NEWNAME 2 -#define RID_STRQRY_BTN_OK 3 -#define RID_STRQRY_BTN_CANCEL 4 -#define RID_STRQRY_BOX_NEWNAME 5 - #define RID_PPDIMPORT_DLG 1004 #define RID_PPDIMP_BTN_OK 1 #define RID_PPDIMP_BTN_CANCEL 2 diff --git a/padmin/source/padialog.src b/padmin/source/padialog.src index a175e3b36146..3bfffa719e72 100644 --- a/padmin/source/padialog.src +++ b/padmin/source/padialog.src @@ -168,49 +168,6 @@ ModalDialog RID_PADIALOG Text [ en-US ] = "Printer Administration"; }; -ModalDialog RID_STRINGQUERYDLG -{ - HelpID = "padmin:ModalDialog:RID_STRINGQUERYDLG"; - OutputSize = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 10 , 10 ) ; - Size = MAP_APPFONT ( 200 , 42 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - FixedText RID_STRQRY_TXT_RENAME - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 130 , 16 ) ; - Wordbreak=TRUE; - }; - Edit RID_STRQRY_EDT_NEWNAME - { - HelpID = "padmin:Edit:RID_STRINGQUERYDLG:RID_STRQRY_EDT_NEWNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 23 ) ; - Size = MAP_APPFONT ( 130 , 12 ) ; - }; - ComboBox RID_STRQRY_BOX_NEWNAME - { - HelpID = "padmin:ComboBox:RID_STRINGQUERYDLG:RID_STRQRY_BOX_NEWNAME"; - Border = TRUE ; - DropDown = TRUE; - Pos = MAP_APPFONT ( 6 , 23 ) ; - Size = MAP_APPFONT ( 130 , 200 ) ; - }; - OKButton RID_STRQRY_BTN_OK - { - DefButton = TRUE ; - Pos = MAP_APPFONT ( 145 , 6 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - CancelButton RID_STRQRY_BTN_CANCEL - { - Pos = MAP_APPFONT ( 145 , 23 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; -}; - String RID_ERR_NOPRINTER { Text [ en-US ] = "Could not open printer %s."; diff --git a/padmin/uiconfig/ui/querydialog.ui b/padmin/uiconfig/ui/querydialog.ui new file mode 100644 index 000000000000..e51e76ccab6e --- /dev/null +++ b/padmin/uiconfig/ui/querydialog.ui @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.16.1 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <object class="GtkDialog" id="QueryDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">New Data Type</property> + <property name="type_hint">normal</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="ok"> + <property name="label">gtk-ok</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="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="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">entry</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="GtkEntry" id="entry"> + <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="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </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> |