author | eilers <eilers> | 2003-08-30 15:32:34 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-08-30 15:32:34 (UTC) |
commit | cfb97af8f45087e58d4b82689df22191bd657c34 (patch) (unidiff) | |
tree | 9e01e85787092abb0d8c6733bbe3091eaf6a892a | |
parent | 9f07321949f8baf1a64db0e4caec58041d3f775f (diff) | |
download | opie-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..
-rw-r--r-- | core/pim/addressbook/ablabel.cpp | 7 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 113 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.h | 16 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 31 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 2 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 2 |
6 files changed, 105 insertions, 66 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 | |||
@@ -71,10 +71,13 @@ OContact AbLabel::currentEntry() | |||
71 | bool AbLabel::selectContact( int UID ) | 71 | bool 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; |
78 | } | ||
77 | } | 79 | } |
80 | |||
78 | sync(); | 81 | sync(); |
79 | 82 | ||
80 | return true; | 83 | return true; |
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 | |||
@@ -44,6 +44,8 @@ | |||
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 | ||
@@ -112,6 +114,8 @@ void AbPickItem::setContentFromEditor( QWidget *w ) | |||
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 | ||
@@ -135,7 +139,7 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name | |||
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 | ||
@@ -158,7 +162,7 @@ void AbTable::init() | |||
158 | 162 | ||
159 | void AbTable::setContacts( const OContactAccess::List& viewList ) | 163 | void 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; |
@@ -168,13 +172,13 @@ void AbTable::setContacts( const OContactAccess::List& viewList ) | |||
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 | ||
@@ -190,23 +194,22 @@ void AbTable::setOrderedList( const QValueList<int> ordered ) | |||
190 | 194 | ||
191 | bool AbTable::selectContact( int UID ) | 195 | bool 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 ); |
@@ -218,9 +221,10 @@ bool AbTable::selectContact( int UID ) | |||
218 | return true; | 221 | return true; |
219 | } | 222 | } |
220 | 223 | ||
224 | #if 0 | ||
221 | void AbTable::insertIntoTable( const OContact& cnt, int row ) | 225 | void 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 | ||
@@ -240,7 +244,7 @@ void AbTable::insertIntoTable( const OContact& cnt, int row ) | |||
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 | ||
246 | void AbTable::columnClicked( int col ) | 250 | void AbTable::columnClicked( int col ) |
@@ -263,7 +267,8 @@ void AbTable::columnClicked( int col ) | |||
263 | 267 | ||
264 | void AbTable::resort() | 268 | void 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 ) |
@@ -273,19 +278,12 @@ void AbTable::resort() | |||
273 | updateVisible(); | 278 | updateVisible(); |
274 | } | 279 | } |
275 | setPaintingEnabled( TRUE ); | 280 | setPaintingEnabled( TRUE ); |
281 | #endif | ||
276 | } | 282 | } |
277 | 283 | ||
278 | OContact AbTable::currentEntry() | 284 | OContact 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 | ||
291 | int AbTable::currentEntry_UID() | 289 | int AbTable::currentEntry_UID() |
@@ -295,8 +293,8 @@ int AbTable::currentEntry_UID() | |||
295 | 293 | ||
296 | void AbTable::clear() | 294 | void 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 ) { |
@@ -313,7 +311,9 @@ void AbTable::clear() | |||
313 | // Refresh updates column 2 if the contactsettings changed | 311 | // Refresh updates column 2 if the contactsettings changed |
314 | void AbTable::refresh() | 312 | void 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; |
@@ -333,6 +333,8 @@ void AbTable::refresh() | |||
333 | } | 333 | } |
334 | resort(); | 334 | resort(); |
335 | setPaintingEnabled( TRUE ); | 335 | setPaintingEnabled( TRUE ); |
336 | |||
337 | #endif | ||
336 | } | 338 | } |
337 | 339 | ||
338 | void AbTable::keyPressEvent( QKeyEvent *e ) | 340 | void AbTable::keyPressEvent( QKeyEvent *e ) |
@@ -365,8 +367,9 @@ void AbTable::keyPressEvent( QKeyEvent *e ) | |||
365 | 367 | ||
366 | void AbTable::moveTo( char c ) | 368 | void 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; |
@@ -394,9 +397,12 @@ void AbTable::moveTo( char c ) | |||
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) | ||
400 | QString AbTable::findContactName( const OContact &entry ) | 406 | QString AbTable::findContactName( const OContact &entry ) |
401 | { | 407 | { |
402 | // We use the fileAs, then company, defaultEmail | 408 | // We use the fileAs, then company, defaultEmail |
@@ -410,7 +416,7 @@ QString AbTable::findContactName( const OContact &entry ) | |||
410 | } | 416 | } |
411 | return str; | 417 | return str; |
412 | } | 418 | } |
413 | 419 | #endif | |
414 | 420 | ||
415 | 421 | ||
416 | void AbTable::resizeRows() { | 422 | void AbTable::resizeRows() { |
@@ -506,6 +512,7 @@ void AbTable::show() | |||
506 | QTable::show(); | 512 | QTable::show(); |
507 | } | 513 | } |
508 | 514 | ||
515 | #if 0 | ||
509 | void AbTable::setChoiceNames( const QStringList& list) | 516 | void AbTable::setChoiceNames( const QStringList& list) |
510 | { | 517 | { |
511 | choicenames = list; | 518 | choicenames = list; |
@@ -520,6 +527,7 @@ void AbTable::setChoiceNames( const QStringList& list) | |||
520 | } | 527 | } |
521 | fitColumns(); | 528 | fitColumns(); |
522 | } | 529 | } |
530 | #endif | ||
523 | 531 | ||
524 | void AbTable::itemClicked(int,int col) | 532 | void AbTable::itemClicked(int,int col) |
525 | { | 533 | { |
@@ -532,11 +540,13 @@ void AbTable::itemClicked(int,int col) | |||
532 | } | 540 | } |
533 | } | 541 | } |
534 | 542 | ||
543 | #if 0 | ||
535 | QStringList AbTable::choiceNames() const | 544 | QStringList AbTable::choiceNames() const |
536 | { | 545 | { |
537 | return choicenames; | 546 | return choicenames; |
538 | } | 547 | } |
539 | 548 | ||
549 | #endif | ||
540 | void AbTable::setChoiceSelection( const QValueList<int>& list ) | 550 | void AbTable::setChoiceSelection( const QValueList<int>& list ) |
541 | { | 551 | { |
542 | intFields = list; | 552 | intFields = list; |
@@ -560,8 +570,6 @@ QStringList AbTable::choiceSelection(int /*index*/) const | |||
560 | } | 570 | } |
561 | 571 | ||
562 | 572 | ||
563 | |||
564 | |||
565 | void AbTable::updateVisible() | 573 | void AbTable::updateVisible() |
566 | { | 574 | { |
567 | //qWarning("void AbTable::updateVisible()"); | 575 | //qWarning("void AbTable::updateVisible()"); |
@@ -630,6 +638,10 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) | |||
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 ) ); |
@@ -647,17 +659,32 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) | |||
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 | |
652 | { | 664 | switch( col ){ |
653 | p->drawPixmap( x + marg, y, pixmap( row, col ) ); | 665 | case 0: |
654 | p->drawText( x + marg + pixmap( row, col ).width() + 4,2 + fm.ascent(), text( row, col ) ); | 666 | p->drawText( x + marg,2 + fm.ascent(), nameText ); |
655 | } | 667 | break; |
656 | else | 668 | case 1:{ |
657 | { | 669 | |
658 | p->drawText( x + marg,2 + fm.ascent(), text( row, col ) ); | 670 | ContactItem contactItem = findContactContact( act_contact, 0 ); |
659 | } | 671 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ |
672 | QString contactText = contactItem.value; | ||
673 | |||
674 | if ( !contactPic.isNull() ) | ||
675 | { | ||
676 | p->drawPixmap( x + marg, y, contactPic ); | ||
677 | p->drawText( x + marg + contactPic.width() | ||
678 | + 4,2 + fm.ascent(), contactText ); | ||
679 | } | ||
680 | else | ||
681 | { | ||
682 | p->drawText( x + marg,2 + fm.ascent(), contactText ); | ||
683 | } | ||
684 | } | ||
685 | break; | ||
660 | 686 | ||
687 | } | ||
661 | p->restore(); | 688 | p->restore(); |
662 | } | 689 | } |
663 | 690 | ||
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 | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
34 | 34 | ||
35 | #if 0 | ||
35 | class AbTableItem : public QTableItem | 36 | class AbTableItem : public QTableItem |
36 | { | 37 | { |
37 | public: | 38 | public: |
@@ -47,6 +48,8 @@ private: | |||
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 |
52 | class ContactItem | 55 | class ContactItem |
@@ -56,6 +59,7 @@ class ContactItem | |||
56 | QString value; | 59 | QString value; |
57 | }; | 60 | }; |
58 | 61 | ||
62 | #if 0 | ||
59 | class AbPickItem : public QTableItem | 63 | class AbPickItem : public QTableItem |
60 | { | 64 | { |
61 | public: | 65 | public: |
@@ -68,6 +72,8 @@ private: | |||
68 | QGuardedPtr<QComboBox> cb; | 72 | QGuardedPtr<QComboBox> cb; |
69 | }; | 73 | }; |
70 | 74 | ||
75 | #endif | ||
76 | |||
71 | class AbTable : public QTable | 77 | class AbTable : public QTable |
72 | { | 78 | { |
73 | Q_OBJECT | 79 | Q_OBJECT |
@@ -91,7 +97,7 @@ public: | |||
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(); |
@@ -103,8 +109,8 @@ public: | |||
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 | ||
@@ -129,7 +135,7 @@ protected slots: | |||
129 | void rowHeightChanged( int row ); | 135 | void rowHeightChanged( int row ); |
130 | 136 | ||
131 | private: | 137 | private: |
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(); |
@@ -139,7 +145,7 @@ private: | |||
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; |
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 | |||
@@ -51,6 +51,7 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): | |||
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() ); |
@@ -97,28 +98,28 @@ AbView::~AbView() | |||
97 | 98 | ||
98 | void AbView::setView( Views view ) | 99 | void 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 | ||
105 | void AbView::addEntry( const OContact &newContact ) | 106 | void 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 | } |
112 | void AbView::removeEntry( const int UID ) | 113 | void 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 | ||
119 | void AbView::replaceEntry( const OContact &contact ) | 120 | void 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 | ||
@@ -149,7 +150,7 @@ bool AbView::save() | |||
149 | 150 | ||
150 | void AbView::load() | 151 | void 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(); |
@@ -159,7 +160,8 @@ void AbView::load() | |||
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 ); |
162 | clearForCategory(); | 163 | if ( m_curr_category != -1 ) |
164 | clearForCategory(); | ||
163 | } | 165 | } |
164 | 166 | ||
165 | qWarning ("Number of contacts: %d", m_list.count()); | 167 | qWarning ("Number of contacts: %d", m_list.count()); |
@@ -170,7 +172,7 @@ void AbView::load() | |||
170 | 172 | ||
171 | void AbView::reload() | 173 | void 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(); |
@@ -183,7 +185,7 @@ void AbView::clear() | |||
183 | 185 | ||
184 | void AbView::setShowByCategory( const QString& cat ) | 186 | void 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 | ||
@@ -207,11 +209,10 @@ void AbView::setShowByCategory( const QString& cat ) | |||
207 | 209 | ||
208 | void AbView::setShowToView( Views view ) | 210 | void 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 | ||
@@ -250,7 +251,8 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) | |||
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 ); |
253 | clearForCategory(); | 254 | if ( m_curr_category != -1 ) |
255 | clearForCategory(); | ||
254 | m_curr_Contact = 0; | 256 | m_curr_Contact = 0; |
255 | } | 257 | } |
256 | updateView( true ); | 258 | updateView( true ); |
@@ -274,7 +276,7 @@ QString AbView::showCategory() const | |||
274 | 276 | ||
275 | void AbView::showPersonal( bool personal ) | 277 | void 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 | ||
@@ -362,7 +364,8 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | |||
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.. |
365 | clearForCategory(); | 367 | if ( m_curr_category != -1 ) |
368 | clearForCategory(); | ||
366 | 369 | ||
367 | // Now show all found entries | 370 | // Now show all found entries |
368 | updateView( true ); | 371 | updateView( true ); |
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 | |||
@@ -248,7 +248,7 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
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 ); |
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 | |||
@@ -2,7 +2,7 @@ | |||
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" |