PlasMate questions

Aaron J. Seigo aseigo at kde.org
Fri Nov 6 18:52:24 CET 2009


On November 6, 2009, Yuen Hoe Lim wrote:
> Yeah, it's me again >.< So I've been spending my free time hacking at
> PlasMate (mainly editor/previewer related atm) and have more than a couple
> of questions that I hope you kind people can give me a hand on :)
> 
> First up is a programming question. I'm trying to get the editor (katepart)
> to remember its size (or relative size) so that after the user adjusts the
> editor size once, it will be that size whenever the editor is activated. I
> can't do it :( I've tried the obvious - saving the width and height and
> attempting to restore it later - but I don't know how to restore it,
> resize() doesn't work, and I don't want to use setFixedSize or
> setMinimumSize which would prevent/limit further resizing by the user. I've
> also tried not deleting the kpart and reusing it everytime - but then I
> discovered that QMainWindow takes ownership of your widget once you set it
> as central widget, so eventually QMainWindow happily deletes the kpart, and
> plasmate crashes. Any other alternative methods I can try to achieve this?
> It seemed like it would be easy to do at first =(

if it's using a QSplitter (which it is iirc?) then you need to set the sizes 
of the splitter not the widgets in it.

> Second, I think minus some rough edges (like the abovementioned issue), the
> previewer+editor is mostly done (for plasmoids anyway). 

great :)

> I'm thinking it's
> probably time to start making progress on the publishing widget. Do we have
> a mockup or something of that sitting somewhere that I can refer to to get
> me started? :)

no mockup yet, no. to start with it only needs to ask for a location on disk 
to put the package. the next step would include uploading via GetHotNewStuff.

> Third, I'm guessing that the 'New' buttons in the editor tree should not
> behave like they currently do. I'm guessing they should really pop up a
> dialog asking for a filename for the new file?

yes :)

> I'm also thinking that this
> dialog should probably be the same as the one you see in dolphin/konqueror
> when creating a new file, so... is there a possibility of reusing some code
> somewhere for that?

they just use:

dialogText = i18n( "Filename for clipboard content:" );
QString file = KInputDialog::getText( QString(), dialogText, QString(), &ok, 
widget );


> Fourth, I noticed that katepart creates backup files (terminating with a
> '~') whenever plasmate autosaves a file, and then that backup file shows up
> in the editor tree and makes it look ugly :P It clearly has to go, my
> question is does it make more sense to just get plasmate to ignore files
> ending with a '~', or should I find a way to stop katepart from creating
> backups?

there is no way to do this currently via KTextEditor::ConfigInterface. worse 
yet, the suffix is configurable so no matter what we do it could end up not 
working properly.

so we could either hack around it and assume a ~ ending to file names, or we 
we could offer a patch to kdelibs/kate/document/katedocument.cpp in 
KateDocument::setConfigValue to the kate developers, however. something like 
the attached patch.

and then we could configure the backup strategy of katepart to match our needs 
in plasmate using KTextEditor::ConfigInterface.

kate devels: what do you think?

the two patches do the config in two different ways for the backup setting; 
one uses a set of simple string values: none, local, remote or all. the second 
patch uses a comma separated string and recognizes the values local and 
remote. so "none" in the first patch is equiv to QString() in the second; 
"local" to "local"; "remote" to "remote"; "all" to "local,remote". i wasn't 
sure which would fit the kate devel's preferences better, so i offer a patch 
doing it each way. suggestions to third ways welcome :)

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: katedocument_backupconfig.diff
Type: text/x-patch
Size: 1177 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20091106/214ea004/attachment-0002.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: katedocument_backupconfig_2.diff
Type: text/x-patch
Size: 1025 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20091106/214ea004/attachment-0003.diff 
-------------- 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/20091106/214ea004/attachment-0001.sig 


More information about the Plasma-devel mailing list