summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extensions/source/bibliography/datman.cxx61
-rw-r--r--extensions/source/bibliography/datman.hxx4
-rw-r--r--extensions/source/bibliography/framectr.cxx2
-rw-r--r--extensions/source/bibliography/toolbar.cxx3
-rw-r--r--extensions/uiconfig/sbibliography/ui/choosedatasourcedialog.ui49
5 files changed, 71 insertions, 48 deletions
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index b2e8119cf257..5af530a355cc 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -448,41 +448,35 @@ IMPL_LINK_NOARG(MappingDialog_Impl, OkHdl, Button*, void)
EndDialog(bModified ? RET_OK : RET_CANCEL);
}
-class DBChangeDialog_Impl : public ModalDialog
+class DBChangeDialog_Impl : public weld::GenericDialogController
{
- VclPtr<ListBox> m_pSelectionLB;
- DBChangeDialogConfig_Impl aConfig;
-
+ DBChangeDialogConfig_Impl aConfig;
BibDataManager* pDatMan;
- DECL_LINK(DoubleClickHdl, ListBox&, void);
+ std::unique_ptr<weld::TreeView> m_xSelectionLB;
+
+ DECL_LINK(DoubleClickHdl, weld::TreeView&, void);
public:
- DBChangeDialog_Impl(vcl::Window* pParent, BibDataManager* pMan );
- virtual ~DBChangeDialog_Impl() override;
- virtual void dispose() override;
+ DBChangeDialog_Impl(weld::Window* pParent, BibDataManager* pMan);
OUString GetCurrentURL()const;
};
-DBChangeDialog_Impl::DBChangeDialog_Impl(vcl::Window* pParent, BibDataManager* pMan )
- : ModalDialog(pParent, "ChooseDataSourceDialog",
- "modules/sbibliography/ui/choosedatasourcedialog.ui")
- ,
- pDatMan(pMan)
+DBChangeDialog_Impl::DBChangeDialog_Impl(weld::Window* pParent, BibDataManager* pMan )
+ : GenericDialogController(pParent, "modules/sbibliography/ui/choosedatasourcedialog.ui", "ChooseDataSourceDialog")
+ , pDatMan(pMan)
+ , m_xSelectionLB(m_xBuilder->weld_tree_view("treeview"))
{
- get(m_pSelectionLB, "treeview");
- m_pSelectionLB->set_height_request(m_pSelectionLB->GetTextHeight() * 6);
-
- m_pSelectionLB->SetStyle(m_pSelectionLB->GetStyle() | WB_SORT);
- m_pSelectionLB->SetDoubleClickHdl( LINK(this, DBChangeDialog_Impl, DoubleClickHdl));
+ m_xSelectionLB->set_size_request(-1, m_xSelectionLB->get_height_rows(6));
+ m_xSelectionLB->connect_row_activated(LINK(this, DBChangeDialog_Impl, DoubleClickHdl));
+ m_xSelectionLB->make_sorted();
try
{
OUString sActiveSource = pDatMan->getActiveDataSource();
for (const OUString& rSourceName : aConfig.GetDataSourceNames())
- m_pSelectionLB->InsertEntry(rSourceName);
-
- m_pSelectionLB->SelectEntry(sActiveSource);
+ m_xSelectionLB->append_text(rSourceName);
+ m_xSelectionLB->select_text(sActiveSource);
}
catch (const Exception& e)
{
@@ -492,25 +486,14 @@ DBChangeDialog_Impl::DBChangeDialog_Impl(vcl::Window* pParent, BibDataManager* p
}
}
-IMPL_LINK_NOARG(DBChangeDialog_Impl, DoubleClickHdl, ListBox&, void)
-{
- EndDialog(RET_OK);
-}
-
-DBChangeDialog_Impl::~DBChangeDialog_Impl()
+IMPL_LINK_NOARG(DBChangeDialog_Impl, DoubleClickHdl, weld::TreeView&, void)
{
- disposeOnce();
-}
-
-void DBChangeDialog_Impl::dispose()
-{
- m_pSelectionLB.clear();
- ModalDialog::dispose();
+ m_xDialog->response(RET_OK);
}
OUString DBChangeDialog_Impl::GetCurrentURL()const
{
- return m_pSelectionLB->GetSelectedEntry();
+ return m_xSelectionLB->get_selected_text();
}
// XDispatchProvider
@@ -1483,13 +1466,13 @@ void BibDataManager::CreateMappingDialog(vcl::Window* pParent)
}
}
-OUString BibDataManager::CreateDBChangeDialog(vcl::Window* pParent)
+OUString BibDataManager::CreateDBChangeDialog(weld::Window* pParent)
{
OUString uRet;
- VclPtrInstance< DBChangeDialog_Impl > pDlg(pParent, this );
- if(RET_OK == pDlg->Execute())
+ DBChangeDialog_Impl aDlg(pParent, this);
+ if (aDlg.run() == RET_OK)
{
- OUString sNewURL = pDlg->GetCurrentURL();
+ OUString sNewURL = aDlg.GetCurrentURL();
if(sNewURL != getActiveDataSource())
{
uRet = sNewURL;
diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx
index e405fd355842..e9aa2559f849 100644
--- a/extensions/source/bibliography/datman.hxx
+++ b/extensions/source/bibliography/datman.hxx
@@ -35,7 +35,7 @@
#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
-
+namespace weld { class Window; }
namespace bib
{
@@ -157,7 +157,7 @@ public:
bool bForceListBox);
void CreateMappingDialog(vcl::Window* pParent);
- OUString CreateDBChangeDialog(vcl::Window* pParent);
+ OUString CreateDBChangeDialog(weld::Window* pParent);
void DispatchDBChangeDialog();
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index 8ac29d500d07..a2d83e49b51a 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -385,7 +385,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen
}
else if(aCommand == "Bib/sdbsource")
{
- OUString aURL = m_xDatMan->CreateDBChangeDialog(pParent);
+ OUString aURL = m_xDatMan->CreateDBChangeDialog(pParent ? pParent->GetFrameWeld() : nullptr);
if(!aURL.isEmpty())
{
try
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index 28feeb20c96e..2a632a546626 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -373,7 +373,8 @@ void BibToolBar::Click()
{
if(pDatMan)
{
- OUString sNew = pDatMan->CreateDBChangeDialog(GetParent());
+ vcl::Window* pWin = GetParent();
+ OUString sNew = pDatMan->CreateDBChangeDialog(pWin ? pWin->GetFrameWeld() : nullptr);
if(!sNew.isEmpty())
pDatMan->setActiveDataSource(sNew);
}
diff --git a/extensions/uiconfig/sbibliography/ui/choosedatasourcedialog.ui b/extensions/uiconfig/sbibliography/ui/choosedatasourcedialog.ui
index 6039efd71d8f..0145dd0dc0c2 100644
--- a/extensions/uiconfig/sbibliography/ui/choosedatasourcedialog.ui
+++ b/extensions/uiconfig/sbibliography/ui/choosedatasourcedialog.ui
@@ -1,12 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="pcr">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkTreeStore" id="liststore2">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="ChooseDataSourceDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="choosedatasourcedialog|ChooseDataSourceDialog">Choose Data Source</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>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -71,14 +85,39 @@
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkTreeView" id="treeview:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="show_expanders">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore2</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">1</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer4"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
</child>