summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-06-29 16:14:46 (UTC)
committer zautrix <zautrix>2005-06-29 16:14:46 (UTC)
commit77aa480c9891a90c9b492618ebfd2b20f2d0727a (patch) (unidiff)
tree4f2c278d016fe21f280f8ee6abbca34685aada96 /kaddressbook
parente0fa858c284dddf0d47146e666c4ece7158487be (diff)
downloadkdepimpi-77aa480c9891a90c9b492618ebfd2b20f2d0727a.zip
kdepimpi-77aa480c9891a90c9b492618ebfd2b20f2d0727a.tar.gz
kdepimpi-77aa480c9891a90c9b492618ebfd2b20f2d0727a.tar.bz2
many sync fixes
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp6
-rw-r--r--kaddressbook/kabcore.cpp5
-rw-r--r--kaddressbook/kabcore.h1
3 files changed, 8 insertions, 4 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index bd32859..5334a0e 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -614,119 +614,119 @@ void AddresseeEditorWidget::setupTab2()
614 if ( QApplication::desktop()->width() == 640 ) { 614 if ( QApplication::desktop()->width() == 640 ) {
615 QHBox * nbox = new QHBox ( tab2 ); 615 QHBox * nbox = new QHBox ( tab2 );
616 label = new QLabel( i18n( "Nick name:" )+" ", nbox ); 616 label = new QLabel( i18n( "Nick name:" )+" ", nbox );
617 mNicknameEdit = new KLineEdit( nbox ); 617 mNicknameEdit = new KLineEdit( nbox );
618 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 618 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
619 SLOT( textChanged( const QString& ) ) ); 619 SLOT( textChanged( const QString& ) ) );
620 label->setBuddy( mNicknameEdit ); 620 label->setBuddy( mNicknameEdit );
621 621
622 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); 622 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox );
623 mSpouseEdit = new KLineEdit( nbox ); 623 mSpouseEdit = new KLineEdit( nbox );
624 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 624 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
625 SLOT( textChanged( const QString& ) ) ); 625 SLOT( textChanged( const QString& ) ) );
626 label->setBuddy( mSpouseEdit ); 626 label->setBuddy( mSpouseEdit );
627 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 627 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
628 ++iii; 628 ++iii;
629 629
630 } else { 630 } else {
631 label = new QLabel( i18n( "Nick name:" ), tab2 ); 631 label = new QLabel( i18n( "Nick name:" ), tab2 );
632 layout->addWidget( label, iii, 1 ); 632 layout->addWidget( label, iii, 1 );
633 mNicknameEdit = new KLineEdit( tab2 ); 633 mNicknameEdit = new KLineEdit( tab2 );
634 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 634 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
635 SLOT( textChanged( const QString& ) ) ); 635 SLOT( textChanged( const QString& ) ) );
636 label->setBuddy( mNicknameEdit ); 636 label->setBuddy( mNicknameEdit );
637 layout->addWidget( mNicknameEdit, iii, 2 ); 637 layout->addWidget( mNicknameEdit, iii, 2 );
638 ++iii; 638 ++iii;
639 639
640 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 640 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
641 layout->addWidget( label, iii, 1 ); 641 layout->addWidget( label, iii, 1 );
642 mSpouseEdit = new KLineEdit( tab2 ); 642 mSpouseEdit = new KLineEdit( tab2 );
643 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 643 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
644 SLOT( textChanged( const QString& ) ) ); 644 SLOT( textChanged( const QString& ) ) );
645 label->setBuddy( mSpouseEdit ); 645 label->setBuddy( mSpouseEdit );
646 layout->addWidget( mSpouseEdit, iii, 2 ); 646 layout->addWidget( mSpouseEdit, iii, 2 );
647 ++iii; 647 ++iii;
648 } 648 }
649 649
650 label = new QLabel( i18n( "Children's names:" ), tab2 ); 650 label = new QLabel( i18n( "Children's names:" ), tab2 );
651 layout->addWidget( label, iii, 1 ); 651 layout->addWidget( label, iii, 1 );
652 mChildEdit = new KLineEdit( tab2 ); 652 mChildEdit = new KLineEdit( tab2 );
653 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), 653 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ),
654 SLOT( textChanged( const QString& ) ) ); 654 SLOT( textChanged( const QString& ) ) );
655 label->setBuddy( mChildEdit ); 655 label->setBuddy( mChildEdit );
656 layout->addWidget( mChildEdit, iii, 2 ); 656 layout->addWidget( mChildEdit, iii, 2 );
657 ++iii; 657 ++iii;
658 if ( QApplication::desktop()->width() == 640 ) { 658 if ( QApplication::desktop()->width() == 640 ) {
659 QHBox * nbox = new QHBox ( tab2 ); 659 QHBox * nbox = new QHBox ( tab2 );
660 label = new QLabel( i18n( "Birthday:" )+" ", nbox ); 660 label = new QLabel( i18n( "Birthday:" )+" ", nbox );
661 mBirthdayPicker = new KDateEdit( nbox ); 661 mBirthdayPicker = new KDateEdit( nbox );
662 mBirthdayPicker->toggleDateFormat(); 662 //mBirthdayPicker->toggleDateFormat();
663 mBirthdayPicker->setHandleInvalid( true ); 663 mBirthdayPicker->setHandleInvalid( true );
664 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 664 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
665 SLOT( dateChanged( QDate ) ) ); 665 SLOT( dateChanged( QDate ) ) );
666 666
667 label->setBuddy( mBirthdayPicker ); 667 label->setBuddy( mBirthdayPicker );
668 668
669 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); 669 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
670 mAnniversaryPicker = new KDateEdit( nbox ); 670 mAnniversaryPicker = new KDateEdit( nbox );
671 mAnniversaryPicker->setHandleInvalid( true ); 671 mAnniversaryPicker->setHandleInvalid( true );
672 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 672 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
673 SLOT( dateChanged( QDate ) ) ); 673 SLOT( dateChanged( QDate ) ) );
674 674
675 label->setBuddy( mAnniversaryPicker ); 675 label->setBuddy( mAnniversaryPicker );
676 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); 676 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
677 ++iii; 677 ++iii;
678 678
679 } else { 679 } else {
680 680
681 label = new QLabel( i18n( "Birthday:" ), tab2 ); 681 label = new QLabel( i18n( "Birthday:" ), tab2 );
682 layout->addWidget( label, iii, 1 ); 682 layout->addWidget( label, iii, 1 );
683 mBirthdayPicker = new KDateEdit( tab2 ); 683 mBirthdayPicker = new KDateEdit( tab2 );
684 mBirthdayPicker->toggleDateFormat(); 684 //mBirthdayPicker->toggleDateFormat();
685 mBirthdayPicker->setHandleInvalid( true ); 685 mBirthdayPicker->setHandleInvalid( true );
686 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 686 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
687 SLOT( dateChanged( QDate ) ) ); 687 SLOT( dateChanged( QDate ) ) );
688 688
689 label->setBuddy( mBirthdayPicker ); 689 label->setBuddy( mBirthdayPicker );
690 layout->addWidget( mBirthdayPicker, iii, 2 ); 690 layout->addWidget( mBirthdayPicker, iii, 2 );
691 ++iii; 691 ++iii;
692 692
693 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 693 label = new QLabel( i18n( "Anniversary:" ), tab2 );
694 layout->addWidget( label, iii, 1 ); 694 layout->addWidget( label, iii, 1 );
695 mAnniversaryPicker = new KDateEdit( tab2 ); 695 mAnniversaryPicker = new KDateEdit( tab2 );
696 mAnniversaryPicker->setHandleInvalid( true ); 696 mAnniversaryPicker->setHandleInvalid( true );
697 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 697 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
698 SLOT( dateChanged( QDate ) ) ); 698 SLOT( dateChanged( QDate ) ) );
699 699
700 label->setBuddy( mAnniversaryPicker ); 700 label->setBuddy( mAnniversaryPicker );
701 layout->addWidget( mAnniversaryPicker, iii, 2 ); 701 layout->addWidget( mAnniversaryPicker, iii, 2 );
702 ++iii; 702 ++iii;
703 703
704 } 704 }
705 705
706 label = new QLabel( i18n( "Gender:" ), tab2 ); 706 label = new QLabel( i18n( "Gender:" ), tab2 );
707 layout->addWidget( label, iii, 1 ); 707 layout->addWidget( label, iii, 1 );
708 mGenderBox = new QComboBox ( tab2 ); 708 mGenderBox = new QComboBox ( tab2 );
709 mGenderBox->insertItem ( i18n( "ALIEN (gender undefined)" )); 709 mGenderBox->insertItem ( i18n( "ALIEN (gender undefined)" ));
710 mGenderBox->insertItem ( i18n( "female" )); 710 mGenderBox->insertItem ( i18n( "female" ));
711 mGenderBox->insertItem ( i18n( "male" )); 711 mGenderBox->insertItem ( i18n( "male" ));
712 connect( mGenderBox, SIGNAL( activated ( const QString & ) ), 712 connect( mGenderBox, SIGNAL( activated ( const QString & ) ),
713 SLOT( textChanged( const QString& ) ) ); 713 SLOT( textChanged( const QString& ) ) );
714 label->setBuddy( mGenderBox ); 714 label->setBuddy( mGenderBox );
715 layout->addWidget( mGenderBox, iii, 2 ); 715 layout->addWidget( mGenderBox, iii, 2 );
716 ++iii; 716 ++iii;
717 // Build the layout and add to the tab widget 717 // Build the layout and add to the tab widget
718 layout->activate(); // required 718 layout->activate(); // required
719 719
720 mTabWidget->addTab( tab2, i18n( "&Details" ) ); 720 mTabWidget->addTab( tab2, i18n( "&Details" ) );
721} 721}
722 722
723void AddresseeEditorWidget::setupTab2_1() 723void AddresseeEditorWidget::setupTab2_1()
724{ 724{
725 // This is the Details tab 725 // This is the Details tab
726 QWidget *tab2_2 = new QWidget( mTabWidget ); 726 QWidget *tab2_2 = new QWidget( mTabWidget );
727 727
728 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); 728 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
729 layout->setMargin( KDialogBase::marginHintSmall() ); 729 layout->setMargin( KDialogBase::marginHintSmall() );
730 layout->setSpacing( KDialogBase::spacingHintSmall() ); 730 layout->setSpacing( KDialogBase::spacingHintSmall() );
731 731
732 QLabel *label; 732 QLabel *label;
@@ -1034,98 +1034,96 @@ void AddresseeEditorWidget::load()
1034 1034
1035 mGeoWidget->setGeo( mAddressee.geo() ); 1035 mGeoWidget->setGeo( mAddressee.geo() );
1036 mImageWidget->setPhoto( mAddressee.photo() ); 1036 mImageWidget->setPhoto( mAddressee.photo() );
1037 mImageWidget->setLogo( mAddressee.logo() ); 1037 mImageWidget->setLogo( mAddressee.logo() );
1038 mKeyWidget->setKeys( mAddressee.keys() ); 1038 mKeyWidget->setKeys( mAddressee.keys() );
1039 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1039 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1040#ifndef KAB_EMBEDDED 1040#ifndef KAB_EMBEDDED
1041 mSoundWidget->setSound( mAddressee.sound() ); 1041 mSoundWidget->setSound( mAddressee.sound() );
1042#else //KAB_EMBEDDED 1042#else //KAB_EMBEDDED
1043//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1043//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1044#endif //KAB_EMBEDDED 1044#endif //KAB_EMBEDDED
1045 1045
1046 // Load customs 1046 // Load customs
1047 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); 1047 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
1048 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); 1048 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
1049 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); 1049 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) );
1050 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); 1050 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
1051 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); 1051 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
1052 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1052 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1053 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1053 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1054 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1054 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1055 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 1055 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
1056 if ( gen == "female" ) 1056 if ( gen == "female" )
1057 mGenderBox->setCurrentItem ( 1 ); 1057 mGenderBox->setCurrentItem ( 1 );
1058 else if ( gen == "male" ) 1058 else if ( gen == "male" )
1059 mGenderBox->setCurrentItem ( 2 ); 1059 mGenderBox->setCurrentItem ( 2 );
1060 else 1060 else
1061 mGenderBox->setCurrentItem ( 0 ); 1061 mGenderBox->setCurrentItem ( 0 );
1062 blockSignals( block ); 1062 blockSignals( block );
1063 mBlockSignals = false; 1063 mBlockSignals = false;
1064 1064
1065 mDirty = false; 1065 mDirty = false;
1066} 1066}
1067 1067
1068void AddresseeEditorWidget::save() 1068void AddresseeEditorWidget::save()
1069{ 1069{
1070 if ( !dirty() ) { 1070 if ( !dirty() ) {
1071 return; 1071 return;
1072 } 1072 }
1073 1073
1074 mAddressee.setRevision( QDateTime::currentDateTime() ); 1074 mAddressee.setRevision( QDateTime::currentDateTime() );
1075 1075
1076 mAddressee.setRole( mRoleEdit->text() ); 1076 mAddressee.setRole( mRoleEdit->text() );
1077 mAddressee.setOrganization( mOrgEdit->text() ); 1077 mAddressee.setOrganization( mOrgEdit->text() );
1078 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1078 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1079 mAddressee.setNote( mNoteEdit->text() ); 1079 mAddressee.setNote( mNoteEdit->text() );
1080 if ( mBirthdayPicker->inputIsValid() ) { 1080 if ( mBirthdayPicker->inputIsValid() ) {
1081 QDate da = mBirthdayPicker->date(); 1081 QDate da = mBirthdayPicker->date();
1082 if ( da > QDate::currentDate() )
1083 da.setYMD(da.year()-100, da.month(), da.day() );
1084 mAddressee.setBirthday( QDateTime( da ) ); 1082 mAddressee.setBirthday( QDateTime( da ) );
1085 //qDebug("bday %s ",da.toString().latin1()); 1083 //qDebug("bday %s ",da.toString().latin1());
1086 } 1084 }
1087 else { 1085 else {
1088 mAddressee.setBirthday( QDateTime() ); 1086 mAddressee.setBirthday( QDateTime() );
1089 mBirthdayPicker->clear(); 1087 mBirthdayPicker->clear();
1090 } 1088 }
1091 mAddressee.setNickName( mNicknameEdit->text() ); 1089 mAddressee.setNickName( mNicknameEdit->text() );
1092 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1090 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1093 1091
1094 mAddressee.setGeo( mGeoWidget->geo() ); 1092 mAddressee.setGeo( mGeoWidget->geo() );
1095 mAddressee.setPhoto( mImageWidget->photo() ); 1093 mAddressee.setPhoto( mImageWidget->photo() );
1096 mAddressee.setLogo( mImageWidget->logo() ); 1094 mAddressee.setLogo( mImageWidget->logo() );
1097 mAddressee.setKeys( mKeyWidget->keys() ); 1095 mAddressee.setKeys( mKeyWidget->keys() );
1098#ifndef KAB_EMBEDDED 1096#ifndef KAB_EMBEDDED
1099 mAddressee.setSound( mSoundWidget->sound() ); 1097 mAddressee.setSound( mSoundWidget->sound() );
1100#else //KAB_EMBEDDED 1098#else //KAB_EMBEDDED
1101//US qDebug("AddresseeEditorWidget::save sound not supported"); 1099//US qDebug("AddresseeEditorWidget::save sound not supported");
1102#endif //KAB_EMBEDDED 1100#endif //KAB_EMBEDDED
1103 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1101 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1104 1102
1105 // save custom fields 1103 // save custom fields
1106 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1104 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1107 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1105 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1108 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); 1106 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() );
1109 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1107 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1110 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1108 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1111 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1109 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1112 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1110 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1113 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1111 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1114 if ( mAnniversaryPicker->inputIsValid() ) { 1112 if ( mAnniversaryPicker->inputIsValid() ) {
1115 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1113 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1116 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1114 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1117 } 1115 }
1118 else { 1116 else {
1119 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1117 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1120 mAnniversaryPicker->clear(); 1118 mAnniversaryPicker->clear();
1121 } 1119 }
1122 int gen = mGenderBox->currentItem (); 1120 int gen = mGenderBox->currentItem ();
1123 if ( gen == 1 ) 1121 if ( gen == 1 )
1124 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); 1122 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
1125 else if ( gen == 2 ) 1123 else if ( gen == 2 )
1126 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 1124 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
1127 else 1125 else
1128 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); 1126 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" );
1129 1127
1130 // Save the email addresses 1128 // Save the email addresses
1131 QStringList emails = mAddressee.emails(); 1129 QStringList emails = mAddressee.emails();
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 3715786..046cb63 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -330,96 +330,97 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
331 "X-IMAddress", "KADDRESSBOOK" ); 331 "X-IMAddress", "KADDRESSBOOK" );
332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
333 "X-Anniversary", "KADDRESSBOOK" ); 333 "X-Anniversary", "KADDRESSBOOK" );
334 334
335 //US added this field to become compatible with Opie/qtopia addressbook 335 //US added this field to become compatible with Opie/qtopia addressbook
336 // values can be "female" or "male" or "". An empty field represents undefined. 336 // values can be "female" or "male" or "". An empty field represents undefined.
337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
338 "X-Gender", "KADDRESSBOOK" ); 338 "X-Gender", "KADDRESSBOOK" );
339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
340 "X-Children", "KADDRESSBOOK" ); 340 "X-Children", "KADDRESSBOOK" );
341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
342 "X-FreeBusyUrl", "KADDRESSBOOK" ); 342 "X-FreeBusyUrl", "KADDRESSBOOK" );
343#endif 343#endif
344 initGUI(); 344 initGUI();
345 345
346 mIncSearchWidget->setFocus(); 346 mIncSearchWidget->setFocus();
347 347
348 348
349 connect( mViewManager, SIGNAL( selected( const QString& ) ), 349 connect( mViewManager, SIGNAL( selected( const QString& ) ),
350 SLOT( setContactSelected( const QString& ) ) ); 350 SLOT( setContactSelected( const QString& ) ) );
351 connect( mViewManager, SIGNAL( executed( const QString& ) ), 351 connect( mViewManager, SIGNAL( executed( const QString& ) ),
352 SLOT( executeContact( const QString& ) ) ); 352 SLOT( executeContact( const QString& ) ) );
353 353
354 connect( mViewManager, SIGNAL( deleteRequest( ) ), 354 connect( mViewManager, SIGNAL( deleteRequest( ) ),
355 SLOT( deleteContacts( ) ) ); 355 SLOT( deleteContacts( ) ) );
356 connect( mViewManager, SIGNAL( modified() ), 356 connect( mViewManager, SIGNAL( modified() ),
357 SLOT( setModified() ) ); 357 SLOT( setModified() ) );
358 358
359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
361 361
362 connect( mXXPortManager, SIGNAL( modified() ), 362 connect( mXXPortManager, SIGNAL( modified() ),
363 SLOT( setModified() ) ); 363 SLOT( setModified() ) );
364 364
365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
366 SLOT( incrementalSearchJump( const QString& ) ) ); 366 SLOT( incrementalSearchJump( const QString& ) ) );
367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
368 mJumpButtonBar, SLOT( recreateButtons() ) ); 368 mJumpButtonBar, SLOT( recreateButtons() ) );
369 369
370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
371 SLOT( sendMail( const QString& ) ) ); 371 SLOT( sendMail( const QString& ) ) );
372 372
373 373
374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
375 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 375 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
378 connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync()));
378 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); 379 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
379 380
380 381
381#ifndef KAB_EMBEDDED 382#ifndef KAB_EMBEDDED
382 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 383 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
383 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 384 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
384 385
385 connect( mDetails, SIGNAL( browse( const QString& ) ), 386 connect( mDetails, SIGNAL( browse( const QString& ) ),
386 SLOT( browse( const QString& ) ) ); 387 SLOT( browse( const QString& ) ) );
387 388
388 389
389 mAddressBookService = new KAddressBookService( this ); 390 mAddressBookService = new KAddressBookService( this );
390 391
391#endif //KAB_EMBEDDED 392#endif //KAB_EMBEDDED
392 393
393 mMessageTimer = new QTimer( this ); 394 mMessageTimer = new QTimer( this );
394 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 395 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
395 mEditorDialog = 0; 396 mEditorDialog = 0;
396 createAddresseeEditorDialog( this ); 397 createAddresseeEditorDialog( this );
397 setModified( false ); 398 setModified( false );
398 mBRdisabled = false; 399 mBRdisabled = false;
399#ifndef DESKTOP_VERSION 400#ifndef DESKTOP_VERSION
400 infrared = 0; 401 infrared = 0;
401#endif 402#endif
402 //toggleBeamReceive( ); 403 //toggleBeamReceive( );
403 mMainWindow->toolBar()->show(); 404 mMainWindow->toolBar()->show();
404 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 405 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
405 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 406 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
406} 407}
407 408
408void KABCore::updateToolBar() 409void KABCore::updateToolBar()
409{ 410{
410 static int iii = 0; 411 static int iii = 0;
411 ++iii; 412 ++iii;
412 mMainWindow->toolBar()->repaintMe(); 413 mMainWindow->toolBar()->repaintMe();
413 if ( iii < 4 ) 414 if ( iii < 4 )
414 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 415 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
415} 416}
416KABCore::~KABCore() 417KABCore::~KABCore()
417{ 418{
418 // save(); 419 // save();
419 //saveSettings(); 420 //saveSettings();
420 //KABPrefs::instance()->writeConfig(); 421 //KABPrefs::instance()->writeConfig();
421 delete AddresseeConfig::instance(); 422 delete AddresseeConfig::instance();
422 mAddressBook = 0; 423 mAddressBook = 0;
423 KABC::StdAddressBook::close(); 424 KABC::StdAddressBook::close();
424 425
425 delete syncManager; 426 delete syncManager;
@@ -2535,96 +2536,100 @@ void KABCore::configureResources()
2535 if ( !dlg.exec() ) 2536 if ( !dlg.exec() )
2536 return; 2537 return;
2537 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2538 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2538} 2539}
2539#endif //KAB_EMBEDDED 2540#endif //KAB_EMBEDDED
2540 2541
2541 2542
2542/* this method will be called through the QCop interface from Ko/Pi to select addresses 2543/* this method will be called through the QCop interface from Ko/Pi to select addresses
2543 * for the attendees list of an event. 2544 * for the attendees list of an event.
2544 */ 2545 */
2545void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2546void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2546{ 2547{
2547 qDebug("KABCore::requestForNameEmailUidList "); 2548 qDebug("KABCore::requestForNameEmailUidList ");
2548 bool ok = false; 2549 bool ok = false;
2549 mEmailSourceChannel = sourceChannel; 2550 mEmailSourceChannel = sourceChannel;
2550 mEmailSourceUID = uid; 2551 mEmailSourceUID = uid;
2551 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); 2552 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) );
2552 //callContactdialog(); 2553 //callContactdialog();
2553#if 0 2554#if 0
2554 int wid = uid.toInt( &ok ); 2555 int wid = uid.toInt( &ok );
2555 qDebug("UID %s ", uid.latin1()); 2556 qDebug("UID %s ", uid.latin1());
2556 if ( ok ) { 2557 if ( ok ) {
2557 if ( wid != QApplication::desktop()->width() ) { 2558 if ( wid != QApplication::desktop()->width() ) {
2558 qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); 2559 qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
2559 message( i18n("Resizing, please wait...") ); 2560 message( i18n("Resizing, please wait...") );
2560 mMainWindow->showMinimized(); 2561 mMainWindow->showMinimized();
2561 /* 2562 /*
2562 { 2563 {
2563 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2564 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2564 } 2565 }
2565 */ 2566 */
2566 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); 2567 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) );
2567 return; 2568 return;
2568 } 2569 }
2569 2570
2570 } else { 2571 } else {
2571 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); 2572 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid ");
2572 } 2573 }
2573 callContactdialog(); 2574 callContactdialog();
2574 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2575 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2575#endif 2576#endif
2576} 2577}
2577void KABCore::resizeAndCallContactdialog() 2578void KABCore::resizeAndCallContactdialog()
2578{ 2579{
2579 updateMainWindow(); 2580 updateMainWindow();
2580 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); 2581 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) );
2581} 2582}
2582 2583
2584void KABCore::doRingSync()
2585{
2586 syncManager->multiSync( false );
2587}
2583void KABCore::callContactdialog() 2588void KABCore::callContactdialog()
2584{ 2589{
2585 static bool running = false; 2590 static bool running = false;
2586 if (running) return; 2591 if (running) return;
2587 running = true; 2592 running = true;
2588 QStringList nameList; 2593 QStringList nameList;
2589 QStringList emailList; 2594 QStringList emailList;
2590 QStringList uidList; 2595 QStringList uidList;
2591 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); 2596 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() );
2592 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2597 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2593 uint i=0; 2598 uint i=0;
2594 for (i=0; i < list.count(); i++) 2599 for (i=0; i < list.count(); i++)
2595 { 2600 {
2596 nameList.append(list[i].realName()); 2601 nameList.append(list[i].realName());
2597 emailList.append(list[i].preferredEmail()); 2602 emailList.append(list[i].preferredEmail());
2598 uidList.append(list[i].uid()); 2603 uidList.append(list[i].uid());
2599 } 2604 }
2600 QString uid = mEmailSourceUID; 2605 QString uid = mEmailSourceUID;
2601 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); 2606 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
2602 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); 2607 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList);
2603 running = false; 2608 running = false;
2604} 2609}
2605/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2610/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2606 * to put them into the calendar. 2611 * to put them into the calendar.
2607 */ 2612 */
2608void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2613void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2609{ 2614{
2610 // qDebug("KABCore::requestForBirthdayList"); 2615 // qDebug("KABCore::requestForBirthdayList");
2611 QStringList birthdayList; 2616 QStringList birthdayList;
2612 QStringList anniversaryList; 2617 QStringList anniversaryList;
2613 QStringList realNameList; 2618 QStringList realNameList;
2614 QStringList preferredEmailList; 2619 QStringList preferredEmailList;
2615 QStringList assembledNameList; 2620 QStringList assembledNameList;
2616 QStringList uidList; 2621 QStringList uidList;
2617 2622
2618 KABC::AddressBook::Iterator it; 2623 KABC::AddressBook::Iterator it;
2619 2624
2620 int count = 0; 2625 int count = 0;
2621 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2626 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2622 ++count; 2627 ++count;
2623 } 2628 }
2624 QProgressBar bar(count,0 ); 2629 QProgressBar bar(count,0 );
2625 int w = 300; 2630 int w = 300;
2626 if ( QApplication::desktop()->width() < 320 ) 2631 if ( QApplication::desktop()->width() < 320 )
2627 w = 220; 2632 w = 220;
2628 int h = bar.sizeHint().height() ; 2633 int h = bar.sizeHint().height() ;
2629 int dw = QApplication::desktop()->width(); 2634 int dw = QApplication::desktop()->width();
2630 int dh = QApplication::desktop()->height(); 2635 int dh = QApplication::desktop()->height();
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 6479a58..ceeeda7 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -328,96 +328,97 @@ class KABCore : public QWidget, public KSyncInterface
328 */ 328 */
329 void openConfigDialog(); 329 void openConfigDialog();
330 void openConfigGlobalDialog(); 330 void openConfigGlobalDialog();
331 331
332 /** 332 /**
333 Launches the ldap search dialog. 333 Launches the ldap search dialog.
334 */ 334 */
335 void openLDAPDialog(); 335 void openLDAPDialog();
336 336
337 /** 337 /**
338 Creates a KAddressBookPrinter, which will display the print 338 Creates a KAddressBookPrinter, which will display the print
339 dialog and do the printing. 339 dialog and do the printing.
340 */ 340 */
341 void print(); 341 void print();
342 342
343 /** 343 /**
344 Registers a new GUI client, so plugins can register its actions. 344 Registers a new GUI client, so plugins can register its actions.
345 */ 345 */
346 void addGUIClient( KXMLGUIClient *client ); 346 void addGUIClient( KXMLGUIClient *client );
347 347
348 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 348 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
349 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 349 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
350 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 350 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
351 351
352 352
353 signals: 353 signals:
354 void contactSelected( const QString &name ); 354 void contactSelected( const QString &name );
355 void contactSelected( const QPixmap &pixmap ); 355 void contactSelected( const QPixmap &pixmap );
356 public slots: 356 public slots:
357 void recieve(QString cmsg ); 357 void recieve(QString cmsg );
358 void getFile( bool success ); 358 void getFile( bool success );
359 void syncFileRequest(); 359 void syncFileRequest();
360 void setDetailsVisible( bool visible ); 360 void setDetailsVisible( bool visible );
361 void setDetailsToState(); 361 void setDetailsToState();
362 362
363 void saveSettings(); 363 void saveSettings();
364 364
365 private slots: 365 private slots:
366 void updateToolBar(); 366 void updateToolBar();
367 void updateMainWindow(); 367 void updateMainWindow();
368 void receive( const QCString& cmsg, const QByteArray& data ); 368 void receive( const QCString& cmsg, const QByteArray& data );
369 void toggleBeamReceive( ); 369 void toggleBeamReceive( );
370 void disableBR(bool); 370 void disableBR(bool);
371 void setJumpButtonBarVisible( bool visible ); 371 void setJumpButtonBarVisible( bool visible );
372 void setJumpButtonBar( bool visible ); 372 void setJumpButtonBar( bool visible );
373 void setCaptionBack(); 373 void setCaptionBack();
374 void resizeAndCallContactdialog(); 374 void resizeAndCallContactdialog();
375 void callContactdialog(); 375 void callContactdialog();
376 void doRingSync();
376 377
377 void importFromOL(); 378 void importFromOL();
378 void extensionModified( const KABC::Addressee::List &list ); 379 void extensionModified( const KABC::Addressee::List &list );
379 void extensionChanged( int id ); 380 void extensionChanged( int id );
380 void clipboardDataChanged(); 381 void clipboardDataChanged();
381 void updateActionMenu(); 382 void updateActionMenu();
382 void configureKeyBindings(); 383 void configureKeyBindings();
383 void removeVoice(); 384 void removeVoice();
384 void setFormattedName(); 385 void setFormattedName();
385#ifdef KAB_EMBEDDED 386#ifdef KAB_EMBEDDED
386 void configureResources(); 387 void configureResources();
387#endif //KAB_EMBEDDED 388#endif //KAB_EMBEDDED
388 389
389 void slotEditorDestroyed( const QString &uid ); 390 void slotEditorDestroyed( const QString &uid );
390 void configurationChanged(); 391 void configurationChanged();
391 void addressBookChanged(); 392 void addressBookChanged();
392 393
393 private: 394 private:
394 QString mEmailSourceChannel; 395 QString mEmailSourceChannel;
395 QString mEmailSourceUID; 396 QString mEmailSourceUID;
396 void resizeEvent(QResizeEvent* e ); 397 void resizeEvent(QResizeEvent* e );
397 bool mBRdisabled; 398 bool mBRdisabled;
398#ifndef DESKTOP_VERSION 399#ifndef DESKTOP_VERSION
399 QCopChannel* infrared; 400 QCopChannel* infrared;
400#endif 401#endif
401 QTimer *mMessageTimer; 402 QTimer *mMessageTimer;
402 void initGUI(); 403 void initGUI();
403 void initActions(); 404 void initActions();
404 QString getPhoneFile(); 405 QString getPhoneFile();
405 406
406 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 407 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
407 const char *name = 0 ); 408 const char *name = 0 );
408 409
409 KXMLGUIClient *mGUIClient; 410 KXMLGUIClient *mGUIClient;
410 411
411 KABC::AddressBook *mAddressBook; 412 KABC::AddressBook *mAddressBook;
412 413
413 ViewManager *mViewManager; 414 ViewManager *mViewManager;
414 // QSplitter *mDetailsSplitter; 415 // QSplitter *mDetailsSplitter;
415 KDGanttMinimizeSplitter *mExtensionBarSplitter; 416 KDGanttMinimizeSplitter *mExtensionBarSplitter;
416 ViewContainer *mDetails; 417 ViewContainer *mDetails;
417 KDGanttMinimizeSplitter* mMiniSplitter; 418 KDGanttMinimizeSplitter* mMiniSplitter;
418 XXPortManager *mXXPortManager; 419 XXPortManager *mXXPortManager;
419 JumpButtonBar *mJumpButtonBar; 420 JumpButtonBar *mJumpButtonBar;
420 IncSearchWidget *mIncSearchWidget; 421 IncSearchWidget *mIncSearchWidget;
421 ExtensionManager *mExtensionManager; 422 ExtensionManager *mExtensionManager;
422 423
423 KCMultiDialog *mConfigureDialog; 424 KCMultiDialog *mConfigureDialog;