KDE/kdebase/workspace/plasma/applets
Aaron J. Seigo
aseigo at kde.org
Wed Sep 3 06:24:16 CEST 2008
On Tuesday 02 September 2008, Rafał Miłecki wrote:
> SVN commit 856465 by rmilecki:
>
> Let's make tooltip display time and date of every selected timezone.
cool ...
> M +18 -2 digital-clock/clock.cpp
> M +5 -0 libplasmaclock/clockapplet.cpp
> M +1 -0 libplasmaclock/clockapplet.h
>
>
> --- trunk/KDE/kdebase/workspace/plasma/applets/digital-clock/clock.cpp
> #856464:856465 @@ -135,9 +135,25 @@
> void Clock::updateToolTipContent()
> {
> Plasma::ToolTipManager::ToolTipContent tipData;
> - tipData.mainText = KGlobal::locale()->formatTime(m_time,
> m_showSeconds); - tipData.subText = m_date.toString();
> tipData.image = m_toolTipIcon;
> +
> + QString mainText = m_prettyTimezone + " ";
> + mainText += KGlobal::locale()->formatTime(m_time, m_showSeconds) +
> "<br>"; + mainText += KGlobal::locale()->formatDate(m_date);
> + tipData.mainText = mainText;
> +
> + QString subText;
> + foreach(QString tz, getSelectedTimezones()) {
> + if (tz==currentTimezone()) {
> + continue;
> + }
> + Plasma::DataEngine::Data data = dataEngine("time")->query(tz);
> + subText += "<br><b>" + data["Timezone
> City"].toString().replace("_", " ")+"</b> "; + subText +=
> KGlobal::locale()->formatTime(data["Time"].toTime(), m_showSeconds) + ", ";
> + subText += KGlobal::locale()->formatDate(data["Date"].toDate()); +
> }
> + tipData.subText = subText;
> +
> Plasma::ToolTipManager::self()->setToolTipContent(this,tipData);
> }
this code probably belongs in libplasmaclock so the other clocks can easily
get to it. in fact, i'd suggest having a virtual QString
ClockApplet::toolTipContent() that clocks can override and implement this
feature in ClockApplet itself; that way all clocks can have custom tooltip
content *and* have all timezones shown.
also, though it's a lesser issue, please take care with whitespace ...
"foreach(" should be "foreach (" and there should always be spaces around
operators such as + ...
> ---
> trunk/KDE/kdebase/workspace/plasma/applets/libplasmaclock/clockapplet.cpp
> #856464:856465 @@ -295,6 +295,11 @@
> return d->timezone;
> }
>
> +QStringList ClockApplet::getSelectedTimezones() const
> +{
> + return d->selectedTimezones;
> +}
> +
this sould just be selectedTimezones, without the "get" prefix
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080902/48294fba/attachment.sig
More information about the Plasma-devel
mailing list