Fixed custom Views
[quassel.git] / src / client / buffertreemodel.cpp
index 23e3688..d62d804 100644 (file)
@@ -1,11 +1,11 @@
 /***************************************************************************
- *   Copyright (C) 2005-07 by The Quassel Team                             *
+ *   Copyright (C) 2005-07 by the Quassel IRC Team                         *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
+ *   (at your option) version 3.                                           *
  *                                                                         *
  *   This program is distributed in the hope that it will be useful,       *
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
@@ -43,7 +43,7 @@ BufferTreeItem::BufferTreeItem(Buffer *buffer, TreeItem *parent)
   setFlags(flags);
 }
 
-uint BufferTreeItem::id() const {
+quint64 BufferTreeItem::id() const {
   return buf->bufferInfo().uid();
 }
 
@@ -122,7 +122,7 @@ QVariant NetworkTreeItem::data(int column, int role) const {
   }
 }
 
-uint NetworkTreeItem::id() const {
+quint64 NetworkTreeItem::id() const {
   return _networkId;
 }
 
@@ -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));
@@ -306,15 +306,15 @@ bool BufferTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
 
 void BufferTreeModel::bufferUpdated(Buffer *buffer) {
   QModelIndex itemindex = getOrCreateBufferItemIndex(buffer);
-  emit invalidateFilter();
   emit dataChanged(itemindex, itemindex);
 }
 
 // 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);