summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/ocontact.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/ocontact.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ocontact.cpp749
1 files changed, 402 insertions, 347 deletions
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index f1a22a7..fa5313f 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -1,9 +1,9 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org> 3 Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
@@ -24,47 +24,31 @@
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30/**********************************************************************
31** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
32** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
33**
34** This file may be distributed and/or modified under the terms of the
35** GNU General Public License version 2 as published by the Free Software
36** Foundation and appearing in the file LICENSE.GPL included in the
37** packaging of this file.
38**
39** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
40** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
41**
42** See http://www.trolltech.com/gpl/ for GPL licensing information.
43**
44** Contact info@trolltech.com if any conditions of this licensing are
45** not clear to you.
46**
47**********************************************************************/
48
49#define QTOPIA_INTERNAL_CONTACT_MRE 30#define QTOPIA_INTERNAL_CONTACT_MRE
50 31
51#include <opie2/ocontact.h> 32#include "ocontact.h"
33
34/* OPIE */
52#include <opie2/opimresolver.h> 35#include <opie2/opimresolver.h>
53#include <opie2/oconversion.h> 36#include <opie2/oconversion.h>
54
55#include <qpe/stringutil.h> 37#include <qpe/stringutil.h>
56#include <qpe/timestring.h> 38#include <qpe/timestring.h>
57#include <qpe/config.h> 39#include <qpe/config.h>
58 40
41/* QT */
59#include <qobject.h> 42#include <qobject.h>
60#include <qregexp.h> 43#include <qregexp.h>
61#include <qstylesheet.h> 44#include <qstylesheet.h>
62#include <qfileinfo.h> 45#include <qfileinfo.h>
63#include <qmap.h> 46#include <qmap.h>
64 47
48/* STD */
65#include <stdio.h> 49#include <stdio.h>
66 50
67/*! 51/*!
68 \class Contact contact.h 52 \class Contact contact.h
69 \brief The Contact class holds the data of an address book entry. 53 \brief The Contact class holds the data of an address book entry.
70 54
@@ -73,51 +57,50 @@
73 57
74 \ingroup qtopiaemb 58 \ingroup qtopiaemb
75 \ingroup qtopiadesktop 59 \ingroup qtopiadesktop
76*/ 60*/
77 61
78 62
79namespace Opie { 63namespace Opie
64{
80/*! 65/*!
81 Creates a new, empty contact. 66 Creates a new, empty contact.
82*/ 67*/
83OContact::OContact() 68OContact::OContact():OPimRecord(), mMap(), d( 0 )
84 : OPimRecord(), mMap(), d( 0 ) 69{}
85{
86}
87 70
88/*! 71/*!
89 \internal 72 \internal
90 Creates a new contact. The properties of the contact are 73 Creates a new contact. The properties of the contact are
91 set from \a fromMap. 74 set from \a fromMap.
92*/ 75*/
93OContact::OContact( const QMap<int, QString> &fromMap ) : 76OContact::OContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap( fromMap ), d( 0 )
94 OPimRecord(), mMap( fromMap ), d( 0 )
95{ 77{
96 QString cats = mMap[ Qtopia::AddressCategory ]; 78 QString cats = mMap[ Qtopia::AddressCategory ];
97 if ( !cats.isEmpty() ) 79 if ( !cats.isEmpty() )
98 setCategories( idsFromString( cats ) ); 80 setCategories( idsFromString( cats ) );
99 81
100 QString uidStr = find( Qtopia::AddressUid ); 82 QString uidStr = find( Qtopia::AddressUid );
101 83
102 if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ 84 if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) )
103 qWarning( "Invalid UID found. Generate new one.." ); 85 {
104 setUid( uidGen().generate() ); 86 qWarning( "Invalid UID found. Generate new one.." );
105 }else 87 setUid( uidGen().generate() );
106 setUid( uidStr.toInt() ); 88 }
89 else
90 setUid( uidStr.toInt() );
107 91
108// if ( !uidStr.isEmpty() ) 92 // if ( !uidStr.isEmpty() )
109 // setUid( uidStr.toInt() ); 93 // setUid( uidStr.toInt() );
110} 94}
111 95
112/*! 96/*!
113 Destroys a contact. 97 Destroys a contact.
114*/ 98*/
115OContact::~OContact() 99OContact::~OContact()
116{ 100{}
117}
118 101
119/*! \fn void OContact::setTitle( const QString &str ) 102/*! \fn void OContact::setTitle( const QString &str )
120 Sets the title of the contact to \a str. 103 Sets the title of the contact to \a str.
121*/ 104*/
122 105
123/*! \fn void OContact::setFirstName( const QString &str ) 106/*! \fn void OContact::setFirstName( const QString &str )
@@ -452,13 +435,13 @@ OContact::~OContact()
452*/ 435*/
453QMap<int, QString> OContact::toMap() const 436QMap<int, QString> OContact::toMap() const
454{ 437{
455 QMap<int, QString> map = mMap; 438 QMap<int, QString> map = mMap;
456 QString cats = idsToString( categories() ); 439 QString cats = idsToString( categories() );
457 if ( !cats.isEmpty() ) 440 if ( !cats.isEmpty() )
458 map.insert( Qtopia::AddressCategory, cats ); 441 map.insert( Qtopia::AddressCategory, cats );
459 return map; 442 return map;
460} 443}
461 444
462/*! 445/*!
463 Returns a rich text formatted QString representing the contents the contact. 446 Returns a rich text formatted QString representing the contents the contact.
464*/ 447*/
@@ -466,366 +449,412 @@ QString OContact::toRichText() const
466{ 449{
467 QString text; 450 QString text;
468 QString value, comp, state; 451 QString value, comp, state;
469 QString str; 452 QString str;
470 bool marker = false; 453 bool marker = false;
471 454
472 Config cfg("qpe"); 455 Config cfg( "qpe" );
473 cfg.setGroup("Appearance"); 456 cfg.setGroup( "Appearance" );
474 int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State ); 457 int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State );
475 458
476 // name, jobtitle and company 459 // name, jobtitle and company
477 if ( !(value = fullName()).isEmpty() ) 460 if ( !( value = fullName() ).isEmpty() )
478 text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString(value) + "</h3></b>"; 461 text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString( value ) + "</h3></b>";
479 462
480 if ( !(value = jobTitle()).isEmpty() ) 463 if ( !( value = jobTitle() ).isEmpty() )
481 text += Qtopia::escapeString(value) + " "; 464 text += Qtopia::escapeString( value ) + " ";
482 465
483 comp = company(); 466 comp = company();
484 if ( !(value = department()).isEmpty() ) { 467 if ( !( value = department() ).isEmpty() )
485 text += Qtopia::escapeString(value); 468 {
486 if ( comp ) 469 text += Qtopia::escapeString( value );
487 text += ", " + Qtopia::escapeString(comp); 470 if ( comp )
488 }else if ( comp ) 471 text += ", " + Qtopia::escapeString( comp );
489 text += "<br>" + Qtopia::escapeString(comp); 472 }
473 else if ( comp )
474 text += "<br>" + Qtopia::escapeString( comp );
490 text += "<br><hr>"; 475 text += "<br><hr>";
491 476
492 // defailt email 477 // defailt email
493 QString defEmail = defaultEmail(); 478 QString defEmail = defaultEmail();
494 if ( !defEmail.isEmpty() ){ 479 if ( !defEmail.isEmpty() )
495 text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>" 480 {
496 + Qtopia::escapeString(defEmail); 481 text += "<b><img src=\"addressbook/email\"> " + QObject::tr( "Default Email: " ) + "</b>"
497 marker = true; 482 + Qtopia::escapeString( defEmail );
483 marker = true;
498 } 484 }
499 485
500 // business address 486 // business address
501 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || 487 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
502 !businessZip().isEmpty() || !businessCountry().isEmpty() ) { 488 !businessZip().isEmpty() || !businessCountry().isEmpty() )
503 text += QObject::tr( "<br><b>Work Address:</b>" ); 489 {
504 marker = true; 490 text += QObject::tr( "<br><b>Work Address:</b>" );
491 marker = true;
505 } 492 }
506 493
507 if ( !(value = businessStreet()).isEmpty() ){ 494 if ( !( value = businessStreet() ).isEmpty() )
508 text += "<br>" + Qtopia::escapeString(value); 495 {
509 marker = true; 496 text += "<br>" + Qtopia::escapeString( value );
497 marker = true;
510 } 498 }
511 499
512 switch( addressformat ){ 500 switch ( addressformat )
513 case Zip_City_State:{ // Zip_Code City, State 501 {
514 state = businessState(); 502 case Zip_City_State:
515 if ( !(value = businessZip()).isEmpty() ){ 503 { // Zip_Code City, State
516 text += "<br>" + Qtopia::escapeString(value) + " "; 504 state = businessState();
517 marker = true; 505 if ( !( value = businessZip() ).isEmpty() )
518 506 {
519 } 507 text += "<br>" + Qtopia::escapeString( value ) + " ";
520 if ( !(value = businessCity()).isEmpty() ) { 508 marker = true;
521 marker = true; 509
522 if ( businessZip().isEmpty() && !businessStreet().isEmpty() ) 510 }
523 text += "<br>"; 511 if ( !( value = businessCity() ).isEmpty() )
524 text += Qtopia::escapeString(value); 512 {
525 if ( state ) 513 marker = true;
526 text += ", " + Qtopia::escapeString(state); 514 if ( businessZip().isEmpty() && !businessStreet().isEmpty() )
527 } else if ( !state.isEmpty() ){ 515 text += "<br>";
528 text += "<br>" + Qtopia::escapeString(state); 516 text += Qtopia::escapeString( value );
529 marker = true; 517 if ( state )
530 } 518 text += ", " + Qtopia::escapeString( state );
531 break; 519 }
532 } 520 else if ( !state.isEmpty() )
533 case City_State_Zip:{ // City, State Zip_Code 521 {
534 state = businessState(); 522 text += "<br>" + Qtopia::escapeString( state );
535 if ( !(value = businessCity()).isEmpty() ) { 523 marker = true;
536 marker = true; 524 }
537 text += "<br>" + Qtopia::escapeString(value); 525 break;
538 if ( state ) 526 }
539 text += ", " + Qtopia::escapeString(state); 527 case City_State_Zip:
540 } else if ( !state.isEmpty() ){ 528 { // City, State Zip_Code
541 text += "<br>" + Qtopia::escapeString(state); 529 state = businessState();
542 marker = true; 530 if ( !( value = businessCity() ).isEmpty() )
543 } 531 {
544 if ( !(value = businessZip()).isEmpty() ){ 532 marker = true;
545 text += " " + Qtopia::escapeString(value); 533 text += "<br>" + Qtopia::escapeString( value );
546 marker = true; 534 if ( state )
547 } 535 text += ", " + Qtopia::escapeString( state );
548 break; 536 }
549 } 537 else if ( !state.isEmpty() )
538 {
539 text += "<br>" + Qtopia::escapeString( state );
540 marker = true;
541 }
542 if ( !( value = businessZip() ).isEmpty() )
543 {
544 text += " " + Qtopia::escapeString( value );
545 marker = true;
546 }
547 break;
548 }
550 } 549 }
551 550
552 if ( !(value = businessCountry()).isEmpty() ){ 551 if ( !( value = businessCountry() ).isEmpty() )
553 text += "<br>" + Qtopia::escapeString(value); 552 {
554 marker = true; 553 text += "<br>" + Qtopia::escapeString( value );
554 marker = true;
555 } 555 }
556 556
557 // rest of Business data 557 // rest of Business data
558 str = office(); 558 str = office();
559 if ( !str.isEmpty() ){ 559 if ( !str.isEmpty() )
560 text += "<br><b>" + QObject::tr("Office: ") + "</b>" 560 {
561 + Qtopia::escapeString(str); 561 text += "<br><b>" + QObject::tr( "Office: " ) + "</b>"
562 marker = true; 562 + Qtopia::escapeString( str );
563 marker = true;
563 } 564 }
564 str = businessWebpage(); 565 str = businessWebpage();
565 if ( !str.isEmpty() ){ 566 if ( !str.isEmpty() )
566 text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>" 567 {
567 + Qtopia::escapeString(str); 568 text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr( "Business Web Page: " ) + "</b>"
568 marker = true; 569 + Qtopia::escapeString( str );
570 marker = true;
569 } 571 }
570 str = businessPhone(); 572 str = businessPhone();
571 if ( !str.isEmpty() ){ 573 if ( !str.isEmpty() )
572 text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>" 574 {
573 + Qtopia::escapeString(str); 575 text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr( "Business Phone: " ) + "</b>"
574 marker = true; 576 + Qtopia::escapeString( str );
577 marker = true;
575 } 578 }
576 str = businessFax(); 579 str = businessFax();
577 if ( !str.isEmpty() ){ 580 if ( !str.isEmpty() )
578 text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>" 581 {
579 + Qtopia::escapeString(str); 582 text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr( "Business Fax: " ) + "</b>"
580 marker = true; 583 + Qtopia::escapeString( str );
584 marker = true;
581 } 585 }
582 str = businessMobile(); 586 str = businessMobile();
583 if ( !str.isEmpty() ){ 587 if ( !str.isEmpty() )
584 text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>" 588 {
585 + Qtopia::escapeString(str); 589 text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr( "Business Mobile: " ) + "</b>"
586 marker = true; 590 + Qtopia::escapeString( str );
591 marker = true;
587 } 592 }
588 str = businessPager(); 593 str = businessPager();
589 if ( !str.isEmpty() ){ 594 if ( !str.isEmpty() )
590 text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>" 595 {
591 + Qtopia::escapeString(str); 596 text += "<br><b>" + QObject::tr( "Business Pager: " ) + "</b>"
592 marker = true; 597 + Qtopia::escapeString( str );
598 marker = true;
593 } 599 }
594 600
595 // text += "<br>"; 601 // text += "<br>";
596 602
597 // home address 603 // home address
598 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || 604 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
599 !homeZip().isEmpty() || !homeCountry().isEmpty() ) { 605 !homeZip().isEmpty() || !homeCountry().isEmpty() )
600 text += QObject::tr( "<br><b>Home Address:</b>" ); 606 {
601 marker = true; 607 text += QObject::tr( "<br><b>Home Address:</b>" );
608 marker = true;
602 } 609 }
603 610
604 if ( !(value = homeStreet()).isEmpty() ){ 611 if ( !( value = homeStreet() ).isEmpty() )
605 text += "<br>" + Qtopia::escapeString(value); 612 {
606 marker = true; 613 text += "<br>" + Qtopia::escapeString( value );
614 marker = true;
607 } 615 }
608 616
609 switch( addressformat ){ 617 switch ( addressformat )
610 case Zip_City_State:{ // Zip_Code City, State 618 {
611 state = homeState(); 619 case Zip_City_State:
612 if ( !(value = homeZip()).isEmpty() ){ 620 { // Zip_Code City, State
613 text += "<br>" + Qtopia::escapeString(value) + " "; 621 state = homeState();
614 marker = true; 622 if ( !( value = homeZip() ).isEmpty() )
615 } 623 {
616 if ( !(value = homeCity()).isEmpty() ) { 624 text += "<br>" + Qtopia::escapeString( value ) + " ";
617 marker = true; 625 marker = true;
618 if ( homeZip().isEmpty() && !homeStreet().isEmpty() ) 626 }
619 text += "<br>"; 627 if ( !( value = homeCity() ).isEmpty() )
620 text += Qtopia::escapeString(value); 628 {
621 if ( !state.isEmpty() ) 629 marker = true;
622 text += ", " + Qtopia::escapeString(state); 630 if ( homeZip().isEmpty() && !homeStreet().isEmpty() )
623 } else if (!state.isEmpty()) { 631 text += "<br>";
624 text += "<br>" + Qtopia::escapeString(state); 632 text += Qtopia::escapeString( value );
625 marker = true; 633 if ( !state.isEmpty() )
626 } 634 text += ", " + Qtopia::escapeString( state );
627 break; 635 }
628 } 636 else if ( !state.isEmpty() )
629 case City_State_Zip:{ // City, State Zip_Code 637 {
630 state = homeState(); 638 text += "<br>" + Qtopia::escapeString( state );
631 if ( !(value = homeCity()).isEmpty() ) { 639 marker = true;
632 marker = true; 640 }
633 text += "<br>" + Qtopia::escapeString(value); 641 break;
634 if ( state ) 642 }
635 text += ", " + Qtopia::escapeString(state); 643 case City_State_Zip:
636 } else if ( !state.isEmpty() ){ 644 { // City, State Zip_Code
637 text += "<br>" + Qtopia::escapeString(state); 645 state = homeState();
638 marker = true; 646 if ( !( value = homeCity() ).isEmpty() )
639 } 647 {
640 if ( !(value = homeZip()).isEmpty() ){ 648 marker = true;
641 text += " " + Qtopia::escapeString(value); 649 text += "<br>" + Qtopia::escapeString( value );
642 marker = true; 650 if ( state )
643 } 651 text += ", " + Qtopia::escapeString( state );
644 break; 652 }
645 } 653 else if ( !state.isEmpty() )
654 {
655 text += "<br>" + Qtopia::escapeString( state );
656 marker = true;
657 }
658 if ( !( value = homeZip() ).isEmpty() )
659 {
660 text += " " + Qtopia::escapeString( value );
661 marker = true;
662 }
663 break;
664 }
646 } 665 }
647 666
648 if ( !(value = homeCountry()).isEmpty() ){ 667 if ( !( value = homeCountry() ).isEmpty() )
649 text += "<br>" + Qtopia::escapeString(value); 668 {
650 marker = true; 669 text += "<br>" + Qtopia::escapeString( value );
670 marker = true;
651 } 671 }
652 672
653 // rest of Home data 673 // rest of Home data
654 str = homeWebpage(); 674 str = homeWebpage();
655 if ( !str.isEmpty() ){ 675 if ( !str.isEmpty() )
656 text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>" 676 {
657 + Qtopia::escapeString(str); 677 text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr( "Home Web Page: " ) + "</b>"
658 marker = true; 678 + Qtopia::escapeString( str );
679 marker = true;
659 } 680 }
660 str = homePhone(); 681 str = homePhone();
661 if ( !str.isEmpty() ){ 682 if ( !str.isEmpty() )
662 text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>" 683 {
663 + Qtopia::escapeString(str); 684 text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr( "Home Phone: " ) + "</b>"
664 marker = true; 685 + Qtopia::escapeString( str );
686 marker = true;
665 } 687 }
666 str = homeFax(); 688 str = homeFax();
667 if ( !str.isEmpty() ){ 689 if ( !str.isEmpty() )
668 text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>" 690 {
669 + Qtopia::escapeString(str); 691 text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr( "Home Fax: " ) + "</b>"
670 marker = true; 692 + Qtopia::escapeString( str );
693 marker = true;
671 } 694 }
672 str = homeMobile(); 695 str = homeMobile();
673 if ( !str.isEmpty() ){ 696 if ( !str.isEmpty() )
674 text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>" 697 {
675 + Qtopia::escapeString(str); 698 text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr( "Home Mobile: " ) + "</b>"
676 marker = true; 699 + Qtopia::escapeString( str );
700 marker = true;
677 } 701 }
678 702
679 if ( marker ) 703 if ( marker )
680 text += "<br><hr>"; 704 text += "<br><hr>";
681 705
682 // the rest... 706 // the rest...
683 str = emails(); 707 str = emails();
684 if ( !str.isEmpty() && ( str != defEmail ) ) 708 if ( !str.isEmpty() && ( str != defEmail ) )
685 text += "<br><b>" + QObject::tr("All Emails: ") + "</b>" 709 text += "<br><b>" + QObject::tr( "All Emails: " ) + "</b>"
686 + Qtopia::escapeString(str); 710 + Qtopia::escapeString( str );
687 str = profession(); 711 str = profession();
688 if ( !str.isEmpty() ) 712 if ( !str.isEmpty() )
689 text += "<br><b>" + QObject::tr("Profession: ") + "</b>" 713 text += "<br><b>" + QObject::tr( "Profession: " ) + "</b>"
690 + Qtopia::escapeString(str); 714 + Qtopia::escapeString( str );
691 str = assistant(); 715 str = assistant();
692 if ( !str.isEmpty() ) 716 if ( !str.isEmpty() )
693 text += "<br><b>" + QObject::tr("Assistant: ") + "</b>" 717 text += "<br><b>" + QObject::tr( "Assistant: " ) + "</b>"
694 + Qtopia::escapeString(str); 718 + Qtopia::escapeString( str );
695 str = manager(); 719 str = manager();
696 if ( !str.isEmpty() ) 720 if ( !str.isEmpty() )
697 text += "<br><b>" + QObject::tr("Manager: ") + "</b>" 721 text += "<br><b>" + QObject::tr( "Manager: " ) + "</b>"
698 + Qtopia::escapeString(str); 722 + Qtopia::escapeString( str );
699 str = gender(); 723 str = gender();
700 if ( !str.isEmpty() && str.toInt() != 0 ) { 724 if ( !str.isEmpty() && str.toInt() != 0 )
701 text += "<br>"; 725 {
702 if ( str.toInt() == 1 ) 726 text += "<br>";
703 str = QObject::tr( "Male" ); 727 if ( str.toInt() == 1 )
704 else if ( str.toInt() == 2 ) 728 str = QObject::tr( "Male" );
705 str = QObject::tr( "Female" ); 729 else if ( str.toInt() == 2 )
706 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str; 730 str = QObject::tr( "Female" );
731 text += "<b>" + QObject::tr( "Gender: " ) + "</b>" + str;
707 } 732 }
708 str = spouse(); 733 str = spouse();
709 if ( !str.isEmpty() ) 734 if ( !str.isEmpty() )
710 text += "<br><b>" + QObject::tr("Spouse: ") + "</b>" 735 text += "<br><b>" + QObject::tr( "Spouse: " ) + "</b>"
711 + Qtopia::escapeString(str); 736 + Qtopia::escapeString( str );
712 if ( birthday().isValid() ){ 737 if ( birthday().isValid() )
713 str = TimeString::numberDateString( birthday() ); 738 {
714 text += "<br><b>" + QObject::tr("Birthday: ") + "</b>" 739 str = TimeString::numberDateString( birthday() );
715 + Qtopia::escapeString(str); 740 text += "<br><b>" + QObject::tr( "Birthday: " ) + "</b>"
741 + Qtopia::escapeString( str );
716 } 742 }
717 if ( anniversary().isValid() ){ 743 if ( anniversary().isValid() )
718 str = TimeString::numberDateString( anniversary() ); 744 {
719 text += "<br><b>" + QObject::tr("Anniversary: ") + "</b>" 745 str = TimeString::numberDateString( anniversary() );
720 + Qtopia::escapeString(str); 746 text += "<br><b>" + QObject::tr( "Anniversary: " ) + "</b>"
747 + Qtopia::escapeString( str );
721 } 748 }
722 str = children(); 749 str = children();
723 if ( !str.isEmpty() ) 750 if ( !str.isEmpty() )
724 text += "<br><b>" + QObject::tr("Children: ") + "</b>" 751 text += "<br><b>" + QObject::tr( "Children: " ) + "</b>"
725 + Qtopia::escapeString(str); 752 + Qtopia::escapeString( str );
726 753
727 str = nickname(); 754 str = nickname();
728 if ( !str.isEmpty() ) 755 if ( !str.isEmpty() )
729 text += "<br><b>" + QObject::tr("Nickname: ") + "</b>" 756 text += "<br><b>" + QObject::tr( "Nickname: " ) + "</b>"
730 + Qtopia::escapeString(str); 757 + Qtopia::escapeString( str );
731 758
732 // categories 759 // categories
733 if ( categoryNames("Contacts").count() ){ 760 if ( categoryNames( "Contacts" ).count() )
734 text += "<br><b>" + QObject::tr( "Category:") + "</b> "; 761 {
735 text += categoryNames("Contacts").join(", "); 762 text += "<br><b>" + QObject::tr( "Category:" ) + "</b> ";
763 text += categoryNames( "Contacts" ).join( ", " );
736 } 764 }
737 765
738 // notes last 766 // notes last
739 if ( !(value = notes()).isEmpty() ) { 767 if ( !( value = notes() ).isEmpty() )
740 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; 768 {
741 QRegExp reg("\n"); 769 text += "<br><hr><b>" + QObject::tr( "Notes:" ) + "</b> ";
742 770 QRegExp reg( "\n" );
743 //QString tmp = Qtopia::escapeString(value); 771
744 QString tmp = QStyleSheet::convertFromPlainText(value); 772 //QString tmp = Qtopia::escapeString(value);
745 //tmp.replace( reg, "<br>" ); 773 QString tmp = QStyleSheet::convertFromPlainText( value );
746 text += "<br>" + tmp + "<br>"; 774 //tmp.replace( reg, "<br>" );
775 text += "<br>" + tmp + "<br>";
747 } 776 }
748 return text; 777 return text;
749} 778}
750 779
751/*! 780/*!
752 \internal 781 \internal
753*/ 782*/
754void OContact::insert( int key, const QString &v ) 783void OContact::insert( int key, const QString &v )
755{ 784{
756 QString value = v.stripWhiteSpace(); 785 QString value = v.stripWhiteSpace();
757 if ( value.isEmpty() ) 786 if ( value.isEmpty() )
758 mMap.remove( key ); 787 mMap.remove( key );
759 else 788 else
760 mMap.insert( key, value ); 789 mMap.insert( key, value );
761} 790}
762 791
763/*! 792/*!
764 \internal 793 \internal
765*/ 794*/
766void OContact::replace( int key, const QString & v ) 795void OContact::replace( int key, const QString & v )
767{ 796{
768 QString value = v.stripWhiteSpace(); 797 QString value = v.stripWhiteSpace();
769 if ( value.isEmpty() ) 798 if ( value.isEmpty() )
770 mMap.remove( key ); 799 mMap.remove( key );
771 else 800 else
772 mMap.replace( key, value ); 801 mMap.replace( key, value );
773} 802}
774 803
775/*! 804/*!
776 \internal 805 \internal
777*/ 806*/
778QString OContact::find( int key ) const 807QString OContact::find( int key ) const
779{ 808{
780 return mMap[key]; 809 return mMap[ key ];
781} 810}
782 811
783/*! 812/*!
784 \internal 813 \internal
785*/ 814*/
786QString OContact::displayAddress( const QString &street, 815QString OContact::displayAddress( const QString &street,
787 const QString &city, 816 const QString &city,
788 const QString &state, 817 const QString &state,
789 const QString &zip, 818 const QString &zip,
790 const QString &country ) const 819 const QString &country ) const
791{ 820{
792 QString s = street; 821 QString s = street;
793 if ( !street.isEmpty() ) 822 if ( !street.isEmpty() )
794 s+= "\n"; 823 s += "\n";
795 s += city; 824 s += city;
796 if ( !city.isEmpty() && !state.isEmpty() ) 825 if ( !city.isEmpty() && !state.isEmpty() )
797 s += ", "; 826 s += ", ";
798 s += state; 827 s += state;
799 if ( !state.isEmpty() && !zip.isEmpty() ) 828 if ( !state.isEmpty() && !zip.isEmpty() )
800 s += " "; 829 s += " ";
801 s += zip; 830 s += zip;
802 if ( !country.isEmpty() && !s.isEmpty() ) 831 if ( !country.isEmpty() && !s.isEmpty() )
803 s += "\n"; 832 s += "\n";
804 s += country; 833 s += country;
805 return s; 834 return s;
806} 835}
807 836
808/*! 837/*!
809 \internal 838 \internal
810*/ 839*/
811QString OContact::displayBusinessAddress() const 840QString OContact::displayBusinessAddress() const
812{ 841{
813 return displayAddress( businessStreet(), businessCity(), 842 return displayAddress( businessStreet(), businessCity(),
814 businessState(), businessZip(), 843 businessState(), businessZip(),
815 businessCountry() ); 844 businessCountry() );
816} 845}
817 846
818/*! 847/*!
819 \internal 848 \internal
820*/ 849*/
821QString OContact::displayHomeAddress() const 850QString OContact::displayHomeAddress() const
822{ 851{
823 return displayAddress( homeStreet(), homeCity(), 852 return displayAddress( homeStreet(), homeCity(),
824 homeState(), homeZip(), 853 homeState(), homeZip(),
825 homeCountry() ); 854 homeCountry() );
826} 855}
827 856
828/*! 857/*!
829 Returns the full name of the contact 858 Returns the full name of the contact
830*/ 859*/
831QString OContact::fullName() const 860QString OContact::fullName() const
@@ -834,31 +863,35 @@ QString OContact::fullName() const
834 QString firstName = find( Qtopia::FirstName ); 863 QString firstName = find( Qtopia::FirstName );
835 QString middleName = find( Qtopia::MiddleName ); 864 QString middleName = find( Qtopia::MiddleName );
836 QString lastName = find( Qtopia::LastName ); 865 QString lastName = find( Qtopia::LastName );
837 QString suffix = find( Qtopia::Suffix ); 866 QString suffix = find( Qtopia::Suffix );
838 867
839 QString name = title; 868 QString name = title;
840 if ( !firstName.isEmpty() ) { 869 if ( !firstName.isEmpty() )
841 if ( !name.isEmpty() ) 870 {
842 name += " "; 871 if ( !name.isEmpty() )
843 name += firstName; 872 name += " ";
873 name += firstName;
844 } 874 }
845 if ( !middleName.isEmpty() ) { 875 if ( !middleName.isEmpty() )
846 if ( !name.isEmpty() ) 876 {
847 name += " "; 877 if ( !name.isEmpty() )
848 name += middleName; 878 name += " ";
879 name += middleName;
849 } 880 }
850 if ( !lastName.isEmpty() ) { 881 if ( !lastName.isEmpty() )
851 if ( !name.isEmpty() ) 882 {
852 name += " "; 883 if ( !name.isEmpty() )
853 name += lastName; 884 name += " ";
885 name += lastName;
854 } 886 }
855 if ( !suffix.isEmpty() ) { 887 if ( !suffix.isEmpty() )
856 if ( !name.isEmpty() ) 888 {
857 name += " "; 889 if ( !name.isEmpty() )
858 name += suffix; 890 name += " ";
891 name += suffix;
859 } 892 }
860 return name.simplifyWhiteSpace(); 893 return name.simplifyWhiteSpace();
861} 894}
862 895
863/*! 896/*!
864 Returns a list of the names of the children of the contact. 897 Returns a list of the names of the children of the contact.
@@ -897,17 +930,18 @@ QStringList OContact::childrenList() const
897*/ 930*/
898QStringList OContact::emailList() const 931QStringList OContact::emailList() const
899{ 932{
900 QString emailStr = emails(); 933 QString emailStr = emails();
901 934
902 QStringList r; 935 QStringList r;
903 if ( !emailStr.isEmpty() ) { 936 if ( !emailStr.isEmpty() )
904 qDebug(" emailstr "); 937 {
905 QStringList l = QStringList::split( emailSeparator(), emailStr ); 938 qDebug( " emailstr " );
906 for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) 939 QStringList l = QStringList::split( emailSeparator(), emailStr );
907 r += (*it).simplifyWhiteSpace(); 940 for ( QStringList::ConstIterator it = l.begin();it != l.end();++it )
941 r += ( *it ).simplifyWhiteSpace();
908 } 942 }
909 943
910 return r; 944 return r;
911} 945}
912 946
913/*! 947/*!
@@ -921,21 +955,21 @@ void OContact::setFileAs()
921 QString lastName, firstName, middleName, fileas; 955 QString lastName, firstName, middleName, fileas;
922 956
923 lastName = find( Qtopia::LastName ); 957 lastName = find( Qtopia::LastName );
924 firstName = find( Qtopia::FirstName ); 958 firstName = find( Qtopia::FirstName );
925 middleName = find( Qtopia::MiddleName ); 959 middleName = find( Qtopia::MiddleName );
926 if ( !lastName.isEmpty() && !firstName.isEmpty() 960 if ( !lastName.isEmpty() && !firstName.isEmpty()
927 && !middleName.isEmpty() ) 961 && !middleName.isEmpty() )
928 fileas = lastName + ", " + firstName + " " + middleName; 962 fileas = lastName + ", " + firstName + " " + middleName;
929 else if ( !lastName.isEmpty() && !firstName.isEmpty() ) 963 else if ( !lastName.isEmpty() && !firstName.isEmpty() )
930 fileas = lastName + ", " + firstName; 964 fileas = lastName + ", " + firstName;
931 else if ( !lastName.isEmpty() || !firstName.isEmpty() || 965 else if ( !lastName.isEmpty() || !firstName.isEmpty() ||
932 !middleName.isEmpty() ) 966 !middleName.isEmpty() )
933 fileas = firstName + ( firstName.isEmpty() ? "" : " " ) 967 fileas = firstName + ( firstName.isEmpty() ? "" : " " )
934 + middleName + ( middleName.isEmpty() ? "" : " " ) 968 + middleName + ( middleName.isEmpty() ? "" : " " )
935 + lastName; 969 + lastName;
936 970
937 replace( Qtopia::FileAs, fileas ); 971 replace( Qtopia::FileAs, fileas );
938} 972}
939 973
940/*! 974/*!
941 \internal 975 \internal
@@ -943,27 +977,29 @@ void OContact::setFileAs()
943*/ 977*/
944void OContact::save( QString &buf ) const 978void OContact::save( QString &buf ) const
945{ 979{
946 static const QStringList SLFIELDS = fields(); 980 static const QStringList SLFIELDS = fields();
947 // I'm expecting "<Contact " in front of this... 981 // I'm expecting "<Contact " in front of this...
948 for ( QMap<int, QString>::ConstIterator it = mMap.begin(); 982 for ( QMap<int, QString>::ConstIterator it = mMap.begin();
949 it != mMap.end(); ++it ) { 983 it != mMap.end(); ++it )
950 const QString &value = it.data(); 984 {
951 int key = it.key(); 985 const QString &value = it.data();
952 if ( !value.isEmpty() ) { 986 int key = it.key();
953 if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) 987 if ( !value.isEmpty() )
954 continue; 988 {
955 989 if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid )
956 key -= Qtopia::AddressCategory+1; 990 continue;
957 buf += SLFIELDS[key]; 991
958 buf += "=\"" + Qtopia::escapeString(value) + "\" "; 992 key -= Qtopia::AddressCategory + 1;
959 } 993 buf += SLFIELDS[ key ];
994 buf += "=\"" + Qtopia::escapeString( value ) + "\" ";
995 }
960 } 996 }
961 buf += customToXml(); 997 buf += customToXml();
962 if ( categories().count() > 0 ) 998 if ( categories().count() > 0 )
963 buf += "Categories=\"" + idsToString( categories() ) + "\" "; 999 buf += "Categories=\"" + idsToString( categories() ) + "\" ";
964 buf += "Uid=\"" + QString::number( uid() ) + "\" "; 1000 buf += "Uid=\"" + QString::number( uid() ) + "\" ";
965 // You need to close this yourself 1001 // You need to close this yourself
966} 1002}
967 1003
968 1004
969/*! 1005/*!
@@ -1058,181 +1094,200 @@ void OContact::setChildren( const QString &str )
1058bool OContact::match( const QRegExp &r ) const 1094bool OContact::match( const QRegExp &r ) const
1059{ 1095{
1060 setLastHitField( -1 ); 1096 setLastHitField( -1 );
1061 bool match; 1097 bool match;
1062 match = false; 1098 match = false;
1063 QMap<int, QString>::ConstIterator it; 1099 QMap<int, QString>::ConstIterator it;
1064 for ( it = mMap.begin(); it != mMap.end(); ++it ) { 1100 for ( it = mMap.begin(); it != mMap.end(); ++it )
1065 if ( (*it).find( r ) > -1 ) { 1101 {
1102 if ( ( *it ).find( r ) > -1 )
1103 {
1066 setLastHitField( it.key() ); 1104 setLastHitField( it.key() );
1067 match = true; 1105 match = true;
1068 break; 1106 break;
1069 } 1107 }
1070 } 1108 }
1071 return match; 1109 return match;
1072} 1110}
1073 1111
1074 1112
1075QString OContact::toShortText() const 1113QString OContact::toShortText() const
1076{ 1114{
1077 return ( fullName() ); 1115 return ( fullName() );
1078} 1116}
1117
1118
1079QString OContact::type() const 1119QString OContact::type() const
1080{ 1120{
1081 return QString::fromLatin1( "OContact" ); 1121 return QString::fromLatin1( "OContact" );
1082} 1122}
1083 1123
1084 1124
1085
1086class QString OContact::recordField( int pos ) const 1125class QString OContact::recordField( int pos ) const
1087{ 1126{
1088 QStringList SLFIELDS = fields(); // ?? why this ? (se) 1127 QStringList SLFIELDS = fields(); // ?? why this ? (se)
1089 return SLFIELDS[pos]; 1128 return SLFIELDS[ pos ];
1090} 1129}
1091 1130
1092// In future releases, we should store birthday and anniversary 1131// In future releases, we should store birthday and anniversary
1093// internally as QDate instead of QString ! 1132// internally as QDate instead of QString !
1094// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) 1133// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
1095 1134
1096/*! \fn void OContact::setBirthday( const QDate& date ) 1135/*! \fn void OContact::setBirthday( const QDate& date )
1097 Sets the birthday for the contact to \a date. If date is null 1136 Sets the birthday for the contact to \a date. If date is null
1098 the current stored date will be removed. 1137 the current stored date will be removed.
1099*/ 1138*/
1100void OContact::setBirthday( const QDate &v ) 1139void OContact::setBirthday( const QDate &v )
1101{ 1140{
1102 if ( v.isNull() ){ 1141 if ( v.isNull() )
1103 qWarning( "Remove Birthday"); 1142 {
1104 replace( Qtopia::Birthday, QString::null ); 1143 qWarning( "Remove Birthday" );
1105 return; 1144 replace( Qtopia::Birthday, QString::null );
1106 } 1145 return ;
1146 }
1107 1147
1108 if ( v.isValid() ) 1148 if ( v.isValid() )
1109 replace( Qtopia::Birthday, OConversion::dateToString( v ) ); 1149 replace( Qtopia::Birthday, OConversion::dateToString( v ) );
1110 1150
1111} 1151}
1112 1152
1113 1153
1114/*! \fn void OContact::setAnniversary( const QDate &date ) 1154/*! \fn void OContact::setAnniversary( const QDate &date )
1115 Sets the anniversary of the contact to \a date. If date is 1155 Sets the anniversary of the contact to \a date. If date is
1116 null, the current stored date will be removed. 1156 null, the current stored date will be removed.
1117*/ 1157*/
1118void OContact::setAnniversary( const QDate &v ) 1158void OContact::setAnniversary( const QDate &v )
1119{ 1159{
1120 if ( v.isNull() ){ 1160 if ( v.isNull() )
1121 qWarning( "Remove Anniversary"); 1161 {
1122 replace( Qtopia::Anniversary, QString::null ); 1162 qWarning( "Remove Anniversary" );
1123 return; 1163 replace( Qtopia::Anniversary, QString::null );
1124 } 1164 return ;
1125 1165 }
1126 if ( v.isValid() ) 1166
1127 replace( Qtopia::Anniversary, OConversion::dateToString( v ) ); 1167 if ( v.isValid() )
1168 replace( Qtopia::Anniversary, OConversion::dateToString( v ) );
1128} 1169}
1129 1170
1171
1130/*! \fn QDate OContact::birthday() const 1172/*! \fn QDate OContact::birthday() const
1131 Returns the birthday of the contact. 1173 Returns the birthday of the contact.
1132*/ 1174*/
1133QDate OContact::birthday() const 1175QDate OContact::birthday() const
1134{ 1176{
1135 QString str = find( Qtopia::Birthday ); 1177 QString str = find( Qtopia::Birthday );
1136 // qWarning ("Birthday %s", str.latin1() ); 1178 // qWarning ("Birthday %s", str.latin1() );
1137 if ( !str.isEmpty() ) 1179 if ( !str.isEmpty() )
1138 return OConversion::dateFromString ( str ); 1180 return OConversion::dateFromString ( str );
1139 else 1181 else
1140 return QDate(); 1182 return QDate();
1141} 1183}
1142 1184
1143 1185
1144/*! \fn QDate OContact::anniversary() const 1186/*! \fn QDate OContact::anniversary() const
1145 Returns the anniversary of the contact. 1187 Returns the anniversary of the contact.
1146*/ 1188*/
1147QDate OContact::anniversary() const 1189QDate OContact::anniversary() const
1148{ 1190{
1149 QDate empty; 1191 QDate empty;
1150 QString str = find( Qtopia::Anniversary ); 1192 QString str = find( Qtopia::Anniversary );
1151 // qWarning ("Anniversary %s", str.latin1() ); 1193 // qWarning ("Anniversary %s", str.latin1() );
1152 if ( !str.isEmpty() ) 1194 if ( !str.isEmpty() )
1153 return OConversion::dateFromString ( str ); 1195 return OConversion::dateFromString ( str );
1154 else 1196 else
1155 return empty; 1197 return empty;
1156} 1198}
1157 1199
1158 1200
1159void OContact::insertEmail( const QString &v ) 1201void OContact::insertEmail( const QString &v )
1160{ 1202{
1161 //qDebug("insertEmail %s", v.latin1()); 1203 //qDebug("insertEmail %s", v.latin1());
1162 QString e = v.simplifyWhiteSpace(); 1204 QString e = v.simplifyWhiteSpace();
1163 QString def = defaultEmail(); 1205 QString def = defaultEmail();
1164 1206
1165 // if no default, set it as the default email and don't insert 1207 // if no default, set it as the default email and don't insert
1166 if ( def.isEmpty() ) { 1208 if ( def.isEmpty() )
1167 setDefaultEmail( e ); // will insert into the list for us 1209 {
1168 return; 1210 setDefaultEmail( e ); // will insert into the list for us
1211 return ;
1169 } 1212 }
1170 1213
1171 // otherwise, insert assuming doesn't already exist 1214 // otherwise, insert assuming doesn't already exist
1172 QString emailsStr = find( Qtopia::Emails ); 1215 QString emailsStr = find( Qtopia::Emails );
1173 if ( emailsStr.contains( e )) 1216 if ( emailsStr.contains( e ) )
1174 return; 1217 return ;
1175 if ( !emailsStr.isEmpty() ) 1218 if ( !emailsStr.isEmpty() )
1176 emailsStr += emailSeparator(); 1219 emailsStr += emailSeparator();
1177 emailsStr += e; 1220 emailsStr += e;
1178 replace( Qtopia::Emails, emailsStr ); 1221 replace( Qtopia::Emails, emailsStr );
1179} 1222}
1180 1223
1181void OContact::removeEmail( const QString &v ) 1224
1225 void OContact::removeEmail( const QString &v )
1182{ 1226{
1183 QString e = v.simplifyWhiteSpace(); 1227 QString e = v.simplifyWhiteSpace();
1184 QString def = defaultEmail(); 1228 QString def = defaultEmail();
1185 QString emailsStr = find( Qtopia::Emails ); 1229 QString emailsStr = find( Qtopia::Emails );
1186 QStringList emails = emailList(); 1230 QStringList emails = emailList();
1187 1231
1188 // otherwise, must first contain it 1232 // otherwise, must first contain it
1189 if ( !emailsStr.contains( e ) ) 1233 if ( !emailsStr.contains( e ) )
1190 return; 1234 return ;
1191 1235
1192 // remove it 1236 // remove it
1193 //qDebug(" removing email from list %s", e.latin1()); 1237 //qDebug(" removing email from list %s", e.latin1());
1194 emails.remove( e ); 1238 emails.remove( e );
1195 // reset the string 1239 // reset the string
1196 emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator 1240 emailsStr = emails.join( emailSeparator() ); // Sharp's brain dead separator
1197 replace( Qtopia::Emails, emailsStr ); 1241 replace( Qtopia::Emails, emailsStr );
1198 1242
1199 // if default, then replace the default email with the first one 1243 // if default, then replace the default email with the first one
1200 if ( def == e ) { 1244 if ( def == e )
1201 //qDebug("removeEmail is default; setting new default"); 1245 {
1202 if ( !emails.count() ) 1246 //qDebug("removeEmail is default; setting new default");
1203 clearEmails(); 1247 if ( !emails.count() )
1204 else // setDefaultEmail will remove e from the list 1248 clearEmails();
1205 setDefaultEmail( emails.first() ); 1249 else // setDefaultEmail will remove e from the list
1250 setDefaultEmail( emails.first() );
1206 } 1251 }
1207} 1252}
1253
1254
1208void OContact::clearEmails() 1255void OContact::clearEmails()
1209{ 1256{
1210 mMap.remove( Qtopia::DefaultEmail ); 1257 mMap.remove( Qtopia::DefaultEmail );
1211 mMap.remove( Qtopia::Emails ); 1258 mMap.remove( Qtopia::Emails );
1212} 1259}
1260
1261
1213void OContact::setDefaultEmail( const QString &v ) 1262void OContact::setDefaultEmail( const QString &v )
1214{ 1263{
1215 QString e = v.simplifyWhiteSpace(); 1264 QString e = v.simplifyWhiteSpace();
1216 1265
1217 //qDebug("OContact::setDefaultEmail %s", e.latin1()); 1266 //qDebug("OContact::setDefaultEmail %s", e.latin1());
1218 replace( Qtopia::DefaultEmail, e ); 1267 replace( Qtopia::DefaultEmail, e );
1219 1268
1220 if ( !e.isEmpty() ) 1269 if ( !e.isEmpty() )
1221 insertEmail( e ); 1270 insertEmail( e );
1222 1271
1223} 1272}
1224 1273
1274
1225void OContact::insertEmails( const QStringList &v ) 1275void OContact::insertEmails( const QStringList &v )
1226{ 1276{
1227 for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) 1277 for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it )
1228 insertEmail( *it ); 1278 insertEmail( *it );
1229} 1279}
1230int OContact::rtti() { 1280
1281
1282int OContact::rtti()
1283{
1231 return OPimResolver::AddressBook; 1284 return OPimResolver::AddressBook;
1232} 1285}
1286
1287
1233void OContact::setUid( int i ) 1288void OContact::setUid( int i )
1234{ 1289{
1235 OPimRecord::setUid(i); 1290 OPimRecord::setUid( i );
1236 replace( Qtopia::AddressUid , QString::number(i)); 1291 replace( Qtopia::AddressUid , QString::number( i ) );
1237} 1292}
1238} 1293}