X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fbuffermodel.cpp;h=52d6d54c5073b05f1d2fc196a3186c487f271622;hb=4e0445e459c690cfa6013c5ad574e94f9214827b;hp=4b78ea9509cb3ddb7b58b9c1a7fddcf9196461db;hpb=f9568f94f1df63d51d7862a0d0270d0b0a93f0cc;p=quassel.git diff --git a/src/client/buffermodel.cpp b/src/client/buffermodel.cpp index 4b78ea95..52d6d54c 100644 --- a/src/client/buffermodel.cpp +++ b/src/client/buffermodel.cpp @@ -28,15 +28,10 @@ BufferModel::BufferModel(NetworkModel *parent) : QSortFilterProxyModel(parent), _selectionModelSynchronizer(this), - _propertyMapper(this) + _standardSelectionModel(this) { setSourceModel(parent); - - // initialize the Property Mapper - _propertyMapper.setModel(this); - _selectionModelSynchronizer.addRegularSelectionModel(_propertyMapper.selectionModel()); - connect(_propertyMapper.selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), - this, SLOT(currentChanged(QModelIndex, QModelIndex))); + _selectionModelSynchronizer.addRegularSelectionModel(standardSelectionModel()); } BufferModel::~BufferModel() { @@ -65,17 +60,11 @@ 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::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { - Q_UNUSED(current); - setData(current, QDateTime::currentDateTime(), NetworkModel::LastSeenRole); - setData(previous, QDateTime::currentDateTime(), NetworkModel::LastSeenRole); - setData(previous, qVariantFromValue((int)BufferItem::NoActivity), NetworkModel::BufferActivityRole); +void BufferModel::setCurrentIndex(const QModelIndex &newCurrent) { + _standardSelectionModel.setCurrentIndex(newCurrent, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); + _standardSelectionModel.select(newCurrent, QItemSelectionModel::ClearAndSelect); }