Kaydet (Commit) 167dea2e authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SfxAddHelpBookmarkDialog

Change-Id: I3724b0e92cfd3103f7ecdadbcf6c1efc501e6c04
Reviewed-on: https://gerrit.libreoffice.org/52822Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst a27f1957
...@@ -1185,15 +1185,15 @@ void BookmarksBox_Impl::DoAction( sal_uInt16 nAction ) ...@@ -1185,15 +1185,15 @@ void BookmarksBox_Impl::DoAction( sal_uInt16 nAction )
sal_Int32 nPos = GetSelectedEntryPos(); sal_Int32 nPos = GetSelectedEntryPos();
if ( nPos != LISTBOX_ENTRY_NOTFOUND ) if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{ {
ScopedVclPtrInstance< SfxAddHelpBookmarkDialog_Impl > aDlg(this, true); SfxAddHelpBookmarkDialog_Impl aDlg(GetFrameWeld(), true);
aDlg->SetTitle( GetEntry( nPos ) ); aDlg.SetTitle(GetEntry(nPos));
if ( aDlg->Execute() == RET_OK ) if (aDlg.run() == RET_OK)
{ {
OUString* pURL = static_cast<OUString*>(GetEntryData( nPos )); OUString* pURL = static_cast<OUString*>(GetEntryData( nPos ));
RemoveEntry( nPos ); RemoveEntry( nPos );
OUString aImageURL = IMAGE_URL; OUString aImageURL = IMAGE_URL;
aImageURL += INetURLObject( *pURL ).GetHost(); 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 ) ); SetEntryData( nPos, new OUString( *pURL ) );
SelectEntryPos( nPos ); SelectEntryPos( nPos );
delete pURL; delete pURL;
...@@ -3099,12 +3099,12 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId ) ...@@ -3099,12 +3099,12 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
OUString aValue; OUString aValue;
if ( aAny >>= aValue ) if ( aAny >>= aValue )
{ {
OUString aTitle( aValue ); OUString aTitle(aValue);
ScopedVclPtrInstance< SfxAddHelpBookmarkDialog_Impl > aDlg(this, false); SfxAddHelpBookmarkDialog_Impl aDlg(GetFrameWeld(), false);
aDlg->SetTitle( aTitle ); aDlg.SetTitle(aTitle);
if ( aDlg->Execute() == RET_OK ) if (aDlg.run() == RET_OK )
{ {
aTitle = aDlg->GetTitle(); aTitle = aDlg.GetTitle();
pIndexWin->AddBookmarks( aTitle, aURL ); pIndexWin->AddBookmarks( aTitle, aURL );
} }
} }
...@@ -3167,29 +3167,19 @@ bool SfxHelpWindow_Impl::HasHistorySuccessor() const ...@@ -3167,29 +3167,19 @@ bool SfxHelpWindow_Impl::HasHistorySuccessor() const
// class SfxAddHelpBookmarkDialog_Impl ----------------------------------- // class SfxAddHelpBookmarkDialog_Impl -----------------------------------
SfxAddHelpBookmarkDialog_Impl::SfxAddHelpBookmarkDialog_Impl(vcl::Window* pParent, bool bRename) SfxAddHelpBookmarkDialog_Impl::SfxAddHelpBookmarkDialog_Impl(weld::Window* pParent, bool bRename)
: ModalDialog( pParent, "BookmarkDialog", "sfx/ui/bookmarkdialog.ui") : 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) 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(); m_xTitleED->set_text(rTitle);
} m_xTitleED->select_region(0, -1);
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() ) );
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <vcl/lstbox.hxx> #include <vcl/lstbox.hxx>
#include <vcl/dialog.hxx> #include <vcl/dialog.hxx>
#include <vcl/weld.hxx>
#include <svtools/treelistbox.hxx> #include <svtools/treelistbox.hxx>
#include <unotools/moduleoptions.hxx> #include <unotools/moduleoptions.hxx>
...@@ -563,17 +564,16 @@ public: ...@@ -563,17 +564,16 @@ public:
bool bAddToHistory = true); bool bAddToHistory = true);
}; };
class SfxAddHelpBookmarkDialog_Impl : public ModalDialog class SfxAddHelpBookmarkDialog_Impl : public weld::GenericDialogController
{ {
private: private:
VclPtr<Edit> m_pTitleED; std::unique_ptr<weld::Entry> m_xTitleED;
std::unique_ptr<weld::Label> m_xAltTitle;
public: public:
SfxAddHelpBookmarkDialog_Impl( vcl::Window* pParent, bool bRename ); SfxAddHelpBookmarkDialog_Impl(weld::Window* pParent, bool bRename);
virtual ~SfxAddHelpBookmarkDialog_Impl() override;
virtual void dispose() override;
void SetTitle( const OUString& rTitle ); 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 /// Appends ?Language=xy&System=abc to the help URL in rURL
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.4 -->
<interface domain="sfx"> <interface domain="sfx">
<!-- interface-requires gtk+ 3.0 --> <requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="BookmarkDialog"> <object class="GtkDialog" id="BookmarkDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="bookmarkdialog|BookmarkDialog">Add to Bookmarks</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> <property name="type_hint">dialog</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</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"> <child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1"> <object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
...@@ -73,6 +65,7 @@ ...@@ -73,6 +65,7 @@
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property> <property name="pack_type">end</property>
<property name="position">2</property> <property name="position">2</property>
<property name="secondary">True</property>
</packing> </packing>
</child> </child>
</object> </object>
...@@ -83,6 +76,18 @@ ...@@ -83,6 +76,18 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </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> <child>
<object class="GtkBox" id="box1"> <object class="GtkBox" id="box1">
<property name="visible">True</property> <property name="visible">True</property>
...@@ -130,5 +135,8 @@ ...@@ -130,5 +135,8 @@
<action-widget response="-6">cancel</action-widget> <action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget> <action-widget response="-11">help</action-widget>
</action-widgets> </action-widgets>
<child>
<placeholder/>
</child>
</object> </object>
</interface> </interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment