[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: KDE/kdebase/workspace/plasma/applets
From:       "Aaron J. Seigo" <aseigo () kde ! org>
Date:       2008-09-03 4:24:16
Message-ID: 200809022224.22917.aseigo () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


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


["signature.asc" (application/pgp-signature)]

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic