[Libreoffice-commits] core.git: vcl/inc vcl/jsdialog
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 17 08:54:07 UTC 2020
vcl/inc/jsdialog/jsdialogbuilder.hxx | 4 +++-
vcl/jsdialog/jsdialogbuilder.cxx | 27 +++++++++++++++++++++++----
2 files changed, 26 insertions(+), 5 deletions(-)
New commits:
commit 915df5936a5392f48736a4b6ba8219d727482b91
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jul 7 13:15:31 2020 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Jul 17 10:53:27 2020 +0200
jsdialog: force update if tab is selected again
This will allow to add additional tabs in the view
(not existing in the JSON) and switching tabs still
will work properly.
Change-Id: Ia6901da3157b391502d5170f599410bfd6ea2c61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98253
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98900
Tested-by: Jenkins
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index c9673e778c16..688744d98e0c 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -29,11 +29,13 @@ class JSDialogNotifyIdle : public Idle
{
VclPtr<vcl::Window> m_aWindow;
std::string m_LastNotificationMessage;
+ bool m_bForce;
public:
JSDialogNotifyIdle(VclPtr<vcl::Window> aWindow);
void Invoke() override;
+ void ForceUpdate();
};
class JSDialogSender
@@ -46,7 +48,7 @@ public:
{
}
- void notifyDialogState();
+ void notifyDialogState(bool bForce = false);
};
class JSInstanceBuilder : public SalInstanceBuilder
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 33a7b8c3c992..25645de365bf 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -26,10 +26,13 @@ JSDialogNotifyIdle::JSDialogNotifyIdle(VclPtr<vcl::Window> aWindow)
: Idle("JSDialog notify")
, m_aWindow(aWindow)
, m_LastNotificationMessage()
+ , m_bForce(false)
{
SetPriority(TaskPriority::POST_PAINT);
}
+void JSDialogNotifyIdle::ForceUpdate() { m_bForce = true; }
+
void JSDialogNotifyIdle::Invoke()
{
try
@@ -43,8 +46,9 @@ void JSDialogNotifyIdle::Invoke()
tools::JsonWriter aJsonWriter;
m_aWindow->DumpAsPropertyTree(aJsonWriter);
aJsonWriter.put("id", m_aWindow->GetLOKWindowId());
- if (!aJsonWriter.isDataEquals(m_LastNotificationMessage))
+ if (m_bForce || !aJsonWriter.isDataEquals(m_LastNotificationMessage))
{
+ m_bForce = false;
m_LastNotificationMessage = aJsonWriter.extractAsStdString();
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG,
m_LastNotificationMessage.c_str());
@@ -57,7 +61,12 @@ void JSDialogNotifyIdle::Invoke()
}
}
-void JSDialogSender::notifyDialogState() { mpIdleNotify->Start(); }
+void JSDialogSender::notifyDialogState(bool bForce)
+{
+ if (bForce)
+ mpIdleNotify->ForceUpdate();
+ mpIdleNotify->Start();
+}
namespace
{
@@ -485,14 +494,24 @@ JSNotebook::JSNotebook(VclPtr<vcl::Window> aOwnedToplevel, ::TabControl* pContro
void JSNotebook::set_current_page(int nPage)
{
+ bool bForce = false;
+ int nCurrent = get_current_page();
+ if (nCurrent == nPage)
+ bForce = true;
+
SalInstanceNotebook::set_current_page(nPage);
- notifyDialogState();
+ notifyDialogState(bForce);
}
void JSNotebook::set_current_page(const OString& rIdent)
{
+ bool bForce = false;
+ OString sCurrent = get_current_page_ident();
+ if (sCurrent == rIdent)
+ bForce = true;
+
SalInstanceNotebook::set_current_page(rIdent);
- notifyDialogState();
+ notifyDialogState(bForce);
}
void JSNotebook::remove_page(const OString& rIdent)
More information about the Libreoffice-commits
mailing list