changeset 25805:ae2c9f1427f0

update news window contents when community news are requeted a second time * main-window.cc (display_community_news): update the browser contents with the given news text if the window already exists
author Torsten <mttl@mailbox.org>
date Thu, 16 Aug 2018 19:36:39 +0200
parents 440d7766b5c6
children 0360ed7c39a8
files libgui/src/main-window.cc
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Wed Aug 15 16:40:57 2018 -0700
+++ b/libgui/src/main-window.cc	Thu Aug 16 19:36:39 2018 +0200
@@ -613,6 +613,15 @@
         m_community_news_window->move ((win_x - m_community_news_window->width ())/2,
                                        (win_y - m_community_news_window->height ())/2);
       }
+    else
+      {
+        // Window already exists, just update the browser contents
+        QTextBrowser *browser
+          = m_community_news_window->findChild<QTextBrowser *>("OctaveNews",
+                                                  Qt::FindDirectChildrenOnly);
+        if (browser)
+          browser->setHtml (news);
+      }
 
     if (! m_community_news_window->isVisible ())
       m_community_news_window->show ();