Summary: | Single-Shot window doesn't correctly bind ENTER | ||
---|---|---|---|
Product: | [Applications] kopete | Reporter: | Don Curtis <milkypostman> |
Component: | Chat Window | Assignee: | Kopete Developers <kopete-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 0.8.0 | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Don Curtis
2004-01-28 07:41:32 UTC
This is confirmed in kopete 0.80. Mine! CVS commit by lilachaze: Make enter and return work as keyboard shortcuts in the single-shot message window. This is a hack, but I couldn't find a better way to divert the keypresses from the text input widget, so I stole this idea from the chat window. CCMAIL: 73661-done@bugs.kde.org M +34 -0 kopeteemailwindow.cpp 1.35 M +1 -0 kopeteemailwindow.h 1.7 --- kdenetwork/kopete/kopete/chatwindow/kopeteemailwindow.cpp #1.34:1.35 @@ -30,4 +30,5 @@ #include <kcolordialog.h> #include <kconfig.h> +#include <kcursor.h> #include <kdebug.h> #include <kdeversion.h> @@ -214,4 +215,6 @@ KopeteEmailWindow::KopeteEmailWindow( Ko m_type = KopeteMessage::Email; + d->txtEntry->installEventFilter( this ); + KCursor::setAutoHideCursor( d->txtEntry, true, true ); } @@ -296,4 +299,35 @@ void KopeteEmailWindow::initActions(void } +bool KopeteEmailWindow::eventFilter( QObject *o, QEvent *e ) +{ + if ( o->inherits( "KTextEdit" ) ) + KCursor::autoHideEventFilter( o, e ); + + if( e->type() == QEvent::KeyPress ) + { + QKeyEvent *event = static_cast<QKeyEvent*>( e ); + KKey key( event ); + + // NOTE: + // shortcut.contains( key ) doesn't work. It was the old way we used to do it, but it is incorrect + // because if you have a multi-key shortcut then pressing any of the keys in + // that shortcut individually causes the shortcut to be activated. + + if( d->chatSend->isEnabled() ) + { + for( uint i = 0; i < d->chatSend->shortcut().count(); i++ ) + { + if( key == d->chatSend->shortcut().seq(i).key(0) ) + { + sendMessage(); + return true; + } + } + } + } + + return false; +} + void KopeteEmailWindow::slotViewToolBar() { --- kdenetwork/kopete/kopete/chatwindow/kopeteemailwindow.h #1.6:1.7 @@ -79,4 +79,5 @@ protected: virtual bool queryExit(); virtual void windowActivationChange( bool activated ); + virtual bool KopeteEmailWindow::eventFilter( QObject *o, QEvent *e ); private slots: |