X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fbuffermodel.cpp;h=2fc222ed4a799c4d455353d20a2169a9a1f85264;hp=c9537f31a9d8ced01bf8636a429215375f25b5e1;hb=770b7ef54b03f3ebd1e29a58b4757505e1809b2d;hpb=2a04cb443a50e37165fc2d5447cc705a813efd3e diff --git a/src/client/buffermodel.cpp b/src/client/buffermodel.cpp index c9537f31..2fc222ed 100644 --- a/src/client/buffermodel.cpp +++ b/src/client/buffermodel.cpp @@ -35,8 +35,8 @@ BufferModel::BufferModel(NetworkModel *parent) // initialize the Property Mapper _propertyMapper.setModel(this); _selectionModelSynchronizer.addRegularSelectionModel(_propertyMapper.selectionModel()); - connect(&_selectionModelSynchronizer, SIGNAL(setCurrentIndex(QModelIndex, QItemSelectionModel::SelectionFlags)), - this, SLOT(setCurrentIndex(QModelIndex, QItemSelectionModel::SelectionFlags))); + connect(_propertyMapper.selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), + this, SLOT(currentChanged(QModelIndex, QModelIndex))); } BufferModel::~BufferModel() { @@ -67,19 +67,11 @@ void BufferModel::mapProperty(int column, int role, QObject *target, const QByte _propertyMapper.addMapping(column, role, target, property); } -// This Slot indicates that the user has selected a different buffer in the gui -void BufferModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) { - Q_UNUSED(command) - BufferId newCurrentBuffer; - if(index.data(NetworkModel::ItemTypeRole) == NetworkModel::BufferItemType - && currentBuffer != (newCurrentBuffer = qVariantValue(index.data(NetworkModel::BufferIdRole)))) { - currentBuffer = newCurrentBuffer; - // FIXME: to something like: index.setData(ActivitRole, NoActivity); - // networkModel->bufferActivity(BufferItem::NoActivity, currentBuffer); - emit selectionChanged(index); - } -} - QModelIndex BufferModel::currentIndex() { return propertyMapper()->selectionModel()->currentIndex(); } + +void BufferModel::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { + Q_UNUSED(current); + setData(previous, qVariantFromValue((int)BufferItem::NoActivity), NetworkModel::BufferActivityRole); +}