[Libreoffice-commits] core.git: 2 commits - libreofficekit/qa sfx2/source vcl/source

Pranav Kant pranavk at collabora.co.uk
Fri Dec 15 12:12:13 UTC 2017


 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |    9 +++++
 sfx2/source/dialog/basedlgs.cxx                                     |   18 ++++++----
 sfx2/source/dialog/tabdlg.cxx                                       |    6 ++-
 vcl/source/window/dialog.cxx                                        |    4 +-
 vcl/source/window/floatwin.cxx                                      |   10 ++---
 5 files changed, 32 insertions(+), 15 deletions(-)

New commits:
commit 49a58e6e735a90532720f74c8d255056cd018a1a
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Dec 14 20:28:39 2017 +0530

    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)

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index ffef18c8bdfa..5983b7f77e5b 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -315,6 +315,7 @@ void LOKDocViewSigHandlers::window(LOKDocView* pDocView, gchar* pPayload, gpoint
     {
         const std::string aType = aRoot.get<std::string>("type");
         const std::string aSize = aRoot.get<std::string>("size");
+        const std::string aTitle = aRoot.get<std::string>("title", "");
         std::vector<int> aSizePoints = GtvHelpers::split<int>(aSize, ", ", 2);
 
         if (aType == "dialog")
@@ -326,6 +327,9 @@ void LOKDocViewSigHandlers::window(LOKDocView* pDocView, gchar* pPayload, gpoint
             g_signal_connect(pDialog, "destroy", G_CALLBACK(destroyLokDialog), window);
             g_signal_connect(pDialog, "delete-event", G_CALLBACK(deleteLokDialog), window);
 
+            if (!aTitle.empty())
+                gtk_window_set_title(GTK_WINDOW(pDialog), aTitle.c_str());
+
             gtk_window_set_resizable(GTK_WINDOW(pDialog), false);
             gtk_widget_show_all(GTK_WIDGET(pDialog));
             gtk_window_present(GTK_WINDOW(pDialog));
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);
     }
 
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index e7d9b3188520..c247a9e50301 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -697,7 +697,7 @@ void Dialog::StateChanged( StateChangedType nType )
         if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
         {
             std::vector<vcl::LOKPayloadItem> aPayload;
-            aPayload.push_back(std::make_pair(OString("title"), GetText().toUtf8()));
+            aPayload.emplace_back("title", GetText().toUtf8());
             pNotifier->notifyWindow(GetLOKWindowId(), "title_changed", aPayload);
         }
     }
@@ -1202,7 +1202,7 @@ void Dialog::Resize()
     if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
     {
         std::vector<vcl::LOKPayloadItem> aItems;
-        aItems.emplace_back(std::make_pair("size", GetOptimalSize().toString()));
+        aItems.emplace_back("size", GetOptimalSize().toString());
         pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
     }
 }
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index d533f558ec6b..63ae2172fc60 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -614,16 +614,16 @@ void FloatingWindow::StateChanged( StateChangedType nType )
                 // we are a toplevel window, let's so far pretend to be a
                 // dialog - but maybe we'll need a separate type for this
                 // later
-                aItems.emplace_back(std::make_pair("type", "dialog"));
+                aItems.emplace_back("type", "dialog");
             }
             else
             {
                 SetLOKNotifier(pParent->GetLOKNotifier());
-                aItems.emplace_back(std::make_pair("type", "child"));
-                aItems.emplace_back(std::make_pair("parentId", OString::number(pParent->GetLOKWindowId())));
+                aItems.emplace_back("type", "child");
+                aItems.emplace_back("parentId", OString::number(pParent->GetLOKWindowId()));
             }
-            aItems.emplace_back(std::make_pair("size", GetSizePixel().toString()));
-            aItems.emplace_back(std::make_pair("position", mpImplData->maPos.toString()));
+            aItems.emplace_back("size", GetSizePixel().toString());
+            aItems.emplace_back("position", mpImplData->maPos.toString());
             GetLOKNotifier()->notifyWindow(GetLOKWindowId(), "created", aItems);
         }
         else if (!IsVisible() && nType == StateChangedType::Visible)
commit 40990006eafa161ad509c4646a80fd28770e2914
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Dec 14 18:35:04 2017 +0530

    lokdialog: gtv: Set dialog title on callback
    
    Change-Id: I6d96a9e2287afdcaad2f770e4b4c73d3671fc76b
    (cherry picked from commit f0a6fd58575ff6b9ebbfb0835aa8694923ddbffd)

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 78f940cb33c7..ffef18c8bdfa 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -387,6 +387,11 @@ void LOKDocViewSigHandlers::window(LOKDocView* pDocView, gchar* pPayload, gpoint
 
                 gtv_lok_dialog_invalidate(GTV_LOK_DIALOG(pDialog), aGdkRectangle);
             }
+            else if (aAction == "title_changed")
+            {
+                const std::string aTitle = aRoot.get<std::string>("title", "");
+                gtk_window_set_title(pDialog, aTitle.c_str());
+            }
         }
     }
 }


More information about the Libreoffice-commits mailing list