summaryrefslogtreecommitdiff
authorzecke <zecke>2002-12-13 21:57:31 (UTC)
committer zecke <zecke>2002-12-13 21:57:31 (UTC)
commitde449c83cf37a64a9d2df586f6d1acecf3bc0c6e (patch) (unidiff)
treeec75354c1d0c3731b675df639e29e173a2967f7e
parentd00761e2b3b69e1edddcb2115c4c0ae6b5aa4265 (diff)
downloadopie-de449c83cf37a64a9d2df586f6d1acecf3bc0c6e.zip
opie-de449c83cf37a64a9d2df586f6d1acecf3bc0c6e.tar.gz
opie-de449c83cf37a64a9d2df586f6d1acecf3bc0c6e.tar.bz2
No default arguments in implementation please
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abview.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 7226e82..161b163 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -52,34 +52,34 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
52 // Load default database and handle syncing myself.. ! 52 // Load default database and handle syncing myself.. !
53 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), 53 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ),
54 mCat.load( categoryFileName() ); 54 mCat.load( categoryFileName() );
55 55
56 // Create Layout and put WidgetStack into it. 56 // Create Layout and put WidgetStack into it.
57 QVBoxLayout *vb = new QVBoxLayout( this ); 57 QVBoxLayout *vb = new QVBoxLayout( this );
58 m_viewStack = new QWidgetStack( this ); 58 m_viewStack = new QWidgetStack( this );
59 vb->addWidget( m_viewStack ); 59 vb->addWidget( m_viewStack );
60 60
61 // Creat TableView 61 // Creat TableView
62 QVBox* tableBox = new QVBox( m_viewStack ); 62 QVBox* tableBox = new QVBox( m_viewStack );
63 m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); 63 m_abTable = new AbTable( m_orderedFields, tableBox, "table" );
64 m_abTable->setCurrentCell( 0, 0 ); 64 m_abTable->setCurrentCell( 0, 0 );
65 m_abTable->setFocus(); 65 m_abTable->setFocus();
66 66
67 // Add TableView to WidgetStack and raise it 67 // Add TableView to WidgetStack and raise it
68 m_viewStack -> addWidget( tableBox , TableView ); 68 m_viewStack -> addWidget( tableBox , TableView );
69 69
70 // Create CardView and add it to WidgetStack 70 // Create CardView and add it to WidgetStack
71 QVBox* cardBox = new QVBox( m_viewStack ); 71 QVBox* cardBox = new QVBox( m_viewStack );
72 m_ablabel = new AbLabel( cardBox, "CardView"); 72 m_ablabel = new AbLabel( cardBox, "CardView");
73 m_viewStack -> addWidget( cardBox , CardView ); 73 m_viewStack -> addWidget( cardBox , CardView );
74 74
75 // Connect views to me 75 // Connect views to me
76 connect ( m_abTable, SIGNAL( signalSwitch( void ) ), 76 connect ( m_abTable, SIGNAL( signalSwitch( void ) ),
77 this, SLOT( slotSwitch( void ) ) ); 77 this, SLOT( slotSwitch( void ) ) );
78 connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), 78 connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ),
79 this, SLOT( slotSwitch( void ) ) ); 79 this, SLOT( slotSwitch( void ) ) );
80 80
81 load(); 81 load();
82} 82}
83 83
84AbView::~AbView() 84AbView::~AbView()
85{ 85{
@@ -100,17 +100,17 @@ void AbView::setView( Views view )
100 load(); 100 load();
101} 101}
102 102
103void AbView::addEntry( const OContact &newContact ) 103void AbView::addEntry( const OContact &newContact )
104{ 104{
105 qWarning("abview:AddContact"); 105 qWarning("abview:AddContact");
106 m_contactdb->add ( newContact ); 106 m_contactdb->add ( newContact );
107 load(); 107 load();
108 108
109} 109}
110void AbView::removeEntry( const int UID ) 110void AbView::removeEntry( const int UID )
111{ 111{
112 qWarning("abview:RemoveContact"); 112 qWarning("abview:RemoveContact");
113 m_contactdb->remove( UID ); 113 m_contactdb->remove( UID );
114 load(); 114 load();
115} 115}
116 116
@@ -146,28 +146,28 @@ bool AbView::save()
146} 146}
147 147
148void AbView::load() 148void AbView::load()
149{ 149{
150 qWarning("abView:Load data"); 150 qWarning("abView:Load data");
151 151
152 // Letter Search is stopped at this place 152 // Letter Search is stopped at this place
153 emit signalClearLetterPicker(); 153 emit signalClearLetterPicker();
154 154
155 if ( m_inPersonal ) 155 if ( m_inPersonal )
156 m_list = m_contactdb->allRecords(); 156 m_list = m_contactdb->allRecords();
157 else{ 157 else{
158 m_list = m_contactdb->sorted( true, 0, 0, 0 ); 158 m_list = m_contactdb->sorted( true, 0, 0, 0 );
159 clearForCategory(); 159 clearForCategory();
160 } 160 }
161 161
162 qWarning ("Number of contacts: %d", m_list.count()); 162 qWarning ("Number of contacts: %d", m_list.count());
163 163
164 updateView( true ); 164 updateView( true );
165 165
166} 166}
167 167
168void AbView::reload() 168void AbView::reload()
169{ 169{
170 qWarning( "void AbView::reload()" ); 170 qWarning( "void AbView::reload()" );
171 171
172 m_contactdb->reload(); 172 m_contactdb->reload();
173 load(); 173 load();
@@ -191,17 +191,17 @@ void AbView::setShowByCategory( const QString& cat )
191 intCat = mCat.id("Contacts", cat ); 191 intCat = mCat.id("Contacts", cat );
192 192
193 // Just do anything if we really change the category 193 // Just do anything if we really change the category
194 if ( intCat != m_curr_category ){ 194 if ( intCat != m_curr_category ){
195 qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); 195 qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category);
196 196
197 m_curr_category = intCat; 197 m_curr_category = intCat;
198 emit signalClearLetterPicker(); 198 emit signalClearLetterPicker();
199 199
200 load(); 200 load();
201 } 201 }
202 202
203} 203}
204 204
205void AbView::setShowToView( Views view ) 205void AbView::setShowToView( Views view )
206{ 206{
207 qWarning("void AbView::setShowToView( View %d )", view); 207 qWarning("void AbView::setShowToView( View %d )", view);
@@ -235,17 +235,17 @@ void AbView::setShowByLetter( char c )
235 235
236void AbView::setListOrder( const QValueList<int>& ordered ) 236void AbView::setListOrder( const QValueList<int>& ordered )
237{ 237{
238 m_orderedFields = ordered; 238 m_orderedFields = ordered;
239 updateView(); 239 updateView();
240} 240}
241 241
242 242
243QString AbView::showCategory() const 243QString AbView::showCategory() const
244{ 244{
245 return mCat.label( "Contacts", m_curr_category ); 245 return mCat.label( "Contacts", m_curr_category );
246} 246}
247 247
248void AbView::showPersonal( bool personal ) 248void AbView::showPersonal( bool personal )
249{ 249{
250 qWarning ("void AbView::showPersonal( %d )", personal); 250 qWarning ("void AbView::showPersonal( %d )", personal);
251 251
@@ -254,52 +254,52 @@ void AbView::showPersonal( bool personal )
254 if ( m_inPersonal ) 254 if ( m_inPersonal )
255 return; 255 return;
256 256
257 // Now switch to vCard Backend and load data. 257 // Now switch to vCard Backend and load data.
258 // The current default backend will be stored 258 // The current default backend will be stored
259 // to avoid unneeded load/stores. 259 // to avoid unneeded load/stores.
260 m_storedDB = m_contactdb; 260 m_storedDB = m_contactdb;
261 261
262 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 262 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
263 addressbookPersonalVCardName() ); 263 addressbookPersonalVCardName() );
264 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 264 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
265 265
266 m_inPersonal = true; 266 m_inPersonal = true;
267 m_curr_View = CardView; 267 m_curr_View = CardView;
268 268
269 }else{ 269 }else{
270 270
271 if ( !m_inPersonal ) 271 if ( !m_inPersonal )
272 return; 272 return;
273 273
274 // Remove vCard Backend and restore default 274 // Remove vCard Backend and restore default
275 m_contactdb->save(); 275 m_contactdb->save();
276 delete m_contactdb; 276 delete m_contactdb;
277 277
278 m_contactdb = m_storedDB; 278 m_contactdb = m_storedDB;
279 m_storedDB = 0l; 279 m_storedDB = 0l;
280 280
281 m_curr_View = TableView; 281 m_curr_View = TableView;
282 m_inPersonal = false; 282 m_inPersonal = false;
283 283
284 } 284 }
285 load(); 285 load();
286} 286}
287 287
288QStringList AbView::categories() 288QStringList AbView::categories()
289{ 289{
290 mCat.load( categoryFileName() ); 290 mCat.load( categoryFileName() );
291 QStringList categoryList = mCat.labels( "Contacts" ); 291 QStringList categoryList = mCat.labels( "Contacts" );
292 return categoryList; 292 return categoryList;
293} 293}
294 294
295// BEGIN: Slots 295// BEGIN: Slots
296void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, 296void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
297 bool , QString cat = QString::null ) 297 bool , QString cat )
298{ 298{
299 qWarning( "void AbView::slotDoFind" ); 299 qWarning( "void AbView::slotDoFind" );
300 300
301 // We reloading the data: Deselect Letterpicker 301 // We reloading the data: Deselect Letterpicker
302 emit signalClearLetterPicker(); 302 emit signalClearLetterPicker();
303 303
304 // Use the current Category if nothing else selected 304 // Use the current Category if nothing else selected
305 int category = 0; 305 int category = 0;
@@ -310,31 +310,31 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
310 category = mCat.id("Contacts", cat ); 310 category = mCat.id("Contacts", cat );
311 } 311 }
312 312
313 qWarning ("Find in Category %d", category); 313 qWarning ("Find in Category %d", category);
314 314
315 QRegExp r( str ); 315 QRegExp r( str );
316 r.setCaseSensitive( caseSensitive ); 316 r.setCaseSensitive( caseSensitive );
317 r.setWildcard( !useRegExp ); 317 r.setWildcard( !useRegExp );
318 318
319 // Get all matching entries out of the database 319 // Get all matching entries out of the database
320 m_list = m_contactdb->matchRegexp( r ); 320 m_list = m_contactdb->matchRegexp( r );
321 321
322 qWarning( "found: %d", m_list.count() ); 322 qWarning( "found: %d", m_list.count() );
323 if ( m_list.count() == 0 ){ 323 if ( m_list.count() == 0 ){
324 emit signalNotFound(); 324 emit signalNotFound();
325 return; 325 return;
326 } 326 }
327 327
328 // Now remove all contacts with wrong category (if any selected) 328 // Now remove all contacts with wrong category (if any selected)
329 // This algorithm is a litte bit ineffective, but 329 // This algorithm is a litte bit ineffective, but
330 // we will not have a lot of matching entries.. 330 // we will not have a lot of matching entries..
331 clearForCategory(); 331 clearForCategory();
332 332
333 // Now show all found entries 333 // Now show all found entries
334 updateView( true ); 334 updateView( true );
335} 335}
336 336
337void AbView::offSearch() 337void AbView::offSearch()
338{ 338{
339 m_inSearch = false; 339 m_inSearch = false;
340 340
@@ -351,30 +351,30 @@ void AbView::slotSwitch(){
351 m_curr_View = CardView; 351 m_curr_View = CardView;
352 break; 352 break;
353 case CardView: 353 case CardView:
354 qWarning("Switching to TableView"); 354 qWarning("Switching to TableView");
355 m_curr_View = TableView; 355 m_curr_View = TableView;
356 break; 356 break;
357 } 357 }
358 updateView(); 358 updateView();
359 359
360} 360}
361 361
362// END: Slots 362// END: Slots
363 363
364void AbView::clearForCategory() 364void AbView::clearForCategory()
365{ 365{
366 OContactAccess::List::Iterator it; 366 OContactAccess::List::Iterator it;
367 // Now remove all contacts with wrong category if any category selected 367 // Now remove all contacts with wrong category if any category selected
368 368
369 OContactAccess::List allList = m_list; 369 OContactAccess::List allList = m_list;
370 if ( m_curr_category != -1 ){ 370 if ( m_curr_category != -1 ){
371 for ( it = allList.begin(); it != allList.end(); ++it ){ 371 for ( it = allList.begin(); it != allList.end(); ++it ){
372 if ( !contactCompare( *it, m_curr_category ) ){ 372 if ( !contactCompare( *it, m_curr_category ) ){
373 qWarning("Removing %d", (*it).uid()); 373 qWarning("Removing %d", (*it).uid());
374 m_list.remove( (*it).uid() ); 374 m_list.remove( (*it).uid() );
375 } 375 }
376 } 376 }
377 } 377 }
378 378
379} 379}
380 380
@@ -430,17 +430,17 @@ void AbView::updateView( bool newdata )
430 break; 430 break;
431 case CardView: 431 case CardView:
432 m_curr_Contact = m_ablabel -> currentEntry_UID(); 432 m_curr_Contact = m_ablabel -> currentEntry_UID();
433 break; 433 break;
434 } 434 }
435 }else 435 }else
436 m_curr_Contact = 0; 436 m_curr_Contact = 0;
437 } 437 }
438 438
439 // Feed all views with new lists 439 // Feed all views with new lists
440 if ( newdata ) 440 if ( newdata )
441 updateListinViews(); 441 updateListinViews();
442 442
443 // Tell the world that the view is changed 443 // Tell the world that the view is changed
444 if ( m_curr_View != m_prev_View ) 444 if ( m_curr_View != m_prev_View )
445 emit signalViewSwitched ( (int) m_curr_View ); 445 emit signalViewSwitched ( (int) m_curr_View );
446 446
@@ -455,14 +455,14 @@ void AbView::updateView( bool newdata )
455 m_abTable -> setFocus(); 455 m_abTable -> setFocus();
456 break; 456 break;
457 case CardView: 457 case CardView:
458 if ( m_curr_Contact != 0 ) 458 if ( m_curr_Contact != 0 )
459 m_ablabel -> selectContact( m_curr_Contact ); 459 m_ablabel -> selectContact( m_curr_Contact );
460 m_ablabel -> setFocus(); 460 m_ablabel -> setFocus();
461 break; 461 break;
462 } 462 }
463 463
464 // Raise the current View 464 // Raise the current View
465 m_viewStack -> raiseWidget( m_curr_View ); 465 m_viewStack -> raiseWidget( m_curr_View );
466} 466}
467 467
468 468