X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Finputwidget.cpp;h=0c66767884002a619a9afcf9af55ed0538b6b5df;hp=d6f0aad6faf84ce8848d39563e9b32892f16b46a;hb=1b2d3ea62867220d7bffc3b23dda1dc14d429007;hpb=08cf52eafbd690bbaa3c86e57cb02e7e82dc3159 diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index d6f0aad6..0c667678 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -27,10 +27,8 @@ InputWidget::InputWidget(QWidget *parent) - : QWidget(parent), - validBuffer(false), - _bufferModel(0), - _selectionModel(0) + : AbstractItemView(parent), + validBuffer(false) { ui.setupUi(this); connect(ui.inputEdit, SIGNAL(sendText(QString)), this, SLOT(sendText(QString))); @@ -45,24 +43,6 @@ InputWidget::InputWidget(QWidget *parent) InputWidget::~InputWidget() { } -void InputWidget::setModel(BufferModel *bufferModel) { - if(_bufferModel) { - disconnect(_bufferModel, 0, this, 0); - } - _bufferModel = bufferModel; - connect(bufferModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), - this, SLOT(dataChanged(QModelIndex, QModelIndex))); -} - -void InputWidget::setSelectionModel(QItemSelectionModel *selectionModel) { - if(_selectionModel) { - disconnect(_selectionModel, 0, this, 0); - } - _selectionModel = selectionModel; - connect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), - this, SLOT(currentChanged(QModelIndex, QModelIndex))); -} - void InputWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { Q_UNUSED(previous); @@ -84,7 +64,7 @@ void InputWidget::currentChanged(const QModelIndex ¤t, const QModelIndex & void InputWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { QItemSelectionRange changedArea(topLeft, bottomRight); - QModelIndex currentIndex = Client::bufferModel()->currentIndex(); + QModelIndex currentIndex = selectionModel()->currentIndex(); if(changedArea.contains(currentIndex)) { ui.inputEdit->setEnabled(currentIndex.data(NetworkModel::ItemActiveRole).value()); }