Patch for system tray layouting

Mathias Kraus k.matze at gmx.net
Sun Jun 15 14:19:54 CEST 2008


Rafael Fernández López schrieb am Sunday 15 June 2008:
> Hi,
>
> Actually, a real patch would work. A real patch helps people who are not
> the author but can give feedback by reading the rest of the code (like me)
> to give a hand.
>
> What I can tell, and is in relation to what Bernhard said is: really guys,
> if we ever go mobile, we will just cry because of all those hard coded
> values we will have to change. For this sizes, instead of a pretty hard
> coded value (22), use, please, KIconLoader::SizeSmallMedium.
>
> If we ever go mobile, we can do SizeSmallMedium = 11 and all our icons will
> be smaller, without the need of changing hard coded values everywhere.
>
> However, the logic of the (patch?) makes sense for me.

Thanks

> Next time, please, do a "svn diff", which will be much better for review,
> rather than posting directly code on your message :)


Sorry, I have no experience with this. It just annoyed me, so I looked for the 
bug and as it seemed to be easy I to fix, I did it myself and thought you guys 
would appreciate to have a little less work to do :)
Here is the svn diff.

Index: systemtraywidget.cpp                                                                       
===================================================================                               
--- systemtraywidget.cpp        (Revision 820519)                                                 
+++ systemtraywidget.cpp        (Arbeitskopie)                                                    
@@ -132,31 +132,31 @@                                                                             
                                                                                                  
     // Figure out where the next widget should go                                                
     if (m_orientation == Qt::Horizontal) {                                                       
+        // Calculate the items that fit into a column                                            
+        m_maxCount = (maximumHeight() + m_mainLayout->spacing()) / (widget-
>height() + m_mainLayout->spacing()) -1;           
+                                                                                                                              
         setMinimumSize(QSize(22 * (m_nextColumn + 1) + m_mainLayout-
>spacing() * m_nextColumn,                                
                              22 * (m_maxCount + 1) + m_mainLayout->spacing() 
* m_maxCount));                                  
+                                                                                                                              
         // Add down then across when horizontal                                                                               
         m_nextRow++;                                                                                                          
-        if ((m_nextRow == m_maxCount && m_nextColumn != 0) ||                                                                 
-            minimumHeight() + widget->height() + m_mainLayout->spacing() > 
maximumHeight()) {                                 
+        if (m_nextRow > m_maxCount){                                                                                          
             m_nextColumn++;                                                                                                   
             m_nextRow = 0;
         }
-        if (m_nextColumn == 0) {
-            m_maxCount = m_nextRow;
-        }
     } else {
+        // Calculate the items that fit into a row
+        m_maxCount = (maximumWidth() + m_mainLayout->spacing()) / (widget-
>width() + m_mainLayout->spacing()) -1;
+
         setMinimumSize(QSize(22 * (m_maxCount + 1) + m_mainLayout->spacing() 
* m_maxCount,
                              22 * (m_nextRow + 1) + m_mainLayout->spacing() * 
m_nextRow));
+
         // Add across then down when vertical
         m_nextColumn++;
-        if ((m_nextColumn == m_maxCount && m_nextRow != 0) ||
-            minimumWidth() + widget->width() + m_mainLayout->spacing() > 
maximumWidth()) {
+        if (m_nextColumn > m_maxCount) {
             m_nextRow++;
             m_nextColumn = 0;
         }
-        if (m_nextRow == 0) {
-            m_maxCount = m_nextColumn;
-        }
     }
 }

I have no svn account. Can someone else submit it for me?

Regards,
Mathias Kraus

>
> Regards,
> Rafael Fernández López.


More information about the Panel-devel mailing list