author | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
commit | 8401def65aa4f19d91873bc57a3dcf25c358c490 (patch) (unidiff) | |
tree | 3e64bd2d1b6f92c77304cc2d2c0fd06b07d718e5 /core/pim/addressbook/ablabel.cpp | |
parent | 4d0773414a0fb59e53f30d4d2363f73304f474dc (diff) | |
download | opie-8401def65aa4f19d91873bc57a3dcf25c358c490.zip opie-8401def65aa4f19d91873bc57a3dcf25c358c490.tar.gz opie-8401def65aa4f19d91873bc57a3dcf25c358c490.tar.bz2 |
Back to main tree. Back to main tree.
Back to main tree. Waiting for moving to feature freeze ..
Diffstat (limited to 'core/pim/addressbook/ablabel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/ablabel.cpp | 98 |
1 files changed, 62 insertions, 36 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp index ea80700..5b40dc1 100644 --- a/core/pim/addressbook/ablabel.cpp +++ b/core/pim/addressbook/ablabel.cpp | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <qstylesheet.h> | 26 | #include <qstylesheet.h> |
27 | 27 | ||
28 | AbLabel::AbLabel( QWidget *parent, const char *name ) | 28 | AbLabel::AbLabel( QWidget *parent, const char *name ): |
29 | : QTextView( parent, name ) | 29 | QTextView( parent, name ), |
30 | m_empty( false ) | ||
30 | { | 31 | { |
31 | } | 32 | } |
@@ -35,12 +36,46 @@ AbLabel::~AbLabel() | |||
35 | } | 36 | } |
36 | 37 | ||
37 | void AbLabel::init( const OContact &entry ) | 38 | void AbLabel::setContacts( const OContactAccess::List& viewList ) |
38 | { | 39 | { |
39 | ent = entry; | 40 | m_viewList = viewList; |
41 | if (m_viewList.count() != 0){ | ||
42 | m_empty = false; | ||
43 | m_itCurContact = m_viewList.begin(); | ||
44 | sync(); | ||
45 | }else{ | ||
46 | // m_itCurContact.clear(); | ||
47 | m_empty = true; | ||
48 | setText( "" ); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | int AbLabel::currentEntry_UID() | ||
53 | { | ||
54 | return ( (*m_itCurContact).uid() ); | ||
55 | } | ||
56 | |||
57 | OContact AbLabel::currentEntry() | ||
58 | { | ||
59 | return ( *m_itCurContact ); | ||
40 | } | 60 | } |
41 | 61 | ||
62 | |||
63 | bool AbLabel::selectContact( int UID ) | ||
64 | { | ||
65 | |||
66 | for ( m_itCurContact = m_viewList.begin(); m_itCurContact != m_viewList.end(); ++m_itCurContact){ | ||
67 | if ( (*m_itCurContact).uid() == UID ) | ||
68 | break; | ||
69 | } | ||
70 | sync(); | ||
71 | |||
72 | return true; | ||
73 | } | ||
74 | |||
75 | |||
76 | |||
42 | void AbLabel::sync() | 77 | void AbLabel::sync() |
43 | { | 78 | { |
44 | QString text = ent.toRichText(); | 79 | QString text = (*m_itCurContact).toRichText(); |
45 | setText( text ); | 80 | setText( text ); |
46 | } | 81 | } |
@@ -49,42 +84,33 @@ void AbLabel::keyPressEvent( QKeyEvent *e ) | |||
49 | { | 84 | { |
50 | // Commonly handled keys | 85 | // Commonly handled keys |
51 | switch( e->key() ) { | 86 | if ( !m_empty ){ |
52 | case Qt::Key_Left: | ||
53 | qWarning( "Left.."); | ||
54 | case Qt::Key_F33: | ||
55 | qWarning( "OK.."); | ||
56 | emit okPressed(); | ||
57 | break; | ||
58 | } | ||
59 | |||
60 | |||
61 | if ( /* m_inSearch */ false ) { | ||
62 | // Running in seach-mode, therefore we will interprete | ||
63 | // some key differently | ||
64 | qWarning("Received key in search mode"); | ||
65 | switch( e->key() ) { | 87 | switch( e->key() ) { |
66 | case Qt::Key_Up: | 88 | case Qt::Key_Left: |
67 | qWarning("a"); | 89 | qWarning( "Left.."); |
68 | // emit signalSearchBackward(); | 90 | case Qt::Key_Right: |
69 | break; | 91 | qWarning( "Right.."); |
70 | case Qt::Key_Down: | 92 | case Qt::Key_F33: |
71 | qWarning("b"); | 93 | qWarning( "OK.."); |
72 | // emit signalSearchNext(); | 94 | emit signalOkPressed(); |
73 | break; | 95 | break; |
74 | } | ||
75 | |||
76 | } else { | ||
77 | qWarning("Received key in NON search mode"); | ||
78 | |||
79 | switch( e->key() ) { | ||
80 | case Qt::Key_Up: | 96 | case Qt::Key_Up: |
81 | qWarning("a"); | 97 | qWarning( "UP.."); |
82 | // emit signalSearchBackward(); | 98 | --m_itCurContact; |
99 | if ( *m_itCurContact != OContact() ) | ||
100 | sync(); | ||
101 | else | ||
102 | m_itCurContact = m_viewList.end(); | ||
103 | |||
83 | break; | 104 | break; |
84 | case Qt::Key_Down: | 105 | case Qt::Key_Down: |
85 | qWarning("b"); | 106 | qWarning( "DOWN.."); |
86 | // emit signalSearchNext(); | 107 | ++m_itCurContact; |
108 | if ( *m_itCurContact != OContact() ) | ||
109 | sync(); | ||
110 | else | ||
111 | m_itCurContact = m_viewList.begin(); | ||
87 | break; | 112 | break; |
88 | } | 113 | } |
89 | } | 114 | } |
115 | |||
90 | } | 116 | } |