[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kopete/kopete/chatwindow
From: Roman Jarosz <kedgedev () gmail ! com>
Date: 2009-07-25 17:06:12
Message-ID: 1248541572.527582.8270.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1002323 by rjarosz:
Fix bug 91409: An empty line is sometimes inserted at the start of a message if the \
type holds down the enter key for too long. Patch by David Mills, thanks!
BUG: 91409
CCMAIL: d.mills-kde@guesny.net
M +11 -1 kopetechatwindow.cpp
M +3 -0 kopetechatwindow.h
M +20 -6 kopeterichtextwidget.cpp
M +1 -0 kopeterichtextwidget.h
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.cpp \
#1002322:1002323 @@ -350,6 +350,11 @@
return m_activeView;
}
+void KopeteChatWindow::updateSendKeySequence()
+{
+ m_activeView->editPart()->textEdit()->setSendKeySequence( sendMessage->shortcut() \
); +}
+
void KopeteChatWindow::initActions(void)
{
KActionCollection *coll = actionCollection();
@@ -357,7 +362,9 @@
createStandardStatusBarAction();
chatSend = new KAction( KIcon("mail-send"), i18n( "&Send Message" ), coll );
- coll->addAction( "chat_send", chatSend );
+ //Recuperate the qAction for later
+ sendMessage = coll->addAction( "chat_send", chatSend );
+
connect( chatSend, SIGNAL( triggered(bool) ), SLOT( slotSendMessage() ) );
//Default to 'Return' and 'Enter' for sending messages
//'Return' is the key in the main part of the keyboard
@@ -992,6 +999,9 @@
updateActions();
slotUpdateSendEnabled();
m_activeView->loadChatSettings();
+ m_activeView->editPart()->textEdit()->setSendKeySequence( sendMessage->shortcut() \
); + //Set up change signal in case the user changer the shortcut later
+ connect( sendMessage, SIGNAL(changed()), SLOT(updateSendKeySequence()) );
emit chatSessionChanged(m_activeView->msgManager());
}
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.h #1002322:1002323
@@ -166,6 +166,8 @@
KAction *tabClose;
KAction *tabCloseAllOthers;
+ QAction *sendMessage;
+
KToggleAction* toggleAutoSpellCheck;
KopeteEmoticonAction *actionSmileyMenu;
@@ -220,6 +222,7 @@
void slotEnableUpdateBg() { updateBg = true; }
void updateChatSendFileAction();
+ void updateSendKeySequence();
void toggleAutoSpellChecking();
void slotAutoSpellCheckEnabled( ChatView*, bool );
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/kopeterichtextwidget.cpp \
#1002322:1002323 @@ -57,6 +57,9 @@
KopeteRichTextWidget *q;
KActionCollection *actionCollection;
+
+ QKeySequence sendKeySequence;
+
const Kopete::Protocol::Capabilities protocolCaps;
QTextCharFormat defaultPlainFormat;
@@ -420,12 +423,6 @@
QKeyEvent *keyEvent = dynamic_cast<QKeyEvent*>(event);
if (keyEvent)
{
- if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == \
Qt::Key_Enter)
- {
- // Enter is the default shortcut for sending a message,
- // therefore it should not be handled by a textedit
- return QWidget::event(event);
- }
if (keyEvent->matches(QKeySequence::Copy) && \
!textCursor().hasSelection()) {
// The copy shortcut has to be handled outside of
@@ -443,9 +440,26 @@
}
}
}
+ if (event->type() == QEvent::ShortcutOverride || event->type() == \
QEvent::KeyRelease || event->type() == QEvent::KeyPress){ + QKeyEvent \
*keyEvent = dynamic_cast<QKeyEvent*>(event); + if (keyEvent)
+ {
+ QKeySequence keyEventSequance(keyEvent->modifiers() + keyEvent->key());
+ if (keyEventSequance.matches(d->sendKeySequence))
+ {
+ // Don't handle the shortcut for sending text in the textedit
+ return false;// QWidget::event(event);
+ }
+ }
+ }
return KRichTextWidget::event(event);
}
+void KopeteRichTextWidget::setSendKeySequence(QKeySequence keySequence)
+{
+ d->sendKeySequence = keySequence;
+}
+
void KopeteRichTextWidget::setDefaultPlainCharFormat(const QTextCharFormat& format)
{
d->defaultPlainFormat = format;
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/kopeterichtextwidget.h \
#1002322:1002323 @@ -76,6 +76,7 @@
void setTextItalic(bool italic);
void setTextUnderline(bool underline);
void setTextStrikeOut(bool strikeout);
+ void setSendKeySequence(QKeySequence keySequence);
void slotResetFontAndColor();
void slotCheckSpellingChanged(bool b);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic