summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/ablabel.cpp7
-rw-r--r--core/pim/addressbook/abtable.cpp113
-rw-r--r--core/pim/addressbook/abtable.h16
-rw-r--r--core/pim/addressbook/abview.cpp31
-rw-r--r--core/pim/addressbook/addressbook.cpp2
-rw-r--r--core/pim/addressbook/version.h2
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
@@ -72,8 +72,11 @@ 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
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
@@ -45,4 +45,6 @@
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
@@ -113,4 +115,6 @@ void AbPickItem::setContentFromEditor( QWidget *w )
113} 115}
114 116
117#endif
118
115/*! 119/*!
116 \class AbTable abtable.h 120 \class AbTable abtable.h
@@ -136,5 +140,5 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name
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}
@@ -159,5 +163,5 @@ void AbTable::init()
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();
@@ -169,11 +173,11 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
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();
@@ -191,15 +195,13 @@ void AbTable::setOrderedList( const QValueList<int> ordered )
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 );
@@ -208,4 +210,5 @@ bool AbTable::selectContact( int UID )
208 } 210 }
209 } 211 }
212 qWarning( "search end" );
210 213
211 if ( !found ){ 214 if ( !found ){
@@ -219,7 +222,8 @@ bool AbTable::selectContact( int UID )
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;
@@ -241,5 +245,5 @@ void AbTable::insertIntoTable( const OContact& cnt, int row )
241 245
242} 246}
243 247#endif
244 248
245 249
@@ -264,5 +268,6 @@ void AbTable::columnClicked( int col )
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() ) {
@@ -274,17 +279,10 @@ void AbTable::resort()
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
@@ -296,6 +294,6 @@ int AbTable::currentEntry_UID()
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 );
@@ -314,5 +312,7 @@ void AbTable::clear()
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;
@@ -334,4 +334,6 @@ void AbTable::refresh()
334 resort(); 334 resort();
335 setPaintingEnabled( TRUE ); 335 setPaintingEnabled( TRUE );
336
337#endif
336} 338}
337 339
@@ -366,6 +368,7 @@ void AbTable::keyPressEvent( QKeyEvent *e )
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;
@@ -395,7 +398,10 @@ void AbTable::moveTo( char c )
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{
@@ -411,5 +417,5 @@ QString AbTable::findContactName( const OContact &entry )
411 return str; 417 return str;
412} 418}
413 419#endif
414 420
415 421
@@ -507,4 +513,5 @@ void AbTable::show()
507} 513}
508 514
515#if 0
509void AbTable::setChoiceNames( const QStringList& list) 516void AbTable::setChoiceNames( const QStringList& list)
510{ 517{
@@ -521,4 +528,5 @@ void AbTable::setChoiceNames( const QStringList& list)
521 fitColumns(); 528 fitColumns();
522} 529}
530#endif
523 531
524void AbTable::itemClicked(int,int col) 532void AbTable::itemClicked(int,int col)
@@ -533,4 +541,5 @@ void AbTable::itemClicked(int,int col)
533} 541}
534 542
543#if 0
535QStringList AbTable::choiceNames() const 544QStringList AbTable::choiceNames() const
536{ 545{
@@ -538,4 +547,5 @@ QStringList AbTable::choiceNames() const
538} 547}
539 548
549#endif
540void AbTable::setChoiceSelection( const QValueList<int>& list ) 550void AbTable::setChoiceSelection( const QValueList<int>& list )
541{ 551{
@@ -561,6 +571,4 @@ QStringList AbTable::choiceSelection(int /*index*/) const
561 571
562 572
563
564
565void AbTable::updateVisible() 573void AbTable::updateVisible()
566{ 574{
@@ -631,4 +639,8 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool )
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 ) {
@@ -648,15 +660,30 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool )
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}
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
@@ -33,4 +33,5 @@
33#include <qpixmap.h> 33#include <qpixmap.h>
34 34
35#if 0
35class AbTableItem : public QTableItem 36class AbTableItem : public QTableItem
36{ 37{
@@ -48,4 +49,6 @@ private:
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
@@ -57,4 +60,5 @@ class ContactItem
57}; 60};
58 61
62#if 0
59class AbPickItem : public QTableItem 63class AbPickItem : public QTableItem
60{ 64{
@@ -69,4 +73,6 @@ private:
69}; 73};
70 74
75#endif
76
71class AbTable : public QTable 77class AbTable : public QTable
72{ 78{
@@ -92,5 +98,5 @@ public:
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();
@@ -104,6 +110,6 @@ public:
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;
@@ -130,5 +136,5 @@ protected slots:
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();
@@ -140,5 +146,5 @@ private:
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;
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
@@ -52,4 +52,5 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
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 ),
@@ -98,5 +99,5 @@ AbView::~AbView()
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();
@@ -105,5 +106,5 @@ void AbView::setView( Views view )
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();
@@ -112,5 +113,5 @@ void AbView::addEntry( const OContact &newContact )
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();
@@ -119,5 +120,5 @@ void AbView::removeEntry( const int UID )
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();
@@ -150,5 +151,5 @@ bool AbView::save()
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
@@ -160,5 +161,6 @@ void AbView::load()
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
@@ -171,5 +173,5 @@ void AbView::load()
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();
@@ -184,5 +186,5 @@ void AbView::clear()
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;
@@ -208,9 +210,8 @@ void AbView::setShowByCategory( const QString& cat )
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;
@@ -251,5 +252,6 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode )
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 }
@@ -275,5 +277,5 @@ QString AbView::showCategory() const
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 ){
@@ -363,5 +365,6 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
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
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
@@ -249,5 +249,5 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
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
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
@@ -3,5 +3,5 @@
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