<div class="gmail_quote">2012/10/30 Milian Wolff <span dir="ltr"><<a href="mailto:mail@milianw.de" target="_blank">mail@milianw.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey Miha!<br>
<br>
I just had to fix <a href="https://bugs.kde.org/show_bug.cgi?id=309271" target="_blank">https://bugs.kde.org/show_bug.cgi?id=309271</a> and stumbled<br>
upon that file the first time. This needs some serious cleanup imo:<br>
<br>
a) figure out whether the file is a template or not, before trying to read its<br>
contents and rendering it. couldn#t you look for a .desktop file?<br>
b) analogous to b, automatically deduce whether we look at a project or file<br>
template<br></blockquote><div>Hello, I've just started fixing this. I agree the plugin is in a sad state. However, I'm not sure if searching for a .desktop file is easier than rendering a document. Then we have to read the desktop file to determine if it's a template or not. <br>
<br>Having only a manual context menu action "preview as template" doesn't sound good either, because you will often edit more than one file simultaneously (.h and .cpp file, for example). <br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
c) only use one temporary file (create it on the stack in the class) and don't<br>
recreate new ones all the time<br></blockquote><div>The problem here is syntax highlighting in the preview. You generally want this, and the easiest way is to keep the suffix of the original file. This means changing the name of the temp file. I know KTextEditor has methods to set the syntax highlighting mode, I will try to work with this instead. <br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
d) only operate on text documents, i.e. make m_currentDocument a KTextEditor<br>
Document<br>
e) rename m_document to m_preview or similar to make clearer what it does<br>
f) use a stacked widget or similar to show a static error message and also<br>
include a link to the template/project documentation instead of using the text<br>
preview for that<br>
g) use TrimEmptyLines as default which is afaik also used for the templates,<br>
no?</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
h) add a context menu action for template files "preview template" that shows<br>
this toolview, otherwise its just not findable<br>
i) add the preview to the config dialog somehow<br></blockquote><div>This I can do. <br><br>In any case, the biggest problem is detecting whether a file is a template or not, both for rendering and for a context menu action. I really don't have a good answer. <br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
and probably more<br>
<span><font color="#888888">--<br>
Milian Wolff<br>
<a href="mailto:mail@milianw.de" target="_blank">mail@milianw.de</a><br>
<a href="http://milianw.de" target="_blank">http://milianw.de</a></font></span><br>--<br>
KDevelop-devel mailing list<br>
<a href="mailto:KDevelop-devel@kdevelop.org" target="_blank">KDevelop-devel@kdevelop.org</a><br>
<a href="https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel" target="_blank">https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel</a><br>
<br></blockquote></div><br>