[Libreoffice-commits] core.git: sfx2/source sfx2/uiconfig
Caolán McNamara
caolanm at redhat.com
Fri Apr 13 12:24:39 UTC 2018
sfx2/source/appl/newhelp.cxx | 44 ++++++++++++++-----------------------
sfx2/source/appl/newhelp.hxx | 12 +++++-----
sfx2/uiconfig/ui/bookmarkdialog.ui | 34 +++++++++++++++++-----------
3 files changed, 44 insertions(+), 46 deletions(-)
New commits:
commit 167dea2eacd6cabfc65c6c756a14a62b58b7f206
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 13 12:04:10 2018 +0100
weld SfxAddHelpBookmarkDialog
Change-Id: I3724b0e92cfd3103f7ecdadbcf6c1efc501e6c04
Reviewed-on: https://gerrit.libreoffice.org/52822
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 47f5a4c09c77..b5dd4b791d97 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1185,15 +1185,15 @@ void BookmarksBox_Impl::DoAction( sal_uInt16 nAction )
sal_Int32 nPos = GetSelectedEntryPos();
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- ScopedVclPtrInstance< SfxAddHelpBookmarkDialog_Impl > aDlg(this, true);
- aDlg->SetTitle( GetEntry( nPos ) );
- if ( aDlg->Execute() == RET_OK )
+ SfxAddHelpBookmarkDialog_Impl aDlg(GetFrameWeld(), true);
+ aDlg.SetTitle(GetEntry(nPos));
+ if (aDlg.run() == RET_OK)
{
OUString* pURL = static_cast<OUString*>(GetEntryData( nPos ));
RemoveEntry( nPos );
OUString aImageURL = IMAGE_URL;
aImageURL += INetURLObject( *pURL ).GetHost();
- nPos = InsertEntry( aDlg->GetTitle(), SvFileInformationManager::GetImage( INetURLObject(aImageURL) ) );
+ nPos = InsertEntry( aDlg.GetTitle(), SvFileInformationManager::GetImage( INetURLObject(aImageURL) ) );
SetEntryData( nPos, new OUString( *pURL ) );
SelectEntryPos( nPos );
delete pURL;
@@ -3099,12 +3099,12 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
OUString aValue;
if ( aAny >>= aValue )
{
- OUString aTitle( aValue );
- ScopedVclPtrInstance< SfxAddHelpBookmarkDialog_Impl > aDlg(this, false);
- aDlg->SetTitle( aTitle );
- if ( aDlg->Execute() == RET_OK )
+ OUString aTitle(aValue);
+ SfxAddHelpBookmarkDialog_Impl aDlg(GetFrameWeld(), false);
+ aDlg.SetTitle(aTitle);
+ if (aDlg.run() == RET_OK )
{
- aTitle = aDlg->GetTitle();
+ aTitle = aDlg.GetTitle();
pIndexWin->AddBookmarks( aTitle, aURL );
}
}
@@ -3167,29 +3167,19 @@ bool SfxHelpWindow_Impl::HasHistorySuccessor() const
// class SfxAddHelpBookmarkDialog_Impl -----------------------------------
-SfxAddHelpBookmarkDialog_Impl::SfxAddHelpBookmarkDialog_Impl(vcl::Window* pParent, bool bRename)
- : ModalDialog( pParent, "BookmarkDialog", "sfx/ui/bookmarkdialog.ui")
+SfxAddHelpBookmarkDialog_Impl::SfxAddHelpBookmarkDialog_Impl(weld::Window* pParent, bool bRename)
+ : GenericDialogController(pParent, "sfx/ui/bookmarkdialog.ui", "BookmarkDialog")
+ , m_xTitleED(m_xBuilder->weld_entry("entry"))
+ , m_xAltTitle(m_xBuilder->weld_label("alttitle"))
{
- get(m_pTitleED, "entry");
if (bRename)
- SetText(get<FixedText>("alttitle")->GetText());
+ m_xDialog->set_title(m_xAltTitle->get_label());
}
-SfxAddHelpBookmarkDialog_Impl::~SfxAddHelpBookmarkDialog_Impl()
+void SfxAddHelpBookmarkDialog_Impl::SetTitle(const OUString& rTitle)
{
- disposeOnce();
-}
-
-void SfxAddHelpBookmarkDialog_Impl::dispose()
-{
- m_pTitleED.clear();
- ModalDialog::dispose();
-}
-
-void SfxAddHelpBookmarkDialog_Impl::SetTitle( const OUString& rTitle )
-{
- m_pTitleED->SetText( rTitle );
- m_pTitleED->SetSelection( Selection( 0, rTitle.getLength() ) );
+ m_xTitleED->set_text(rTitle);
+ m_xTitleED->select_region(0, -1);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index b5388a3af315..4c6d4818910a 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -33,6 +33,7 @@
#include <vcl/button.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/dialog.hxx>
+#include <vcl/weld.hxx>
#include <svtools/treelistbox.hxx>
#include <unotools/moduleoptions.hxx>
@@ -563,17 +564,16 @@ public:
bool bAddToHistory = true);
};
-class SfxAddHelpBookmarkDialog_Impl : public ModalDialog
+class SfxAddHelpBookmarkDialog_Impl : public weld::GenericDialogController
{
private:
- VclPtr<Edit> m_pTitleED;
+ std::unique_ptr<weld::Entry> m_xTitleED;
+ std::unique_ptr<weld::Label> m_xAltTitle;
public:
- SfxAddHelpBookmarkDialog_Impl( vcl::Window* pParent, bool bRename );
- virtual ~SfxAddHelpBookmarkDialog_Impl() override;
- virtual void dispose() override;
+ SfxAddHelpBookmarkDialog_Impl(weld::Window* pParent, bool bRename);
void SetTitle( const OUString& rTitle );
- OUString GetTitle() const { return m_pTitleED->GetText(); }
+ OUString GetTitle() const { return m_xTitleED->get_text(); }
};
/// Appends ?Language=xy&System=abc to the help URL in rURL
diff --git a/sfx2/uiconfig/ui/bookmarkdialog.ui b/sfx2/uiconfig/ui/bookmarkdialog.ui
index a1e97eeba836..b8663d906b5f 100644
--- a/sfx2/uiconfig/ui/bookmarkdialog.ui
+++ b/sfx2/uiconfig/ui/bookmarkdialog.ui
@@ -1,28 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.4 -->
<interface domain="sfx">
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="BookmarkDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="bookmarkdialog|BookmarkDialog">Add to Bookmarks</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">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="alttitle">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes" context="bookmarkdialog|alttitle">Rename Bookmark</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
@@ -73,6 +65,7 @@
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
+ <property name="secondary">True</property>
</packing>
</child>
</object>
@@ -84,6 +77,18 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="alttitle">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="bookmarkdialog|alttitle">Rename Bookmark</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -130,5 +135,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
More information about the Libreoffice-commits
mailing list