Review Request: User defined variables (2)

Thorsten Zachmann t.zachmann at zagge.de
Mon Nov 28 06:52:50 GMT 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103276/#review8555
-----------------------------------------------------------


Looks quite good. I have not yet tested it. It would be good if Mek could have a look at the calligra tables changes.


libs/kopageapp/KoPADocument.cpp
<http://git.reviewboard.kde.org/r/103276/#comment7247>

    This should be done in loadOdfProlog



libs/kopageapp/KoPADocument.cpp
<http://git.reviewboard.kde.org/r/103276/#comment7248>

    Should be moved to saveOdfProlog



libs/kotext/KoVariableManager.cpp
<http://git.reviewboard.kde.org/r/103276/#comment7249>

    Is this needded when the variableMapping already contains the variable? or should that is be moved to be under d->userVariableNames some line up.



libs/kotext/KoVariableManager.cpp
<http://git.reviewboard.kde.org/r/103276/#comment7250>

    Please use 
    
    d->userTypes.find(key) and check the iterator as that removes one lookup in the hash.



libs/kotext/KoVariableManager.cpp
<http://git.reviewboard.kde.org/r/103276/#comment7251>

    how about using remove to make sure it is no longer in?



libs/kotext/KoVariableManager.cpp
<http://git.reviewboard.kde.org/r/103276/#comment7245>

    This should not use namedItemNS as this will iterate over all elements which can be very long for big documents. It should use a for loop and quit it when it found the first element that should be after user-field-decls. Doing that way will not cause a slowdown in loading documents.



libs/kotext/KoVariableManager.cpp
<http://git.reviewboard.kde.org/r/103276/#comment7246>

    name can type can be const



plugins/variables/UserVariable.h
<http://git.reviewboard.kde.org/r/103276/#comment7252>

    Is it possible to move the option widget into its own class. That makes it easier for applications not based on QWidget to use it?



plugins/variables/UserVariable.cpp
<http://git.reviewboard.kde.org/r/103276/#comment7254>

    should that really be commented out?



plugins/variables/UserVariable.cpp
<http://git.reviewboard.kde.org/r/103276/#comment7253>

    should this really be commented out?



words/part/KWAboutData.h
<http://git.reviewboard.kde.org/r/103276/#comment7255>

    You are to kind :-)


- Thorsten Zachmann


On Nov. 27, 2011, 3:54 p.m., Sebastian Sauer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103276/
> -----------------------------------------------------------
> 
> (Updated Nov. 27, 2011, 3:54 p.m.)
> 
> 
> Review request for Calligra and Thorsten Zachmann.
> 
> 
> Description
> -------
> 
> Following patch implements user defined variables. This solves bug https://bugs.kde.org/show_bug.cgi?id=282972
> 
> What I did;
> * extended the KoVariableManager to handle now also such user defined variables.
> * the KoVariableManager now has loadOdf and saveOdf methods to load and save user defined variables declarations.
> * the user defined variables are implemented using the new plugins/variables/User* classes.
> * KoVariable::manager() can now be used even on KoVariable::createOptionsWidget
> * replaced the previous unused KoInlineObject::User with KoInlineObject::UserGet and KoInlineObject::UserInput and make use of them
> * extended KoTextLoader.cpp to proper load user defined variables into the KoVariableManager. Instances are created using the new UserVariable plugin.
> * extended KoOdfNumberStyles with the formatFraction method. Ideally I would also move the other format (e.g. formatDate, formatTime, etc.) methods from the plugin to the KoOdfNumberStyles class to have it reusable (we at least need formatDate and KoOdfNumberStyles also in the DateVariable later).
> * added the KoOdfNumberStyles::saveOdfBooleanStyle to also save boolean formattings proper back.
> * introduced the KoOdfNumberStyles::saveOdfNumberStyle method to handle choosing the proper KoOdfNumberStyles::saveOdf*Style methods.
> * extended KWOdfWriter.cpp to proper save the user defined variable declarations back to the ODT.
> 
> Remaining problems;
> * there is no way to add/edit/remove/display such user defined variables in Calligra Tables. Seems oocalc has the same problem.
> * the UI still misses a way to set/modify custom formatings.
> * support for formulas... but this is another beast and partly already covered at bug 283816. I do not plan to work on this anytime soon.
> 
> Update to the first review-request at https://git.reviewboard.kde.org/r/102890/ ;
> * loading of the variables happens now not any longer in the KoTextLoader but in the applications themself right after loading the body-element what is inline with how saving is done.
> * the same logic is applied to Calligra Words, Stage and Tables what means all 3 of them support now loading and saving of user defined variables. Editing can be done direct in the Insert=>Variable=>Custom (should we better rename it to "User defined" rather then "Custom"?) dialog what is inline with how it can be done in OO.org/LO.
> 
> 
> Diffs
> -----
> 
>   libs/kopageapp/KoPADocument.cpp 43e002a 
>   libs/kotext/InsertVariableAction.cpp de68bbf 
>   libs/kotext/KoInlineObject.h fbd1795 
>   libs/kotext/KoVariableManager.h 680a29b 
>   libs/kotext/KoVariableManager.cpp a915b77 
>   libs/kotext/tests/TestKoInlineTextObjectManager.cpp 5bafc82 
>   libs/odf/KoOdfNumberStyles.h 536408d 
>   libs/odf/KoOdfNumberStyles.cpp 5611465 
>   libs/odf/tests/CMakeLists.txt a1c71dc 
>   libs/odf/tests/TestNumberStyle.h PRE-CREATION 
>   libs/odf/tests/TestNumberStyle.cpp PRE-CREATION 
>   plugins/variables/CMakeLists.txt cca8198 
>   plugins/variables/UserVariable.h PRE-CREATION 
>   plugins/variables/UserVariable.cpp PRE-CREATION 
>   plugins/variables/UserVariableFactory.h PRE-CREATION 
>   plugins/variables/UserVariableFactory.cpp PRE-CREATION 
>   plugins/variables/VariablesPlugin.cpp 913aebc 
>   tables/DocBase.h daf758e 
>   tables/DocBase.cpp adb9940 
>   words/part/KWAboutData.h 68e9a6f 
>   words/part/KWOdfLoader.cpp 837280a 
>   words/part/KWOdfWriter.cpp ebfdad9 
> 
> Diff: http://git.reviewboard.kde.org/r/103276/diff/diff
> 
> 
> Testing
> -------
> 
> see the documents attached to bug 282972
> 
> 
> Thanks,
> 
> Sebastian Sauer
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20111128/2cc7f6b0/attachment.htm>


More information about the calligra-devel mailing list