mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-23 10:22:50 +00:00
kpowercontrol: reset the overlay icon when setting the profile does not fail
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f847278b75
commit
a9b2e3cd92
1 changed files with 4 additions and 3 deletions
|
@ -60,7 +60,7 @@ KPowerControl::KPowerControl(QObject* parent)
|
|||
m_menu->addSeparator();
|
||||
} else {
|
||||
setOverlayIconByName("dialog-error");
|
||||
showMessage(i18n("Power management"), i18n("Power manager is not activer"), "dialog-error");
|
||||
showMessage(i18n("Power management"), i18n("Power manager is not active"), "dialog-error");
|
||||
}
|
||||
|
||||
m_helpmenu = new KHelpMenu(associatedWidget(), KGlobal::mainComponent().aboutData());
|
||||
|
@ -75,6 +75,7 @@ void KPowerControl::slotChangeProfile()
|
|||
{
|
||||
KAction* profileaction = qobject_cast<KAction*>(sender());
|
||||
if (m_powermanager.setProfile(profileaction->iconText())) {
|
||||
setOverlayIconByName(QString());
|
||||
// do not wait for the signal to be emited
|
||||
slotProfileChanged(profileaction->iconText());
|
||||
} else {
|
||||
|
@ -85,11 +86,11 @@ void KPowerControl::slotChangeProfile()
|
|||
|
||||
void KPowerControl::slotProfileChanged(const QString &profile)
|
||||
{
|
||||
const QString profile_objectname = QString::fromLatin1("profile_%1").arg(profile);
|
||||
const QString profileobjectname = QString::fromLatin1("profile_%1").arg(profile);
|
||||
foreach (QAction* qaction, actionCollection()->actions()) {
|
||||
const QString qactionobjectname = qaction->objectName();
|
||||
if (qactionobjectname.startsWith(QLatin1String("profile_"))) {
|
||||
qaction->setChecked(qactionobjectname == profile_objectname);
|
||||
qaction->setChecked(qactionobjectname == profileobjectname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue