author | eilers <eilers> | 2003-03-24 07:44:33 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-24 07:44:33 (UTC) |
commit | 0e1275a67cae2435c0ac8cee2252f91737c2e10a (patch) (side-by-side diff) | |
tree | 0d65a291c21353a5e25932331b63e85050c6bff8 /core/pim/addressbook/ablabel.cpp | |
parent | 1b4836ba28ca57947d37699fc67cddd74fb29fbe (diff) | |
download | opie-0e1275a67cae2435c0ac8cee2252f91737c2e10a.zip opie-0e1275a67cae2435c0ac8cee2252f91737c2e10a.tar.gz opie-0e1275a67cae2435c0ac8cee2252f91737c2e10a.tar.bz2 |
DetailView: If card is too big to show, use page up/down instead of
next/previous contact if cursor up/down is used ..
Diffstat (limited to 'core/pim/addressbook/ablabel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/ablabel.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp index 80b57ae..6d8de91 100644 --- a/core/pim/addressbook/ablabel.cpp +++ b/core/pim/addressbook/ablabel.cpp @@ -87,12 +87,13 @@ void AbLabel::sync() QString text = (*m_itCurContact).toRichText(); setText( text ); } void AbLabel::keyPressEvent( QKeyEvent *e ) { + // Commonly handled keys if ( !m_empty ){ switch( e->key() ) { case Qt::Key_Left: qWarning( "Left.."); case Qt::Key_Right: @@ -100,26 +101,39 @@ void AbLabel::keyPressEvent( QKeyEvent *e ) case Qt::Key_F33: qWarning( "OK.."); emit signalOkPressed(); break; case Qt::Key_Up: qWarning( "UP.."); - --m_itCurContact; - if ( *m_itCurContact != OContact() ) - sync(); - else - m_itCurContact = m_viewList.end(); + if ( ( visibleHeight() < contentsHeight() ) && + ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) + scrollBy( 0, -(visibleHeight()-20) ); + else { + --m_itCurContact; + if ( *m_itCurContact != OContact() ) + sync(); + else + m_itCurContact = m_viewList.end(); + } break; case Qt::Key_Down: qWarning( "DOWN.."); - ++m_itCurContact; - if ( *m_itCurContact != OContact() ) - sync(); - else - m_itCurContact = m_viewList.begin(); +// qWarning( "visible: %d, content: %d",visibleHeight(),contentsHeight()); +// qWarning( "value: %d; barMaxValue: %d", verticalScrollBar()->value() +// , verticalScrollBar()->maxValue() ); + if ( ( visibleHeight() < contentsHeight() ) && + ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) + scrollBy( 0, visibleHeight()-20 ); + else { + ++m_itCurContact; + if ( *m_itCurContact != OContact() ) + sync(); + else + m_itCurContact = m_viewList.begin(); + } break; case Qt::Key_Return: // fall through case Qt::Key_Space: // fall through case Qt::Key_Enter: // we want to switch back emit signalOkPressed(); break; |