sfx2/source/dialog/backingwindow.cxx |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit ce8256032edef03320f9d6ba6deba85977209e8f
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Sep 16 17:28:47 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Sep 17 13:02:39 2022 +0200

    toggle the other togglebutton to the inverse state of this togglebutton
    
    Change-Id: I7e19fdb89b1503644a49d8beaef9ada3fe6beabe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140085
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sfx2/source/dialog/backingwindow.cxx 
b/sfx2/source/dialog/backingwindow.cxx
index a19529fea4f0..8f1554659bde 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -286,12 +286,9 @@ void BackingWindow::initControls()
     mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_OTHER;
     mxAllRecentThumbnails->Reload();
     mxAllRecentThumbnails->ShowTooltips( true );
-    mxAllRecentThumbnails->GrabFocus();
-    mxRecentButton->set_highlight_background();
 
-    //initialize Template view
-    mxLocalView->Hide();
-    mxActions->set_sensitive(true);
+    mxRecentButton->set_active(true);
+    ToggleHdl(*mxRecentButton);
 
     //set handlers
     mxLocalView->setCreateContextMenuHdl(LINK(this, BackingWindow, 
CreateContextMenuHdl));
@@ -583,12 +580,20 @@ IMPL_LINK_NOARG( BackingWindow, FilterHdl, 
weld::ComboBox&, void )
 
 IMPL_LINK( BackingWindow, ToggleHdl, weld::Toggleable&, rButton, void )
 {
-    if( &rButton == mxRecentButton.get() )
+    bool bRecentMode;
+    if (&rButton == mxRecentButton.get())
+        bRecentMode = rButton.get_active();
+    else
+        bRecentMode = !rButton.get_active();
+
+    if (bRecentMode)
     {
         mxLocalView->Hide();
         mxAllRecentThumbnails->Show();
         mxAllRecentThumbnails->GrabFocus();
+        mxRecentButton->set_active(true);
         mxRecentButton->set_highlight_background();
+        mxTemplateButton->set_active(false);
         mxTemplateButton->set_stack_background();
         mxActions->set_sensitive(true);
     }
@@ -599,8 +604,10 @@ IMPL_LINK( BackingWindow, ToggleHdl, weld::Toggleable&, 
rButton, void )
         mxLocalView->Show();
         mxLocalView->reload();
         mxLocalView->GrabFocus();
-        mxTemplateButton->set_highlight_background();
+        mxRecentButton->set_active(false);
         mxRecentButton->set_stack_background();
+        mxTemplateButton->set_active(true);
+        mxTemplateButton->set_highlight_background();
         mxActions->set_sensitive(false);
     }
     applyFilter();

Reply via email to