summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/ablabel.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp
index 937aaae..1139bd7 100644
--- a/core/pim/addressbook/ablabel.cpp
+++ b/core/pim/addressbook/ablabel.cpp
@@ -22,75 +22,78 @@
22 22
23#include <qpe/stringutil.h> 23#include <qpe/stringutil.h>
24 24
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qstylesheet.h> 26#include <qstylesheet.h>
27 27
28AbLabel::AbLabel( QWidget *parent, const char *name ): 28AbLabel::AbLabel( QWidget *parent, const char *name ):
29 QTextView( parent, name ), 29 QTextView( parent, name ),
30 m_empty( false ) 30 m_empty( false )
31{ 31{
32} 32}
33 33
34AbLabel::~AbLabel() 34AbLabel::~AbLabel()
35{ 35{
36} 36}
37 37
38void AbLabel::setContacts( const OContactAccess::List& viewList ) 38void AbLabel::setContacts( const OContactAccess::List& viewList )
39{ 39{
40 m_viewList = viewList; 40 m_viewList = viewList;
41 if (m_viewList.count() != 0){ 41 if (m_viewList.count() != 0){
42 m_empty = false; 42 m_empty = false;
43 m_itCurContact = m_viewList.begin(); 43 m_itCurContact = m_viewList.begin();
44 sync(); 44 sync();
45 }else{ 45 }else{
46 // m_itCurContact.clear(); 46 // m_itCurContact.clear();
47 m_empty = true; 47 m_empty = true;
48 setText( "" ); 48 setText( "" );
49 } 49 }
50} 50}
51 51
52int AbLabel::currentEntry_UID() 52int AbLabel::currentEntry_UID()
53{ 53{
54 OContact contact = *m_itCurContact; 54 OContact contact = currentEntry();
55 55
56 if ( contact.isEmpty() ) 56 if ( contact.isEmpty() )
57 return 0; 57 return 0;
58 else 58 else
59 return ( contact.uid() ); 59 return ( contact.uid() );
60} 60}
61 61
62OContact AbLabel::currentEntry() 62OContact AbLabel::currentEntry()
63{ 63{
64 return ( *m_itCurContact ); 64 if ( ! m_empty )
65 return ( *m_itCurContact );
66 else
67 return OContact();
65} 68}
66 69
67 70
68bool AbLabel::selectContact( int UID ) 71bool AbLabel::selectContact( int UID )
69{ 72{
70 73
71 for ( m_itCurContact = m_viewList.begin(); m_itCurContact != m_viewList.end(); ++m_itCurContact){ 74 for ( m_itCurContact = m_viewList.begin(); m_itCurContact != m_viewList.end(); ++m_itCurContact){
72 if ( (*m_itCurContact).uid() == UID ) 75 if ( (*m_itCurContact).uid() == UID )
73 break; 76 break;
74 } 77 }
75 sync(); 78 sync();
76 79
77 return true; 80 return true;
78} 81}
79 82
80 83
81 84
82void AbLabel::sync() 85void AbLabel::sync()
83{ 86{
84 QString text = (*m_itCurContact).toRichText(); 87 QString text = (*m_itCurContact).toRichText();
85 setText( text ); 88 setText( text );
86} 89}
87 90
88void AbLabel::keyPressEvent( QKeyEvent *e ) 91void AbLabel::keyPressEvent( QKeyEvent *e )
89{ 92{
90 // Commonly handled keys 93 // Commonly handled keys
91 if ( !m_empty ){ 94 if ( !m_empty ){
92 switch( e->key() ) { 95 switch( e->key() ) {
93 case Qt::Key_Left: 96 case Qt::Key_Left:
94 qWarning( "Left.."); 97 qWarning( "Left..");
95 case Qt::Key_Right: 98 case Qt::Key_Right:
96 qWarning( "Right.."); 99 qWarning( "Right..");