author | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
commit | 8401def65aa4f19d91873bc57a3dcf25c358c490 (patch) (side-by-side diff) | |
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 @@ -24,67 +24,93 @@ #include <qregexp.h> #include <qstylesheet.h> -AbLabel::AbLabel( QWidget *parent, const char *name ) - : QTextView( parent, name ) +AbLabel::AbLabel( QWidget *parent, const char *name ): + QTextView( parent, name ), + m_empty( false ) { } AbLabel::~AbLabel() { } -void AbLabel::init( const OContact &entry ) +void AbLabel::setContacts( const OContactAccess::List& viewList ) { - ent = entry; + m_viewList = viewList; + if (m_viewList.count() != 0){ + m_empty = false; + m_itCurContact = m_viewList.begin(); + sync(); + }else{ + // m_itCurContact.clear(); + m_empty = true; + setText( "" ); + } +} + +int AbLabel::currentEntry_UID() +{ + return ( (*m_itCurContact).uid() ); +} + +OContact AbLabel::currentEntry() +{ + return ( *m_itCurContact ); } + +bool AbLabel::selectContact( int UID ) +{ + + for ( m_itCurContact = m_viewList.begin(); m_itCurContact != m_viewList.end(); ++m_itCurContact){ + if ( (*m_itCurContact).uid() == UID ) + break; + } + sync(); + + return true; +} + + + void AbLabel::sync() { - QString text = ent.toRichText(); + QString text = (*m_itCurContact).toRichText(); setText( text ); } void AbLabel::keyPressEvent( QKeyEvent *e ) { // Commonly handled keys - switch( e->key() ) { - case Qt::Key_Left: - qWarning( "Left.."); - case Qt::Key_F33: - qWarning( "OK.."); - emit okPressed(); - break; - } - - - if ( /* m_inSearch */ false ) { - // Running in seach-mode, therefore we will interprete - // some key differently - qWarning("Received key in search mode"); + if ( !m_empty ){ switch( e->key() ) { - case Qt::Key_Up: - qWarning("a"); - // emit signalSearchBackward(); - break; - case Qt::Key_Down: - qWarning("b"); - // emit signalSearchNext(); + case Qt::Key_Left: + qWarning( "Left.."); + case Qt::Key_Right: + qWarning( "Right.."); + case Qt::Key_F33: + qWarning( "OK.."); + emit signalOkPressed(); break; - } - - } else { - qWarning("Received key in NON search mode"); - - switch( e->key() ) { case Qt::Key_Up: - qWarning("a"); - // emit signalSearchBackward(); + qWarning( "UP.."); + --m_itCurContact; + if ( *m_itCurContact != OContact() ) + sync(); + else + m_itCurContact = m_viewList.end(); + break; case Qt::Key_Down: - qWarning("b"); - // emit signalSearchNext(); + qWarning( "DOWN.."); + ++m_itCurContact; + if ( *m_itCurContact != OContact() ) + sync(); + else + m_itCurContact = m_viewList.begin(); break; } } + } |