Saving size of PopupApplet

Aaron J. Seigo aseigo at kde.org
Sun Apr 4 23:08:06 CEST 2010


On April 3, 2010, Rob Hasselbaum wrote:
> On Sat, Apr 3, 2010 at 9:52 PM, Aaron J. Seigo <aseigo at kde.org> wrote:
> > On April 3, 2010, Rob Hasselbaum wrote:
> >> Hi all. How can I coax Plasma into saving the size of a PopupApplet
> >> after a user has changed it? This happens automatically when the
> >> applet is placed on the desktop, but not when it's iconified on a
> >> panel. Thanks!
> > 
> > this seems to be working in trunk. can you provide a more detailed
> > how-to- reproduce? thanks.
> 
> I add my widget to a panel, pop it up, resize it by dragging a corner,
> hide it again, then restart Plasma (kquitapp plasma-desktop or
> logout/login). When the desktop comes back up and I click on the panel
> icon again for the widget, it's back to its original size. Happens in
> KDE 4.3 and 4.4.2.
> 
> Must be something I'm doing in my code, but I don't know what.
> When/how is the size saved?

when the dialog resizes, the new size is saved. this is flushed out to disk 
when either plasma-desktop quits or when another change occurs which prompts a 
call to Corona::requestConfigSync(). 

it doesn't happen immediately because we don't want to hit disk every time a 
window is resized and it's not particularly critical data to save. on the 
other hand, we could make the case that resizing these dialogs doesn't happen 
very often, that Corona::requestConfigSync() compresses multiple calls within 
any given time span, and so the disk access would be moderate. hmm... 
actually, i've just convinced myself, so i'll change that. now it will happen 
whenever the config sync timeout (10s currently) is done.

in any case, the code is in PopupAppletPrivate::dialogSizeChanged() in 
kdelibs/plasma/popupapplet.cpp if you wish to investigate further.

note that if you change the size of the graphicsWidget() that it will change 
the size the dialog. a common mistake in writing plasmoids is to resize the 
plasmoid in init() or some other place which will result in overriding the 
size the user set.

-- 
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 Qt Development Frameworks


More information about the Plasma-devel mailing list