[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: patch: (preliminary) fix for #31732
From:       David Faure <david () mandrakesoft ! com>
Date:       2002-01-15 23:24:47
[Download RAW message or body]

On Tuesday 15 January 2002 23:34, Emmanuel Touzery wrote:
> >OK, so what about making those method return a KCommand ?
> > we still need kotextobject to emit the command when not 
> >called through kotextformatinterface.
> 
> what do you mean, not called through kotextformatinterface?

i.e. when kwview.cc calls KoTextObject::setBold() directly.

> we would need an additionnal method commit() or apply() to do the actual 
> m_doc->addCommand(), that's what i meant when i talked about breaking code.
> that would be unnatural to type edit->setBold();edit->apply(); just for 
> normal text.

I'm not too sure what you call apply().
If you mean adding the command... I see nothing wrong with
KCommand *cmd = edit->setBoldCommand();
m_doc->addCommand( cmd );

It gives control to the caller, which is what we need.
(Same solution has been used a lot in KWord already).

> [merging the other mail]
> or we could make
> KCommand *setBold(bool applyCommand=true)
Hmm, that might work but is a bit of a strange API, IMHO.
The returned command shouldn't be used if applyCommand is true, which is a bit 
dangerous.

> i prefer that idea. of course, that's unless you have already a better one. 
> when call with false, it would not do the m_doc->addCommand(). and it would 
> not break kpresenter code and still look quite natural.
On the contrary, kpresenter needs to take care of those commands too,
(in the case of complete textobjects being modified, just like KWord).
So better fix both with one rock ;)

> there's also the possibility to add setBoldCommand and setBold that uses it.

I think I prefer this last one.
It's consistent with all the other methods in KWTextFrameset...
It's only that setBold() was calling setFormat(), which called 
setFormatCommand(). setBoldCommand would be calling setFormatCommand() 
directly, and that's all.

We can even getting rid of setBold, since it might be called from a single 
place anyway (kwview), which could use setBoldCommand directly.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david, http://www.konqueror.org
KDE 3.0: Konquering the Desktops
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic