Magnus Lundborg | 1 Dec 2008 08:54
Picon

Re: [PATCH] Fix warning about missing parentheses around && within || in kchart/kdchart/src/KDChartCartesianAxis.cpp

Alexis Ménard wrote:
>
>
> On Sun, Nov 30, 2008 at 8:49 PM, Johannes Simon 
> <johannes.simon <at> gmail.com <mailto:johannes.simon <at> gmail.com>> wrote:
>
>     On Sunday 30 November 2008 01:25:16 Magnus Lundborg wrote:
>     > This patch fixes six compilation warnings about missing
>     parentheses in
>     > if statements.
>
>     Hi,
>
>     Are you sure that "a && (b || c)" is equivalent to "a && b || c"?
>     As far as I
>     know, it is not ;) But parantheses should be added either way, to
>     make it
>     clearer.
>
>
> Right && has a higher priority than ||. So the patch is wrong in some 
> cases. :D

Hello,

It is definitely true there can be no rule where to put the parentheses 
in a generic "a && b || c" case. But at least they should be added. When 
I have made the patches I have analysed the if statements to find the 
intentions of them. So have you found my submitted patch to be wrong? Or 
do you just mean that it could be wrong in other cases? It is indeed a 
(Continue reading)

Thomas Zander | 1 Dec 2008 09:27
Picon
Favicon

Re: [PATCH] Fix warning about missing parentheses around && within || in kchart/kdchart/src/KDChartCartesianAxis.cpp

On Monday 1. December 2008 08:54:20 Magnus Lundborg wrote:
> > Right && has a higher priority than ||. So the patch is wrong in some
> > cases. :D
>
> Hello,
>
> It is definitely true there can be no rule where to put the parentheses
> in a generic "a && b || c" case.

The logic priority used is found in 'man 7 operator'
you will see that && has higher priority and thus is always executed first. 
Since the compiler started complaining about this confusion only 
recently[1] we have to keep the actual logical meaning in the code. This 
means to add braces around the && area where gcc complains about them.

So with the background that the actual logic as we have now can not change 
the logic for adding parentheses is actually easy;

  a || b && c   =>    a || (b && c)

  a && b || c && d  =>   (a && b) || (c && d)

1) note that even code that gcc complains about does not change logic from 
its intended logic written long ago. gcc just wants us to write things in a 
way that makes it easier to read for everyone.
--

-- 
Thomas Zander
_______________________________________________
(Continue reading)

Thomas Zander | 1 Dec 2008 09:31
Picon
Favicon

Re: questions regarding QTextDocument behaviour

On Sunday 30. November 2008 20:32:05 Pierre Stirnweiss wrote:
> I have committed a working version of the above. 

Cool, thanks for working on real 2.0 fixes!

> To summarize what I have 
> done:
> - the text tool public interface has not been changed.

Note that the text tool is a plugin; the public interface is irrelevant. :)

> - in the private part, the following was done:

I'm just back from holiday; I'll have to look at your actual code later and 
get back to you.

--

-- 
Thomas Zander
_______________________________________________
koffice-devel mailing list
koffice-devel <at> kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
Magnus Lundborg | 1 Dec 2008 10:16
Picon

Re: [PATCH] Fix warning about missing parentheses around && within || in kchart/kdchart/src/KDChartCartesianAxis.cpp

Thomas Zander wrote:
> On Monday 1. December 2008 08:54:20 Magnus Lundborg wrote:
>   
>>> Right && has a higher priority than ||. So the patch is wrong in some
>>> cases. :D
>>>       
>> Hello,
>>
>> It is definitely true there can be no rule where to put the parentheses
>> in a generic "a && b || c" case.
>>     
>
> The logic priority used is found in 'man 7 operator'
> you will see that && has higher priority and thus is always executed first. 
> Since the compiler started complaining about this confusion only 
> recently[1] we have to keep the actual logical meaning in the code. This 
> means to add braces around the && area where gcc complains about them.
>
> So with the background that the actual logic as we have now can not change 
> the logic for adding parentheses is actually easy;
>
>   a || b && c   =>    a || (b && c)
>
>   a && b || c && d  =>   (a && b) || (c && d)
>
> 1) note that even code that gcc complains about does not change logic from 
> its intended logic written long ago. gcc just wants us to write things in a 
> way that makes it easier to read for everyone.
>   
That is true. I will fix that last patch I sent to make it correct.
(Continue reading)

Cyrille Berger | 1 Dec 2008 19:55

Re: [PATCH] Fix warning about missing parentheses around && within || in kchart/kdchart/src/KDChartCartesianAxis.cpp

On Monday 01 December 2008, Thomas Zander wrote:
> Since the compiler started complaining about this confusion only
> recently[1] we have to keep the actual logical meaning in the code.

Unless it was the lack of parentheses was a mistake... It's not about 
readability, it's about making sure that the test do what the author intended 
to do.

--

-- 
Cyrille Berger
Thomas Zander | 1 Dec 2008 21:07
Picon
Favicon

Re: questions regarding QTextDocument behaviour

On Sunday 30. November 2008 20:32:05 Pierre Stirnweiss wrote:
> I have committed a working version of the above.

Hi again,

I just now realize the size of your change; its quite some new code and new 
files and also introducing new concept.

In general the rule for KDE is that if you are new to project, especially if 
you are a first time committer, its appreciated if a patch is sent for 
review and feedback instead of committed in svn.
You can send such a patch to the list or to me personally so we can make 
sure it works well for all.

I'll do a post-commit review on these patches as soon as I can (i'm pretty 
busy after coming back from holidays, so please bear with me). So no 
worries about these patches.  Just for future reference :)

--

-- 
Thomas Zander
_______________________________________________
koffice-devel mailing list
koffice-devel <at> kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
Pierre Stirnweiss | 1 Dec 2008 21:40
Picon
Favicon

Re: questions regarding QTextDocument behaviour

On Monday 01 December 2008 21:07:16 Thomas Zander wrote:

> On Sunday 30. November 2008 20:32:05 Pierre Stirnweiss wrote:

> > I have committed a working version of the above.

>

> Hi again,

>

> I just now realize the size of your change; its quite some new code and new

> files and also introducing new concept.

Actually, it is sort of a copy paste job. The commands actions themselves are copied from the TextTool and the TextSelectionHandler, but yes, I have shuffled things around quite a bit.

As for the concept, I have tried to change as little as possible, (it actually keeps all the UndoTextCommand mechanism), in order to keep all existing code as functional as it already were.

>

> In general the rule for KDE is that if you are new to project, especially

> if you are a first time committer, its appreciated if a patch is sent for

> review and feedback instead of committed in svn.

> You can send such a patch to the list or to me personally so we can make

> sure it works well for all.

this is actually why I didn't commit the other 12 or so commands :)

But I will send patches to the list first in the future.

As for what Florian was asking (with regards to making undo/redo more accessible to other tools), I was wondering if the undoTextCommand (listening to QTextDocument::undoCommandAdded signal,...) mechanism couldn't be moved from the TextTool to the KoTextDocument, that way all this could be abstracted away and the interface could actually be quite simple for tools interfacing with the document. I will have a look later on this.

>

> I'll do a post-commit review on these patches as soon as I can (i'm pretty

> busy after coming back from holidays, so please bear with me). So no

> worries about these patches. Just for future reference :)

Thanks, I am looking into the functioning of the addShapes, new frames,... so I can understand where the undo between shapes actually falls down. I have a gut feeling, there might be just a repaint problem (I wonder if the undo are done but the document is not repainted,...

I am currently trying to crawl my way into how KWord is started and how text shapes are created.

Pierre

_______________________________________________
koffice-devel mailing list
koffice-devel <at> kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
Burkhard Lück | 1 Dec 2008 23:28
Picon

koffice

SVN commit 891389 by lueck:

make the script messages translatable, thanks to Albert and Dag, this works only with Alberts patch for
kdelibs/kross, which is not commited so far
CCMAIL:danders <at> get2net.dk
CCMAIL:aacid <at> kde.org
CCMAIL:koffice-devel <at> kde.org

 M  +1 -1      krita/Messages.sh  
 M  +1 -0      kspread/plugins/scripting/Messages.sh  
 M  +18 -51    kspread/plugins/scripting/scripts/scripts.rc  
 M  +2 -2      kword/Messages.sh  
 AM            kword/plugins/scripting/Messages.sh  
 M  +23 -61    kword/plugins/scripting/scripts/scripts.rc  

--- trunk/koffice/krita/Messages.sh #891388:891389
 <at>  <at>  -3,6 +3,6  <at>  <at> 
 $EXTRACTRC `find . -name \*.rc` >> rc.cpp
 perl extracti18n.pl > i18ndata
 # ignore sdk/templates since it contains templates for use a future plugins, none of the strings there will
ever be seen by any user
-$XGETTEXT i18ndata rc.cpp `find . -name \*.cc -o -name \*.h | grep -v './sdk/templates' | grep -v
'./plugins/paintops/deform'` ui/kis_aboutdata.h -o $podir/krita.pot
+$XGETTEXT i18ndata rc.cpp `find . -name \*.cc -o -name \*.h  -o -name \*.cpp | grep -v './sdk/templates' |
grep -v './plugins/paintops/deform'` ui/kis_aboutdata.h -o $podir/krita.pot
 rm -f i18ndata

--- trunk/koffice/kspread/plugins/scripting/Messages.sh #891388:891389
 <at>  <at>  -1,3 +1,4  <at>  <at> 
 #! /bin/sh
 $EXTRACTRC *.ui *.rc >> rc.cpp || exit 11
+$EXTRACTATTR --attr=collection,text --attr=collection,comment --attr=script,text
--attr=script,comment scripts/*.rc >> rc.cpp || exit 12
 $XGETTEXT ScriptingWriter.h *.cpp -o $podir/krossmodulekspread.pot
--- trunk/koffice/kspread/plugins/scripting/scripts/scripts.rc #891388:891389
 <at>  <at>  -1,121 +1,88  <at>  <at> 
+<!DOCTYPE KrossScripting SYSTEM "kpartgui.dtd">
 <KrossScripting>

     <collection name="import" text="Import" comment="Import content">
-        <script
+        <script text="CSV File" comment="Import from a Comma-Separated-Value File"
             name="pycsvimport"
-            text="CSV File"
-            comment="Import from a Comma-Separated-Value File"
             interpreter="python"
             file="extensions/csvimport.py" />
-        <script
+        <script text="vCard File" comment="Import from a vCard File"
             name="pyvcardimport"
-            text="vCard File"
-            comment="Import from a vCard File"
             interpreter="python"
             file="extensions/vcardimport.py" />
-        <script
+        <script text="Kexi Database" comment="Import from a Kexi Project File"
             name="pykexidbimport"
-            text="Kexi Database"
-            comment="Import from a Kexi Project File"
             interpreter="python"
             file="extensions/kexidbimport.py" />
     </collection>

     <collection name="export" text="Export" comment="Export content">
-        <script
+        <script text="CSV File" comment="Export to a Comma-Separated-Value File"
             name="pycsvexport"
-            text="CSV File"
-            comment="Export to a Comma-Separated-Value File"
             interpreter="python"
             file="extensions/csvexport.py" />
-        <script
+        <script text="Kexi Database" comment="Export to a Kexi Project File"
             name="pykexidbexport"
-            text="Kexi Database"
-            comment="Export to a Kexi Project File"
             interpreter="python"
             file="extensions/kexidbexport.py" />
-        <script
+        <script text="HTML File" comment="Export to a HTML File"
             name="pyhtmlexport"
-            text="HTML File"
-            comment="Export to a HTML File"
             interpreter="python"
             file="extensions/htmlexport.py" />
-        <script
+        <script text="OdfPy File" comment="Export to an OpenDocument File"
             name="odfpyexport"
-            text="OdfPy File"
-            comment="Export to an OpenDocument File"
             interpreter="python"
             file="extensions/odfpyexport.py" />
     </collection>

     <collection name="functions" text="Functions" comment="Scripting formula functions">
-        <script
+        <script text="R-Project" comment="Functions for the R programming environment for data analysis and graphics"
             name="rpyfunctions"
-            text="R-Project"
-            comment="Functions for the R programming environment for data analysis and graphics"
             interpreter="python"
             file="functions/rpyfunctions.py" />
-        <script
+        <script text="YFinance" comment="Yahoo! Finance formula function"
             name="yfinance"
-            text="YFinance"
-            comment="Yahoo! Finance formula function"
             interpreter="python"
             file="functions/yfinance.py" />
-        <script
+        <script text="YWeather" comment="Yahoo! Weather formula function"
             name="yweather"
-            text="YWeather"
-            comment="Yahoo! Weather formula function"
             interpreter="python"
             file="functions/yweather.py" />
-        <script
+        <script text="PyTime" comment="Time formula function"
             name="pytime"
-            text="PyTime"
-            comment="Time formula function"
             enabled="false"
             interpreter="python"
             file="functions/pytime.py" />
-        <script
+        <script text="PyRegExp" comment="Regular Expression formula function"
             name="pyregexp"
-            text="PyRegExp"
-            comment="Regular Expression formula function"
             enabled="false"
             interpreter="python"
             file="functions/pyregexp.py" />
     </collection>

     <collection name="tools" text="Tools" comment="Miscellaneous scripts">
-        <script
+        <script text="XML Viewer" comment="Python script to view the OpenDocument XML representation of the
current document"
            name="pyxmlviewer"
-           text="XML Viewer"
-           comment="Python script to view the OpenDocument XML representation of the current document"
            interpreter="python"
            file="extensions/xmlviewer.py" />
-        <script
+        <script text="Orca Speech" comment="Orca Screen Reader"
            name="pyOrcaScreenReader"
-           text="Orca Speech"
-           comment="Orca Screen Reader"
            interpreter="python"
            file="extensions/myorca.py" />
-        <script
+        <script text="Logger" comment="Log changes in cells to a file"
            name="pylogger"
-           text="Logger"
-           comment="Log changes in cells to a file"
            interpreter="python"
            file="extensions/logger.py" />
     </collection>

     <collection name="docker" text="Docker" comment="Scripting Docker Widgets" enabled="false">
-        <script
+        <script text="Python Console" comment="Interactive Python Console Docker"
            name="pyconsoledocker"
-           text="Python Console"
-           comment="Interactive Python Console Docker"
            enabled="true"
            interpreter="python"
            file="docker/consoledocker.py" />
-        <script
+        <script text="Ruby Snippets" comment="Ruby Snippets"
            name="rbsnippets"
-           text="Ruby Snippets"
-           comment="Ruby Snippets"
            enabled="true"
            interpreter="ruby"
            file="docker/snippetsdocker.rb" />
--- trunk/koffice/kword/Messages.sh #891388:891389
 <at>  <at>  -1,6 +1,6  <at>  <at> 
 #! /bin/sh
 $EXTRACTRC --tag-group=koffice expression/*.xml > xml_doc.cpp
-$EXTRACTRC `find mailmerge part plugins -name \*.ui -o -name \*.rc` >> rc.cpp
-$XGETTEXT rc.cpp *.cpp `find mailmerge part plugins -name \*.cpp -o -name \*.cpp -o -name \*.h | egrep -v
"/old"` -o $podir/kword.pot
+$EXTRACTRC `find mailmerge part -name \*.ui -o -name \*.rc` >> rc.cpp
+$XGETTEXT rc.cpp *.cpp `find mailmerge part -name \*.cpp -o -name \*.cpp -o -name \*.h | egrep -v "/old"`
-o $podir/kword.pot
 rm xml_doc.cpp

** trunk/koffice/kword/plugins/scripting/Messages.sh #property svn:executable
   + *
--- trunk/koffice/kword/plugins/scripting/scripts/scripts.rc #891388:891389
 <at>  <at>  -1,3 +1,4  <at>  <at> 
+<!DOCTYPE KrossScripting SYSTEM "kpartgui.dtd">
 <KrossScripting>

     <!--
 <at>  <at>  -4,65 +5,49  <at>  <at> 
         The "import" collection provides scripts to import content into KWord.
         //-->
     <collection name="import" text="Import" comment="Import content">
-        <script
+        <script text="Text or HTML File" comment="Python script to import content from a text or html file"
                name="pyimportfile"
-               text="Text or HTML File"
-               comment="Python script to import content from a text or html file"
                interpreter="python"
                file="extensions/importfile.py" />
-        <script
+        <script text="Doxygen XML" comment="Python script to import content from a combined doxygen XML file"
                name="pyimportdoxyxml"
-               text="Doxygen XML"
-               comment="Python script to import content from a combined doxygen XML file"
                interpreter="python"
                file="extensions/importdoxyxml.py" />
-        <script
+        <script text="OpenOffice.org UNO" comment="Python script to import content using OpenOffice.org PyUNO"
                name="pyooimport"
-               text="OpenOffice.org UNO"
-               comment="Python script to import content using OpenOffice.org PyUNO"
                interpreter="python"
                file="extensions/ooimport.py" />
     </collection>

     <!--
-        The "import" collection provides scripts to export content from KWord.
+        The "export" collection provides scripts to export content from KWord.
         //-->
     <collection name="export" text="Export" comment="Export content">
-        <script
+        <script text="Text or HTML File" comment="Python script to export content to a text or html file"
                name="pyexportfile"
-               text="Text or HTML File"
-               comment="Python script to export content to a text or html file"
                interpreter="python"
                file="extensions/exportfile.py" />
-        <script
+        <script text="ReportLab.org PDF" comment="Python script to export content to a PDF file using ReportLab.org"
                name="kwreportlab"
-               text="ReportLab.org PDF"
-               comment="Python script to export content to a PDF file using ReportLab.org"
                interpreter="python"
                file="extensions/kwreportlab.py" />
     </collection>

     <!--
-        The "samples" collection provides misc example scripts to demonstrate
+        The "tools" collection provides misc example scripts to demonstrate
         parts of the KWord scripting functionality.
         //-->
     <collection name="tools" text="Tools" comment="Miscellaneous scripts">
-        <script
+        <script text="XML Viewer" comment="Python script to view the OpenDocument XML representation of the
current document"
                name="pyxmlviewer"
-               text="XML Viewer"
-               comment="Python script to view the OpenDocument XML representation of the current document"
                interpreter="python"
                file="extensions/xmlviewer.py" />
-        <script
+        <script text="Document Tree" comment="QtRuby script that displays the document structur within a treeview"
                name="rbdoctree"
-               text="Document Tree"
-               comment="QtRuby script that displays the document structur within a treeview"
                interpreter="ruby"
                file="extensions/doctree.rb" />
-        <script
+        <script text="Online Help" comment="Python script that uses the KHTML Part to display the KWord
Scripting online help"
                name="pyonlinehelp"
-               text="Online Help"
-               comment="Python script that uses the KHTML Part to display the KWord Scripting online help"
                interpreter="python"
                file="extensions/onlinehelp.py" />
     </collection>
 <at>  <at>  -74,10 +59,8  <at>  <at> 
         create an options widget for a variable from within scripts.
     <collection name="variables" text="Variables" comment="Scripting variables for KWord" enabled="false">
             This script reads the value of a variable from an external file.
-        <script
+        <script text="Read From File..." comment="Python script to read a variable from a file"
             name="pyvariablereadfile"
-            text="Read From File..."
-            comment="Python script to read a variable from a file"
             interpreter="python"
             file="variables/variable_readfile.py">
                 This is the default value the variable has.
 <at>  <at>  -95,70 +78,49  <at>  <at> 
         parts of the KWord scripting functionality.
         //-->
     <collection name="samples" text="Samples" comment="Samples to demonstrate scripting with KWord" enabled="false">
-        <script
+        <script text="Insert Shape..." comment="Python script to insert a shape"
             name="pysampleinsertshape"
-            text="Insert Shape..."
-            comment="Python script to insert a shape"
             interpreter="python"
             file="samples/sample_insertshape.py" />
-        <script
+        <script text="Control Cursor..." comment="Ruby script that demonstrates how to control the cursor"
             name="rbsamplecursor"
-            text="Control Cursor..."
-            comment="Ruby script that demonstrates how to control the cursor"
             interpreter="ruby"
             file="samples/sample_cursor.rb" />
-        <script
+        <script text="Execute Action..." comment="Python script that demonstrates usage of actions"
             name="pysampleactions"
-            text="Execute Action..."
-            comment="Python script that demonstrates usage of actions"
             interpreter="python"
             file="samples/sample_actions.py" />
-        <script
+        <script text="Tool Actions..." comment="Python script that demonstrates usage of tool actions"
             name="pysampletoolactions"
-            text="Tool Actions..."
-            comment="Python script that demonstrates usage of tool actions"
             interpreter="python"
             file="samples/sample_toolactions.py" />
-        <script
+        <script text="Progressbar" comment="Python script that demonstrates how to use the progressbar"
             name="pysampleprogressbar"
-            text="Progressbar"
-            comment="Python script that demonstrates how to use the progressbar"
             interpreter="python"
             file="samples/sample_progressbar.py" />
-        <script
+        <script text="Text" comment="Python script that demonstrates usage of the text engine"
             name="pysampletext"
-            text="Text"
-            comment="Python script that demonstrates usage of the text engine"
             interpreter="python"
             file="samples/sample_text.py" />
-        <script
+        <script text="Lists with HTML" comment="Python script that demonstrates how to create lists with HTML"
             name="pysamplelisthtml"
             text="Lists with HTML"
-            comment="Python script that demonstrates how to create lists with HTML"
             interpreter="python"
             file="samples/sample_lists_html.py" />
-        <script
+        <script text="Lists with Cursor" comment="Python script that demonstrates how to create lists with a cursor"
             name="pysamplelistcursor"
-            text="Lists with Cursor"
-            comment="Python script that demonstrates how to create lists with a cursor"
             interpreter="python"
             file="samples/sample_lists_cursor.py" />
-        <script
+        <script text="Tables" comment="Python script that demonstrates how to deal with tables"
             name="pysampletables"
-            text="Tables"
-            comment="Python script that demonstrates how to deal with tables"
             interpreter="python"
             file="samples/sample_tables.py" />
-        <script
+        <script text="Variables" comment="Python script that demonstrates how to handle variables"
             name="pysamplevariables"
-            text="Variables"
-            comment="Python script that demonstrates how to handle variables"
             interpreter="python"
             file="samples/sample_variables.py" />
-        <script
+        <script text="All Shapes" comment="Python script adds all shapes"
             name="pysampleallshapes"
-            text="All Shapes"
-            comment="Python script adds all shapes"
             interpreter="python"
             file="samples/sample_allshapes.py" />
     </collection>

Magnus Lundborg | 2 Dec 2008 00:28
Picon

[PATCH] Fix problem with tabstops in filters/liboofilter/ooutils.cc

I am sorry about my last patch which proved erroneous. I hope this is 
better.

My oowriter files do not contain the prefix ("style") in the tagName. I 
split the checks so that the prefix and the tagName are examined 
separately to avoid a crash.

If someone else has got files to test this it would be good.

Best Regards
/Magnus
Index: filters/liboofilter/ooutils.cc
===================================================================
--- filters/liboofilter/ooutils.cc	(revision 891384)
+++ filters/liboofilter/ooutils.cc	(working copy)
 <at>  <at>  -208,7 +208,8  <at>  <at> 
     for ( KoXmlNode it = tabStops.firstChild(); !it.isNull(); it = it.nextSibling() )
     {
         KoXmlElement tabStop = it.toElement();
-        Q_ASSERT( tabStop.tagName() == "style:tab-stop" );
+	Q_ASSERT( tabStop.prefix() == "style" );
+	Q_ASSERT( tabStop.tagName() == "tab-stop" );
         QString type = tabStop.attributeNS( ooNS::style, "type", QString() ); // left, right, center or char

         QDomElement elem = parentElement.ownerDocument().createElement( "TABULATOR" );
_______________________________________________
koffice-devel mailing list
koffice-devel <at> kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
Thorsten Zachmann | 2 Dec 2008 06:04
Picon
Favicon

Re: questions regarding QTextDocument behaviour

Hello Pierre,

> Thanks, I am looking into the functioning of the addShapes, new frames,...
> so I can understand where the undo between shapes actually falls down. I
> have a gut feeling, there might be just a repaint problem (I wonder if the
> undo are done but the document is not repainted,...

I don't think that is the case as you can trigger a repaint by switching to a 
different window and back but that does not change anything.

Thorsten

Gmane