summaryrefslogtreecommitdiff
path: root/vcl/jsdialog
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-07-07 13:15:31 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2020-07-17 10:53:27 +0200
commit915df5936a5392f48736a4b6ba8219d727482b91 (patch)
tree1217abd554447522b222731792f2ffdda3b27965 /vcl/jsdialog
parent710edb329fe73433f17e81839313ac9551a4aec4 (diff)
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@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98900 Tested-by: Jenkins
Diffstat (limited to 'vcl/jsdialog')
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx27
1 files changed, 23 insertions, 4 deletions
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)