Fix #984 without breaking topic input
[quassel.git] / src / qtui / inputwidget.cpp
index d3a7f74..d325578 100644 (file)
@@ -132,6 +132,7 @@ InputWidget::InputWidget(QWidget *parent)
   activateInputline->setText(tr("Focus Input Line"));
   activateInputline->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
 
   activateInputline->setText(tr("Focus Input Line"));
   activateInputline->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
 
+  connect(inputLine(), SIGNAL(textEntered(QString)), SLOT(onTextEntered(QString)), Qt::QueuedConnection); // make sure the line is already reset, bug #984
   connect(inputLine(), SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat)));
 }
 
   connect(inputLine(), SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat)));
 }
 
@@ -277,7 +278,12 @@ void InputWidget::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int
   }
 }
 
   }
 }
 
+
 void InputWidget::updateEnabledState() {
 void InputWidget::updateEnabledState() {
+// FIXME: Find a visualization for this that does not disable the widget!
+//        Disabling kills global action shortcuts, plus users sometimes need/want to enter text
+//        even in inactive channels.
+#if 0
   QModelIndex currentIndex = selectionModel()->currentIndex();
 
   const Network *net = Client::networkModel()->networkByIndex(currentIndex);
   QModelIndex currentIndex = selectionModel()->currentIndex();
 
   const Network *net = Client::networkModel()->networkByIndex(currentIndex);
@@ -288,7 +294,9 @@ void InputWidget::updateEnabledState() {
     // ... if we're not connected to the network at all
     enabled &= net->isConnected();
   }
     // ... if we're not connected to the network at all
     enabled &= net->isConnected();
   }
+
   ui.inputEdit->setEnabled(enabled);
   ui.inputEdit->setEnabled(enabled);
+#endif
 }
 
 const Network *InputWidget::currentNetwork() const {
 }
 
 const Network *InputWidget::currentNetwork() const {
@@ -406,7 +414,7 @@ void InputWidget::changeNick(const QString &newNick) const {
   Client::userInput(BufferInfo::fakeStatusBuffer(net->networkId()), QString("/NICK %1").arg(newNick));
 }
 
   Client::userInput(BufferInfo::fakeStatusBuffer(net->networkId()), QString("/NICK %1").arg(newNick));
 }
 
-void InputWidget::on_inputEdit_textEntered(const QString &text) {
+void InputWidget::onTextEntered(const QString &text) {
   Client::userInput(currentBufferInfo(), text);
   ui.boldButton->setChecked(false);
   ui.underlineButton->setChecked(false);
   Client::userInput(currentBufferInfo(), text);
   ui.boldButton->setChecked(false);
   ui.underlineButton->setChecked(false);