author | eilers <eilers> | 2004-07-18 13:54:18 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-07-18 13:54:18 (UTC) |
commit | bb9c5344b397796ed424e3daddaf68e6c062c747 (patch) (unidiff) | |
tree | 13d2fc8da9b891c8d63c6d319177b7e8e868aaa3 | |
parent | b5e4ae2b7d5dfc371ed621242da4e019ede1b579 (diff) | |
download | opie-bb9c5344b397796ed424e3daddaf68e6c062c747.zip opie-bb9c5344b397796ed424e3daddaf68e6c062c747.tar.gz opie-bb9c5344b397796ed424e3daddaf68e6c062c747.tar.bz2 |
Fixing Bug #1361
-rw-r--r-- | core/pim/addressbook/namelineedit.cpp | 33 | ||||
-rw-r--r-- | core/pim/addressbook/namelineedit.h | 3 |
2 files changed, 30 insertions, 6 deletions
diff --git a/core/pim/addressbook/namelineedit.cpp b/core/pim/addressbook/namelineedit.cpp index 81b959b..5c6c0b9 100644 --- a/core/pim/addressbook/namelineedit.cpp +++ b/core/pim/addressbook/namelineedit.cpp | |||
@@ -5,2 +5,3 @@ | |||
5 | 5 | ||
6 | #include <qpe/config.h> | ||
6 | 7 | ||
@@ -8,3 +9,4 @@ namespace ABOOK { | |||
8 | NameLineEdit::NameLineEdit( QWidget* parent, const char* name ) | 9 | NameLineEdit::NameLineEdit( QWidget* parent, const char* name ) |
9 | : QLineEdit( parent, name ), m_prevSpace( true ) { | 10 | : QLineEdit( parent, name ), m_prevSpace( true ), m_disabled( false ) { |
11 | configReader(); | ||
10 | } | 12 | } |
@@ -13,3 +15,4 @@ NameLineEdit::NameLineEdit( const QString& str, QWidget* par, | |||
13 | const char* name ) | 15 | const char* name ) |
14 | : QLineEdit( str, par, name ),m_prevSpace( true ) { | 16 | : QLineEdit( str, par, name ),m_prevSpace( true ), m_disabled( false ) { |
17 | configReader(); | ||
15 | } | 18 | } |
@@ -20,2 +23,9 @@ NameLineEdit::~NameLineEdit() { | |||
20 | void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { | 23 | void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { |
24 | |||
25 | // If disabled: Push everything to the mother class.. | ||
26 | if ( m_disabled ){ | ||
27 | QLineEdit::keyPressEvent( ev ); | ||
28 | return; | ||
29 | } | ||
30 | |||
21 | QString t = ev->text(); | 31 | QString t = ev->text(); |
@@ -28,3 +38,3 @@ void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { | |||
28 | key != Key_Return && key != Key_Enter ) { | 38 | key != Key_Return && key != Key_Enter ) { |
29 | owarn << "str " << ev->text() << " " << m_prevSpace << oendl; | 39 | odebug << "str " << ev->text() << " " << m_prevSpace << oendl; |
30 | 40 | ||
@@ -50,5 +60,9 @@ void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { | |||
50 | QString te = text(); | 60 | QString te = text(); |
51 | /* if string is empty capitalize the first letter */ | 61 | odebug << "Backspace: " << te << oendl; |
52 | /* else see if we're at the end of the string */ | 62 | /* Capitalize first letter if a char is removed and: |
53 | if ( te.isEmpty() || cursorPosition() == te.length() ) | 63 | * 1. String is empty |
64 | * 2. We are at the beginning of the line (pos 0) | ||
65 | * 3. The char left from current cursor position is a space ! | ||
66 | */ | ||
67 | if ( te.isEmpty() || ( cursorPosition() == 0 ) || ( te[cursorPosition() - 1] == Key_Space ) ) | ||
54 | m_prevSpace = true; | 68 | m_prevSpace = true; |
@@ -58,2 +72,9 @@ void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { | |||
58 | 72 | ||
73 | void NameLineEdit::configReader() { | ||
74 | Config cfg("AddressBook"); | ||
75 | cfg.setGroup("Editor"); | ||
76 | m_disabled = cfg.readBoolEntry( "disableAutoCaps", false ); | ||
77 | } | ||
78 | |||
79 | |||
59 | } | 80 | } |
diff --git a/core/pim/addressbook/namelineedit.h b/core/pim/addressbook/namelineedit.h index c719579..7f0eda8 100644 --- a/core/pim/addressbook/namelineedit.h +++ b/core/pim/addressbook/namelineedit.h | |||
@@ -28,3 +28,6 @@ namespace ABOOK { | |||
28 | private: | 28 | private: |
29 | void configReader(); | ||
30 | |||
29 | bool m_prevSpace : 1; | 31 | bool m_prevSpace : 1; |
32 | bool m_disabled : 1; | ||
30 | }; | 33 | }; |