[Kde-pim] KNotes issues

Reinhold Kainhofer reinhold at kainhofer.com
Wed Aug 1 14:42:14 BST 2007


Am Mittwoch, 1. August 2007 schrieb Allen Winter:
> On Tuesday 31 July 2007 8:58:21 pm Reinhold Kainhofer wrote:
> > Am Mittwoch, 1. August 2007 schrieb Allen Winter:
> > > Wuestion.. why can't we simply use
> > > if (  Qt::mightBeRichText( journal()->description() ) ) ...
> > >
> > > Then we don't have to store the custom property.
> > >
> > > Qt::mightBeRichtText() simply looks for any supported tag
> > > before it sees a newline.
> >
> > Imagine a journal entry like:
> > -) Fixed that bad bug with <td>
> >
> > Won't this text-only entry be falsely detected as rich text by
> > Qt::mightBeRichText?
>
> No, because there aren't any tags before the first newline.
> But I get your point.

Huh? The <td> is right before the first newline, so mightBeRichText returns 
true (at least it did in 3.5.x; In particular, enter such a journal and then 
open the journal editor. The edit box will be in richt text mode, because of 
Qt's heuristics.

> > I admit, currently it breaks badly, too, since korganizer simply relies
> > on QTextEditor (which uses mightBeRichText...). Simply try to add a
> > journal with the contents:
> > "test: <ul><li> is completely broken in flopzilla, version -1, but </ul>
> > works just fine!"
>
> Use cases:
> 1) user types in free-form data and we need to guess if they entered
> valid richtext.  In which case we must use a heuristic.  We could write
> our own heuristic so we can "learn as we go".

If a user types in a text containing <sometag>, then we need to preserve that 
text verbatim! Otherwise writing a journal about html, xml or browsers won't 
be possible! I don't thing we should allow raw html input that will then be 
turned into a real html display. The letters that the user enters should be 
shown exactly as (s)he entered them. If he enters <ul><li>blah</ul>, then we 
should not display a list but rather the string "<ul><li>blah</ul>".

> 2) user first selects "rich text" mode.  just like in the kmail composer
> when the user does html composing.  In this case we can simply
> surround the entered data with "<qt>data</qt>".  Then we reading
> that data back in a simple heuristic will detect it as richtext.

This will still break when you write a blog about Qt:
<qt> must be at the beginning of some rich text and for Qt to understand the 
text as rich text, you'll also have to end the string with a </qt>

(Yeah, thats a very pathological example, and I doubt that this case will ever 
happen...)

> Do we really want to have X-KDE-RICHTEXT-DESCRIPTION,
> X-KDE-RICHTEXT-SUMMARY, X-KDE-RICHTEXT-LOCATION, etc flags?

I'm not talking about adding the X-KDE-RICHTEXT as a property of the event, 
like in 
BEGIN:VEVENT
DESCRIPTION:<qt><b>description</b> of the event</qt>
X-KDE-RICHTEXT-DESCRIPTION: HTML
END:VEVENT

I'm rather proposing to add a property parameter X-KDE-RICHTEXT to the 
DESCRIPTION property:
BEGIN:VEVENT
DESCRIPTION;X-KDE-RICHTEXT=HTML:<qt><b>description</b> of the event</qt>
END:VEVENT

Oracle does something similar with their X-ORACLE-PERSONAL-COMMENT-RTF 
parameter for ATTENDEE 
(http://download.oracle.com/docs/cd/B25553_01/calendar.1012/b25489/adcsdk_ical.htm)



> So.. my idea is to have our own isRichText() method.  Initially it would
> simply use Qt::mightBeRichText(). But we could make it smarter as we go.

I don't think we should use any heuristics at all.

Cheers,
Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: reinhold at kainhofer.com, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list