From kde-commits Sat Mar 31 22:31:52 2012 From: John Layt Date: Sat, 31 Mar 2012 22:31:52 +0000 To: kde-commits Subject: [kdeplasma-addons] applets/fuzzy-clock: Fuzzy Clock: Use proper date api Message-Id: <20120331223152.385B8A60A9 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=133323319815023 Git commit 6427816afb476dcc30d7be2457d2a6bd9ec746cf by John Layt. Committed on 01/04/2012 at 00:30. Pushed by jlayt into branch 'master'. Fuzzy Clock: Use proper date api Use the correct date api instead of a temp locale. KF5 prep. M +5 -9 applets/fuzzy-clock/fuzzyClock.cpp http://commits.kde.org/kdeplasma-addons/6427816afb476dcc30d7be2457d2a6bd9ec= 746cf diff --git a/applets/fuzzy-clock/fuzzyClock.cpp b/applets/fuzzy-clock/fuzzy= Clock.cpp index d67e912..2cd189d 100644 --- a/applets/fuzzy-clock/fuzzyClock.cpp +++ b/applets/fuzzy-clock/fuzzyClock.cpp @@ -28,6 +28,7 @@ #include #include #include +#include = #include = @@ -296,13 +297,9 @@ void Clock::calculateDateString() return; } = - KLocale tmpLocale(*KGlobal::locale()); - tmpLocale.setDateFormat("%e"); // day number of the month - QString day =3D tmpLocale.formatDate(m_date); - tmpLocale.setDateFormat("%b"); // short form of the month - QString month =3D tmpLocale.formatDate(m_date); - tmpLocale.setDateFormat("%Y"); // the year with four digits - QString year =3D tmpLocale.formatDate(m_date); + QString day =3D KGlobal::locale()->calendar()->formatDate(m_date, KLoc= ale::Day, KLocale::ShortNumber); + QString month =3D KGlobal::locale()->calendar()->formatDate(m_date, KL= ocale::Month, KLocale::ShortName); + QString year =3D KGlobal::locale()->calendar()->formatDate(m_date, KLo= cale::Year, KLocale::LongNumber); = //Copied from the digital-clock if (m_showDate) { @@ -317,8 +314,7 @@ void Clock::calculateDateString() "%1 %2", day, month); } if (m_showDay) { - tmpLocale.setDateFormat("%a"); // short weekday - QString weekday =3D tmpLocale.formatDate(m_date); + QString weekday =3D KGlobal::locale()->calendar()->formatDate(= m_date, KLocale::DayOfWeek, KLocale::ShortName); m_dateString =3D i18nc("@label Day of the week with date: " "%1 short day name, %2 short date", "%1, %2", weekday, m_dateString);