summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/ablabel.cpp2
-rw-r--r--core/pim/addressbook/abtable.cpp3
2 files changed, 2 insertions, 3 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp
index 6b8e4dd..139030d 100644
--- a/core/pim/addressbook/ablabel.cpp
+++ b/core/pim/addressbook/ablabel.cpp
@@ -23,97 +23,97 @@
23#include <opie2/odebug.h> 23#include <opie2/odebug.h>
24 24
25AbLabel::AbLabel( QWidget *parent, const char *name ): 25AbLabel::AbLabel( QWidget *parent, const char *name ):
26 QTextView( parent, name ), 26 QTextView( parent, name ),
27 m_empty( false ) 27 m_empty( false )
28{ 28{
29} 29}
30 30
31AbLabel::~AbLabel() 31AbLabel::~AbLabel()
32{ 32{
33} 33}
34 34
35void AbLabel::setContacts( const Opie::OPimContactAccess::List& viewList ) 35void AbLabel::setContacts( const Opie::OPimContactAccess::List& viewList )
36{ 36{
37 m_viewList = viewList; 37 m_viewList = viewList;
38 if (m_viewList.count() != 0){ 38 if (m_viewList.count() != 0){
39 m_empty = false; 39 m_empty = false;
40 m_itCurContact = m_viewList.begin(); 40 m_itCurContact = m_viewList.begin();
41 sync(); 41 sync();
42 }else{ 42 }else{
43 // m_itCurContact.clear(); 43 // m_itCurContact.clear();
44 m_empty = true; 44 m_empty = true;
45 setText( "" ); 45 setText( "" );
46 } 46 }
47} 47}
48 48
49int AbLabel::currentEntry_UID() 49int AbLabel::currentEntry_UID()
50{ 50{
51 Opie::OPimContact contact = currentEntry(); 51 Opie::OPimContact contact = currentEntry();
52 52
53 if ( contact.isEmpty() ) 53 if ( contact.isEmpty() )
54 return 0; 54 return 0;
55 else 55 else
56 return ( contact.uid() ); 56 return ( contact.uid() );
57} 57}
58 58
59Opie::OPimContact AbLabel::currentEntry() 59Opie::OPimContact AbLabel::currentEntry()
60{ 60{
61 if ( ! m_empty ) 61 if ( ! m_empty )
62 return ( *m_itCurContact ); 62 return ( *m_itCurContact );
63 else 63 else
64 return Opie::OPimContact(); 64 return Opie::OPimContact();
65} 65}
66 66
67 67
68bool AbLabel::selectContact( int UID ) 68bool AbLabel::selectContact( int UID )
69{ 69{
70 70
71 for ( int r = 0; r < m_viewList.count(); ++r ) { 71 for ( uint r = 0; r < m_viewList.count(); ++r ) {
72 if ( m_viewList.uidAt( r ) == UID ){ 72 if ( m_viewList.uidAt( r ) == UID ){
73 m_itCurContact.setCurrent( r ); 73 m_itCurContact.setCurrent( r );
74 break; 74 break;
75 } 75 }
76 } 76 }
77 77
78 sync(); 78 sync();
79 79
80 return true; 80 return true;
81} 81}
82 82
83 83
84 84
85void AbLabel::sync() 85void AbLabel::sync()
86{ 86{
87 QString text = (*m_itCurContact).toRichText(); 87 QString text = (*m_itCurContact).toRichText();
88 setText( text ); 88 setText( text );
89} 89}
90 90
91void AbLabel::keyPressEvent( QKeyEvent *e ) 91void AbLabel::keyPressEvent( QKeyEvent *e )
92{ 92{
93 93
94 // Commonly handled keys 94 // Commonly handled keys
95 if ( !m_empty ){ 95 if ( !m_empty ){
96 switch( e->key() ) { 96 switch( e->key() ) {
97 case Qt::Key_Left: 97 case Qt::Key_Left:
98 odebug << "Left.." << oendl; 98 odebug << "Left.." << oendl;
99 case Qt::Key_Right: 99 case Qt::Key_Right:
100 odebug << "Right.." << oendl; 100 odebug << "Right.." << oendl;
101 case Qt::Key_F33: 101 case Qt::Key_F33:
102 odebug << "OK.." << oendl; 102 odebug << "OK.." << oendl;
103 emit signalOkPressed(); 103 emit signalOkPressed();
104 break; 104 break;
105 case Qt::Key_Up: 105 case Qt::Key_Up:
106 odebug << "Up.." << oendl; 106 odebug << "Up.." << oendl;
107 if ( ( visibleHeight() < contentsHeight() ) && 107 if ( ( visibleHeight() < contentsHeight() ) &&
108 ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) 108 ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) )
109 scrollBy( 0, -(visibleHeight()-20) ); 109 scrollBy( 0, -(visibleHeight()-20) );
110 else { 110 else {
111 --m_itCurContact; 111 --m_itCurContact;
112 if ( *m_itCurContact != Opie::OPimContact() ) 112 if ( *m_itCurContact != Opie::OPimContact() )
113 sync(); 113 sync();
114 else 114 else
115 m_itCurContact = m_viewList.end(); 115 m_itCurContact = m_viewList.end();
116 } 116 }
117 117
118 break; 118 break;
119 case Qt::Key_Down: 119 case Qt::Key_Down:
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 30d749c..0be7d1a 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -140,97 +140,96 @@ void AbTable::init()
140{ 140{
141 // :SX showChar = '\0'; 141 // :SX showChar = '\0';
142 setNumRows( 0 ); 142 setNumRows( 0 );
143 setNumCols( 2 ); 143 setNumCols( 2 );
144 144
145 horizontalHeader()->setLabel( 0, tr( "Full Name" )); 145 horizontalHeader()->setLabel( 0, tr( "Full Name" ));
146 horizontalHeader()->setLabel( 1, tr( "Contact" )); 146 horizontalHeader()->setLabel( 1, tr( "Contact" ));
147 setLeftMargin( 0 ); 147 setLeftMargin( 0 );
148 verticalHeader()->hide(); 148 verticalHeader()->hide();
149 columnVisible = true; 149 columnVisible = true;
150} 150}
151 151
152void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList ) 152void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList )
153{ 153{
154 odebug << "AbTable::setContacts()" << oendl; 154 odebug << "AbTable::setContacts()" << oendl;
155 155
156 clear(); 156 clear();
157 m_viewList = viewList; 157 m_viewList = viewList;
158 158
159 setSorting( false ); 159 setSorting( false );
160 setPaintingEnabled( FALSE ); 160 setPaintingEnabled( FALSE );
161 161
162 Opie::OPimContactAccess::List::Iterator it; 162 Opie::OPimContactAccess::List::Iterator it;
163 setNumRows( m_viewList.count() ); 163 setNumRows( m_viewList.count() );
164 //int row = 0; 164 //int row = 0;
165 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) 165 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
166 // insertIntoTable( *it, row++ ); 166 // insertIntoTable( *it, row++ );
167 167
168 // setSorting( true ); 168 // setSorting( true );
169 169
170 // resort(); 170 // resort();
171 171
172 updateVisible(); 172 updateVisible();
173 173
174 setPaintingEnabled( TRUE ); 174 setPaintingEnabled( TRUE );
175 175
176} 176}
177 177
178void AbTable::setOrderedList( const QValueList<int> ordered ) 178void AbTable::setOrderedList( const QValueList<int> ordered )
179{ 179{
180 intFields = ordered; 180 intFields = ordered;
181} 181}
182 182
183 183
184bool AbTable::selectContact( int UID ) 184bool AbTable::selectContact( int UID )
185{ 185{
186 odebug << "AbTable::selectContact( " << UID << " )" << oendl; 186 odebug << "AbTable::selectContact( " << UID << " )" << oendl;
187 int rows = numRows(); 187 int rows = numRows();
188 Opie::OPimContact* foundContact = 0l;
189 bool found = false; 188 bool found = false;
190 189
191 setPaintingEnabled( FALSE ); 190 setPaintingEnabled( FALSE );
192 odebug << "Search start" << oendl; 191 odebug << "Search start" << oendl;
193 for ( int r = 0; r < rows; ++r ) { 192 for ( int r = 0; r < rows; ++r ) {
194 if ( m_viewList.uidAt( r ) == UID ){ 193 if ( m_viewList.uidAt( r ) == UID ){
195 ensureCellVisible( r, 0 ); 194 ensureCellVisible( r, 0 );
196 setCurrentCell( r, 0 ); 195 setCurrentCell( r, 0 );
197 found = true; 196 found = true;
198 break; 197 break;
199 } 198 }
200 } 199 }
201 odebug << "Search end" << oendl; 200 odebug << "Search end" << oendl;
202 201
203 if ( !found ){ 202 if ( !found ){
204 ensureCellVisible( 0,0 ); 203 ensureCellVisible( 0,0 );
205 setCurrentCell( 0, 0 ); 204 setCurrentCell( 0, 0 );
206 } 205 }
207 206
208 setPaintingEnabled( TRUE ); 207 setPaintingEnabled( TRUE );
209 208
210 return true; 209 return true;
211} 210}
212 211
213#if 0 212#if 0
214void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row ) 213void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row )
215{ 214{
216 odebug << "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, " 215 odebug << "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, "
217 << row << " )" << oendl; 216 << row << " )" << oendl;
218 QString strName; 217 QString strName;
219 ContactItem contactItem; 218 ContactItem contactItem;
220 219
221 strName = findContactName( cnt ); 220 strName = findContactName( cnt );
222 contactItem = findContactContact( cnt, row ); 221 contactItem = findContactContact( cnt, row );
223 222
224 AbTableItem *ati; 223 AbTableItem *ati;
225 ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); 224 ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value );
226 contactList.insert( ati, cnt ); 225 contactList.insert( ati, cnt );
227 setItem( row, 0, ati ); 226 setItem( row, 0, ati );
228 ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); 227 ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName);
229 if ( !contactItem.icon.isNull() ) 228 if ( !contactItem.icon.isNull() )
230 ati->setPixmap( contactItem.icon ); 229 ati->setPixmap( contactItem.icon );
231 setItem( row, 1, ati ); 230 setItem( row, 1, ati );
232 231
233 //### cannot do this; table only has two columns at this point 232 //### cannot do this; table only has two columns at this point
234 // setItem( row, 2, new AbPickItem( this ) ); 233 // setItem( row, 2, new AbPickItem( this ) );
235 234
236} 235}
@@ -310,97 +309,97 @@ void AbTable::refresh()
310 309
311 setPaintingEnabled( FALSE ); 310 setPaintingEnabled( FALSE );
312 for ( int r = 0; r < rows; ++r ) { 311 for ( int r = 0; r < rows; ++r ) {
313 abi = static_cast<AbTableItem*>( item(r, 0) ); 312 abi = static_cast<AbTableItem*>( item(r, 0) );
314 contactItem = findContactContact( contactList[abi], r ); 313 contactItem = findContactContact( contactList[abi], r );
315 static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); 314 static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() );
316 if ( !contactItem.icon.isNull() ){ 315 if ( !contactItem.icon.isNull() ){
317 static_cast<AbTableItem*>( item(r, 1) )-> 316 static_cast<AbTableItem*>( item(r, 1) )->
318 setPixmap( contactItem.icon ); 317 setPixmap( contactItem.icon );
319 }else{ 318 }else{
320 static_cast<AbTableItem*>( item(r, 1) )-> 319 static_cast<AbTableItem*>( item(r, 1) )->
321 setPixmap( QPixmap() ); 320 setPixmap( QPixmap() );
322 } 321 }
323 } 322 }
324 resort(); 323 resort();
325 setPaintingEnabled( TRUE ); 324 setPaintingEnabled( TRUE );
326 325
327#endif 326#endif
328} 327}
329 328
330void AbTable::keyPressEvent( QKeyEvent *e ) 329void AbTable::keyPressEvent( QKeyEvent *e )
331{ 330{
332 char key = toupper( e->ascii() ); 331 char key = toupper( e->ascii() );
333 332
334 if ( key >= 'A' && key <= 'Z' ) 333 if ( key >= 'A' && key <= 'Z' )
335 moveTo( key ); 334 moveTo( key );
336 335
337 // odebug << "Received key .." << oendl; 336 // odebug << "Received key .." << oendl;
338 switch( e->key() ) { 337 switch( e->key() ) {
339 case Qt::Key_Space: 338 case Qt::Key_Space:
340 case Qt::Key_Return: 339 case Qt::Key_Return:
341 case Qt::Key_Enter: 340 case Qt::Key_Enter:
342 emit signalSwitch(); 341 emit signalSwitch();
343 break; 342 break;
344 // case Qt::Key_Up: 343 // case Qt::Key_Up:
345 // odebug << "a" << oendl; 344 // odebug << "a" << oendl;
346 // emit signalKeyUp(); 345 // emit signalKeyUp();
347 // break; 346 // break;
348 // case Qt::Key_Down: 347 // case Qt::Key_Down:
349 // odebug << "b" << oendl; 348 // odebug << "b" << oendl;
350 // emit signalKeyDown(); 349 // emit signalKeyDown();
351 // break; 350 // break;
352 default: 351 default:
353 QTable::keyPressEvent( e ); 352 QTable::keyPressEvent( e );
354 } 353 }
355 354
356} 355}
357 356
358void AbTable::moveTo( char c ) 357void AbTable::moveTo( char /*c*/ )
359{ 358{
360 odebug << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl; 359 odebug << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl;
361 360
362#if 0 361#if 0
363 int rows = numRows(); 362 int rows = numRows();
364 QString value; 363 QString value;
365 AbTableItem *abi; 364 AbTableItem *abi;
366 int r; 365 int r;
367 if ( asc ) { 366 if ( asc ) {
368 r = 0; 367 r = 0;
369 while ( r < rows-1) { 368 while ( r < rows-1) {
370 abi = static_cast<AbTableItem*>( item(r, 0) ); 369 abi = static_cast<AbTableItem*>( item(r, 0) );
371 QChar first = abi->key()[0]; 370 QChar first = abi->key()[0];
372 //### is there a bug in QChar to char comparison??? 371 //### is there a bug in QChar to char comparison???
373 if ( first.row() || first.cell() >= c ) 372 if ( first.row() || first.cell() >= c )
374 break; 373 break;
375 r++; 374 r++;
376 } 375 }
377 } else { 376 } else {
378 //### should probably disable reverse sorting instead 377 //### should probably disable reverse sorting instead
379 r = rows - 1; 378 r = rows - 1;
380 while ( r > 0 ) { 379 while ( r > 0 ) {
381 abi = static_cast<AbTableItem*>( item(r, 0) ); 380 abi = static_cast<AbTableItem*>( item(r, 0) );
382 QChar first = abi->key()[0]; 381 QChar first = abi->key()[0];
383 //### is there a bug in QChar to char comparison??? 382 //### is there a bug in QChar to char comparison???
384 if ( first.row() || first.cell() >= c ) 383 if ( first.row() || first.cell() >= c )
385 break; 384 break;
386 r--; 385 r--;
387 } 386 }
388 } 387 }
389 setCurrentCell( r, currentColumn() ); 388 setCurrentCell( r, currentColumn() );
390 389
391#endif 390#endif
392} 391}
393 392
394#if 0 393#if 0
395// Useless.. Nobody uses it .. (se) 394// Useless.. Nobody uses it .. (se)
396QString AbTable::findContactName( const Opie::OPimContact &entry ) 395QString AbTable::findContactName( const Opie::OPimContact &entry )
397{ 396{
398 // We use the fileAs, then company, defaultEmail 397 // We use the fileAs, then company, defaultEmail
399 QString str; 398 QString str;
400 str = entry.fileAs(); 399 str = entry.fileAs();
401 if ( str.isEmpty() ) { 400 if ( str.isEmpty() ) {
402 str = entry.company(); 401 str = entry.company();
403 if ( str.isEmpty() ) { 402 if ( str.isEmpty() ) {
404 str = entry.defaultEmail(); 403 str = entry.defaultEmail();
405 } 404 }
406 } 405 }