From 3eadf3a904e2702acaa63d7ddb1db386c659ac52 Mon Sep 17 00:00:00 2001 From: seshagiriprabhu Date: Sat, 1 Mar 2014 21:22:07 +0530 Subject: [PATCH] Added feature to prevent users from sending blank messages as mentioned in #60 --- projectfiles/QtCreator/TOX-Qt-GUI.pro | 1 + src/inputtextwidget.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/projectfiles/QtCreator/TOX-Qt-GUI.pro b/projectfiles/QtCreator/TOX-Qt-GUI.pro index fdb38e8..07d9823 100644 --- a/projectfiles/QtCreator/TOX-Qt-GUI.pro +++ b/projectfiles/QtCreator/TOX-Qt-GUI.pro @@ -33,6 +33,7 @@ QT += core gui widgets TARGET = TOX-Qt-GUI TEMPLATE = app +QMAKE_CXX = g++-4.8 CONFIG += c++11 INCLUDEPATH += ../../src/ ../../submodules/ProjectTox-Core/toxcore/ diff --git a/src/inputtextwidget.cpp b/src/inputtextwidget.cpp index 7df59c9..2874a7d 100644 --- a/src/inputtextwidget.cpp +++ b/src/inputtextwidget.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "smileypack.hpp" #include "Settings/settings.hpp" @@ -80,6 +81,8 @@ void InputTextWidget::keyPressEvent(QKeyEvent* event) // Send message on Return if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && (event->modifiers() == Qt::NoModifier || event->modifiers() == Qt::KeypadModifier)) { + if (toPlainText().trimmed().isEmpty()) + return; if (toPlainText().startsWith("/me ") ) { QString html = toHtml(); html.remove(html.indexOf("/me "), 4);