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

List:       koffice-devel
Subject:    Re: TextTool commands
From:       Pierre Stirnweiss <pstirnweiss () googlemail ! com>
Date:       2007-03-26 21:17:43
Message-ID: 200703262317.43292.pierre.stirnweiss () t-online ! de
[Download RAW message or body]

On Monday 26 March 2007 22:19:28 Thomas Zander wrote:
> On Monday 26 March 2007 20:07, Pierre Stirnweiss wrote:
> > The advantage I see is that it is that the (in this case) TextBoldCommand
> > can on top of calling QTextDocument undo/redo methods, do some nice other
> > thing (for example notify the track change framework, precisely what has
> > been done/undone).
> >
> > So to summarise, my proposal is not to reimplement the actual editing
> > operations, but just how they are called (or by what in this case).
> >
> > Hope to have been a bit clearer.
>
> Yes, I understood that :)  But thanks for reiterating it.
>
> What you are missing here is that if I type a character in the text tool I
> insert some text. Which generates an undo action.
> Then if I select some text and press the same character it creates a very
> different undo action (it replaces text).

Which is why I still have the undoAvailable signal connected to the 
addUndoCommad slot. So in case an editing action is done that is not covered 
by a specific undoCommand, a generic undo action is still generated.
(Avoiding double undoAction creation (specific+generic) is avoided with the 
use of the existing bool m_allowAddUndoCommand)

>
> Additionally; if I click 'bold' and I don't have a selection; no undo
> action will be generated as no change is made.

which is why the slot tests if anchor=position, in which case the formating is 
applied and no undoAction is generated.

>
> These are just 3 cases where your idea breaks down. You would need to
> basically rewrite the Qt text package to do what you want and put all this
> stuff into commands. And it would be a maintenance nightmare.
>
> Which is why I said you can not do this; you _have_ to depend on the
> qtextdocument undo actions.
> I think I said that 3 times now; so I won't repeat it again :)

which is why I depend on qtextdocument undo actions :)

I still fail to see what re-implementing of Qt text package I am doing (but in 
that case I guess it is hopeless).
The only thing I have done now (as opposed to the first version which was 
admittedly bogus) is take the lines of codes from KoSelectionHandler bold 
slot and put it in the TextBoldCommand cstr and copy the undo/redo of the 
generic undoTextCommand to the specific ones.

>
> Let me know if the signal does not help you.


since it seems my previous idea does not yield a massive enthousiasm :), I 
will have to find another way using only the signal then. I'll have to think 
a bit how to articulate things another way.
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://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