summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp61
-rw-r--r--core/pim/addressbook/contacteditor.h4
-rw-r--r--core/pim/addressbook/ocontactfields.cpp4
3 files changed, 44 insertions, 25 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 5a7bf1a..7338eeb 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -11,98 +11,98 @@
11 * 11 *
12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 * 14 *
15 * 15 *
16 * This is a rewrite of the abeditor.h file, modified to provide a more 16 * This is a rewrite of the abeditor.h file, modified to provide a more
17 * intuitive interface to TrollTech's original Address Book editor. This 17 * intuitive interface to TrollTech's original Address Book editor. This
18 * is made to operate exactly in interface with the exception of name. 18 * is made to operate exactly in interface with the exception of name.
19 * 19 *
20 */ 20 */
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23#include "addresspicker.h" 23#include "addresspicker.h"
24#include "ocontactfields.h" 24#include "ocontactfields.h"
25 25
26#include <qpe/categoryselect.h> 26#include <qpe/categoryselect.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/qpedialog.h> 28#include <qpe/qpedialog.h>
29#include <qpe/timeconversion.h> 29#include <qpe/timeconversion.h>
30#include <opie/ocontact.h> 30#include <opie/ocontact.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32 32
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qtabwidget.h> 35#include <qtabwidget.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qmultilineedit.h> 38#include <qmultilineedit.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qmainwindow.h> 42#include <qmainwindow.h>
43#include <qvaluelist.h> 43#include <qvaluelist.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qlistbox.h> 45#include <qlistbox.h>
46#include <qhbox.h> 46#include <qhbox.h>
47#include <qaction.h> 47#include <qaction.h>
48#include <qiconset.h> 48#include <qiconset.h>
49 49
50static inline bool containsAlphaNum( const QString &str ); 50static inline bool containsAlphaNum( const QString &str );
51static inline bool constainsWhiteSpace( const QString &str ); 51static inline bool constainsWhiteSpace( const QString &str );
52 52
53// helper functions, convert our comma delimited list to proper 53// helper functions, convert our comma delimited list to proper
54// file format... 54// file format...
55void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 55void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
56 QString &strAll ); 56 QString &strAll );
57 57
58// helper convert from file format to comma delimited... 58// helper convert from file format to comma delimited...
59void parseEmailTo( const QString &strDefaultEmail, 59//void parseEmailTo( const QString &strDefaultEmail,
60 const QString &strOtherEmail, QString &strBack ); 60 // const QString &strOtherEmail, QString &strBack );
61 61
62 ContactEditor::ContactEditor(const OContact &entry, 62 ContactEditor::ContactEditor(const OContact &entry,
63 QWidget *parent, 63 QWidget *parent,
64 const char *name, 64 const char *name,
65 WFlags fl ) 65 WFlags fl )
66 : QDialog( parent, name, TRUE, fl ), 66 : QDialog( parent, name, TRUE, fl ),
67 m_personalView ( false ) 67 m_personalView ( false )
68{ 68{
69 69
70 init(); 70 init();
71 setEntry( entry ); 71 setEntry( entry );
72} 72}
73 73
74ContactEditor::~ContactEditor() { 74ContactEditor::~ContactEditor() {
75} 75}
76 76
77void ContactEditor::init() { 77void ContactEditor::init() {
78 78
79 useFullName = true; 79 useFullName = true;
80 80
81 uint i = 0; 81 uint i = 0;
82 82
83 QStringList trlChooserNames; 83 QStringList trlChooserNames;
84 84
85 for (i = 0; i <= 6; i++) { 85 for (i = 0; i <= 6; i++) {
86 slHomeAddress.append( "" ); 86 slHomeAddress.append( "" );
87 slBusinessAddress.append( "" ); 87 slBusinessAddress.append( "" );
88 } 88 }
89 89
90 trlChooserNames = OContactFields::trphonefields(); 90 trlChooserNames = OContactFields::trphonefields();
91 slChooserNames = OContactFields::untrphonefields(); 91 slChooserNames = OContactFields::untrphonefields();
92 slDynamicEntries = OContactFields::untrdetailsfields(); 92 slDynamicEntries = OContactFields::untrdetailsfields();
93 trlDynamicEntries = OContactFields::trdetailsfields(); 93 trlDynamicEntries = OContactFields::trdetailsfields();
94 for (i = 0; i < slChooserNames.count(); i++) 94 for (i = 0; i < slChooserNames.count(); i++)
95 slChooserValues.append(""); 95 slChooserValues.append("");
96 96
97 97
98 QVBoxLayout *vb = new QVBoxLayout( this ); 98 QVBoxLayout *vb = new QVBoxLayout( this );
99 99
100 tabMain = new QTabWidget( this ); 100 tabMain = new QTabWidget( this );
101 vb->addWidget( tabMain ); 101 vb->addWidget( tabMain );
102 102
103 QWidget *tabViewport = new QWidget ( tabMain ); 103 QWidget *tabViewport = new QWidget ( tabMain );
104 104
105 vb = new QVBoxLayout( tabViewport ); 105 vb = new QVBoxLayout( tabViewport );
106 106
107 svGeneral = new QScrollView( tabViewport ); 107 svGeneral = new QScrollView( tabViewport );
108 vb->addWidget( svGeneral, 0, 0 ); 108 vb->addWidget( svGeneral, 0, 0 );
@@ -576,126 +576,140 @@ void ContactEditor::init() {
576 cmbChooserField4->insertStringList( trlChooserNames ); 576 cmbChooserField4->insertStringList( trlChooserNames );
577 577
578 cmbChooserField1->setCurrentItem( 0 ); 578 cmbChooserField1->setCurrentItem( 0 );
579 cmbChooserField2->setCurrentItem( 1 ); 579 cmbChooserField2->setCurrentItem( 1 );
580 cmbChooserField3->setCurrentItem( 2 ); 580 cmbChooserField3->setCurrentItem( 2 );
581 581
582 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 582 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
583 583
584 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 584 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
585 585
586 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 586 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
587 this, SLOT(slotChooser1Change(const QString &)) ); 587 this, SLOT(slotChooser1Change(const QString &)) );
588 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 588 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
589 this, SLOT(slotChooser2Change(const QString &)) ); 589 this, SLOT(slotChooser2Change(const QString &)) );
590 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 590 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
591 this, SLOT(slotChooser3Change(const QString &)) ); 591 this, SLOT(slotChooser3Change(const QString &)) );
592 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 592 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
593 this, SLOT(slotChooser4Change(const QString &)) ); 593 this, SLOT(slotChooser4Change(const QString &)) );
594 connect( txtAddress, SIGNAL(textChanged(const QString &)), 594 connect( txtAddress, SIGNAL(textChanged(const QString &)),
595 this, SLOT(slotAddressChange(const QString &)) ); 595 this, SLOT(slotAddressChange(const QString &)) );
596 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 596 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
597 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 597 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
598 connect( txtCity, SIGNAL(textChanged(const QString &)), 598 connect( txtCity, SIGNAL(textChanged(const QString &)),
599 this, SLOT(slotCityChange(const QString &)) ); 599 this, SLOT(slotCityChange(const QString &)) );
600 connect( txtState, SIGNAL(textChanged(const QString &)), 600 connect( txtState, SIGNAL(textChanged(const QString &)),
601 this, SLOT(slotStateChange(const QString &)) ); 601 this, SLOT(slotStateChange(const QString &)) );
602 connect( txtZip, SIGNAL(textChanged(const QString &)), 602 connect( txtZip, SIGNAL(textChanged(const QString &)),
603 this, SLOT(slotZipChange(const QString &)) ); 603 this, SLOT(slotZipChange(const QString &)) );
604 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 604 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
605 this, SLOT(slotCountryChange(const QString &)) ); 605 this, SLOT(slotCountryChange(const QString &)) );
606 connect( cmbCountry, SIGNAL(activated(const QString &)), 606 connect( cmbCountry, SIGNAL(activated(const QString &)),
607 this, SLOT(slotCountryChange(const QString &)) ); 607 this, SLOT(slotCountryChange(const QString &)) );
608 connect( cmbChooserField1, SIGNAL(activated(int)), 608 connect( cmbChooserField1, SIGNAL(activated(int)),
609 this, SLOT(slotCmbChooser1Change(int)) ); 609 this, SLOT(slotCmbChooser1Change(int)) );
610 connect( cmbChooserField2, SIGNAL(activated(int)), 610 connect( cmbChooserField2, SIGNAL(activated(int)),
611 this, SLOT(slotCmbChooser2Change(int)) ); 611 this, SLOT(slotCmbChooser2Change(int)) );
612 connect( cmbChooserField3, SIGNAL(activated(int)), 612 connect( cmbChooserField3, SIGNAL(activated(int)),
613 this, SLOT(slotCmbChooser3Change(int)) ); 613 this, SLOT(slotCmbChooser3Change(int)) );
614 connect( cmbChooserField4, SIGNAL(activated(int)), 614 connect( cmbChooserField4, SIGNAL(activated(int)),
615 this, SLOT(slotCmbChooser4Change(int)) ); 615 this, SLOT(slotCmbChooser4Change(int)) );
616 connect( cmbAddress, SIGNAL(activated(int)), 616 connect( cmbAddress, SIGNAL(activated(int)),
617 this, SLOT(slotAddressTypeChange(int)) ); 617 this, SLOT(slotAddressTypeChange(int)) );
618 618
619 new QPEDialogListener(this); 619 new QPEDialogListener(this);
620 620
621 setPersonalView ( m_personalView ); 621 setPersonalView ( m_personalView );
622} 622}
623 623
624void ContactEditor::slotChooser1Change( const QString &textChanged ) { 624void ContactEditor::defaultEmailChanged(int i){
625 625 qDebug("defaultEmailChanged");
626 int index = cmbChooserField1->currentItem(); 626 int index = cmbChooserField1->currentItem();
627 627 slChooserValues[index] = cmbDefaultEmail->text(i);
628 slChooserValues[index] = textChanged;
629 628
630} 629}
631 630
632void ContactEditor::slotChooser2Change( const QString &textChanged ) { 631void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) {
632
633 if (slChooserNames[index] == "Default Email"){
634 delete cmbDefaultEmail;
635 cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
636 cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
637 cmbDefaultEmail->insertStringList(ent.emailList());
638 connect(cmbDefaultEmail,SIGNAL(activated(int)),
639 SLOT(defaultEmailChanged(int)));
640 QString demail = ent.defaultEmail();
641 for ( int i = 0; i < cmbDefaultEmail->count(); i++)
642 if ( cmbDefaultEmail->text( i ) == demail )
643 cmbDefaultEmail->setCurrentItem( i );
644
645 cmbDefaultEmail->show();
646 }
633 647
634 int index = cmbChooserField2->currentItem();
635 648
636 slChooserValues[index] = textChanged; 649 slChooserValues[index] = textChanged;
637 650
638} 651}
639 652
640void ContactEditor::slotChooser3Change( const QString &textChanged ) { 653void ContactEditor::slotChooser1Change( const QString &textChanged ) {
654 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1);
655}
641 656
642 int index = cmbChooserField3->currentItem(); 657void ContactEditor::slotChooser2Change( const QString &textChanged ) {
658 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2);
643 659
644 slChooserValues[index] = textChanged; 660}
645 661
662void ContactEditor::slotChooser3Change( const QString &textChanged ) {
663 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3);
646} 664}
647 665
648void ContactEditor::slotChooser4Change( const QString &textChanged ) { 666void ContactEditor::slotChooser4Change( const QString &textChanged ) {
649 667 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4);
650 int index = cmbChooserField4->currentItem();
651
652 slChooserValues[index] = textChanged;
653
654} 668}
655 669
656void ContactEditor::slotAddressChange( const QString &textChanged ) { 670void ContactEditor::slotAddressChange( const QString &textChanged ) {
657 671
658 if ( cmbAddress->currentItem() == 0 ) { 672 if ( cmbAddress->currentItem() == 0 ) {
659 slBusinessAddress[0] = textChanged; 673 slBusinessAddress[0] = textChanged;
660 } else { 674 } else {
661 slHomeAddress[0] = textChanged; 675 slHomeAddress[0] = textChanged;
662 } 676 }
663} 677}
664 678
665void ContactEditor::slotAddress2Change( const QString &textChanged ) { 679void ContactEditor::slotAddress2Change( const QString &textChanged ) {
666 680
667 if ( cmbAddress->currentItem() == 0 ) { 681 if ( cmbAddress->currentItem() == 0 ) {
668 slBusinessAddress[1] = textChanged; 682 slBusinessAddress[1] = textChanged;
669 } else { 683 } else {
670 slHomeAddress[1] = textChanged; 684 slHomeAddress[1] = textChanged;
671 } 685 }
672} 686}
673 687
674void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 688void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
675 689
676 if ( cmbAddress->currentItem() == 0 ) { 690 if ( cmbAddress->currentItem() == 0 ) {
677 slBusinessAddress[2] = textChanged; 691 slBusinessAddress[2] = textChanged;
678 } else { 692 } else {
679 slHomeAddress[2] = textChanged; 693 slHomeAddress[2] = textChanged;
680 } 694 }
681} 695}
682 696
683void ContactEditor::slotCityChange( const QString &textChanged ) { 697void ContactEditor::slotCityChange( const QString &textChanged ) {
684 698
685 if ( cmbAddress->currentItem() == 0 ) { 699 if ( cmbAddress->currentItem() == 0 ) {
686 slBusinessAddress[3] = textChanged; 700 slBusinessAddress[3] = textChanged;
687 } else { 701 } else {
688 slHomeAddress[3] = textChanged; 702 slHomeAddress[3] = textChanged;
689 } 703 }
690} 704}
691 705
692void ContactEditor::slotStateChange( const QString &textChanged ) { 706void ContactEditor::slotStateChange( const QString &textChanged ) {
693 707
694 708
695 if ( cmbAddress->currentItem() == 0 ) { 709 if ( cmbAddress->currentItem() == 0 ) {
696 slBusinessAddress[4] = textChanged; 710 slBusinessAddress[4] = textChanged;
697 } else { 711 } else {
698 slHomeAddress[4] = textChanged; 712 slHomeAddress[4] = textChanged;
699 } 713 }
700} 714}
701 715
@@ -1326,104 +1340,107 @@ void ContactEditor::saveEntry() {
1326 1340
1327 QStringList::ConstIterator it; 1341 QStringList::ConstIterator it;
1328 QListIterator<QLineEdit> itLE( listValue ); 1342 QListIterator<QLineEdit> itLE( listValue );
1329 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { 1343 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) {
1330 1344
1331 if ( *it == "Department" ) 1345 if ( *it == "Department" )
1332 ent.setDepartment( (*itLE)->text() ); 1346 ent.setDepartment( (*itLE)->text() );
1333 1347
1334 if ( *it == "Company" ) 1348 if ( *it == "Company" )
1335 ent.setCompany( (*itLE)->text() ); 1349 ent.setCompany( (*itLE)->text() );
1336 1350
1337 if ( *it == "Office" ) 1351 if ( *it == "Office" )
1338 ent.setOffice( (*itLE)->text() ); 1352 ent.setOffice( (*itLE)->text() );
1339 1353
1340 if ( *it == "Profession" ) 1354 if ( *it == "Profession" )
1341 ent.setProfession( (*itLE)->text() ); 1355 ent.setProfession( (*itLE)->text() );
1342 1356
1343 if ( *it == "Assistant" ) 1357 if ( *it == "Assistant" )
1344 ent.setAssistant( (*itLE)->text() ); 1358 ent.setAssistant( (*itLE)->text() );
1345 1359
1346 if ( *it == "Manager" ) 1360 if ( *it == "Manager" )
1347 ent.setManager( (*itLE)->text() ); 1361 ent.setManager( (*itLE)->text() );
1348 1362
1349 if ( *it == "Spouse" ) 1363 if ( *it == "Spouse" )
1350 ent.setSpouse( (*itLE)->text() ); 1364 ent.setSpouse( (*itLE)->text() );
1351 1365
1352 if ( *it == "Nickname" ) 1366 if ( *it == "Nickname" )
1353 ent.setNickname( (*itLE)->text() ); 1367 ent.setNickname( (*itLE)->text() );
1354 1368
1355 if ( *it == "Children" ) 1369 if ( *it == "Children" )
1356 ent.setChildren( (*itLE)->text() ); 1370 ent.setChildren( (*itLE)->text() );
1357 1371
1358 } 1372 }
1359 1373
1360 1374
1361 QStringList::ConstIterator itV; 1375 QStringList::ConstIterator itV;
1362 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1376 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1363 1377
1364 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) 1378 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1365 ent.setBusinessPhone( *itV ); 1379 ent.setBusinessPhone( *itV );
1366 1380
1367 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) 1381 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1368 ent.setBusinessFax( *itV ); 1382 ent.setBusinessFax( *itV );
1369 1383
1370 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) 1384 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1371 ent.setBusinessMobile( *itV ); 1385 ent.setBusinessMobile( *itV );
1372 1386
1373 if ( *it == "Emails" ){ 1387 if ( *it == "Emails" ){
1374 QString allemail; 1388 QString allemail;
1375 QString defaultmail; 1389 QString defaultmail;
1376 parseEmailFrom( *itV, defaultmail, allemail ); 1390 parseEmailFrom( *itV, defaultmail, allemail );
1377 // ent.clearEmails(); 1391 // ent.clearEmails();
1378 ent.setDefaultEmail( defaultmail ); 1392 // ent.setDefaultEmail( defaultmail );
1379 ent.setEmails( allemail ); 1393 ent.setEmails( allemail );
1380 } 1394 }
1381 1395
1396 if ( *it == "Default Email")
1397 ent.setDefaultEmail( *itV );
1398
1382 if ( *it == "Home Phone" ) 1399 if ( *it == "Home Phone" )
1383 ent.setHomePhone( *itV ); 1400 ent.setHomePhone( *itV );
1384 1401
1385 if ( *it == "Home Fax" ) 1402 if ( *it == "Home Fax" )
1386 ent.setHomeFax( *itV ); 1403 ent.setHomeFax( *itV );
1387 1404
1388 if ( *it == "Home Mobile" ) 1405 if ( *it == "Home Mobile" )
1389 ent.setHomeMobile( *itV ); 1406 ent.setHomeMobile( *itV );
1390 1407
1391 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1408 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1392 ent.setBusinessPager( *itV ); 1409 ent.setBusinessPager( *itV );
1393 1410
1394 if ( *it == "Home Web Page" ) 1411 if ( *it == "Home Web Page" )
1395 ent.setHomeWebpage( *itV ); 1412 ent.setHomeWebpage( *itV );
1396 1413
1397 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1414 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1398 ent.setBusinessWebpage( *itV ); 1415 ent.setBusinessWebpage( *itV );
1399 1416
1400 1417
1401 } 1418 }
1402 1419
1403 int gender = cmbGender->currentItem(); 1420 int gender = cmbGender->currentItem();
1404 ent.setGender( QString::number( gender ) ); 1421 ent.setGender( QString::number( gender ) );
1405 1422
1406 QString str = txtNote->text(); 1423 QString str = txtNote->text();
1407 if ( !str.isNull() ) 1424 if ( !str.isNull() )
1408 ent.setNotes( str ); 1425 ent.setNotes( str );
1409 1426
1410} 1427}
1411 1428
1412void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1429void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1413 QString &strAll ) 1430 QString &strAll )
1414{ 1431{
1415 int where, 1432 int where,
1416 start; 1433 start;
1417 if ( txt.isEmpty() ) 1434 if ( txt.isEmpty() )
1418 return; 1435 return;
1419 // find the first 1436 // find the first
1420 where = txt.find( ',' ); 1437 where = txt.find( ',' );
1421 if ( where < 0 ) { 1438 if ( where < 0 ) {
1422 strDefaultEmail = txt; 1439 strDefaultEmail = txt;
1423 strAll = txt; 1440 strAll = txt;
1424 } else { 1441 } else {
1425 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1442 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1426 strAll = strDefaultEmail; 1443 strAll = strDefaultEmail;
1427 while ( where > -1 ) { 1444 while ( where > -1 ) {
1428 strAll.append(" "); 1445 strAll.append(" ");
1429 start = where; 1446 start = where;
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index 250b831..d4b7f27 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -55,118 +55,120 @@ class ContactEditor : public QDialog {
55 55
56 public: 56 public:
57 ContactEditor(const OContact &entry, 57 ContactEditor(const OContact &entry,
58 QWidget *parent = 0, 58 QWidget *parent = 0,
59 const char *name = 0, 59 const char *name = 0,
60 WFlags fl = 0 ); 60 WFlags fl = 0 );
61 ~ContactEditor(); 61 ~ContactEditor();
62 void setNameFocus(); 62 void setNameFocus();
63 void setPersonalView( bool personal = true ); 63 void setPersonalView( bool personal = true );
64 OContact entry() const { return ent; } 64 OContact entry() const { return ent; }
65 65
66 public slots: 66 public slots:
67 void slotNote(); 67 void slotNote();
68 void slotName(); 68 void slotName();
69 void setEntry(const OContact &entry); 69 void setEntry(const OContact &entry);
70 70
71 protected slots: 71 protected slots:
72 void accept(); 72 void accept();
73 73
74 private: 74 private:
75 void init(); 75 void init();
76 void saveEntry(); 76 void saveEntry();
77 bool isEmpty(); 77 bool isEmpty();
78 void cleanupFields(); 78 void cleanupFields();
79 void updateDatePicker(); 79 void updateDatePicker();
80 QString parseName( QString fullName, int type ); 80 QString parseName( QString fullName, int type );
81 private slots: 81 private slots:
82 void slotChooser1Change( const QString &textChanged ); 82 void slotChooser1Change( const QString &textChanged );
83 void slotChooser2Change( const QString &textChanged ); 83 void slotChooser2Change( const QString &textChanged );
84 void slotChooser3Change( const QString &textChanged ); 84 void slotChooser3Change( const QString &textChanged );
85 void slotChooser4Change( const QString &textChanged ); 85 void slotChooser4Change( const QString &textChanged );
86 void slotCmbChooser1Change( int index ); 86 void slotCmbChooser1Change( int index );
87 void slotCmbChooser2Change( int index ); 87 void slotCmbChooser2Change( int index );
88 void slotCmbChooser3Change( int index ); 88 void slotCmbChooser3Change( int index );
89 void slotCmbChooser4Change( int index ); 89 void slotCmbChooser4Change( int index );
90 void slotAddressTypeChange( int index ); 90 void slotAddressTypeChange( int index );
91 void slotAddressChange( const QString &textChanged ); 91 void slotAddressChange( const QString &textChanged );
92 void slotAddress2Change( const QString &textChanged ); 92 void slotAddress2Change( const QString &textChanged );
93 void slotPOBoxChange( const QString &textChanged ); 93 void slotPOBoxChange( const QString &textChanged );
94 void slotCityChange( const QString &textChanged ); 94 void slotCityChange( const QString &textChanged );
95 void slotStateChange( const QString &textChanged ); 95 void slotStateChange( const QString &textChanged );
96 void slotZipChange( const QString &textChanged ); 96 void slotZipChange( const QString &textChanged );
97 void slotCountryChange( const QString &textChanged ); 97 void slotCountryChange( const QString &textChanged );
98 void slotFullNameChange( const QString &textChanged ); 98 void slotFullNameChange( const QString &textChanged );
99 void slotAnniversaryDateChanged( int year, int month, int day); 99 void slotAnniversaryDateChanged( int year, int month, int day);
100 void slotBirthdayDateChanged( int year, int month, int day); 100 void slotBirthdayDateChanged( int year, int month, int day);
101 void slotRemoveBirthday(); 101 void slotRemoveBirthday();
102 void slotRemoveAnniversary(); 102 void slotRemoveAnniversary();
103 void defaultEmailChanged(int);
103 104
104 private: 105 private:
106 void chooserChange( const QString&, int , QLineEdit* );
105 bool useFullName; 107 bool useFullName;
106 // bool hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry;
107 108
108 OContact ent; 109 OContact ent;
109 110
110 QDialog *dlgNote; 111 QDialog *dlgNote;
111 QDialog *dlgName; 112 QDialog *dlgName;
112 113
113 QList<QLineEdit> listValue; 114 QList<QLineEdit> listValue;
114 QList<QLabel> listName; 115 QList<QLabel> listName;
115 116
116 QStringList slDynamicEntries; 117 QStringList slDynamicEntries;
117 QStringList trlDynamicEntries; 118 QStringList trlDynamicEntries;
118 119
119 bool m_personalView; 120 bool m_personalView;
120 121
121 QStringList slHomeAddress; 122 QStringList slHomeAddress;
122 QStringList slBusinessAddress; 123 QStringList slBusinessAddress;
123 QStringList slChooserNames; 124 QStringList slChooserNames;
124 QStringList slChooserValues; 125 QStringList slChooserValues;
125 126
126 QMultiLineEdit *txtNote; 127 QMultiLineEdit *txtNote;
127 QLabel *lblNote; 128 QLabel *lblNote;
128 129
129 //QLineEdit *txtTitle; 130 //QLineEdit *txtTitle;
130 QLineEdit *txtFirstName; 131 QLineEdit *txtFirstName;
131 QLineEdit *txtMiddleName; 132 QLineEdit *txtMiddleName;
132 QLineEdit *txtLastName; 133 QLineEdit *txtLastName;
133 QLineEdit *txtSuffix; 134 QLineEdit *txtSuffix;
134 135
135 QTabWidget *tabMain; 136 QTabWidget *tabMain;
136 QScrollView *svGeneral; 137 QScrollView *svGeneral;
137 QPushButton *btnFullName; 138 QPushButton *btnFullName;
138 QPushButton *btnNote; 139 QPushButton *btnNote;
139 QLineEdit *txtFullName; 140 QLineEdit *txtFullName;
140 QLineEdit *txtJobTitle; 141 QLineEdit *txtJobTitle;
141 QLineEdit *txtOrganization; 142 QLineEdit *txtOrganization;
142 QLineEdit *txtChooserField1; 143 QLineEdit *txtChooserField1;
143 QLineEdit *txtChooserField2; 144 QLineEdit *txtChooserField2;
144 QLineEdit *txtChooserField3; 145 QLineEdit *txtChooserField3;
145 QLineEdit *txtChooserField4; 146 QLineEdit *txtChooserField4;
146 QComboBox *cmbChooserField1; 147 QComboBox *cmbChooserField1;
147 QComboBox *cmbChooserField2; 148 QComboBox *cmbChooserField2;
148 QComboBox *cmbChooserField3; 149 QComboBox *cmbChooserField3;
149 QComboBox *cmbChooserField4; 150 QComboBox *cmbChooserField4;
151 QComboBox *cmbDefaultEmail;
150 QComboBox *cmbFileAs; 152 QComboBox *cmbFileAs;
151 CategorySelect *cmbCat; 153 CategorySelect *cmbCat;
152 QLabel *labCat; 154 QLabel *labCat;
153 155
154 QScrollView *svAddress; 156 QScrollView *svAddress;
155 QLineEdit *txtAddress; 157 QLineEdit *txtAddress;
156 //QLineEdit *txtAddress2; 158 //QLineEdit *txtAddress2;
157 //QLineEdit *txtPOBox; 159 //QLineEdit *txtPOBox;
158 QLineEdit *txtCity; 160 QLineEdit *txtCity;
159 QLineEdit *txtState; 161 QLineEdit *txtState;
160 QLineEdit *txtZip; 162 QLineEdit *txtZip;
161 QComboBox *cmbAddress; 163 QComboBox *cmbAddress;
162 QComboBox *cmbCountry; 164 QComboBox *cmbCountry;
163 165
164 QScrollView *svDetails; 166 QScrollView *svDetails;
165 QComboBox *cmbGender; 167 QComboBox *cmbGender;
166 DateBookMonth* birthdayPicker; 168 DateBookMonth* birthdayPicker;
167 QToolButton* birthdayButton; 169 QToolButton* birthdayButton;
168 DateBookMonth* anniversaryPicker; 170 DateBookMonth* anniversaryPicker;
169 QToolButton* anniversaryButton; 171 QToolButton* anniversaryButton;
170 }; 172 };
171 173
172#endif 174#endif
diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp
index df57efa..7823a9c 100644
--- a/core/pim/addressbook/ocontactfields.cpp
+++ b/core/pim/addressbook/ocontactfields.cpp
@@ -1,189 +1,189 @@
1 1
2#include "ocontactfields.h" 2#include "ocontactfields.h"
3 3
4#include <qstringlist.h> 4#include <qstringlist.h>
5#include <qobject.h> 5#include <qobject.h>
6 6
7// We should use our own enum in the future .. 7// We should use our own enum in the future ..
8#include <qpe/recordfields.h> 8#include <qpe/recordfields.h>
9 9
10/*! 10/*!
11 \internal 11 \internal
12 Returns a list of details field names for a contact. 12 Returns a list of details field names for a contact.
13*/ 13*/
14QStringList OContactFields::untrdetailsfields( bool sorted ) 14QStringList OContactFields::untrdetailsfields( bool sorted )
15{ 15{
16 QStringList list; 16 QStringList list;
17 17
18 list.append( "Office" ); 18 list.append( "Office" );
19 list.append( "Profession" ); 19 list.append( "Profession" );
20 list.append( "Assistant" ); 20 list.append( "Assistant" );
21 list.append( "Manager" ); 21 list.append( "Manager" );
22 list.append( "Spouse" ); 22 list.append( "Spouse" );
23 list.append( "Gender" ); 23 list.append( "Gender" );
24 list.append( "Birthday" ); 24 list.append( "Birthday" );
25 list.append( "Anniversary" ); 25 list.append( "Anniversary" );
26 list.append( "Nickname" ); 26 list.append( "Nickname" );
27 list.append( "Children" ); 27 list.append( "Children" );
28 28
29 if (sorted) list.sort(); 29 if (sorted) list.sort();
30 30
31 return list; 31 return list;
32} 32}
33 33
34/*! 34/*!
35 \internal 35 \internal
36 Returns a translated list of phone field names for a contact. 36 Returns a translated list of phone field names for a contact.
37*/ 37*/
38QStringList OContactFields::trphonefields( bool sorted ) 38QStringList OContactFields::trphonefields( bool sorted )
39{ 39{
40 QStringList list; 40 QStringList list;
41 list.append( QObject::tr( "Business Phone" ) ); 41 list.append( QObject::tr( "Business Phone" ) );
42 list.append( QObject::tr( "Business Fax" ) ); 42 list.append( QObject::tr( "Business Fax" ) );
43 list.append( QObject::tr( "Business Mobile" ) ); 43 list.append( QObject::tr( "Business Mobile" ) );
44 44
45 // list.append( QObject::tr( "Default Email" ) ); 45 list.append( QObject::tr( "Default Email" ) );
46 list.append( QObject::tr( "Emails" ) ); 46 list.append( QObject::tr( "Emails" ) );
47 47
48 list.append( QObject::tr( "Home Phone" ) ); 48 list.append( QObject::tr( "Home Phone" ) );
49 list.append( QObject::tr( "Home Fax" ) ); 49 list.append( QObject::tr( "Home Fax" ) );
50 list.append( QObject::tr( "Home Mobile" ) ); 50 list.append( QObject::tr( "Home Mobile" ) );
51 51
52 if (sorted) list.sort(); 52 if (sorted) list.sort();
53 53
54 return list; 54 return list;
55} 55}
56 56
57 57
58/*! 58/*!
59 \internal 59 \internal
60 Returns a translated list of details field names for a contact. 60 Returns a translated list of details field names for a contact.
61*/ 61*/
62QStringList OContactFields::trdetailsfields( bool sorted ) 62QStringList OContactFields::trdetailsfields( bool sorted )
63{ 63{
64 QStringList list; 64 QStringList list;
65 65
66 list.append( QObject::tr( "Office" ) ); 66 list.append( QObject::tr( "Office" ) );
67 list.append( QObject::tr( "Profession" ) ); 67 list.append( QObject::tr( "Profession" ) );
68 list.append( QObject::tr( "Assistant" ) ); 68 list.append( QObject::tr( "Assistant" ) );
69 list.append( QObject::tr( "Manager" ) ); 69 list.append( QObject::tr( "Manager" ) );
70 70
71 list.append( QObject::tr( "Spouse" ) ); 71 list.append( QObject::tr( "Spouse" ) );
72 list.append( QObject::tr( "Gender" ) ); 72 list.append( QObject::tr( "Gender" ) );
73 list.append( QObject::tr( "Birthday" ) ); 73 list.append( QObject::tr( "Birthday" ) );
74 list.append( QObject::tr( "Anniversary" ) ); 74 list.append( QObject::tr( "Anniversary" ) );
75 list.append( QObject::tr( "Nickname" ) ); 75 list.append( QObject::tr( "Nickname" ) );
76 list.append( QObject::tr( "Children" ) ); 76 list.append( QObject::tr( "Children" ) );
77 77
78 if (sorted) list.sort(); 78 if (sorted) list.sort();
79 return list; 79 return list;
80} 80}
81 81
82 82
83/*! 83/*!
84 \internal 84 \internal
85 Returns a translated list of field names for a contact. 85 Returns a translated list of field names for a contact.
86*/ 86*/
87QStringList OContactFields::trfields( bool sorted ) 87QStringList OContactFields::trfields( bool sorted )
88{ 88{
89 QStringList list; 89 QStringList list;
90 90
91 list.append( QObject::tr( "Name Title") ); 91 list.append( QObject::tr( "Name Title") );
92 list.append( QObject::tr( "First Name" ) ); 92 list.append( QObject::tr( "First Name" ) );
93 list.append( QObject::tr( "Middle Name" ) ); 93 list.append( QObject::tr( "Middle Name" ) );
94 list.append( QObject::tr( "Last Name" ) ); 94 list.append( QObject::tr( "Last Name" ) );
95 list.append( QObject::tr( "Suffix" ) ); 95 list.append( QObject::tr( "Suffix" ) );
96 list.append( QObject::tr( "File As" ) ); 96 list.append( QObject::tr( "File As" ) );
97 97
98 list.append( QObject::tr( "Job Title" ) ); 98 list.append( QObject::tr( "Job Title" ) );
99 list.append( QObject::tr( "Department" ) ); 99 list.append( QObject::tr( "Department" ) );
100 list.append( QObject::tr( "Company" ) ); 100 list.append( QObject::tr( "Company" ) );
101 101
102 list += trphonefields( sorted ); 102 list += trphonefields( sorted );
103 103
104 list.append( QObject::tr( "Business Street" ) ); 104 list.append( QObject::tr( "Business Street" ) );
105 list.append( QObject::tr( "Business City" ) ); 105 list.append( QObject::tr( "Business City" ) );
106 list.append( QObject::tr( "Business State" ) ); 106 list.append( QObject::tr( "Business State" ) );
107 list.append( QObject::tr( "Business Zip" ) ); 107 list.append( QObject::tr( "Business Zip" ) );
108 list.append( QObject::tr( "Business Country" ) ); 108 list.append( QObject::tr( "Business Country" ) );
109 list.append( QObject::tr( "Business Pager" ) ); 109 list.append( QObject::tr( "Business Pager" ) );
110 list.append( QObject::tr( "Business WebPage" ) ); 110 list.append( QObject::tr( "Business WebPage" ) );
111 111
112 list.append( QObject::tr( "Home Street" ) ); 112 list.append( QObject::tr( "Home Street" ) );
113 list.append( QObject::tr( "Home City" ) ); 113 list.append( QObject::tr( "Home City" ) );
114 list.append( QObject::tr( "Home State" ) ); 114 list.append( QObject::tr( "Home State" ) );
115 list.append( QObject::tr( "Home Zip" ) ); 115 list.append( QObject::tr( "Home Zip" ) );
116 list.append( QObject::tr( "Home Country" ) ); 116 list.append( QObject::tr( "Home Country" ) );
117 list.append( QObject::tr( "Home Web Page" ) ); 117 list.append( QObject::tr( "Home Web Page" ) );
118 118
119 list += trdetailsfields( sorted ); 119 list += trdetailsfields( sorted );
120 120
121 list.append( QObject::tr( "Notes" ) ); 121 list.append( QObject::tr( "Notes" ) );
122 list.append( QObject::tr( "Groups" ) ); 122 list.append( QObject::tr( "Groups" ) );
123 123
124 if (sorted) list.sort(); 124 if (sorted) list.sort();
125 125
126 return list; 126 return list;
127} 127}
128 128
129/*! 129/*!
130 \internal 130 \internal
131 Returns a list of phone field names for a contact. 131 Returns a list of phone field names for a contact.
132*/ 132*/
133QStringList OContactFields::untrphonefields( bool sorted ) 133QStringList OContactFields::untrphonefields( bool sorted )
134{ 134{
135 QStringList list; 135 QStringList list;
136 136
137 list.append( "Business Phone" ); 137 list.append( "Business Phone" );
138 list.append( "Business Fax" ); 138 list.append( "Business Fax" );
139 list.append( "Business Mobile" ); 139 list.append( "Business Mobile" );
140 140
141 // list.append( "Default Email" ); 141 list.append( "Default Email" );
142 list.append( "Emails" ); 142 list.append( "Emails" );
143 143
144 list.append( "Home Phone" ); 144 list.append( "Home Phone" );
145 list.append( "Home Fax" ); 145 list.append( "Home Fax" );
146 list.append( "Home Mobile" ); 146 list.append( "Home Mobile" );
147 147
148 if (sorted) list.sort(); 148 if (sorted) list.sort();
149 149
150 return list; 150 return list;
151} 151}
152 152
153/*! 153/*!
154 \internal 154 \internal
155 Returns an untranslated list of field names for a contact. 155 Returns an untranslated list of field names for a contact.
156*/ 156*/
157QStringList OContactFields::untrfields( bool sorted ) 157QStringList OContactFields::untrfields( bool sorted )
158{ 158{
159 QStringList list; 159 QStringList list;
160 160
161 list.append( "Name Title" ); 161 list.append( "Name Title" );
162 list.append( "First Name" ); 162 list.append( "First Name" );
163 list.append( "Middle Name" ); 163 list.append( "Middle Name" );
164 list.append( "Last Name" ); 164 list.append( "Last Name" );
165 list.append( "Suffix" ); 165 list.append( "Suffix" );
166 list.append( "File As" ); 166 list.append( "File As" );
167 167
168 list.append( "Job Title" ); 168 list.append( "Job Title" );
169 list.append( "Department" ); 169 list.append( "Department" );
170 list.append( "Company" ); 170 list.append( "Company" );
171 171
172 list += untrphonefields( sorted ); 172 list += untrphonefields( sorted );
173 173
174 list.append( "Business Street" ); 174 list.append( "Business Street" );
175 list.append( "Business City" ); 175 list.append( "Business City" );
176 list.append( "Business State" ); 176 list.append( "Business State" );
177 list.append( "Business Zip" ); 177 list.append( "Business Zip" );
178 list.append( "Business Country" ); 178 list.append( "Business Country" );
179 list.append( "Business Pager" ); 179 list.append( "Business Pager" );
180 list.append( "Business WebPage" ); 180 list.append( "Business WebPage" );
181 181
182 list.append( "Office" ); 182 list.append( "Office" );
183 list.append( "Profession" ); 183 list.append( "Profession" );
184 list.append( "Assistant" ); 184 list.append( "Assistant" );
185 list.append( "Manager" ); 185 list.append( "Manager" );
186 186
187 list.append( "Home Street" ); 187 list.append( "Home Street" );
188 list.append( "Home City" ); 188 list.append( "Home City" );
189 list.append( "Home State" ); 189 list.append( "Home State" );