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-07 13:49:15 +0200
commitaff12153caab1abd5ab576cf5ff36b49c25310d4 (patch)
tree2f42f8262e2f100a2188c2c1068db8f1ce84c1a7 /vcl/jsdialog
parentf54d3aa9bee7bc794b18b968835c6d6393f350ea (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>
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 4601a26d4cd1..d9fcf3032081 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -22,10 +22,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
@@ -41,8 +44,9 @@ void JSDialogNotifyIdle::Invoke()
aTree.put("id", m_aWindow->GetLOKWindowId());
boost::property_tree::write_json(aStream, aTree);
const std::string message = aStream.str();
- if (message != m_LastNotificationMessage)
+ if (m_bForce || message != m_LastNotificationMessage)
{
+ m_bForce = false;
m_LastNotificationMessage = message;
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str());
}
@@ -54,7 +58,12 @@ void JSDialogNotifyIdle::Invoke()
}
}
-void JSDialogSender::notifyDialogState() { mpIdleNotify->Start(); }
+void JSDialogSender::notifyDialogState(bool bForce)
+{
+ if (bForce)
+ mpIdleNotify->ForceUpdate();
+ mpIdleNotify->Start();
+}
JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot,
const OUString& rUIFile)
@@ -479,14 +488,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)