basctl/source/basicide/macrodlg.cxx | 8 +-- basctl/source/basicide/moduldl2.cxx | 68 ++++++++++------------------ basctl/source/basicide/moduldlg.cxx | 26 +++++----- basctl/source/basicide/moduldlg.hxx | 33 +++++++------ basctl/uiconfig/basicide/ui/newlibdialog.ui | 12 +++- tools/source/fsys/urlobj.cxx | 5 +- 6 files changed, 73 insertions(+), 79 deletions(-)
New commits: commit f705047867c30cbcdf45fae2e035b304c42ce336 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Mar 3 17:53:54 2018 +0000 weld new library dialog Change-Id: I86c70a01e45a7e9f80c19f9a9b0e6307830ba722 Reviewed-on: https://gerrit.libreoffice.org/50685 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index 69c2e4ec4b90..986dfecb635e 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -369,8 +369,7 @@ SbMethod* MacroChooser::CreateMacro() if ( !pModule ) { - pModule = createModImpl( static_cast<vcl::Window*>( this ), - aDocument, *m_pBasicBox, aLibName, aModName, false ); + pModule = createModImpl(GetFrameWeld(), aDocument, *m_pBasicBox, aLibName, aModName, false); } DBG_ASSERT( !pModule || !pModule->FindMethod( aSubName, SbxClassType::Method ), "Macro exists already!" ); @@ -758,7 +757,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void ) SvTreeListEntry* pCurEntry = m_pBasicBox->GetCurEntry(); EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(pCurEntry); ScriptDocument aDocument( aDesc.GetDocument() ); - createLibImpl( static_cast<vcl::Window*>( this ), aDocument, nullptr, m_pBasicBox ); + createLibImpl(GetFrameWeld(), aDocument, nullptr, m_pBasicBox); } else if (pButton == m_pNewModButton) { @@ -766,8 +765,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void ) EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(pCurEntry); ScriptDocument aDocument( aDesc.GetDocument() ); OUString aLibName( aDesc.GetLibName() ); - createModImpl( static_cast<vcl::Window*>( this ), aDocument, - *m_pBasicBox, aLibName, OUString(), true ); + createModImpl(GetFrameWeld(), aDocument, *m_pBasicBox, aLibName, OUString(), true); } else if (pButton == m_pOrganizeButton) { diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 40da9f29f536..9062db209b33 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -355,57 +355,41 @@ bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewName ) } // NewObjectDialog -IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler, Button*, void) +IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler, weld::Button&, void) { - if (IsValidSbxName(m_pEdit->GetText())) - EndDialog(1); + if (!m_bCheckName || IsValidSbxName(m_xEdit->get_text())) + m_xDialog->response(RET_OK); else { - std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME))); xErrorBox->run(); - m_pEdit->GrabFocus(); + m_xEdit->grab_focus(); } } -NewObjectDialog::NewObjectDialog(vcl::Window * pParent, ObjectMode eMode, - bool bCheckName) - : ModalDialog(pParent, "NewLibDialog", "modules/BasicIDE/ui/newlibdialog.ui") +NewObjectDialog::NewObjectDialog(weld::Window * pParent, ObjectMode eMode, bool bCheckName) + : m_xBuilder(Application::CreateBuilder(pParent, "modules/BasicIDE/ui/newlibdialog.ui")) + , m_xDialog(m_xBuilder->weld_dialog("NewLibDialog")) + , m_xEdit(m_xBuilder->weld_entry("entry")) + , m_xOKButton(m_xBuilder->weld_button("ok")) + , m_bCheckName(bCheckName) { - get(m_pOKButton, "ok"); - get(m_pEdit, "entry"); - - m_pEdit->GrabFocus(); - switch (eMode) { case ObjectMode::Library: - SetText( IDEResId(RID_STR_NEWLIB) ); + m_xDialog->set_title(IDEResId(RID_STR_NEWLIB)); break; case ObjectMode::Module: - SetText( IDEResId(RID_STR_NEWMOD) ); + m_xDialog->set_title(IDEResId(RID_STR_NEWMOD)); break; case ObjectMode::Dialog: - SetText( IDEResId(RID_STR_NEWDLG) ); + m_xDialog->set_title(IDEResId(RID_STR_NEWDLG)); break; default: assert(false); } - - if (bCheckName) - m_pOKButton->SetClickHdl(LINK(this, NewObjectDialog, OkButtonHandler)); -} - -NewObjectDialog::~NewObjectDialog() -{ - disposeOnce(); -} - -void NewObjectDialog::dispose() -{ - m_pEdit.clear(); - m_pOKButton.clear(); - ModalDialog::dispose(); + m_xOKButton->connect_clicked(LINK(this, NewObjectDialog, OkButtonHandler)); } // GotoLineDialog @@ -735,7 +719,7 @@ IMPL_LINK( LibPage, CheckPasswordHdl, SvxPasswordDialog *, pDlg, bool ) void LibPage::NewLib() { - createLibImpl( static_cast<vcl::Window*>( this ), m_aCurDocument, m_pLibBox, nullptr); + createLibImpl(GetFrameWeld(), m_aCurDocument, m_pLibBox, nullptr); } void LibPage::InsertLib() @@ -1478,8 +1462,8 @@ SvTreeListEntry* LibPage::ImpInsertLibEntry( const OUString& rLibName, sal_uLong } // Helper function -void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument, - CheckBox* pLibBox, TreeListBox* pBasicBox ) +void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument, + CheckBox* pLibBox, TreeListBox* pBasicBox) { OSL_ENSURE( rDocument.isAlive(), "createLibImpl: invalid document!" ); if ( !rDocument.isAlive() ) @@ -1497,29 +1481,29 @@ void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument, i++; } - ScopedVclPtrInstance< NewObjectDialog > aNewDlg(pWin, ObjectMode::Library); - aNewDlg->SetObjectName(aLibName); + NewObjectDialog aNewDlg(pWin, ObjectMode::Library); + aNewDlg.SetObjectName(aLibName); - if (aNewDlg->Execute()) + if (aNewDlg.run()) { - if (!aNewDlg->GetObjectName().isEmpty()) - aLibName = aNewDlg->GetObjectName(); + if (!aNewDlg.GetObjectName().isEmpty()) + aLibName = aNewDlg.GetObjectName(); if ( aLibName.getLength() > 30 ) { - std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin, VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_LIBNAMETOLONG))); xErrorBox->run(); } else if ( !IsValidSbxName( aLibName ) ) { - std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin, VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME))); xErrorBox->run(); } else if ( rDocument.hasLibrary( E_SCRIPTS, aLibName ) || rDocument.hasLibrary( E_DIALOGS, aLibName ) ) { - std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin, VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_SBXNAMEALLREADYUSED2))); xErrorBox->run(); } diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index d0abbe481951..68c4b1b7526a 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -802,8 +802,8 @@ void ObjectPage::NewModule() if ( GetSelection( aDocument, aLibName ) ) { - createModImpl( static_cast<vcl::Window*>( this ), aDocument, - *m_pBasicBox, aLibName, OUString(), true ); + createModImpl(GetFrameWeld(), aDocument, + *m_pBasicBox, aLibName, OUString(), true); } } @@ -816,12 +816,12 @@ void ObjectPage::NewDialog() { aDocument.getOrCreateLibrary( E_DIALOGS, aLibName ); - ScopedVclPtrInstance< NewObjectDialog > aNewDlg(this, ObjectMode::Dialog, true); - aNewDlg->SetObjectName( aDocument.createObjectName( E_DIALOGS, aLibName ) ); + NewObjectDialog aNewDlg(GetFrameWeld(), ObjectMode::Dialog, true); + aNewDlg.SetObjectName(aDocument.createObjectName(E_DIALOGS, aLibName)); - if (aNewDlg->Execute() != 0) + if (aNewDlg.run() != RET_CANCEL) { - OUString aDlgName = aNewDlg->GetObjectName(); + OUString aDlgName = aNewDlg.GetObjectName(); if (aDlgName.isEmpty()) aDlgName = aDocument.createObjectName( E_DIALOGS, aLibName); @@ -959,7 +959,7 @@ void LibDialog::SetStorageName( const OUString& rName ) } // Helper function -SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument, +SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument, TreeListBox& rBasicBox, const OUString& rLibName, const OUString& _aModName, bool bMain ) { OSL_ENSURE( rDocument.isAlive(), "createModImpl: invalid document!" ); @@ -976,13 +976,13 @@ SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument, if ( aModName.isEmpty() ) aModName = rDocument.createObjectName( E_SCRIPTS, aLibName ); - ScopedVclPtrInstance< NewObjectDialog > aNewDlg(pWin, ObjectMode::Module, true); - aNewDlg->SetObjectName( aModName ); + NewObjectDialog aNewDlg(pWin, ObjectMode::Module, true); + aNewDlg.SetObjectName(aModName); - if (aNewDlg->Execute() != 0) + if (aNewDlg.run() != RET_CANCEL) { - if (!aNewDlg->GetObjectName().isEmpty() ) - aModName = aNewDlg->GetObjectName(); + if (!aNewDlg.GetObjectName().isEmpty()) + aModName = aNewDlg.GetObjectName(); try { @@ -1043,7 +1043,7 @@ SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument, } catch (const container::ElementExistException& ) { - std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(pWin, VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_SBXNAMEALLREADYUSED2))); xError->run(); } diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index ce9de92864bc..b1fe48ad0ac4 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -27,6 +27,7 @@ #include <vcl/tabctrl.hxx> #include <vcl/tabdlg.hxx> #include <vcl/tabpage.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/task/XInteractionHandler.hpp> class SvxPasswordDialog; @@ -41,22 +42,24 @@ enum class ObjectMode Dialog = 3, }; -class NewObjectDialog : public ModalDialog +class NewObjectDialog { private: - VclPtr<Edit> m_pEdit; - VclPtr<OKButton> m_pOKButton; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Dialog> m_xDialog; + std::unique_ptr<weld::Entry> m_xEdit; + std::unique_ptr<weld::Button> m_xOKButton; + bool m_bCheckName; - DECL_LINK(OkButtonHandler, Button*, void); + DECL_LINK(OkButtonHandler, weld::Button&, void); public: - NewObjectDialog (vcl::Window* pParent, ObjectMode, bool bCheckName = false); - virtual ~NewObjectDialog() override; - virtual void dispose() override; - OUString GetObjectName() const { return m_pEdit->GetText(); } - void SetObjectName( const OUString& rName ) + NewObjectDialog(weld::Window* pParent, ObjectMode, bool bCheckName = false); + short run() { return m_xDialog->run(); } + OUString GetObjectName() const { return m_xEdit->get_text(); } + void SetObjectName(const OUString& rName) { - m_pEdit->SetText( rName ); - m_pEdit->SetSelection(Selection( 0, rName.getLength())); + m_xEdit->set_text(rName); + m_xEdit->select_region(0, -1); } }; @@ -252,10 +255,10 @@ public: }; // Helper functions -SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument, - TreeListBox& rBasicBox, const OUString& rLibName, const OUString& aModName, bool bMain ); -void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument, - CheckBox* pLibBox, TreeListBox* pBasicBox ); +SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument, + TreeListBox& rBasicBox, const OUString& rLibName, const OUString& aModName, bool bMain); +void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument, + CheckBox* pLibBox, TreeListBox* pBasicBox); } // namespace basctl diff --git a/basctl/uiconfig/basicide/ui/newlibdialog.ui b/basctl/uiconfig/basicide/ui/newlibdialog.ui index 53db96c6a8d9..c52086b638a5 100644 --- a/basctl/uiconfig/basicide/ui/newlibdialog.ui +++ b/basctl/uiconfig/basicide/ui/newlibdialog.ui @@ -1,10 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="basctl"> <requires lib="gtk+" version="3.0"/> <object class="GtkDialog" id="NewLibDialog"> <property name="can_focus">False</property> <property name="border_width">6</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 internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -80,10 +83,10 @@ <object class="GtkLabel" id="area"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="newlibdialog|area">_Name:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entry</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -111,8 +114,11 @@ </object> </child> <action-widgets> - <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> + <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> commit c7bb99964bc29f146a8bc7f27f21a3b62a197b2d Author: Stephan Bergmann <sberg...@redhat.com> Date: Sun Mar 4 16:26:23 2018 +0100 Improve comment ...after c3ecef8067e274d017a344b4c8049cd5f49c6729 "INTEGRATION: CWS fwk01ea" had introduced INET_PROT_GENERIC back then. Change-Id: I156c1b52d02446168fa9202b3a65a0aad701f6ce diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 6a3b2ef712c2..5e8ca4d0d614 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -746,7 +746,7 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef, // hex4 = 1*4HEXDIG // UCS4 = <any UCS4 character> - // 1st Production (known scheme): + // 1st Production (known scheme; handled by the "if (pPrefix)" branch above): // <one of the known schemes, ignoring case> ":" *UCS4 // 2nd Production (mailto): // domain "@" domain @@ -764,6 +764,9 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef, // ALPHA ":" ["/" *UCS4] // 9th Production (DOS file; FSysStyle::Dos only): // ALPHA ":" ["\" *UCS4] + // 10th Production (any scheme; handled by the "m_eScheme = INetProtocol::Generic;" code + // after this else branch): + // <any scheme> ":" *UCS4 // For the 'non URL' file productions 6--9, the interpretation of // the input as a (degenerate) URI is turned off, i.e., escape _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits