From e6830cb5db0dc537fb1b0944a33bfd7eebc2c022 Mon Sep 17 00:00:00 2001
From: Mavridis Philippe <mavridisf@gmail.com>
Date: Tue, 21 Nov 2023 15:05:20 +0200
Subject: TastyMenu: fixes to previous commits

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
---
 src/menuhandler.cpp |  9 ++++++++-
 src/tastymenu.cpp   | 18 ++++++++----------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/menuhandler.cpp b/src/menuhandler.cpp
index 1728439..4894a0a 100644
--- a/src/menuhandler.cpp
+++ b/src/menuhandler.cpp
@@ -30,7 +30,6 @@
 #include <tqcursor.h>
 #include <tqsplitter.h>
 #include <tdepopupmenu.h>
-#include <tqobjectlist.h>
 #include <kdebug.h>
 #include <tqlabel.h>
 #include <time.h>
@@ -482,6 +481,13 @@ void MenuHandler::updateConfig()
   KServiceGroup::Ptr service = KServiceGroup::root();
   menu->rootList->clear();
   populateList( service, menu->rootList, NULL, false );
+
+  TQListViewItemIterator it(menu->childList);
+  while (it.current()) {
+    TastyListViewItem *listItem = static_cast<TastyListViewItem *>(it.current());
+    listItem->setDisplaySubText(_displaySubText);
+    ++it;
+  }
 }
 
 
@@ -1676,6 +1682,7 @@ void MenuHandler::setBackground()
     rootPix->stop();
     delete rootPix;
     rootPix = nullptr;
+    menu->unsetPalette();
   }
 
   if (isTransparent()) {
diff --git a/src/tastymenu.cpp b/src/tastymenu.cpp
index 25c17db..652efa1 100644
--- a/src/tastymenu.cpp
+++ b/src/tastymenu.cpp
@@ -45,7 +45,6 @@
 TastyMenu::TastyMenu(const TQString& configFile, Type type, int actions, TQWidget *parent, const char *name)
   : KPanelApplet(configFile, type, actions, parent, name), numNewApplications(0)
 {
-
     // Get the current application configuration handle
     kConfig = sharedConfig();
     prefSkel = new Prefs(kConfig);
@@ -113,10 +112,10 @@ void TastyMenu::loadMenuButtonIcon()
   //the tooltip has the same icon as the button
   menuTip->loadIcon( _menuButtonIcon );
 
-  if( prefSkel->menuButtonIconType()
-      == Prefs::EnumMenuButtonIconType::IconNone )
+  if( prefSkel->menuButtonIconType() != Prefs::EnumMenuButtonIconType::Icon )
   {
     button->setIconSet(TQIconSet());
+    _iconsize = 0;
     return;
   }
 
@@ -354,13 +353,13 @@ void TastyMenu::setNewApplicationsMessage( int number )
 
 int TastyMenu::widthForHeight(int height) const
 {
-  int buttonWidth = width();
+  int buttonWidth = minimumWidth();
   if( position() == pTop || position() == pBottom )
   {
-    button -> setTextPosition(TQToolButton::BesideIcon);
-    if( prefSkel->menuButtonLabelType()
-        != Prefs::EnumMenuButtonLabelType::MenuButtonNone )
+    if( prefSkel->menuButtonLabelType() != Prefs::EnumMenuButtonLabelType::MenuButtonNone ) {
+      button -> setTextPosition(TQToolButton::BesideIcon);
       return ((button->fontMetrics()).width(button->textLabel())) + _iconsize + 10;
+    }
     else
       return height;
   }
@@ -370,11 +369,10 @@ int TastyMenu::widthForHeight(int height) const
 
 int TastyMenu::heightForWidth(int width) const
 {
-  int buttonHeight = height();
+  int buttonHeight = minimumHeight();
   if( position() == pLeft || position() == pRight )
   {
-    if( prefSkel->menuButtonLabelType()
-        != Prefs::EnumMenuButtonLabelType::MenuButtonNone )
+    if( prefSkel->menuButtonLabelType() != Prefs::EnumMenuButtonLabelType::MenuButtonNone )
     {
       button -> setTextPosition(TQToolButton::BelowIcon);
       return ((button->fontMetrics()).height()) + _iconsize + 10;
-- 
cgit v1.2.1