diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-14 20:28:39 +0530 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-19 18:57:50 +0100 |
commit | f4bcc782e7bb232c26749a00f91c586f94e12bbf (patch) | |
tree | e31552c2af246a16f8aada434818bb77b0ffcf78 /sfx2/source/dialog | |
parent | c36413494878bbdfb8c4cf237127d4114eb40fcb (diff) |
lokdialog: If we already have the title, emit it during creation
Some dialogs load the UI before we "Execute()" the dialog, or before the
dialog fires the InitShow event. In those cases, the title event has
already been fired and won't be fired after dialog is created.
Make sure that we send the title for such dialogs.
Change-Id: Ib66238298ad9b0dc85bd269aff37aeadf1fc82e4
(cherry picked from commit 10a88598a4233f2b24548571644a83dc9d20e15d)
(cherry picked from commit 49a58e6e735a90532720f74c8d255056cd018a1a)
Diffstat (limited to 'sfx2/source/dialog')
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index a11ddad63f02..fe740c879b34 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -178,8 +178,10 @@ short SfxModalDialog::Execute() SetLOKNotifier(pViewShell); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; - aItems.emplace_back(std::make_pair("type", "dialog")); - aItems.emplace_back(std::make_pair("size", aSize.toString())); + aItems.emplace_back("type", "dialog"); + aItems.emplace_back("size", aSize.toString()); + if (!GetText().isEmpty()) + aItems.emplace_back("title", GetText().toUtf8()); pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems); } @@ -217,8 +219,10 @@ void SfxModalDialog::StateChanged( StateChangedType nType ) SetLOKNotifier(SfxViewShell::Current()); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; - aItems.emplace_back(std::make_pair("type", "dialog")); - aItems.emplace_back(std::make_pair("size", aSize.toString())); + aItems.emplace_back("type", "dialog"); + aItems.emplace_back("size", aSize.toString()); + if (!GetText().isEmpty()) + aItems.emplace_back("title", GetText().toUtf8()); SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "created", aItems); } else if (nType == StateChangedType::Visible && @@ -278,8 +282,10 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange ) { SetLOKNotifier(pViewShell); std::vector<vcl::LOKPayloadItem> aItems; - aItems.emplace_back(std::make_pair("type", "dialog")); - aItems.emplace_back(std::make_pair("size", GetOptimalSize().toString())); + aItems.emplace_back("type", "dialog"); + aItems.emplace_back("size", GetOptimalSize().toString()); + if (!GetText().isEmpty()) + aItems.emplace_back("title", GetText().toUtf8()); pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems); } diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index eac3ea1968ae..c62a1c315e65 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -524,8 +524,10 @@ short SfxTabDialog::Execute() SetLOKNotifier(pViewShell); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; - aItems.emplace_back(std::make_pair("type", "dialog")); - aItems.emplace_back(std::make_pair("size", aSize.toString())); + aItems.emplace_back("type", "dialog"); + aItems.emplace_back("size", aSize.toString()); + if (!GetText().isEmpty()) + aItems.emplace_back("title", GetText().toUtf8()); pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems); } |