TastyMenu: fixes to previous commits

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
feat/minor-improvements
Mavridis Philippe 6 months ago
parent dcfb02cce1
commit e6830cb5db
No known key found for this signature in database
GPG Key ID: 93F66F98F906147D

@ -30,7 +30,6 @@
#include <tqcursor.h> #include <tqcursor.h>
#include <tqsplitter.h> #include <tqsplitter.h>
#include <tdepopupmenu.h> #include <tdepopupmenu.h>
#include <tqobjectlist.h>
#include <kdebug.h> #include <kdebug.h>
#include <tqlabel.h> #include <tqlabel.h>
#include <time.h> #include <time.h>
@ -482,6 +481,13 @@ void MenuHandler::updateConfig()
KServiceGroup::Ptr service = KServiceGroup::root(); KServiceGroup::Ptr service = KServiceGroup::root();
menu->rootList->clear(); menu->rootList->clear();
populateList( service, menu->rootList, NULL, false ); 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(); rootPix->stop();
delete rootPix; delete rootPix;
rootPix = nullptr; rootPix = nullptr;
menu->unsetPalette();
} }
if (isTransparent()) { if (isTransparent()) {

@ -45,7 +45,6 @@
TastyMenu::TastyMenu(const TQString& configFile, Type type, int actions, TQWidget *parent, const char *name) TastyMenu::TastyMenu(const TQString& configFile, Type type, int actions, TQWidget *parent, const char *name)
: KPanelApplet(configFile, type, actions, parent, name), numNewApplications(0) : KPanelApplet(configFile, type, actions, parent, name), numNewApplications(0)
{ {
// Get the current application configuration handle // Get the current application configuration handle
kConfig = sharedConfig(); kConfig = sharedConfig();
prefSkel = new Prefs(kConfig); prefSkel = new Prefs(kConfig);
@ -113,10 +112,10 @@ void TastyMenu::loadMenuButtonIcon()
//the tooltip has the same icon as the button //the tooltip has the same icon as the button
menuTip->loadIcon( _menuButtonIcon ); menuTip->loadIcon( _menuButtonIcon );
if( prefSkel->menuButtonIconType() if( prefSkel->menuButtonIconType() != Prefs::EnumMenuButtonIconType::Icon )
== Prefs::EnumMenuButtonIconType::IconNone )
{ {
button->setIconSet(TQIconSet()); button->setIconSet(TQIconSet());
_iconsize = 0;
return; return;
} }
@ -354,13 +353,13 @@ void TastyMenu::setNewApplicationsMessage( int number )
int TastyMenu::widthForHeight(int height) const int TastyMenu::widthForHeight(int height) const
{ {
int buttonWidth = width(); int buttonWidth = minimumWidth();
if( position() == pTop || position() == pBottom ) if( position() == pTop || position() == pBottom )
{ {
button -> setTextPosition(TQToolButton::BesideIcon); if( prefSkel->menuButtonLabelType() != Prefs::EnumMenuButtonLabelType::MenuButtonNone ) {
if( prefSkel->menuButtonLabelType() button -> setTextPosition(TQToolButton::BesideIcon);
!= Prefs::EnumMenuButtonLabelType::MenuButtonNone )
return ((button->fontMetrics()).width(button->textLabel())) + _iconsize + 10; return ((button->fontMetrics()).width(button->textLabel())) + _iconsize + 10;
}
else else
return height; return height;
} }
@ -370,11 +369,10 @@ int TastyMenu::widthForHeight(int height) const
int TastyMenu::heightForWidth(int width) const int TastyMenu::heightForWidth(int width) const
{ {
int buttonHeight = height(); int buttonHeight = minimumHeight();
if( position() == pLeft || position() == pRight ) if( position() == pLeft || position() == pRight )
{ {
if( prefSkel->menuButtonLabelType() if( prefSkel->menuButtonLabelType() != Prefs::EnumMenuButtonLabelType::MenuButtonNone )
!= Prefs::EnumMenuButtonLabelType::MenuButtonNone )
{ {
button -> setTextPosition(TQToolButton::BelowIcon); button -> setTextPosition(TQToolButton::BelowIcon);
return ((button->fontMetrics()).height()) + _iconsize + 10; return ((button->fontMetrics()).height()) + _iconsize + 10;

Loading…
Cancel
Save