pidgin/quail/quail-redux

45addfe34752
Parents 6559ccf2152b
Children f50c05f040fb
Make sending a message happen when we press enter
--- a/TODO.txt Tue Aug 20 19:09:16 2013 +0100
+++ b/TODO.txt Tue Aug 20 20:03:27 2013 +0100
@@ -4,7 +4,6 @@
* Use Aduim's Message Styles for the conversation window
* Buddy icons showing up
* Buddy status icons showing
-* Join a chat
* Formatting toolbar on the conversation window
* Kill off dead code
* Rename group
@@ -31,8 +30,7 @@
* Add recent statuses to the change status menu
* Display the currently used icon on the buddy list window
* Enable the selection of a new buddy icon
-* Conversation room list display
-* Conversation text entry
+* Conversation room list display status icons
DONE
===========================================================
@@ -44,3 +42,6 @@
* Tray icon
* Add Accounts to tray icon
* Account icons now correctly changing colour on connect and disconnect
+* Join a chat
+* Conversation room list display
+* Conversation text entry
--- a/src/QuailConvWindow.cpp Tue Aug 20 19:09:16 2013 +0100
+++ b/src/QuailConvWindow.cpp Tue Aug 20 20:03:27 2013 +0100
@@ -473,13 +473,14 @@
{
qDebug() << "QQuailConvChat::send()";
QString text = entry->toPlainText();
-
- if (text[text.length() - 1] == '\n')
- text.remove(text.length() - 1, 1);
+ if (!text.isEmpty())
+ {
+ if (text[text.length() - 1] == '\n')
+ text.remove(text.length() - 1, 1);
- purple_conv_chat_send(PURPLE_CONV_CHAT(conv), text.toStdString().c_str());
-
- entry->setText("");
+ purple_conv_chat_send(PURPLE_CONV_CHAT(conv), text.toStdString().c_str());
+ }
+ entry->setText("");
}
void
@@ -662,14 +663,14 @@
{
qDebug() << "QQuailConvIm::send()";
QString text = entry->toPlainText();
-
- if (text[text.length() - 1] == '\n')
- text.remove(text.length() - 1, 1);
+ if (!text.isEmpty())
+ {
+ if (text[text.length() - 1] == '\n')
+ text.remove(text.length() - 1, 1);
- purple_conv_im_send(PURPLE_CONV_IM(conv), text.toStdString().c_str());
-
- entry->setText("");
-
+ purple_conv_im_send(PURPLE_CONV_IM(conv), text.toStdString().c_str());
+ }
+ entry->setText("");
updateTyping();
}
--- a/src/QuailMultiLineEdit.cpp Tue Aug 20 19:09:16 2013 +0100
+++ b/src/QuailMultiLineEdit.cpp Tue Aug 20 20:03:27 2013 +0100
@@ -21,6 +21,8 @@
* MA 02111-1307 USA
*/
#include "QuailMultiLineEdit.h"
+
+#include <QDebug>
#include <QEvent>
#include <QKeyEvent>
@@ -63,6 +65,7 @@
void
QQuailMultiLineEdit::keyPressEvent(QKeyEvent *event)
{
+ qDebug() << "QQuailMultiLineEdit::keyPressEvent";
int key = event->key();
if (historyEnabled)
@@ -94,14 +97,21 @@
{
history.prepend(this->toPlainText());
index = -1;
+ qDebug() << "QQuailMultiLineEdit::keyPressEvent.1";
+ emit returnPressed();
+ return;
}
else if (key == Qt::Key_Tab)
{
/* TODO Tab completion */
return;
}
+ else if (key == Qt::Key_Return && event->modifiers() == Qt::CTRL)
+ {
+ emit returnPressed();
+ }
}
- else if (key == Qt::Key_Down)
+ else if (key == Qt::Key_Down || key == Qt::Key_Return)
{
emit returnPressed();