mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
plasma: connect digital-clock applet to the KGlobalSettings::localeChanged() signal
because QEvent::LocaleChange or QEvent::LanguageChange may not be received, also for the hints to be calculated correctly the clock string has to be updated first Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f895f839eb
commit
cc32c51f05
2 changed files with 19 additions and 2 deletions
|
@ -89,6 +89,8 @@ DigitalClockApplet::DigitalClockApplet(QObject *parent, const QVariantList &args
|
|||
connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
|
||||
|
||||
m_clockstring = kClockString();
|
||||
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void DigitalClockApplet::init()
|
||||
|
@ -97,6 +99,11 @@ void DigitalClockApplet::init()
|
|||
|
||||
m_timer->start();
|
||||
Plasma::ToolTipManager::self()->registerWidget(this);
|
||||
|
||||
connect(
|
||||
KGlobalSettings::self(), SIGNAL(localeChanged()),
|
||||
this, SLOT(slotLocaleChanged())
|
||||
);
|
||||
}
|
||||
|
||||
void DigitalClockApplet::paintInterface(QPainter *painter,
|
||||
|
@ -151,9 +158,19 @@ void DigitalClockApplet::constraintsEvent(Plasma::Constraints constraints)
|
|||
break;
|
||||
}
|
||||
}
|
||||
emit sizeHintChanged(Qt::MinimumSize);
|
||||
emit sizeHintChanged(Qt::PreferredSize);
|
||||
}
|
||||
}
|
||||
|
||||
void DigitalClockApplet::slotLocaleChanged()
|
||||
{
|
||||
// the time format depends on the locale, update the sizes and poll timer
|
||||
m_clockstring = kClockString();
|
||||
constraintsEvent(Plasma::SizeConstraint);
|
||||
m_timer->setInterval(kClockInterval(KGlobal::locale()->timeFormat(s_timeformat)));
|
||||
}
|
||||
|
||||
void DigitalClockApplet::changeEvent(QEvent *event)
|
||||
{
|
||||
Plasma::Applet::changeEvent(event);
|
||||
|
@ -161,8 +178,7 @@ void DigitalClockApplet::changeEvent(QEvent *event)
|
|||
// the time format depends on the locale, update the sizes and poll timer
|
||||
case QEvent::LocaleChange:
|
||||
case QEvent::LanguageChange: {
|
||||
constraintsEvent(Plasma::SizeConstraint);
|
||||
m_timer->setInterval(kClockInterval(KGlobal::locale()->timeFormat(s_timeformat)));
|
||||
slotLocaleChanged();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
|
@ -48,6 +48,7 @@ protected:
|
|||
private Q_SLOTS:
|
||||
void slotTimeout();
|
||||
void slotConfigAccepted();
|
||||
void slotLocaleChanged();
|
||||
|
||||
private:
|
||||
Plasma::Svg* m_svg;
|
||||
|
|
Loading…
Add table
Reference in a new issue