summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abview.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/addressbook/abview.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 93e57ca..7da0992 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -92,34 +92,34 @@ AbView::~AbView()
92 } 92 }
93} 93}
94 94
95 95
96void AbView::setView( Views view ) 96void AbView::setView( Views view )
97{ 97{
98 qWarning("AbView::setView( Views view )"); 98 //qWarning("AbView::setView( Views view )");
99 m_curr_View = view; 99 m_curr_View = 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
117void AbView::replaceEntry( const OContact &contact ) 117void AbView::replaceEntry( const OContact &contact )
118{ 118{
119 qWarning("abview:ReplaceContact"); 119 //qWarning("abview:ReplaceContact");
120 m_contactdb->replace( contact ); 120 m_contactdb->replace( contact );
121 load(); 121 load();
122 122
123} 123}
124 124
125OContact AbView::currentEntry() 125OContact AbView::currentEntry()
@@ -137,93 +137,93 @@ OContact AbView::currentEntry()
137 m_curr_Contact = currentContact.uid(); 137 m_curr_Contact = currentContact.uid();
138 return currentContact; 138 return currentContact;
139} 139}
140 140
141bool AbView::save() 141bool AbView::save()
142{ 142{
143 qWarning("abView:Save data"); 143 //qWarning("abView:Save data");
144 144
145 return m_contactdb->save(); 145 return m_contactdb->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 // VCard Backend does not sort.. 156 // VCard Backend does not sort..
157 m_list = m_contactdb->allRecords(); 157 m_list = m_contactdb->allRecords();
158 else{ 158 else{
159 m_list = m_contactdb->sorted( true, 0, 0, 0 ); 159 m_list = m_contactdb->sorted( true, 0, 0, 0 );
160 clearForCategory(); 160 clearForCategory();
161 } 161 }
162 162
163 qWarning ("Number of contacts: %d", m_list.count()); 163 //qWarning ("Number of contacts: %d", m_list.count());
164 164
165 updateView( true ); 165 updateView( true );
166 166
167} 167}
168 168
169void AbView::reload() 169void AbView::reload()
170{ 170{
171 qWarning( "void AbView::reload()" ); 171 //qWarning( "void AbView::reload()" );
172 172
173 m_contactdb->reload(); 173 m_contactdb->reload();
174 load(); 174 load();
175} 175}
176 176
177void AbView::clear() 177void AbView::clear()
178{ 178{
179 // :SX 179 // :SX
180} 180}
181 181
182void AbView::setShowByCategory( const QString& cat ) 182void AbView::setShowByCategory( const QString& cat )
183{ 183{
184 qWarning("AbView::setShowCategory( const QString& cat )"); 184 //qWarning("AbView::setShowCategory( const QString& cat )");
185 185
186 int intCat = 0; 186 int intCat = 0;
187 187
188 // All (cat == NULL) will be stored as -1 188 // All (cat == NULL) will be stored as -1
189 if ( cat.isNull() ) 189 if ( cat.isNull() )
190 intCat = -1; 190 intCat = -1;
191 else 191 else
192 intCat = mCat.id("Contacts", cat ); 192 intCat = mCat.id("Contacts", cat );
193 193
194 // Just do anything if we really change the category 194 // Just do anything if we really change the category
195 if ( intCat != m_curr_category ){ 195 if ( intCat != m_curr_category ){
196 qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); 196 // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category);
197 197
198 m_curr_category = intCat; 198 m_curr_category = intCat;
199 emit signalClearLetterPicker(); 199 emit signalClearLetterPicker();
200 200
201 load(); 201 load();
202 } 202 }
203 203
204} 204}
205 205
206void AbView::setShowToView( Views view ) 206void AbView::setShowToView( Views view )
207{ 207{
208 qWarning("void AbView::setShowToView( View %d )", view); 208 //qWarning("void AbView::setShowToView( View %d )", view);
209 209
210 qWarning ("Change the View (Category is: %d)", m_curr_category); 210 //qWarning ("Change the View (Category is: %d)", m_curr_category);
211 211
212 if ( m_curr_View != view ){ 212 if ( m_curr_View != view ){
213 m_prev_View = m_curr_View; 213 m_prev_View = m_curr_View;
214 m_curr_View = view; 214 m_curr_View = view;
215 215
216 updateView(); 216 updateView();
217 } 217 }
218 218
219} 219}
220 220
221void AbView::setShowByLetter( char c ) 221void AbView::setShowByLetter( char c )
222{ 222{
223 qWarning("void AbView::setShowByLetter( %c )", c ); 223 //qWarning("void AbView::setShowByLetter( %c )", c );
224 OContact query; 224 OContact query;
225 if ( c == 0 ){ 225 if ( c == 0 ){
226 load(); 226 load();
227 return; 227 return;
228 }else{ 228 }else{
229 // If the current Backend is unable to solve the query, we will 229 // If the current Backend is unable to solve the query, we will
@@ -251,13 +251,13 @@ QString AbView::showCategory() const
251{ 251{
252 return mCat.label( "Contacts", m_curr_category ); 252 return mCat.label( "Contacts", m_curr_category );
253} 253}
254 254
255void AbView::showPersonal( bool personal ) 255void AbView::showPersonal( bool personal )
256{ 256{
257 qWarning ("void AbView::showPersonal( %d )", personal); 257 //qWarning ("void AbView::showPersonal( %d )", personal);
258 258
259 if ( personal ){ 259 if ( personal ){
260 260
261 if ( m_inPersonal ) 261 if ( m_inPersonal )
262 return; 262 return;
263 263
@@ -300,13 +300,13 @@ QStringList AbView::categories()
300} 300}
301 301
302// BEGIN: Slots 302// BEGIN: Slots
303void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, 303void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
304 bool , QString cat ) 304 bool , QString cat )
305{ 305{
306 qWarning( "void AbView::slotDoFind" ); 306 //qWarning( "void AbView::slotDoFind" );
307 307
308 // We reloading the data: Deselect Letterpicker 308 // We reloading the data: Deselect Letterpicker
309 emit signalClearLetterPicker(); 309 emit signalClearLetterPicker();
310 310
311 // Use the current Category if nothing else selected 311 // Use the current Category if nothing else selected
312 int category = 0; 312 int category = 0;
@@ -314,22 +314,22 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
314 if ( cat.isEmpty() ) 314 if ( cat.isEmpty() )
315 category = m_curr_category; 315 category = m_curr_category;
316 else{ 316 else{
317 category = mCat.id("Contacts", cat ); 317 category = mCat.id("Contacts", cat );
318 } 318 }
319 319
320 qWarning ("Find in Category %d", category); 320 //qWarning ("Find in Category %d", category);
321 321
322 QRegExp r( str ); 322 QRegExp r( str );
323 r.setCaseSensitive( caseSensitive ); 323 r.setCaseSensitive( caseSensitive );
324 r.setWildcard( !useRegExp ); 324 r.setWildcard( !useRegExp );
325 325
326 // Get all matching entries out of the database 326 // Get all matching entries out of the database
327 m_list = m_contactdb->matchRegexp( r ); 327 m_list = m_contactdb->matchRegexp( r );
328 328
329 qWarning( "found: %d", m_list.count() ); 329 //qWarning( "found: %d", m_list.count() );
330 if ( m_list.count() == 0 ){ 330 if ( m_list.count() == 0 ){
331 emit signalNotFound(); 331 emit signalNotFound();
332 return; 332 return;
333 } 333 }
334 334
335 // Now remove all contacts with wrong category (if any selected) 335 // Now remove all contacts with wrong category (if any selected)
@@ -346,13 +346,13 @@ void AbView::offSearch()
346 m_inSearch = false; 346 m_inSearch = false;
347 347
348 load(); 348 load();
349} 349}
350 350
351void AbView::slotSwitch(){ 351void AbView::slotSwitch(){
352 qWarning("AbView::slotSwitch()"); 352 //qWarning("AbView::slotSwitch()");
353 353
354 m_prev_View = m_curr_View; 354 m_prev_View = m_curr_View;
355 switch ( (int) m_curr_View ){ 355 switch ( (int) m_curr_View ){
356 case TableView: 356 case TableView:
357 qWarning("Switching to CardView"); 357 qWarning("Switching to CardView");
358 m_curr_View = CardView; 358 m_curr_View = CardView;
@@ -374,58 +374,58 @@ void AbView::clearForCategory()
374 // Now remove all contacts with wrong category if any category selected 374 // Now remove all contacts with wrong category if any category selected
375 375
376 OContactAccess::List allList = m_list; 376 OContactAccess::List allList = m_list;
377 if ( m_curr_category != -1 ){ 377 if ( m_curr_category != -1 ){
378 for ( it = allList.begin(); it != allList.end(); ++it ){ 378 for ( it = allList.begin(); it != allList.end(); ++it ){
379 if ( !contactCompare( *it, m_curr_category ) ){ 379 if ( !contactCompare( *it, m_curr_category ) ){
380 qWarning("Removing %d", (*it).uid()); 380 // qWarning("Removing %d", (*it).uid());
381 m_list.remove( (*it).uid() ); 381 m_list.remove( (*it).uid() );
382 } 382 }
383 } 383 }
384 } 384 }
385 385
386} 386}
387 387
388bool AbView::contactCompare( const OContact &cnt, int category ) 388bool AbView::contactCompare( const OContact &cnt, int category )
389{ 389{
390 qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); 390 //qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category);
391 391
392 bool returnMe; 392 bool returnMe;
393 QArray<int> cats; 393 QArray<int> cats;
394 cats = cnt.categories(); 394 cats = cnt.categories();
395 395
396 qWarning ("Number of categories: %d", cats.count() ); 396 //qWarning ("Number of categories: %d", cats.count() );
397 397
398 returnMe = false; 398 returnMe = false;
399 if ( cats.count() == 0 && category == 0 ) 399 if ( cats.count() == 0 && category == 0 )
400 // Contacts with no category will just shown on "All" and "Unfiled" 400 // Contacts with no category will just shown on "All" and "Unfiled"
401 returnMe = true; 401 returnMe = true;
402 else { 402 else {
403 int i; 403 int i;
404 for ( i = 0; i < int(cats.count()); i++ ) { 404 for ( i = 0; i < int(cats.count()); i++ ) {
405 qWarning("Comparing %d with %d",cats[i],category ); 405 // qWarning("Comparing %d with %d",cats[i],category );
406 if ( cats[i] == category ) { 406 if ( cats[i] == category ) {
407 returnMe = true; 407 returnMe = true;
408 break; 408 break;
409 } 409 }
410 } 410 }
411 } 411 }
412 qWarning ("Return: %d", returnMe); 412 //qWarning ("Return: %d", returnMe);
413 return returnMe; 413 return returnMe;
414} 414}
415 415
416// In Some rare cases we have to update all lists.. 416// In Some rare cases we have to update all lists..
417void AbView::updateListinViews() 417void AbView::updateListinViews()
418{ 418{
419 m_abTable -> setContacts( m_list ); 419 m_abTable -> setContacts( m_list );
420 m_ablabel -> setContacts( m_list ); 420 m_ablabel -> setContacts( m_list );
421} 421}
422 422
423void AbView::updateView( bool newdata ) 423void AbView::updateView( bool newdata )
424{ 424{
425 qWarning("AbView::updateView()"); 425 //qWarning("AbView::updateView()");
426 426
427 if ( m_viewStack -> visibleWidget() ){ 427 if ( m_viewStack -> visibleWidget() ){
428 m_viewStack -> visibleWidget() -> clearFocus(); 428 m_viewStack -> visibleWidget() -> clearFocus();
429 } 429 }
430 430
431 // If we switching the view, we have to store some information 431 // If we switching the view, we have to store some information