-rw-r--r-- | core/pim/addressbook/namelineedit.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/pim/addressbook/namelineedit.cpp b/core/pim/addressbook/namelineedit.cpp index ba16e2c..81b959b 100644 --- a/core/pim/addressbook/namelineedit.cpp +++ b/core/pim/addressbook/namelineedit.cpp | |||
@@ -1,49 +1,53 @@ | |||
1 | #include "namelineedit.h" | 1 | #include "namelineedit.h" |
2 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | |||
6 | |||
3 | namespace ABOOK { | 7 | namespace ABOOK { |
4 | NameLineEdit::NameLineEdit( QWidget* parent, const char* name ) | 8 | NameLineEdit::NameLineEdit( QWidget* parent, const char* name ) |
5 | : QLineEdit( parent, name ), m_prevSpace( true ) { | 9 | : QLineEdit( parent, name ), m_prevSpace( true ) { |
6 | } | 10 | } |
7 | 11 | ||
8 | NameLineEdit::NameLineEdit( const QString& str, QWidget* par, | 12 | NameLineEdit::NameLineEdit( const QString& str, QWidget* par, |
9 | const char* name ) | 13 | const char* name ) |
10 | : QLineEdit( str, par, name ),m_prevSpace( true ) { | 14 | : QLineEdit( str, par, name ),m_prevSpace( true ) { |
11 | } | 15 | } |
12 | 16 | ||
13 | NameLineEdit::~NameLineEdit() { | 17 | NameLineEdit::~NameLineEdit() { |
14 | } | 18 | } |
15 | 19 | ||
16 | void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { | 20 | void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { |
17 | QString t = ev->text(); | 21 | QString t = ev->text(); |
18 | int key = ev->key(); | 22 | int key = ev->key(); |
19 | int ascii = ev->ascii(); | 23 | int ascii = ev->ascii(); |
20 | 24 | ||
21 | // ### FIXME with composed events | 25 | // ### FIXME with composed events |
22 | if ( !t.isEmpty() && ( !ev->ascii() || ev->ascii()>=32 ) && | 26 | if ( !t.isEmpty() && ( !ev->ascii() || ev->ascii()>=32 ) && |
23 | key != Key_Delete && key != Key_Backspace && | 27 | key != Key_Delete && key != Key_Backspace && |
24 | key != Key_Return && key != Key_Enter ) { | 28 | key != Key_Return && key != Key_Enter ) { |
25 | qWarning( "str " + ev->text() + " %d", m_prevSpace ); | 29 | owarn << "str " << ev->text() << " " << m_prevSpace << oendl; |
26 | 30 | ||
27 | if ( m_prevSpace ) { | 31 | if ( m_prevSpace ) { |
28 | t = t.upper(); | 32 | t = t.upper(); |
29 | m_prevSpace = false; | 33 | m_prevSpace = false; |
30 | } | 34 | } |
31 | if ( key == Key_Space ) | 35 | if ( key == Key_Space ) |
32 | m_prevSpace = true; | 36 | m_prevSpace = true; |
33 | 37 | ||
34 | 38 | ||
35 | QKeyEvent nEv(ev->type(), key, ascii, ev->state(), | 39 | QKeyEvent nEv(ev->type(), key, ascii, ev->state(), |
36 | t, ev->isAutoRepeat(), ev->count() ); | 40 | t, ev->isAutoRepeat(), ev->count() ); |
37 | QLineEdit::keyPressEvent( &nEv ); | 41 | QLineEdit::keyPressEvent( &nEv ); |
38 | if ( !nEv.isAccepted() ) | 42 | if ( !nEv.isAccepted() ) |
39 | ev->ignore(); | 43 | ev->ignore(); |
40 | }else { | 44 | }else { |
41 | QLineEdit::keyPressEvent( ev ); | 45 | QLineEdit::keyPressEvent( ev ); |
42 | /* if key was a backspace lets see if we should | 46 | /* if key was a backspace lets see if we should |
43 | * capitalize the next letter | 47 | * capitalize the next letter |
44 | */ | 48 | */ |
45 | if ( key == Key_Backspace ) { | 49 | if ( key == Key_Backspace ) { |
46 | QString te = text(); | 50 | QString te = text(); |
47 | /* if string is empty capitalize the first letter */ | 51 | /* if string is empty capitalize the first letter */ |
48 | /* else see if we're at the end of the string */ | 52 | /* else see if we're at the end of the string */ |
49 | if ( te.isEmpty() || cursorPosition() == te.length() ) | 53 | if ( te.isEmpty() || cursorPosition() == te.length() ) |