This should fix the bug, that buffer switches are propagated multiple times
authorMarcus Eggenberger <egs@quassel-irc.org>
Wed, 28 Nov 2007 17:06:04 +0000 (17:06 +0000)
committerMarcus Eggenberger <egs@quassel-irc.org>
Wed, 28 Nov 2007 17:06:04 +0000 (17:06 +0000)
src/client/buffertreemodel.cpp

index 1066c89..bc2bf0a 100644 (file)
@@ -313,8 +313,9 @@ void BufferTreeModel::bufferUpdated(Buffer *buffer) {
 // This Slot indicates that the user has selected a different buffer in the gui
 void BufferTreeModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) {
   Q_UNUSED(command)
 // This Slot indicates that the user has selected a different buffer in the gui
 void BufferTreeModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) {
   Q_UNUSED(command)
-  if(isBufferIndex(index)) {
-    currentBuffer = getBufferByIndex(index);
+  Buffer *newCurrentBuffer;
+  if(isBufferIndex(index) && currentBuffer != (newCurrentBuffer = getBufferByIndex(index))) {
+    currentBuffer = newCurrentBuffer;
     bufferActivity(Buffer::NoActivity, currentBuffer);
     emit bufferSelected(currentBuffer);
     emit selectionChanged(index);
     bufferActivity(Buffer::NoActivity, currentBuffer);
     emit bufferSelected(currentBuffer);
     emit selectionChanged(index);