This should fix the bug, that buffer switches are propagated multiple times
[quassel.git] / src / client / buffertreemodel.cpp
index 23e3688..bc2bf0a 100644 (file)
@@ -286,7 +286,7 @@ bool BufferTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
   uint bufferId = bufferList.first().second;
 
   // no self merges (would kill us)
-  if(bufferId == parent.data(BufferUidRole).toInt())
+  if(bufferId == parent.data(BufferUidRole).toUInt())
     return false; 
   
   Q_ASSERT(rootItem->childById(netId));
@@ -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)
-  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);