Merging r732:766 from trunk to branches/0.3.
[quassel.git] / src / client / buffermodel.cpp
index 3426632..3dfdc6d 100644 (file)
 
 BufferModel::BufferModel(NetworkModel *parent)
   : QSortFilterProxyModel(parent),
-    _selectionModelSynchronizer(this),
-    _propertyMapper(this)
+    _selectionModelSynchronizer(this)
 {
   setSourceModel(parent);
-
-  // initialize the Property Mapper
-  _propertyMapper.setModel(this);
-  _selectionModelSynchronizer.addRegularSelectionModel(_propertyMapper.selectionModel());
-}
-
-BufferModel::~BufferModel() {
 }
 
 bool BufferModel::filterAcceptsRow(int sourceRow, const QModelIndex &parent) const {
@@ -63,15 +55,19 @@ void BufferModel::synchronizeView(QAbstractItemView *view) {
   view->setSelectionModel(mappedSelectionModel);
 }
 
-void BufferModel::mapProperty(int column, int role, QObject *target, const QByteArray &property) {
-  _propertyMapper.addMapping(column, role, target, property);
-}
-
 QModelIndex BufferModel::currentIndex() {
-  return propertyMapper()->selectionModel()->currentIndex();
+  return standardSelectionModel()->currentIndex();
 }
 
 void BufferModel::setCurrentIndex(const QModelIndex &newCurrent) {
-  standardSelectionModel()->setCurrentIndex(newCurrent, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
-  standardSelectionModel()->select(newCurrent, QItemSelectionModel::ClearAndSelect);
+  _selectionModelSynchronizer.selectionModel()->setCurrentIndex(newCurrent, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
+  _selectionModelSynchronizer.selectionModel()->select(newCurrent, QItemSelectionModel::Current);
+}
+
+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 << ")";
 }