summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 0da4563..bda6b3e 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -284,75 +284,75 @@ void QtChatWindow::handleKeyPressEvent(QKeyEvent* event) {
event->ignore();
}
else {
messageLog_->handleKeyPressEvent(event);
}
}
void QtChatWindow::beginCorrection() {
boost::optional<AlertID> newCorrectingAlert;
if (correctionEnabled_ == Maybe) {
newCorrectingAlert = addAlert(Q2PSTRING(tr("This chat may not support message correction. If you send a correction anyway, it may appear as a duplicate message")));
}
else if (correctionEnabled_ == No) {
newCorrectingAlert = addAlert(Q2PSTRING(tr("This chat does not support message correction. If you send a correction anyway, it will appear as a duplicate message")));
}
if (newCorrectingAlert) {
if (correctingAlert_) {
removeAlert(*correctingAlert_);
}
correctingAlert_ = newCorrectingAlert;
}
QTextCursor cursor = input_->textCursor();
cursor.select(QTextCursor::Document);
cursor.beginEditBlock();
cursor.insertText(QString(lastSentMessage_));
cursor.endEditBlock();
isCorrection_ = true;
correctingLabel_->show();
- input_->setStyleSheet(alertStyleSheet_);
+ input_->setCorrectionHighlight(true);
labelsWidget_->setEnabled(false);
}
void QtChatWindow::cancelCorrection() {
if (correctingAlert_) {
removeAlert(*correctingAlert_);
correctingAlert_.reset();
}
QTextCursor cursor = input_->textCursor();
cursor.select(QTextCursor::Document);
cursor.removeSelectedText();
isCorrection_ = false;
correctingLabel_->hide();
- input_->setStyleSheet(qApp->styleSheet());
+ input_->setCorrectionHighlight(false);
labelsWidget_->setEnabled(true);
}
QByteArray QtChatWindow::getSplitterState() {
return logRosterSplitter_->saveState();
}
void QtChatWindow::handleChangeSplitterState(QByteArray state) {
logRosterSplitter_->restoreState(state);
}
void QtChatWindow::handleSplitterMoved(int, int) {
emit splitterMoved();
}
void QtChatWindow::tabComplete() {
if (!completer_) {
return;
}
QTextCursor cursor;
if (tabCompleteCursor_.hasSelection()) {
cursor = tabCompleteCursor_;
}
else {
cursor = input_->textCursor();
while(cursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor) && cursor.document()->characterAt(cursor.position() - 1) != ' ') { }
}
QString root = cursor.selectedText();
if (root.isEmpty()) {
@@ -817,64 +817,61 @@ void QtChatWindow::setAffiliations(MUCOccupant::Affiliation affiliation, const s
}
void QtChatWindow::setAvailableRoomActions(const std::vector<RoomAction>& actions) {
availableRoomActions_ = actions;
}
void QtChatWindow::setBlockingState(BlockingState state) {
blockingState_ = state;
}
void QtChatWindow::setCanInitiateImpromptuChats(bool supportsImpromptu) {
supportsImpromptuChat_ = supportsImpromptu;
}
void QtChatWindow::showBookmarkWindow(const MUCBookmark& bookmark) {
if (roomBookmarkState_ == RoomNotBookmarked) {
QtAddBookmarkWindow* window = new QtAddBookmarkWindow(eventStream_, bookmark);
window->show();
}
else {
QtEditBookmarkWindow* window = new QtEditBookmarkWindow(eventStream_, bookmark);
window->show();
}
}
std::string QtChatWindow::getID() const {
return id_;
}
void QtChatWindow::setEmphasiseFocus(bool emphasise) {
- input_->setAttribute(Qt::WA_MacShowFocusRect, emphasise);
-#ifdef SWIFTEN_PLATFORM_WINDOWS
input_->setEmphasiseFocus(emphasise);
-#endif
}
void QtChatWindow::showRoomConfigurationForm(Form::ref form) {
if (mucConfigurationWindow_) {
delete mucConfigurationWindow_.data();
}
mucConfigurationWindow_ = new QtMUCConfigurationWindow(form);
mucConfigurationWindow_->onFormComplete.connect(boost::bind(boost::ref(onConfigureRequest), _1));
mucConfigurationWindow_->onFormCancelled.connect(boost::bind(boost::ref(onConfigurationFormCancelled)));
}
void QtChatWindow::handleAppendedToLog() {
if (lastLineTracker_.getShouldMoveLastLine()) {
/* should this be queued? */
messageLog_->addLastSeenLine();
}
if (isWidgetSelected()) {
onAllMessagesRead();
}
}
void QtChatWindow::addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct, bool isImpromptu, bool isContinuation) {
handleAppendedToLog();
messageLog_->addMUCInvitation(senderName, jid, reason, password, direct, isImpromptu, isContinuation);
}
std::string QtChatWindow::addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) {
handleAppendedToLog();
return messageLog_->addMessage(message, senderName, senderIsSelf, label, avatarPath, time);
}