[devel] kdenonbeta/kdedebian/kalternatives/src

Mario Bensi <[email protected]> Mon, 4 Oct 2004 15:53:29 +0200 (CEST)
Newsgroups gmane.comp.kde.devel.debian
Message-ID <20041004135329.E4FDD126EF__8515.54581099681$1096898042$gmane$org@office.kde.org>
CVS commit by bensi: 

change color and font when a alternative is changed or added


  M +2 -3      kalternatives.cpp   1.11
  M +35 -3     treeitemelement.cpp   1.5
  M +2 -2      treeitemelement.h   1.4


--- kdenonbeta/kdedebian/kalternatives/src/kalternatives.cpp  #1.10:1.11
@@ -271,5 +271,4 @@ void Kalternatives::slotDeleteClicked()
                         m_optionsList->takeItem(altItem);
                         
-                        //treeItem->setChanged(TRUE);
                         treeItem->setNbrAltChanged(TRUE);
                         if(!m_bApply->isEnabled() && m_bisRoot)
@@ -327,7 +326,7 @@ void Kalternatives::slotPropertiesClicke
                         text += *it;
                 }
-        }
         prop->m_text->setText(text);
         prop->show();
+        }
 }
 

--- kdenonbeta/kdedebian/kalternatives/src/treeitemelement.cpp  #1.4:1.5
@@ -19,7 +19,12 @@
  ***************************************************************************/
  
- #include "treeitemelement.h"
- #include "altparser.h"
- #include "altcontroller.h"
+#include "treeitemelement.h"
+#include "altparser.h"
+#include "altcontroller.h"
+#include <qfont.h> 
+#include <qpainter.h> 
+
+#include <iostream>
+using namespace std;
 
 TreeItemElement::TreeItemElement(KListView *parent, Item *itemarg, AltController *altControl )
@@ -37,2 +42,29 @@ TreeItemElement::~TreeItemElement()
 {
 }
+
+void TreeItemElement::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align )
+{
+        QColor color;
+        
+        if (m_changed || m_nbrAltChanged)
+        {
+                color=QColor(QColor("red"));
+                QFont f = p->font();
+                f.setBold(true);
+                p->setFont(f);
+        }
+         
+        // the pallet of colors is saved
+        QColorGroup _cg( cg );
+        QColor oldText=_cg.text();
+ 
+        // modification of the pallet of colors by defining 
+        //our new color as color of text
+        _cg.setColor( QColorGroup::Text, color );
+ 
+        QListViewItem::paintCell( p, _cg, column, width, align );
+ 
+        // restoration of the pallet of "standard" colors
+        _cg.setColor( QColorGroup::Text, oldText );
+ 
+}

--- kdenonbeta/kdedebian/kalternatives/src/treeitemelement.h  #1.3:1.4
@@ -50,7 +50,7 @@ public:
         bool isNbrAltChanged() const { return m_nbrAltChanged; }
         AltController *getAltController() {return m_altControl;}
-};
-
 
+        virtual void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align );
+};
 
 #endif //_TREEITEMELEMENT_H_