KDE/kdebase/workspace/plasma/applets/battery

Aaron J. Seigo aseigo at kde.org
Thu Sep 18 04:13:29 CEST 2008


On Wednesday 17 September 2008, Sebastian Kügler wrote:
>  void Battery::init()
>  {
> +    new Plasma::Extender(this);
> +    extender()->setEmptyExtenderMessage(i18n("no running jobs..."));
> +    extender()->setSizePolicy(QSizePolicy::MinimumExpanding,

this makes me wonder if Applet::extender() shouldn't be:

if (!d->extender) {
    new Extender(this);
}

is there a use case for accessing extender() to check for null (no extender)?

in fact, since Applet is a friend of Extender, the Extender constructor could 
be made protected. this would allow people to still subclass Extender if so 
desired, but would prevent people from accidently creating more than one 
Extender!

also, in Extender::Extender, shouldn't there be a check for applet->d-
>extender? and if one exists delete it? (and perhaps migrate it's items?)

-- 
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/20080917/9b4e253f/attachment.sig 


More information about the Plasma-devel mailing list