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

List:       kde-commits
Subject:    branches/work/kopete/dev-4.2/kopete/contactlist
From:       Roman Jarosz <kedgedev () gmail ! com>
Date:       2009-03-28 22:34:21
Message-ID: 1238279661.608452.6427.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 946236 by rjarosz:

Don't emit dataChanged if data didn't change.
Reexpand groups on config change.



 M  +5 -2      contactlisttreemodel.cpp  
 M  +11 -0     kopetecontactlistview.cpp  
 M  +1 -0      kopetecontactlistview.h  


--- branches/work/kopete/dev-4.2/kopete/contactlist/contactlisttreemodel.cpp #946235:946236
@@ -241,8 +241,11 @@
 
 		if ( gmi )
 		{
-			gmi->group()->setExpanded( value.toBool() );
-			emit dataChanged( index, index );
+			if ( gmi->group()->isExpanded() != value.toBool() )
+			{
+				gmi->group()->setExpanded( value.toBool() );
+				emit dataChanged( index, index );
+			}
 			return true;
 		}
 	}
--- branches/work/kopete/dev-4.2/kopete/contactlist/kopetecontactlistview.cpp #946235:946236
@@ -235,6 +235,17 @@
 
 }
 
+void KopeteContactListView::setModel( QAbstractItemModel *newModel )
+{
+	if ( model() )
+		disconnect( model(), SIGNAL(layoutChanged()), this, SLOT(reexpandGroups()) );
+
+	QTreeView::setModel( newModel );
+
+	// TODO: This is not the best approach as this is emitted often, find a better way.
+	connect( newModel, SIGNAL(layoutChanged()), this, SLOT(reexpandGroups()) );
+}
+
 void KopeteContactListView::reset()
 {
 	QTreeView::reset();
--- branches/work/kopete/dev-4.2/kopete/contactlist/kopetecontactlistview.h #946235:946236
@@ -65,6 +65,7 @@
 	~KopeteContactListView();
 
 	void initActions( KActionCollection *ac );
+	virtual void setModel( QAbstractItemModel *newModel );
 
 public Q_SLOTS:
 	virtual void reset();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic