void RemoveRedEyesWindow::setBusy(bool busy) { d->busy = busy; if (busy) { // disable connection to make sure that the "test run" and "correct photos" // buttons are not enabled again on ImageListChange disconnect(d->imageList, SIGNAL(signalImageListChanged()), this, SLOT(imageListChanged())); disconnect(this, SIGNAL(myCloseClicked()), this, SLOT(closeClicked())); setButtonGuiItem(Close, KStandardGuiItem::cancel()); enableButton(User1, false); // correction button enableButton(User2, false); // testrun button connect(this, SIGNAL(myCloseClicked()), this, SLOT(cancelCorrection())); d->settingsTab->setEnabled(false); } else { // enable connection again to make sure that an empty image list will // disable the "test run" and "correct photos" buttons connect(d->imageList, SIGNAL(signalImageListChanged()), this, SLOT(imageListChanged())); disconnect(this, SIGNAL(myCloseClicked()), this, SLOT(cancelCorrection())); setButtonGuiItem(Close, KStandardGuiItem::close()); enableButton(User1, true); // correction button enableButton(User2, true); // testrun button connect(this, SIGNAL(myCloseClicked()), this, SLOT(closeClicked())); d->settingsTab->setEnabled(true); } }
void QtChatWindow::returnPressed() { if (!isOnline_ || (blockingState_ == IsBlocked)) { return; } messageLog_->scrollToBottom(); lastSentMessage_ = QString(input_->toPlainText()); onSendMessageRequest(Q2PSTRING(input_->toPlainText()), isCorrection_); inputClearing_ = true; input_->clear(); cancelCorrection(); inputClearing_ = false; }
void QtChatWindow::handleKeyPressEvent(QKeyEvent* event) { event->ignore(); if (event->isAccepted()) { return; } event->accept(); int key = event->key(); if (key == Qt::Key_Tab) { tabComplete(); } else if ((key == Qt::Key_Up) && input_->toPlainText().isEmpty() && !(lastSentMessage_.isEmpty())) { beginCorrection(); } else if (key == Qt::Key_Down && isCorrection_ && input_->textCursor().atBlockEnd()) { cancelCorrection(); } else if (key == Qt::Key_Down || key == Qt::Key_Up) { event->ignore(); } else { messageLog_->handleKeyPressEvent(event); } }