summaryrefslogtreecommitdiff
authoreilers <eilers>2003-03-09 16:59:29 (UTC)
committer eilers <eilers>2003-03-09 16:59:29 (UTC)
commit06d6fd6ae517d560616d0864db29c7d8ae7a0a32 (patch) (unidiff)
tree36e4672fcded6fc2009a5af6a111d1d8d4dc6bb5
parent77c55432622d2821023ac73f47d3215d04cc4f58 (diff)
downloadopie-06d6fd6ae517d560616d0864db29c7d8ae7a0a32.zip
opie-06d6fd6ae517d560616d0864db29c7d8ae7a0a32.tar.gz
opie-06d6fd6ae517d560616d0864db29c7d8ae7a0a32.tar.bz2
Fixed missing table refresh after changing the primary contact order
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp13
-rw-r--r--core/pim/addressbook/abtable.h4
-rw-r--r--core/pim/addressbook/abview.cpp4
3 files changed, 19 insertions, 2 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index a829dc2..a2617fa 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -169,32 +169,38 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
169 OContactAccess::List::Iterator it; 169 OContactAccess::List::Iterator it;
170 setNumRows( m_viewList.count() ); 170 setNumRows( m_viewList.count() );
171 int row = 0; 171 int row = 0;
172 for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) 172 for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
173 insertIntoTable( *it, row++ ); 173 insertIntoTable( *it, row++ );
174 174
175 setSorting( true ); 175 setSorting( true );
176 176
177 resort(); 177 resort();
178 178
179 updateVisible(); 179 updateVisible();
180 180
181 setPaintingEnabled( TRUE ); 181 setPaintingEnabled( TRUE );
182 182
183} 183}
184 184
185void AbTable::setOrderedList( const QValueList<int> ordered )
186{
187 intFields = ordered;
188}
189
190
185bool AbTable::selectContact( int UID ) 191bool AbTable::selectContact( int UID )
186{ 192{
187 //qWarning( "AbTable::selectContact( %d )", UID ); 193 //qWarning( "AbTable::selectContact( %d )", UID );
188 int rows = numRows(); 194 int rows = numRows();
189 AbTableItem *abi; 195 AbTableItem *abi;
190 OContact* foundContact = 0l; 196 OContact* foundContact = 0l;
191 bool found = false; 197 bool found = false;
192 198
193 setPaintingEnabled( FALSE ); 199 setPaintingEnabled( FALSE );
194 for ( int r = 0; r < rows; ++r ) { 200 for ( int r = 0; r < rows; ++r ) {
195 abi = static_cast<AbTableItem*>( item(r, 0) ); 201 abi = static_cast<AbTableItem*>( item(r, 0) );
196 foundContact = &contactList[abi]; 202 foundContact = &contactList[abi];
197 if ( foundContact -> uid() == UID ){ 203 if ( foundContact -> uid() == UID ){
198 ensureCellVisible( r, 0 ); 204 ensureCellVisible( r, 0 );
199 setCurrentCell( r, 0 ); 205 setCurrentCell( r, 0 );
200 found = true; 206 found = true;
@@ -304,36 +310,39 @@ void AbTable::clear()
304 setPaintingEnabled( TRUE ); 310 setPaintingEnabled( TRUE );
305} 311}
306 312
307// Refresh updates column 2 if the contactsettings changed 313// Refresh updates column 2 if the contactsettings changed
308void AbTable::refresh() 314void AbTable::refresh()
309{ 315{
310 //qWarning( "void AbTable::refresh()" ); 316 //qWarning( "void AbTable::refresh()" );
311 int rows = numRows(); 317 int rows = numRows();
312 AbTableItem *abi; 318 AbTableItem *abi;
313 ContactItem contactItem; 319 ContactItem contactItem;
314 320
315 setPaintingEnabled( FALSE ); 321 setPaintingEnabled( FALSE );
316 for ( int r = 0; r < rows; ++r ) { 322 for ( int r = 0; r < rows; ++r ) {
317 abi = static_cast<AbTableItem*>( item(r, 0) ); 323 abi = static_cast<AbTableItem*>( item(r, 0) );
318 contactItem = findContactContact( contactList[abi], r ); 324 contactItem = findContactContact( contactList[abi], r );
319 static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); 325 static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() );
320 if ( !contactItem.icon.isNull() ) 326 if ( !contactItem.icon.isNull() ){
321 static_cast<AbTableItem*>( item(r, 1) )-> 327 static_cast<AbTableItem*>( item(r, 1) )->
322 setPixmap( contactItem.icon ); 328 setPixmap( contactItem.icon );
323 329 }else{
330 static_cast<AbTableItem*>( item(r, 1) )->
331 setPixmap( QPixmap() );
332 }
324 } 333 }
325 resort(); 334 resort();
326 setPaintingEnabled( TRUE ); 335 setPaintingEnabled( TRUE );
327} 336}
328 337
329void AbTable::keyPressEvent( QKeyEvent *e ) 338void AbTable::keyPressEvent( QKeyEvent *e )
330{ 339{
331 char key = toupper( e->ascii() ); 340 char key = toupper( e->ascii() );
332 341
333 if ( key >= 'A' && key <= 'Z' ) 342 if ( key >= 'A' && key <= 'Z' )
334 moveTo( key ); 343 moveTo( key );
335 344
336 //qWarning("Received key .."); 345 //qWarning("Received key ..");
337 switch( e->key() ) { 346 switch( e->key() ) {
338 case Qt::Key_Space: 347 case Qt::Key_Space:
339 case Qt::Key_Return: 348 case Qt::Key_Return:
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 4e6b294..0f7bc29 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -65,32 +65,36 @@ public:
65 void setContentFromEditor( QWidget *w ); 65 void setContentFromEditor( QWidget *w );
66 66
67private: 67private:
68 QGuardedPtr<QComboBox> cb; 68 QGuardedPtr<QComboBox> cb;
69}; 69};
70 70
71class AbTable : public QTable 71class AbTable : public QTable
72{ 72{
73 Q_OBJECT 73 Q_OBJECT
74 74
75public: 75public:
76 AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 ); 76 AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 );
77 ~AbTable(); 77 ~AbTable();
78 78
79 // Set the contacts shown in the table 79 // Set the contacts shown in the table
80 void setContacts( const OContactAccess::List& viewList ); 80 void setContacts( const OContactAccess::List& viewList );
81
82 // Set the list for primary contacts
83 void setOrderedList( const QValueList<int> ordered );
84
81 // Selects a contact of a specific UID 85 // Selects a contact of a specific UID
82 bool selectContact( int UID ); 86 bool selectContact( int UID );
83 87
84 // Get the current selected entry 88 // Get the current selected entry
85 OContact currentEntry(); 89 OContact currentEntry();
86 90
87 // Get the UID of the current selected Entry 91 // Get the UID of the current selected Entry
88 int currentEntry_UID(); 92 int currentEntry_UID();
89 93
90 QString findContactName( const OContact &entry ); 94 QString findContactName( const OContact &entry );
91 95
92 void init(); 96 void init();
93 void clear(); 97 void clear();
94 void refresh(); 98 void refresh();
95 99
96 void show(); 100 void show();
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 7da0992..b89b794 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -230,32 +230,36 @@ void AbView::setShowByLetter( char c )
230 // ignore the request .. 230 // ignore the request ..
231 if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ 231 if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){
232 return; 232 return;
233 } 233 }
234 234
235 query.setLastName( QString("%1*").arg(c) ); 235 query.setLastName( QString("%1*").arg(c) );
236 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); 236 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase );
237 clearForCategory(); 237 clearForCategory();
238 m_curr_Contact = 0; 238 m_curr_Contact = 0;
239 } 239 }
240 updateView( true ); 240 updateView( true );
241} 241}
242 242
243void AbView::setListOrder( const QValueList<int>& ordered ) 243void AbView::setListOrder( const QValueList<int>& ordered )
244{ 244{
245 m_orderedFields = ordered; 245 m_orderedFields = ordered;
246 if ( m_abTable ){
247 m_abTable->setOrderedList( ordered );
248 m_abTable->refresh();
249 }
246 updateView(); 250 updateView();
247} 251}
248 252
249 253
250QString AbView::showCategory() const 254QString AbView::showCategory() const
251{ 255{
252 return mCat.label( "Contacts", m_curr_category ); 256 return mCat.label( "Contacts", m_curr_category );
253} 257}
254 258
255void AbView::showPersonal( bool personal ) 259void AbView::showPersonal( bool personal )
256{ 260{
257 //qWarning ("void AbView::showPersonal( %d )", personal); 261 //qWarning ("void AbView::showPersonal( %d )", personal);
258 262
259 if ( personal ){ 263 if ( personal ){
260 264
261 if ( m_inPersonal ) 265 if ( m_inPersonal )