fixed bufferswitches when using different buffer views
[quassel.git] / src / client / buffermodel.cpp
index 3dfdc6d..c487e0f 100644 (file)
@@ -30,6 +30,10 @@ BufferModel::BufferModel(NetworkModel *parent)
     _selectionModelSynchronizer(this)
 {
   setSourceModel(parent);
+  if(QCoreApplication::instance()->arguments().contains("--debugbufferswitches")) {
+    connect(_selectionModelSynchronizer.selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
+           this, SLOT(debug_currentChanged(const QModelIndex &, const QModelIndex &)));
+  }
 }
 
 bool BufferModel::filterAcceptsRow(int sourceRow, const QModelIndex &parent) const {
@@ -65,9 +69,6 @@ void BufferModel::setCurrentIndex(const QModelIndex &newCurrent) {
 }
 
 void BufferModel::debug_currentChanged(QModelIndex current, QModelIndex previous) {
-  qDebug() << "New current:" << current << "(previous:" << previous << ")";
-}
-
-void BufferModel::debug_selectionChanged(QItemSelection current , QItemSelection previous) {
-  qDebug() << "new selection:" << current << "(previoius:" << previous << ")";
+  Q_UNUSED(previous);
+  qDebug() << "Switched current Buffer: " << current << current.data().toString() << "Buffer:" << current.data(NetworkModel::BufferIdRole).value<BufferId>();
 }