[Libreoffice-commits] core.git: dbaccess/source dbaccess/uiconfig
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 17 20:56:00 UTC 2021
dbaccess/source/ui/browser/brwview.cxx | 38 +++++++++++----------------
dbaccess/source/ui/control/dbtreelistbox.cxx | 2 +
dbaccess/source/ui/inc/brwview.hxx | 1
dbaccess/source/ui/inc/dbtreelistbox.hxx | 3 ++
dbaccess/uiconfig/ui/dbtreelist.ui | 38 +++++++++++++++++++--------
5 files changed, 49 insertions(+), 33 deletions(-)
New commits:
commit 48d27dc08012b5f0e9adf2053a8d73479bed5938
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 17 14:27:06 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Feb 17 21:55:16 2021 +0100
move statusbar into DBTreeListBox container
and convert to weld::Label
Change-Id: Ic3cacf2197895712c6e6b38226f65078320c590f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111071
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index b0e3e516511c..4aa7c4c5abb9 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -21,7 +21,6 @@
#include <sbagrid.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/types.hxx>
-#include <vcl/fixed.hxx>
#include <vcl/split.hxx>
#include <strings.hxx>
#include <com/sun/star/form/XLoadable.hpp>
@@ -71,7 +70,6 @@ UnoDataBrowserView::UnoDataBrowserView( vcl::Window* pParent,
,m_pTreeView(nullptr)
,m_pSplitter(nullptr)
,m_pVclControl(nullptr)
- ,m_pStatus(nullptr)
{
}
@@ -124,8 +122,6 @@ void UnoDataBrowserView::dispose()
m_pSplitter.disposeAndClear();
setTreeView(nullptr);
- m_pStatus.disposeAndClear();
-
try
{
::comphelper::disposeComponent(m_xGrid);
@@ -167,10 +163,11 @@ void UnoDataBrowserView::showStatus( const OUString& _rStatus )
hideStatus();
else
{
- if (!m_pStatus)
- m_pStatus = VclPtr<FixedText>::Create(this);
- m_pStatus->SetText(_rStatus);
- m_pStatus->Show();
+ if (!m_pTreeView)
+ return;
+ weld::Label& rLabel = m_pTreeView->GetStatusBar();
+ rLabel.set_label(_rStatus);
+ rLabel.show();
Resize();
PaintImmediately();
}
@@ -178,10 +175,15 @@ void UnoDataBrowserView::showStatus( const OUString& _rStatus )
void UnoDataBrowserView::hideStatus()
{
- if (!m_pStatus || !m_pStatus->IsVisible())
+ if (!m_pTreeView)
+ return;
+ weld::Label& rLabel = m_pTreeView->GetStatusBar();
+ if (!rLabel.get_visible())
+ {
// nothing to do
return;
- m_pStatus->Hide();
+ }
+ rLabel.hide();
Resize();
PaintImmediately();
}
@@ -211,20 +213,12 @@ void UnoDataBrowserView::resizeDocumentView(tools::Rectangle& _rPlayground)
Point aTreeViewPos( aPlaygroundPos );
Size aTreeViewSize( aSplitPos.X(), aPlaygroundSize.Height() );
- // the status pos and size
- if (m_pStatus && m_pStatus->IsVisible())
- {
- Size aStatusSize(aPlaygroundPos.X(), GetTextHeight() + 2);
- aStatusSize = LogicToPixel(aStatusSize, MapMode(MapUnit::MapAppFont));
- aStatusSize.setWidth( aTreeViewSize.Width() - 2 - 2 );
-
- Point aStatusPos( aPlaygroundPos.X() + 2, aTreeViewPos.Y() + aTreeViewSize.Height() - aStatusSize.Height() );
- m_pStatus->SetPosSizePixel( aStatusPos, aStatusSize );
- aTreeViewSize.AdjustHeight( -(aStatusSize.Height()) );
- }
-
// set the size of treelistbox
m_pTreeView->SetPosSizePixel( aTreeViewPos, aTreeViewSize );
+ // Call this to trigger InterimItemWindow::Layout immediately, and
+ // not later on idle so the statusbar will be shown to explain
+ // a long delay on opening databases
+ m_pTreeView->Resize();
//set the size of the splitter
m_pSplitter->SetPosSizePixel( aSplitPos, Size( aSplitSize.Width(), aPlaygroundSize.Height() ) );
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 132a659a776f..4c415007709c 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -56,6 +56,7 @@ using namespace ::com::sun::star::view;
InterimDBTreeListBox::InterimDBTreeListBox(vcl::Window* pParent, bool bSQLType)
: InterimItemWindow(pParent, "dbaccess/ui/dbtreelist.ui", "DBTreeList")
, TreeListBox(m_xBuilder->weld_tree_view("treeview"), bSQLType)
+ , m_xStatusBar(m_xBuilder->weld_label("statusbar"))
{
InitControlBase(&GetWidget());
}
@@ -68,6 +69,7 @@ InterimDBTreeListBox::~InterimDBTreeListBox()
void InterimDBTreeListBox::dispose()
{
implStopSelectionTimer();
+ m_xStatusBar.reset();
m_xTreeView.reset();
InterimItemWindow::dispose();
}
diff --git a/dbaccess/source/ui/inc/brwview.hxx b/dbaccess/source/ui/inc/brwview.hxx
index 2d8b4f879dc3..0933861b8cf3 100644
--- a/dbaccess/source/ui/inc/brwview.hxx
+++ b/dbaccess/source/ui/inc/brwview.hxx
@@ -44,7 +44,6 @@ namespace dbaui
VclPtr<InterimDBTreeListBox> m_pTreeView;
VclPtr<Splitter> m_pSplitter;
mutable VclPtr<SbaGridControl> m_pVclControl; // our grid's VCL representation
- VclPtr<vcl::Window> m_pStatus;
DECL_LINK( SplitHdl, Splitter*, void );
// attribute access
diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx
index 4838e5c74d10..7beb90a6d69d 100644
--- a/dbaccess/source/ui/inc/dbtreelistbox.hxx
+++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx
@@ -116,9 +116,12 @@ namespace dbaui
class InterimDBTreeListBox : public InterimItemWindow
, public TreeListBox
{
+ private:
+ std::unique_ptr<weld::Label> m_xStatusBar;
public:
InterimDBTreeListBox(vcl::Window* pParent, bool bSQLType);
virtual void dispose() override;
+ weld::Label& GetStatusBar() { return *m_xStatusBar; }
virtual ~InterimDBTreeListBox() override;
void show_container() { m_xContainer->show(); }
protected:
diff --git a/dbaccess/uiconfig/ui/dbtreelist.ui b/dbaccess/uiconfig/ui/dbtreelist.ui
index e5c692953b62..aa875dd74c83 100644
--- a/dbaccess/uiconfig/ui/dbtreelist.ui
+++ b/dbaccess/uiconfig/ui/dbtreelist.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.36.0 -->
+<!-- Generated with glade 3.38.2 -->
<interface domain="dba">
<requires lib="gtk+" version="3.20"/>
<object class="GtkTreeStore" id="liststore1">
@@ -21,29 +21,30 @@
</columns>
</object>
<object class="GtkBox" id="DBTreeList">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
+ <property name="can-focus">False</property>
+ <property name="no-show-all">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="border_width">0</property>
+ <property name="border-width">0</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</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="can-focus">True</property>
+ <property name="receives-default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
- <property name="headers_visible">False</property>
+ <property name="headers-visible">False</property>
<property name="reorderable">True</property>
- <property name="search_column">2</property>
- <property name="enable_tree_lines">True</property>
+ <property name="search-column">2</property>
+ <property name="enable-tree-lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Macro Library List-selection2"/>
</child>
@@ -82,5 +83,22 @@
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="statusbar">
+ <property name="can-focus">False</property>
+ <property name="no-show-all">True</property>
+ <property name="xalign">0</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="statusbar-atkobject">
+ <property name="AtkObject::accessible-role" translatable="no">static</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
</interface>
More information about the Libreoffice-commits
mailing list