summaryrefslogtreecommitdiff
authoreilers <eilers>2003-08-30 15:32:34 (UTC)
committer eilers <eilers>2003-08-30 15:32:34 (UTC)
commitcfb97af8f45087e58d4b82689df22191bd657c34 (patch) (unidiff)
tree9e01e85787092abb0d8c6733bbe3091eaf6a892a
parent9f07321949f8baf1a64db0e4caec58041d3f775f (diff)
downloadopie-cfb97af8f45087e58d4b82689df22191bd657c34.zip
opie-cfb97af8f45087e58d4b82689df22191bd657c34.tar.gz
opie-cfb97af8f45087e58d4b82689df22191bd657c34.tar.bz2
Speed optimization fix:
Startup and usability improved if a lot of contacts are stored. Left speed bootleneck is the xml file..
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/addressbook/ablabel.cpp7
-rw-r--r--core/pim/addressbook/abtable.cpp101
-rw-r--r--core/pim/addressbook/abtable.h16
-rw-r--r--core/pim/addressbook/abview.cpp25
-rw-r--r--core/pim/addressbook/addressbook.cpp2
-rw-r--r--core/pim/addressbook/version.h2
6 files changed, 96 insertions, 57 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp
index 6d8de91..1914f71 100644
--- a/core/pim/addressbook/ablabel.cpp
+++ b/core/pim/addressbook/ablabel.cpp
@@ -68,16 +68,19 @@ OContact AbLabel::currentEntry()
68} 68}
69 69
70 70
71bool AbLabel::selectContact( int UID ) 71bool AbLabel::selectContact( int UID )
72{ 72{
73 73
74 for ( m_itCurContact = m_viewList.begin(); m_itCurContact != m_viewList.end(); ++m_itCurContact){ 74 for ( int r = 0; r < m_viewList.count(); ++r ) {
75 if ( (*m_itCurContact).uid() == UID ) 75 if ( m_viewList.uidAt( r ) == UID ){
76 m_itCurContact.setCurrent( r );
76 break; 77 break;
77 } 78 }
79 }
80
78 sync(); 81 sync();
79 82
80 return true; 83 return true;
81} 84}
82 85
83 86
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index a2617fa..4705c78 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -41,12 +41,14 @@
41#include <fcntl.h> 41#include <fcntl.h>
42#include <unistd.h> 42#include <unistd.h>
43#include <stdlib.h> 43#include <stdlib.h>
44 44
45#include <ctype.h> //toupper() for key hack 45#include <ctype.h> //toupper() for key hack
46 46
47#if 0
48
47/*! 49/*!
48 \class AbTableItem abtable.h 50 \class AbTableItem abtable.h
49 51
50 \brief QTableItem based class for showing a field of an entry 52 \brief QTableItem based class for showing a field of an entry
51*/ 53*/
52 54
@@ -109,12 +111,14 @@ void AbPickItem::setContentFromEditor( QWidget *w )
109 if ( w->inherits("QComboBox") ) 111 if ( w->inherits("QComboBox") )
110 setText( ( (QComboBox*)w )->currentText() ); 112 setText( ( (QComboBox*)w )->currentText() );
111 else 113 else
112 QTableItem::setContentFromEditor( w ); 114 QTableItem::setContentFromEditor( w );
113} 115}
114 116
117#endif
118
115/*! 119/*!
116 \class AbTable abtable.h 120 \class AbTable abtable.h
117 121
118 \brief QTable based class for showing a list of entries 122 \brief QTable based class for showing a list of entries
119*/ 123*/
120 124
@@ -132,13 +136,13 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name
132 setSelectionMode( NoSelection ); 136 setSelectionMode( NoSelection );
133 init(); 137 init();
134 setSorting( TRUE ); 138 setSorting( TRUE );
135 connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), 139 connect( this, SIGNAL(clicked(int,int,int,const QPoint &)),
136 this, SLOT(itemClicked(int,int)) ); 140 this, SLOT(itemClicked(int,int)) );
137 141
138 contactList.clear(); 142 // contactList.clear();
139 //qWarning("C'tor end"); 143 //qWarning("C'tor end");
140} 144}
141 145
142AbTable::~AbTable() 146AbTable::~AbTable()
143{ 147{
144} 148}
@@ -155,29 +159,29 @@ void AbTable::init()
155 verticalHeader()->hide(); 159 verticalHeader()->hide();
156 columnVisible = true; 160 columnVisible = true;
157} 161}
158 162
159void AbTable::setContacts( const OContactAccess::List& viewList ) 163void AbTable::setContacts( const OContactAccess::List& viewList )
160{ 164{
161 //qWarning("AbTable::setContacts()"); 165 qWarning("AbTable::setContacts()");
162 166
163 clear(); 167 clear();
164 m_viewList = viewList; 168 m_viewList = viewList;
165 169
166 setSorting( false ); 170 setSorting( false );
167 setPaintingEnabled( FALSE ); 171 setPaintingEnabled( FALSE );
168 172
169 OContactAccess::List::Iterator it; 173 OContactAccess::List::Iterator it;
170 setNumRows( m_viewList.count() ); 174 setNumRows( m_viewList.count() );
171 int row = 0; 175 //int row = 0;
172 for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) 176 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
173 insertIntoTable( *it, row++ ); 177 // insertIntoTable( *it, row++ );
174 178
175 setSorting( true ); 179 // setSorting( true );
176 180
177 resort(); 181 // resort();
178 182
179 updateVisible(); 183 updateVisible();
180 184
181 setPaintingEnabled( TRUE ); 185 setPaintingEnabled( TRUE );
182 186
183} 187}
@@ -187,43 +191,43 @@ void AbTable::setOrderedList( const QValueList<int> ordered )
187 intFields = ordered; 191 intFields = ordered;
188} 192}
189 193
190 194
191bool AbTable::selectContact( int UID ) 195bool AbTable::selectContact( int UID )
192{ 196{
193 //qWarning( "AbTable::selectContact( %d )", UID ); 197 qWarning( "AbTable::selectContact( %d )", UID );
194 int rows = numRows(); 198 int rows = numRows();
195 AbTableItem *abi;
196 OContact* foundContact = 0l; 199 OContact* foundContact = 0l;
197 bool found = false; 200 bool found = false;
198 201
199 setPaintingEnabled( FALSE ); 202 setPaintingEnabled( FALSE );
203 qWarning( "search start" );
200 for ( int r = 0; r < rows; ++r ) { 204 for ( int r = 0; r < rows; ++r ) {
201 abi = static_cast<AbTableItem*>( item(r, 0) ); 205 if ( m_viewList.uidAt( r ) == UID ){
202 foundContact = &contactList[abi];
203 if ( foundContact -> uid() == UID ){
204 ensureCellVisible( r, 0 ); 206 ensureCellVisible( r, 0 );
205 setCurrentCell( r, 0 ); 207 setCurrentCell( r, 0 );
206 found = true; 208 found = true;
207 break; 209 break;
208 } 210 }
209 } 211 }
212 qWarning( "search end" );
210 213
211 if ( !found ){ 214 if ( !found ){
212 ensureCellVisible( 0,0 ); 215 ensureCellVisible( 0,0 );
213 setCurrentCell( 0, 0 ); 216 setCurrentCell( 0, 0 );
214 } 217 }
215 218
216 setPaintingEnabled( TRUE ); 219 setPaintingEnabled( TRUE );
217 220
218 return true; 221 return true;
219} 222}
220 223
224#if 0
221void AbTable::insertIntoTable( const OContact& cnt, int row ) 225void AbTable::insertIntoTable( const OContact& cnt, int row )
222{ 226{
223 //qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); 227 qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row );
224 QString strName; 228 QString strName;
225 ContactItem contactItem; 229 ContactItem contactItem;
226 230
227 strName = findContactName( cnt ); 231 strName = findContactName( cnt );
228 contactItem = findContactContact( cnt, row ); 232 contactItem = findContactContact( cnt, row );
229 233
@@ -237,13 +241,13 @@ void AbTable::insertIntoTable( const OContact& cnt, int row )
237 setItem( row, 1, ati ); 241 setItem( row, 1, ati );
238 242
239 //### cannot do this; table only has two columns at this point 243 //### cannot do this; table only has two columns at this point
240 // setItem( row, 2, new AbPickItem( this ) ); 244 // setItem( row, 2, new AbPickItem( this ) );
241 245
242} 246}
243 247#endif
244 248
245 249
246void AbTable::columnClicked( int col ) 250void AbTable::columnClicked( int col )
247{ 251{
248 if ( !sorting() ) 252 if ( !sorting() )
249 return; 253 return;
@@ -260,46 +264,40 @@ void AbTable::columnClicked( int col )
260 //QMessageBox::information( this, "resort", "columnClicked" ); 264 //QMessageBox::information( this, "resort", "columnClicked" );
261 resort(); 265 resort();
262} 266}
263 267
264void AbTable::resort() 268void AbTable::resort()
265{ 269{
266 //qWarning( "void AbTable::resort()" ); 270 qWarning( "void AbTable::resort() NOT POSSIBLE !!" );
271#if 0
267 setPaintingEnabled( FALSE ); 272 setPaintingEnabled( FALSE );
268 if ( sorting() ) { 273 if ( sorting() ) {
269 if ( lastSortCol == -1 ) 274 if ( lastSortCol == -1 )
270 lastSortCol = 0; 275 lastSortCol = 0;
271 sortColumn( lastSortCol, asc, TRUE ); 276 sortColumn( lastSortCol, asc, TRUE );
272 //QMessageBox::information( this, "resort", "resort" ); 277 //QMessageBox::information( this, "resort", "resort" );
273 updateVisible(); 278 updateVisible();
274 } 279 }
275 setPaintingEnabled( TRUE ); 280 setPaintingEnabled( TRUE );
281#endif
276} 282}
277 283
278OContact AbTable::currentEntry() 284OContact AbTable::currentEntry()
279{ 285{
280 //qWarning( "OContact AbTable::currentEntry()" ); 286 return m_viewList[currentRow()];
281 OContact cnt;
282 AbTableItem *abItem;
283 abItem = static_cast<AbTableItem*>(item( currentRow(), 0 ));
284 if ( abItem ) {
285 cnt = contactList[abItem];
286 //cnt = contactList[currentRow()];
287 }
288 return cnt;
289} 287}
290 288
291int AbTable::currentEntry_UID() 289int AbTable::currentEntry_UID()
292{ 290{
293 return ( currentEntry().uid() ); 291 return ( currentEntry().uid() );
294} 292}
295 293
296void AbTable::clear() 294void AbTable::clear()
297{ 295{
298 //qWarning( "void AbTable::clear()" ); 296 qWarning( "void AbTable::clear()" );
299 contactList.clear(); 297 // contactList.clear();
300 298
301 setPaintingEnabled( FALSE ); 299 setPaintingEnabled( FALSE );
302 for ( int r = 0; r < numRows(); ++r ) { 300 for ( int r = 0; r < numRows(); ++r ) {
303 for ( int c = 0; c < numCols(); ++c ) { 301 for ( int c = 0; c < numCols(); ++c ) {
304 if ( cellWidget( r, c ) ) 302 if ( cellWidget( r, c ) )
305 clearCellWidget( r, c ); 303 clearCellWidget( r, c );
@@ -310,13 +308,15 @@ void AbTable::clear()
310 setPaintingEnabled( TRUE ); 308 setPaintingEnabled( TRUE );
311} 309}
312 310
313// Refresh updates column 2 if the contactsettings changed 311// Refresh updates column 2 if the contactsettings changed
314void AbTable::refresh() 312void AbTable::refresh()
315{ 313{
316 //qWarning( "void AbTable::refresh()" ); 314 qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" );
315
316#if 0
317 int rows = numRows(); 317 int rows = numRows();
318 AbTableItem *abi; 318 AbTableItem *abi;
319 ContactItem contactItem; 319 ContactItem contactItem;
320 320
321 setPaintingEnabled( FALSE ); 321 setPaintingEnabled( FALSE );
322 for ( int r = 0; r < rows; ++r ) { 322 for ( int r = 0; r < rows; ++r ) {
@@ -330,12 +330,14 @@ void AbTable::refresh()
330 static_cast<AbTableItem*>( item(r, 1) )-> 330 static_cast<AbTableItem*>( item(r, 1) )->
331 setPixmap( QPixmap() ); 331 setPixmap( QPixmap() );
332 } 332 }
333 } 333 }
334 resort(); 334 resort();
335 setPaintingEnabled( TRUE ); 335 setPaintingEnabled( TRUE );
336
337#endif
336} 338}
337 339
338void AbTable::keyPressEvent( QKeyEvent *e ) 340void AbTable::keyPressEvent( QKeyEvent *e )
339{ 341{
340 char key = toupper( e->ascii() ); 342 char key = toupper( e->ascii() );
341 343
@@ -362,14 +364,15 @@ void AbTable::keyPressEvent( QKeyEvent *e )
362 } 364 }
363 365
364} 366}
365 367
366void AbTable::moveTo( char c ) 368void AbTable::moveTo( char c )
367{ 369{
368 qWarning( "void AbTable::moveTo( char c )" ); 370 qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" );
369 371
372#if 0
370 int rows = numRows(); 373 int rows = numRows();
371 QString value; 374 QString value;
372 AbTableItem *abi; 375 AbTableItem *abi;
373 int r; 376 int r;
374 if ( asc ) { 377 if ( asc ) {
375 r = 0; 378 r = 0;
@@ -391,15 +394,18 @@ void AbTable::moveTo( char c )
391 if ( first.row() || first.cell() >= c ) 394 if ( first.row() || first.cell() >= c )
392 break; 395 break;
393 r--; 396 r--;
394 } 397 }
395 } 398 }
396 setCurrentCell( r, currentColumn() ); 399 setCurrentCell( r, currentColumn() );
397}
398 400
401#endif
402}
399 403
404#if 0
405// Useless.. Nobody uses it .. (se)
400QString AbTable::findContactName( const OContact &entry ) 406QString AbTable::findContactName( const OContact &entry )
401{ 407{
402 // We use the fileAs, then company, defaultEmail 408 // We use the fileAs, then company, defaultEmail
403 QString str; 409 QString str;
404 str = entry.fileAs(); 410 str = entry.fileAs();
405 if ( str.isEmpty() ) { 411 if ( str.isEmpty() ) {
@@ -407,13 +413,13 @@ QString AbTable::findContactName( const OContact &entry )
407 if ( str.isEmpty() ) { 413 if ( str.isEmpty() ) {
408 str = entry.defaultEmail(); 414 str = entry.defaultEmail();
409 } 415 }
410 } 416 }
411 return str; 417 return str;
412} 418}
413 419#endif
414 420
415 421
416void AbTable::resizeRows() { 422void AbTable::resizeRows() {
417 /* 423 /*
418 if (numRows()) { 424 if (numRows()) {
419 for (int i = 0; i < numRows(); i++) { 425 for (int i = 0; i < numRows(); i++) {
@@ -503,12 +509,13 @@ void AbTable::show()
503{ 509{
504 //qWarning( "void AbTable::show()" ); 510 //qWarning( "void AbTable::show()" );
505 realignTable(); 511 realignTable();
506 QTable::show(); 512 QTable::show();
507} 513}
508 514
515#if 0
509void AbTable::setChoiceNames( const QStringList& list) 516void AbTable::setChoiceNames( const QStringList& list)
510{ 517{
511 choicenames = list; 518 choicenames = list;
512 if ( choicenames.isEmpty() ) { 519 if ( choicenames.isEmpty() ) {
513 // hide pick column 520 // hide pick column
514 setNumCols( 2 ); 521 setNumCols( 2 );
@@ -517,29 +524,32 @@ void AbTable::setChoiceNames( const QStringList& list)
517 setNumCols( 3 ); 524 setNumCols( 3 );
518 setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); 525 setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 );
519 horizontalHeader()->setLabel( 2, tr( "Pick" )); 526 horizontalHeader()->setLabel( 2, tr( "Pick" ));
520 } 527 }
521 fitColumns(); 528 fitColumns();
522} 529}
530#endif
523 531
524void AbTable::itemClicked(int,int col) 532void AbTable::itemClicked(int,int col)
525{ 533{
526 //qWarning( "AbTable::itemClicked(int, col:%d)", col); 534 //qWarning( "AbTable::itemClicked(int, col:%d)", col);
527 if ( col == 2 ) { 535 if ( col == 2 ) {
528 return; 536 return;
529 } else { 537 } else {
530 // qWarning ("Emitting signalSwitch()"); 538 // qWarning ("Emitting signalSwitch()");
531 emit signalSwitch(); 539 emit signalSwitch();
532 } 540 }
533} 541}
534 542
543#if 0
535QStringList AbTable::choiceNames() const 544QStringList AbTable::choiceNames() const
536{ 545{
537 return choicenames; 546 return choicenames;
538} 547}
539 548
549#endif
540void AbTable::setChoiceSelection( const QValueList<int>& list ) 550void AbTable::setChoiceSelection( const QValueList<int>& list )
541{ 551{
542 intFields = list; 552 intFields = list;
543} 553}
544 554
545QStringList AbTable::choiceSelection(int /*index*/) const 555QStringList AbTable::choiceSelection(int /*index*/) const
@@ -557,14 +567,12 @@ QStringList AbTable::choiceSelection(int /*index*/) const
557 567
558 */ 568 */
559 return r; 569 return r;
560} 570}
561 571
562 572
563
564
565void AbTable::updateVisible() 573void AbTable::updateVisible()
566{ 574{
567 //qWarning("void AbTable::updateVisible()"); 575 //qWarning("void AbTable::updateVisible()");
568 576
569 int visible, 577 int visible,
570 totalRows, 578 totalRows,
@@ -627,12 +635,16 @@ void AbTable::viewportPaintEvent( QPaintEvent* e ) {
627 635
628void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { 636void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) {
629 const QColorGroup &cg = colorGroup(); 637 const QColorGroup &cg = colorGroup();
630 638
631 p->save(); 639 p->save();
632 640
641 //qWarning( "Paint row: %d", row );
642
643 OContact act_contact = m_viewList[row];
644
633 // Paint alternating background bars 645 // Paint alternating background bars
634 if ( (row % 2 ) == 0 ) { 646 if ( (row % 2 ) == 0 ) {
635 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); 647 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
636 p->setPen( QPen( cg.text() ) ); 648 p->setPen( QPen( cg.text() ) );
637 } 649 }
638 else { 650 else {
@@ -644,23 +656,38 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool )
644 QFontMetrics fm(f); 656 QFontMetrics fm(f);
645 657
646 int marg = 2; 658 int marg = 2;
647 int x = 0; 659 int x = 0;
648 int y = ( cr.height() - 14 ) / 2; 660 int y = ( cr.height() - 14 ) / 2;
649 661
650 QPixmap pic = pixmap( row, col ); 662 QString nameText = act_contact.fileAs();
651 if ( !pic.isNull() ) 663
664 switch( col ){
665 case 0:
666 p->drawText( x + marg,2 + fm.ascent(), nameText );
667 break;
668 case 1:{
669
670 ContactItem contactItem = findContactContact( act_contact, 0 );
671 QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */
672 QString contactText = contactItem.value;
673
674 if ( !contactPic.isNull() )
652 { 675 {
653 p->drawPixmap( x + marg, y, pixmap( row, col ) ); 676 p->drawPixmap( x + marg, y, contactPic );
654 p->drawText( x + marg + pixmap( row, col ).width() + 4,2 + fm.ascent(), text( row, col ) ); 677 p->drawText( x + marg + contactPic.width()
678 + 4,2 + fm.ascent(), contactText );
655 } 679 }
656 else 680 else
657 { 681 {
658 p->drawText( x + marg,2 + fm.ascent(), text( row, col ) ); 682 p->drawText( x + marg,2 + fm.ascent(), contactText );
659 } 683 }
684 }
685 break;
660 686
687 }
661 p->restore(); 688 p->restore();
662} 689}
663 690
664void AbTable::rowHeightChanged( int row ) 691void AbTable::rowHeightChanged( int row )
665{ 692{
666 if ( enablePainting ) 693 if ( enablePainting )
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 0f7bc29..b9ebe27 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -29,12 +29,13 @@
29#include <qmap.h> 29#include <qmap.h>
30#include <qtable.h> 30#include <qtable.h>
31#include <qstringlist.h> 31#include <qstringlist.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qpixmap.h> 33#include <qpixmap.h>
34 34
35#if 0
35class AbTableItem : public QTableItem 36class AbTableItem : public QTableItem
36{ 37{
37public: 38public:
38 AbTableItem( QTable *t, EditType et, const QString &s, 39 AbTableItem( QTable *t, EditType et, const QString &s,
39 const QString &secondSortKey); 40 const QString &secondSortKey);
40 QString entryKey() const; 41 QString entryKey() const;
@@ -44,33 +45,38 @@ public:
44 void setItem( const QString &txt, const QString &secondKey ); 45 void setItem( const QString &txt, const QString &secondKey );
45 46
46private: 47private:
47 QString sortKey; 48 QString sortKey;
48}; 49};
49 50
51#endif
52
50// This is a simple container, storing all contact 53// This is a simple container, storing all contact
51// information 54// information
52class ContactItem 55class ContactItem
53{ 56{
54 public: 57 public:
55 QPixmap icon; 58 QPixmap icon;
56 QString value; 59 QString value;
57}; 60};
58 61
62#if 0
59class AbPickItem : public QTableItem 63class AbPickItem : public QTableItem
60{ 64{
61public: 65public:
62 AbPickItem( QTable *t ); 66 AbPickItem( QTable *t );
63 67
64 QWidget *createEditor() const; 68 QWidget *createEditor() const;
65 void setContentFromEditor( QWidget *w ); 69 void setContentFromEditor( QWidget *w );
66 70
67private: 71private:
68 QGuardedPtr<QComboBox> cb; 72 QGuardedPtr<QComboBox> cb;
69}; 73};
70 74
75#endif
76
71class AbTable : public QTable 77class AbTable : public QTable
72{ 78{
73 Q_OBJECT 79 Q_OBJECT
74 80
75public: 81public:
76 AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 ); 82 AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 );
@@ -88,26 +94,26 @@ public:
88 // Get the current selected entry 94 // Get the current selected entry
89 OContact currentEntry(); 95 OContact currentEntry();
90 96
91 // Get the UID of the current selected Entry 97 // Get the UID of the current selected Entry
92 int currentEntry_UID(); 98 int currentEntry_UID();
93 99
94 QString findContactName( const OContact &entry ); 100 // QString findContactName( const OContact &entry );
95 101
96 void init(); 102 void init();
97 void clear(); 103 void clear();
98 void refresh(); 104 void refresh();
99 105
100 void show(); 106 void show();
101 void setPaintingEnabled( bool e ); 107 void setPaintingEnabled( bool e );
102 void viewportPaintEvent( QPaintEvent* e); 108 void viewportPaintEvent( QPaintEvent* e);
103 void paintCell(QPainter* p, int row, int col, const QRect&, bool ); 109 void paintCell(QPainter* p, int row, int col, const QRect&, bool );
104 110
105 // addresspicker mode (What's that ? se) 111 // addresspicker mode (What's that ? se)
106 void setChoiceNames( const QStringList& list); 112 // void setChoiceNames( const QStringList& list);
107 QStringList choiceNames() const; 113 // QStringList choiceNames() const;
108 void setChoiceSelection( const QValueList<int>& list ); 114 void setChoiceSelection( const QValueList<int>& list );
109 QStringList choiceSelection(int index) const; 115 QStringList choiceSelection(int index) const;
110 116
111signals: 117signals:
112 void signalSwitch(); 118 void signalSwitch();
113 void signalEditor(); 119 void signalEditor();
@@ -126,23 +132,23 @@ protected slots:
126 void moveTo( char ); 132 void moveTo( char );
127 virtual void columnClicked( int col ); 133 virtual void columnClicked( int col );
128 void itemClicked(int,int col); 134 void itemClicked(int,int col);
129 void rowHeightChanged( int row ); 135 void rowHeightChanged( int row );
130 136
131private: 137private:
132 void insertIntoTable( const OContact &cnt, int row ); 138 // void insertIntoTable( const OContact &cnt, int row );
133 ContactItem findContactContact( const OContact &entry, int row ); 139 ContactItem findContactContact( const OContact &entry, int row );
134 void fitColumns(); 140 void fitColumns();
135 void resizeRows(); 141 void resizeRows();
136 void realignTable(); 142 void realignTable();
137 void resort(); 143 void resort();
138 void updateVisible(); 144 void updateVisible();
139 145
140 int lastSortCol; 146 int lastSortCol;
141 bool asc; 147 bool asc;
142 QMap<AbTableItem*, OContact> contactList; 148 // QMap<AbTableItem*, OContact> contactList;
143 QValueList<int> intFields; 149 QValueList<int> intFields;
144 QStringList choicenames; 150 QStringList choicenames;
145 bool enablePainting; 151 bool enablePainting;
146 bool columnVisible; 152 bool columnVisible;
147 int countNested; 153 int countNested;
148 154
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 477f85b..6cbd556 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -48,12 +48,13 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
48 m_contactdb ( 0l ), 48 m_contactdb ( 0l ),
49 m_storedDB ( 0l ), 49 m_storedDB ( 0l ),
50 m_viewStack( 0l ), 50 m_viewStack( 0l ),
51 m_abTable( 0l ), 51 m_abTable( 0l ),
52 m_orderedFields( ordered ) 52 m_orderedFields( ordered )
53{ 53{
54 qWarning("AbView::c'tor");
54 // Load default database and handle syncing myself.. ! 55 // Load default database and handle syncing myself.. !
55 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), 56 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ),
56 mCat.load( categoryFileName() ); 57 mCat.load( categoryFileName() );
57 58
58 // Create Layout and put WidgetStack into it. 59 // Create Layout and put WidgetStack into it.
59 QVBoxLayout *vb = new QVBoxLayout( this ); 60 QVBoxLayout *vb = new QVBoxLayout( this );
@@ -94,34 +95,34 @@ AbView::~AbView()
94 } 95 }
95} 96}
96 97
97 98
98void AbView::setView( Views view ) 99void AbView::setView( Views view )
99{ 100{
100 //qWarning("AbView::setView( Views view )"); 101 qWarning("AbView::setView( Views view )");
101 m_curr_View = view; 102 m_curr_View = view;
102 load(); 103 load();
103} 104}
104 105
105void AbView::addEntry( const OContact &newContact ) 106void AbView::addEntry( const OContact &newContact )
106{ 107{
107 //qWarning("abview:AddContact"); 108 qWarning("abview:AddContact");
108 m_contactdb->add ( newContact ); 109 m_contactdb->add ( newContact );
109 load(); 110 load();
110 111
111} 112}
112void AbView::removeEntry( const int UID ) 113void AbView::removeEntry( const int UID )
113{ 114{
114 //qWarning("abview:RemoveContact"); 115 qWarning("abview:RemoveContact");
115 m_contactdb->remove( UID ); 116 m_contactdb->remove( UID );
116 load(); 117 load();
117} 118}
118 119
119void AbView::replaceEntry( const OContact &contact ) 120void AbView::replaceEntry( const OContact &contact )
120{ 121{
121 //qWarning("abview:ReplaceContact"); 122 qWarning("abview:ReplaceContact");
122 m_contactdb->replace( contact ); 123 m_contactdb->replace( contact );
123 load(); 124 load();
124 125
125} 126}
126 127
127OContact AbView::currentEntry() 128OContact AbView::currentEntry()
@@ -146,47 +147,48 @@ bool AbView::save()
146 147
147 return m_contactdb->save(); 148 return m_contactdb->save();
148} 149}
149 150
150void AbView::load() 151void AbView::load()
151{ 152{
152 //qWarning("abView:Load data"); 153 qWarning("abView:Load data");
153 154
154 // Letter Search is stopped at this place 155 // Letter Search is stopped at this place
155 emit signalClearLetterPicker(); 156 emit signalClearLetterPicker();
156 157
157 if ( m_inPersonal ) 158 if ( m_inPersonal )
158 // VCard Backend does not sort.. 159 // VCard Backend does not sort..
159 m_list = m_contactdb->allRecords(); 160 m_list = m_contactdb->allRecords();
160 else{ 161 else{
161 m_list = m_contactdb->sorted( true, 0, 0, 0 ); 162 m_list = m_contactdb->sorted( true, 0, 0, 0 );
163 if ( m_curr_category != -1 )
162 clearForCategory(); 164 clearForCategory();
163 } 165 }
164 166
165 qWarning ("Number of contacts: %d", m_list.count()); 167 qWarning ("Number of contacts: %d", m_list.count());
166 168
167 updateView( true ); 169 updateView( true );
168 170
169} 171}
170 172
171void AbView::reload() 173void AbView::reload()
172{ 174{
173 //qWarning( "void AbView::reload()" ); 175 qWarning( "void AbView::reload()" );
174 176
175 m_contactdb->reload(); 177 m_contactdb->reload();
176 load(); 178 load();
177} 179}
178 180
179void AbView::clear() 181void AbView::clear()
180{ 182{
181 // :SX 183 // :SX
182} 184}
183 185
184void AbView::setShowByCategory( const QString& cat ) 186void AbView::setShowByCategory( const QString& cat )
185{ 187{
186 //qWarning("AbView::setShowCategory( const QString& cat )"); 188 qWarning("AbView::setShowCategory( const QString& cat )");
187 189
188 int intCat = 0; 190 int intCat = 0;
189 191
190 // All (cat == NULL) will be stored as -1 192 // All (cat == NULL) will be stored as -1
191 if ( cat.isNull() ) 193 if ( cat.isNull() )
192 intCat = -1; 194 intCat = -1;
@@ -204,17 +206,16 @@ void AbView::setShowByCategory( const QString& cat )
204 } 206 }
205 207
206} 208}
207 209
208void AbView::setShowToView( Views view ) 210void AbView::setShowToView( Views view )
209{ 211{
210 //qWarning("void AbView::setShowToView( View %d )", view); 212 qWarning("void AbView::setShowToView( View %d )", view);
211
212 //qWarning ("Change the View (Category is: %d)", m_curr_category);
213 213
214 if ( m_curr_View != view ){ 214 if ( m_curr_View != view ){
215 qWarning ("Change the View (Category is: %d)", m_curr_category);
215 m_prev_View = m_curr_View; 216 m_prev_View = m_curr_View;
216 m_curr_View = view; 217 m_curr_View = view;
217 218
218 updateView(); 219 updateView();
219 } 220 }
220 221
@@ -247,12 +248,13 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode )
247 default: 248 default:
248 qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); 249 qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode );
249 qWarning( "I will ignore it.." ); 250 qWarning( "I will ignore it.." );
250 return; 251 return;
251 } 252 }
252 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); 253 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase );
254 if ( m_curr_category != -1 )
253 clearForCategory(); 255 clearForCategory();
254 m_curr_Contact = 0; 256 m_curr_Contact = 0;
255 } 257 }
256 updateView( true ); 258 updateView( true );
257} 259}
258 260
@@ -271,13 +273,13 @@ QString AbView::showCategory() const
271{ 273{
272 return mCat.label( "Contacts", m_curr_category ); 274 return mCat.label( "Contacts", m_curr_category );
273} 275}
274 276
275void AbView::showPersonal( bool personal ) 277void AbView::showPersonal( bool personal )
276{ 278{
277 //qWarning ("void AbView::showPersonal( %d )", personal); 279 qWarning ("void AbView::showPersonal( %d )", personal);
278 280
279 if ( personal ){ 281 if ( personal ){
280 282
281 if ( m_inPersonal ) 283 if ( m_inPersonal )
282 return; 284 return;
283 285
@@ -359,12 +361,13 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
359 return; 361 return;
360 } 362 }
361 363
362 // Now remove all contacts with wrong category (if any selected) 364 // Now remove all contacts with wrong category (if any selected)
363 // This algorithm is a litte bit ineffective, but 365 // This algorithm is a litte bit ineffective, but
364 // we will not have a lot of matching entries.. 366 // we will not have a lot of matching entries..
367 if ( m_curr_category != -1 )
365 clearForCategory(); 368 clearForCategory();
366 369
367 // Now show all found entries 370 // Now show all found entries
368 updateView( true ); 371 updateView( true );
369} 372}
370 373
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 03c96c8..0ba024e 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -245,13 +245,13 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
245 connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), 245 connect( m_abView, SIGNAL( signalViewSwitched ( int ) ),
246 this, SLOT( slotViewSwitched( int ) ) ); 246 this, SLOT( slotViewSwitched( int ) ) );
247 247
248 248
249 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); 249 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) );
250 250
251 m_abView->load(); 251 // m_abView->load(); // Already done by c'tor .
252 252
253 // Letter Picker 253 // Letter Picker
254 pLabel = new LetterPicker( listContainer ); 254 pLabel = new LetterPicker( listContainer );
255 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); 255 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
256 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); 256 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) );
257 257
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h
index 9621826..790aa95 100644
--- a/core/pim/addressbook/version.h
+++ b/core/pim/addressbook/version.h
@@ -1,10 +1,10 @@
1#ifndef _VERSION_H_ 1#ifndef _VERSION_H_
2#define _VERSION_H_ 2#define _VERSION_H_
3 3
4#define MAINVERSION "1" 4#define MAINVERSION "1"
5#define SUBVERSION "0" 5#define SUBVERSION "1"
6#define PATCHVERSION "0" 6#define PATCHVERSION "0"
7 7
8#define APPNAME "OPIE_ADDRESSBOOK" 8#define APPNAME "OPIE_ADDRESSBOOK"
9 9
10#endif 10#endif