From 0d75229c2afdd0ea62e2f0be2a021436f0201062 Mon Sep 17 00:00:00 2001 From: Marcus Eggenberger Date: Tue, 22 Jul 2008 21:28:15 +0200 Subject: [PATCH] the inputline is now only disabled if we are not connected to the network or it is a channel we parted from --- src/qtui/inputwidget.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index a1267178..37f84885 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -55,9 +55,18 @@ void InputWidget::currentChanged(const QModelIndex ¤t, const QModelIndex & if(current.data(NetworkModel::BufferInfoRole) == previous.data(NetworkModel::BufferInfoRole)) return; - setNetwork(Client::networkModel()->networkByIndex(current)); + const Network *net = Client::networkModel()->networkByIndex(current); + setNetwork(net); updateNickSelector(); - ui.inputEdit->setEnabled(current.data(NetworkModel::ItemActiveRole).value()); + + bool enabled = false; + if(net) { + // disable inputline if it's a channelbuffer we parted from or... + enabled = (current.data(NetworkModel::ItemActiveRole).value() || (current.data(NetworkModel::BufferTypeRole).toInt() != BufferInfo::ChannelBuffer)); + // ... if we're not connected to the network at all + enabled &= net->isConnected(); + } + ui.inputEdit->setEnabled(enabled); } void InputWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { -- 2.20.1