CVS commit by markey: Make tooltip for Random/Repeat always reflect current on/off state. CCMAIL: amarok-devel@lists.sf.net M +15 -7 toggleLabel.h 1.5 --- kdeextragear-1/amarok/src/statusbar/toggleLabel.h #1.4:1.5 @@ -50,11 +50,5 @@ public: setChecked( isChecked() ); - - QString tip = "
 "; - tip += action->isChecked() ? i18n("%2: on") : i18n("%2: off"); - tip += " "; - const QString path = KGlobal::iconLoader()->iconPath( action->icon(), -KIcon::SizeHuge ); - - QToolTip::add( this, tip.arg( path ).arg( action->text().remove('&') ) ); + setToolTip(); } @@ -80,5 +74,19 @@ public slots: { setPixmap( m_action->iconSet().pixmap( QIconSet::Small, on ? QIconSet::Normal : QIconSet::Disabled ) ); + setToolTip(); + } + +private: + void setToolTip() + { + QString tip = "
 "; + tip += m_action->isChecked() ? i18n("%2: on") : i18n("%2: off"); + tip += " "; + const QString path = KGlobal::iconLoader()->iconPath( m_action->icon(), -KIcon::SizeHuge ); + + QToolTip::remove( this ); + QToolTip::add( this, tip.arg( path ).arg( m_action->text().remove('&') ) ); } + };