summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abview.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abview.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 8d61582..aa242b7 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -13,17 +13,17 @@
13** 13**
14** 14**
15**********************************************************************/ 15**********************************************************************/
16 16
17#include "abview.h" 17#include "abview.h"
18 18
19#include <qlayout.h> 19#include <opie2/ocontactaccessbackend_vcard.h>
20 20
21#include <qpe/global.h> 21#include <qpe/global.h>
22 22
23#include <opie/ocontactaccessbackend_vcard.h> 23#include <qlayout.h>
24 24
25#include <assert.h> 25#include <assert.h>
26 26
27 27
28// Is defined in LibQPE 28// Is defined in LibQPE
29extern QString categoryFileName(); 29extern QString categoryFileName();
@@ -50,13 +50,13 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
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 qWarning("AbView::c'tor");
55 // Load default database and handle syncing myself.. ! 55 // Load default database and handle syncing myself.. !
56 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ); 56 m_contactdb = new Opie::OPimContactAccess ( "addressbook", 0l, 0l, false );
57 m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available 57 m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available
58 mCat.load( categoryFileName() ); 58 mCat.load( categoryFileName() );
59 59
60 // Create Layout and put WidgetStack into it. 60 // Create Layout and put WidgetStack into it.
61 QVBoxLayout *vb = new QVBoxLayout( this ); 61 QVBoxLayout *vb = new QVBoxLayout( this );
62 m_viewStack = new QWidgetStack( this ); 62 m_viewStack = new QWidgetStack( this );
@@ -101,13 +101,13 @@ void AbView::setView( Views view )
101{ 101{
102 qWarning("AbView::setView( Views view )"); 102 qWarning("AbView::setView( Views view )");
103 m_curr_View = view; 103 m_curr_View = view;
104 load(); 104 load();
105} 105}
106 106
107void AbView::addEntry( const OContact &newContact ) 107void AbView::addEntry( const Opie::OPimContact &newContact )
108{ 108{
109 qWarning("abview:AddContact"); 109 qWarning("abview:AddContact");
110 m_contactdb->add ( newContact ); 110 m_contactdb->add ( newContact );
111 load(); 111 load();
112 112
113} 113}
@@ -115,23 +115,23 @@ void AbView::removeEntry( const int UID )
115{ 115{
116 qWarning("abview:RemoveContact"); 116 qWarning("abview:RemoveContact");
117 m_contactdb->remove( UID ); 117 m_contactdb->remove( UID );
118 load(); 118 load();
119} 119}
120 120
121void AbView::replaceEntry( const OContact &contact ) 121void AbView::replaceEntry( const Opie::OPimContact &contact )
122{ 122{
123 qWarning("abview:ReplaceContact"); 123 qWarning("abview:ReplaceContact");
124 m_contactdb->replace( contact ); 124 m_contactdb->replace( contact );
125 load(); 125 load();
126 126
127} 127}
128 128
129OContact AbView::currentEntry() 129Opie::OPimContact AbView::currentEntry()
130{ 130{
131 OContact currentContact; 131 Opie::OPimContact currentContact;
132 132
133 switch ( (int) m_curr_View ) { 133 switch ( (int) m_curr_View ) {
134 case TableView: 134 case TableView:
135 currentContact = m_abTable -> currentEntry(); 135 currentContact = m_abTable -> currentEntry();
136 break; 136 break;
137 case CardView: 137 case CardView:
@@ -154,13 +154,13 @@ void AbView::load()
154 qWarning("abView:Load data"); 154 qWarning("abView:Load data");
155 155
156 // Letter Search is stopped at this place 156 // Letter Search is stopped at this place
157 emit signalClearLetterPicker(); 157 emit signalClearLetterPicker();
158 158
159 if ( m_inPersonal ) 159 if ( m_inPersonal )
160 // VCard Backend does not sort.. 160 // VCard Backend does not sort..
161 m_list = m_contactdb->allRecords(); 161 m_list = m_contactdb->allRecords();
162 else{ 162 else{
163 m_list = m_contactdb->sorted( true, 0, 0, 0 ); 163 m_list = m_contactdb->sorted( true, 0, 0, 0 );
164 if ( m_curr_category != -1 ) 164 if ( m_curr_category != -1 )
165 clearForCategory(); 165 clearForCategory();
166 } 166 }
@@ -225,20 +225,20 @@ void AbView::setShowToView( Views view )
225void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) 225void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode )
226{ 226{
227 qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); 227 qWarning("void AbView::setShowByLetter( %c, %d )", c, mode );
228 228
229 assert( mode < AbConfig::LASTELEMENT ); 229 assert( mode < AbConfig::LASTELEMENT );
230 230
231 OContact query; 231 Opie::OPimContact query;
232 if ( c == 0 ){ 232 if ( c == 0 ){
233 load(); 233 load();
234 return; 234 return;
235 }else{ 235 }else{
236 // If the current Backend is unable to solve the query, we will 236 // If the current Backend is unable to solve the query, we will
237 // ignore the request .. 237 // ignore the request ..
238 if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ 238 if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ) ){
239 return; 239 return;
240 } 240 }
241 241
242 switch( mode ){ 242 switch( mode ){
243 case AbConfig::LastName: 243 case AbConfig::LastName:
244 query.setLastName( QString("%1*").arg(c) ); 244 query.setLastName( QString("%1*").arg(c) );
@@ -248,13 +248,13 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode )
248 break; 248 break;
249 default: 249 default:
250 qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); 250 qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode );
251 qWarning( "I will ignore it.." ); 251 qWarning( "I will ignore it.." );
252 return; 252 return;
253 } 253 }
254 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); 254 m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase );
255 if ( m_curr_category != -1 ) 255 if ( m_curr_category != -1 )
256 clearForCategory(); 256 clearForCategory();
257 m_curr_Contact = 0; 257 m_curr_Contact = 0;
258 } 258 }
259 updateView( true ); 259 updateView( true );
260} 260}
@@ -286,15 +286,15 @@ void AbView::showPersonal( bool personal )
286 286
287 // Now switch to vCard Backend and load data. 287 // Now switch to vCard Backend and load data.
288 // The current default backend will be stored 288 // The current default backend will be stored
289 // to avoid unneeded load/stores. 289 // to avoid unneeded load/stores.
290 m_storedDB = m_contactdb; 290 m_storedDB = m_contactdb;
291 291
292 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 292 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
293 addressbookPersonalVCardName() ); 293 addressbookPersonalVCardName() );
294 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 294 m_contactdb = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
295 295
296 m_inPersonal = true; 296 m_inPersonal = true;
297 m_curr_View = CardView; 297 m_curr_View = CardView;
298 298
299 }else{ 299 }else{
300 300
@@ -315,13 +315,13 @@ void AbView::showPersonal( bool personal )
315 load(); 315 load();
316} 316}
317 317
318void AbView::setCurrentUid( int uid ){ 318void AbView::setCurrentUid( int uid ){
319 319
320 m_curr_Contact = uid; 320 m_curr_Contact = uid;
321 updateView( true ); //true: Don't modificate the UID ! 321 updateView( true ); //true: Don't modificate the UID !
322} 322}
323 323
324 324
325QStringList AbView::categories() 325QStringList AbView::categories()
326{ 326{
327 mCat.load( categoryFileName() ); 327 mCat.load( categoryFileName() );
@@ -398,30 +398,30 @@ void AbView::slotSwitch(){
398} 398}
399 399
400// END: Slots 400// END: Slots
401 401
402void AbView::clearForCategory() 402void AbView::clearForCategory()
403{ 403{
404 OContactAccess::List::Iterator it; 404 Opie::OPimContactAccess::List::Iterator it;
405 // Now remove all contacts with wrong category if any category selected 405 // Now remove all contacts with wrong category if any category selected
406 406
407 OContactAccess::List allList = m_list; 407 Opie::OPimContactAccess::List allList = m_list;
408 if ( m_curr_category != -1 ){ 408 if ( m_curr_category != -1 ){
409 for ( it = allList.begin(); it != allList.end(); ++it ){ 409 for ( it = allList.begin(); it != allList.end(); ++it ){
410 if ( !contactCompare( *it, m_curr_category ) ){ 410 if ( !contactCompare( *it, m_curr_category ) ){
411 // qWarning("Removing %d", (*it).uid()); 411 // qWarning("Removing %d", (*it).uid());
412 m_list.remove( (*it).uid() ); 412 m_list.remove( (*it).uid() );
413 } 413 }
414 } 414 }
415 } 415 }
416 416
417} 417}
418 418
419bool AbView::contactCompare( const OContact &cnt, int category ) 419bool AbView::contactCompare( const Opie::OPimContact &cnt, int category )
420{ 420{
421 //qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); 421 //qWarning ("bool AbView::contactCompare( const Opie::OPimContact &cnt, %d )", category);
422 422
423 bool returnMe; 423 bool returnMe;
424 QArray<int> cats; 424 QArray<int> cats;
425 cats = cnt.categories(); 425 cats = cnt.categories();
426 426
427 //qWarning ("Number of categories: %d", cats.count() ); 427 //qWarning ("Number of categories: %d", cats.count() );