summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp56
-rw-r--r--kaddressbook/mainembedded.cpp15
-rw-r--r--kaddressbook/nameeditdialog.cpp7
3 files changed, 58 insertions, 20 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 3cfc1f2..826c69b 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -78,25 +78,24 @@
78#include "addresseeeditorwidget.h" 78#include "addresseeeditorwidget.h"
79 79
80 80
81 81
82AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, 82AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension,
83 QWidget *parent, const char *name ) 83 QWidget *parent, const char *name )
84 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ), 84 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ),
85 mBlockSignals( false ) 85 mBlockSignals( false )
86{ 86{
87 87
88 mAConfig = AddresseeConfig::instance(); 88 mAConfig = AddresseeConfig::instance();
89 89
90 kdDebug(5720) << "AddresseeEditorWidget()" << endl;
91 mFormattedNameType = NameEditDialog::CustomName; 90 mFormattedNameType = NameEditDialog::CustomName;
92 initGUI(); 91 initGUI();
93 mCategoryDialog = 0; 92 mCategoryDialog = 0;
94 mCategoryEditDialog = 0; 93 mCategoryEditDialog = 0;
95 94
96 // Load the empty addressee as defaults 95 // Load the empty addressee as defaults
97 load(); 96 load();
98 97
99 mDirty = false; 98 mDirty = false;
100} 99}
101 100
102AddresseeEditorWidget::~AddresseeEditorWidget() 101AddresseeEditorWidget::~AddresseeEditorWidget()
@@ -623,24 +622,25 @@ void AddresseeEditorWidget::setupTab2()
623 layout->addWidget( label, 7, 1 ); 622 layout->addWidget( label, 7, 1 );
624 mSpouseEdit = new KLineEdit( tab2 ); 623 mSpouseEdit = new KLineEdit( tab2 );
625 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 624 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
626 SLOT( textChanged( const QString& ) ) ); 625 SLOT( textChanged( const QString& ) ) );
627 label->setBuddy( mSpouseEdit ); 626 label->setBuddy( mSpouseEdit );
628//US layout->addWidget( mSpouseEdit, 5, 2 ); 627//US layout->addWidget( mSpouseEdit, 5, 2 );
629 layout->addWidget( mSpouseEdit, 7, 2 ); 628 layout->addWidget( mSpouseEdit, 7, 2 );
630 629
631 label = new QLabel( i18n( "Birthday:" ), tab2 ); 630 label = new QLabel( i18n( "Birthday:" ), tab2 );
632//US layout->addWidget( label, 4, 3 ); 631//US layout->addWidget( label, 4, 3 );
633 layout->addWidget( label, 8, 1 ); 632 layout->addWidget( label, 8, 1 );
634 mBirthdayPicker = new KDateEdit( tab2 ); 633 mBirthdayPicker = new KDateEdit( tab2 );
634 mBirthdayPicker->toggleDateFormat();
635 mBirthdayPicker->setHandleInvalid( true ); 635 mBirthdayPicker->setHandleInvalid( true );
636 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 636 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
637 SLOT( dateChanged( QDate ) ) ); 637 SLOT( dateChanged( QDate ) ) );
638 638
639 639
640#ifndef KAB_EMBEDDED 640#ifndef KAB_EMBEDDED
641 //US invalid dates are handdled by the KDateEdit widget itself 641 //US invalid dates are handdled by the KDateEdit widget itself
642 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), 642 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
643 SLOT( invalidDate() ) ); 643 SLOT( invalidDate() ) );
644 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), 644 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
645 SLOT( emitModified() ) ); 645 SLOT( emitModified() ) );
646#endif //KAB_EMBEDDED 646#endif //KAB_EMBEDDED
@@ -938,25 +938,24 @@ void AddresseeEditorWidget::setupTab3_1()
938 // Keys 938 // Keys
939 mKeyWidget = new KeyWidget( tab3 ); 939 mKeyWidget = new KeyWidget( tab3 );
940 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 940 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
941 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 941 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
942 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 942 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
943*/ 943*/
944 mTabWidget->addTab( tab3, i18n( "&Images" ) ); 944 mTabWidget->addTab( tab3, i18n( "&Images" ) );
945} 945}
946 946
947 947
948void AddresseeEditorWidget::load() 948void AddresseeEditorWidget::load()
949{ 949{
950 kdDebug(5720) << "AddresseeEditorWidget::load()" << endl;
951 950
952 // Block signals in case anything tries to emit modified 951 // Block signals in case anything tries to emit modified
953 // CS: This doesn't seem to work. 952 // CS: This doesn't seem to work.
954 bool block = signalsBlocked(); 953 bool block = signalsBlocked();
955 blockSignals( true ); 954 blockSignals( true );
956 mBlockSignals = true; // used for internal signal blocking 955 mBlockSignals = true; // used for internal signal blocking
957 956
958 mNameEdit->setText( mAddressee.assembledName() ); 957 mNameEdit->setText( mAddressee.assembledName() );
959 958
960 if ( mAddressee.formattedName().isEmpty() ) { 959 if ( mAddressee.formattedName().isEmpty() ) {
961//US KConfig config( "kaddressbookrc" ); 960//US KConfig config( "kaddressbookrc" );
962 KConfig config( locateLocal("config", "kaddressbookrc") ); 961 KConfig config( locateLocal("config", "kaddressbookrc") );
@@ -1019,66 +1018,73 @@ void AddresseeEditorWidget::load()
1019 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1018 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1020 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1019 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1021 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1020 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1022 1021
1023 blockSignals( block ); 1022 blockSignals( block );
1024 mBlockSignals = false; 1023 mBlockSignals = false;
1025 1024
1026 mDirty = false; 1025 mDirty = false;
1027} 1026}
1028 1027
1029void AddresseeEditorWidget::save() 1028void AddresseeEditorWidget::save()
1030{ 1029{
1031 if ( !mDirty ) return; 1030 if ( !dirty() ) {
1031 return;
1032 }
1032 1033
1033 mAddressee.setRole( mRoleEdit->text() ); 1034 mAddressee.setRole( mRoleEdit->text() );
1034 mAddressee.setOrganization( mOrgEdit->text() ); 1035 mAddressee.setOrganization( mOrgEdit->text() );
1035 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1036 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1036 mAddressee.setNote( mNoteEdit->text() ); 1037 mAddressee.setNote( mNoteEdit->text() );
1037 if ( mBirthdayPicker->inputIsValid() ) 1038 if ( mBirthdayPicker->inputIsValid() ) {
1038 mAddressee.setBirthday( QDateTime( mBirthdayPicker->date() ) ); 1039 QDate da = mBirthdayPicker->date();
1039 else 1040 if ( da > QDate::currentDate() )
1041 da.setYMD(da.year()-100, da.month(), da.day() );
1042 mAddressee.setBirthday( QDateTime( da ) );
1043 qDebug("bday %s ",da.toString().latin1());
1044 }
1045 else {
1040 mAddressee.setBirthday( QDateTime() ); 1046 mAddressee.setBirthday( QDateTime() );
1041 1047 mBirthdayPicker->clear();
1048 }
1042 mAddressee.setNickName( mNicknameEdit->text() ); 1049 mAddressee.setNickName( mNicknameEdit->text() );
1043 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1050 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1044 1051
1045 mAddressee.setGeo( mGeoWidget->geo() ); 1052 mAddressee.setGeo( mGeoWidget->geo() );
1046 mAddressee.setPhoto( mImageWidget->photo() ); 1053 mAddressee.setPhoto( mImageWidget->photo() );
1047 mAddressee.setLogo( mImageWidget->logo() ); 1054 mAddressee.setLogo( mImageWidget->logo() );
1048 mAddressee.setKeys( mKeyWidget->keys() ); 1055 mAddressee.setKeys( mKeyWidget->keys() );
1049#ifndef KAB_EMBEDDED 1056#ifndef KAB_EMBEDDED
1050 mAddressee.setSound( mSoundWidget->sound() ); 1057 mAddressee.setSound( mSoundWidget->sound() );
1051#else //KAB_EMBEDDED 1058#else //KAB_EMBEDDED
1052//US qDebug("AddresseeEditorWidget::save sound not supported"); 1059//US qDebug("AddresseeEditorWidget::save sound not supported");
1053#endif //KAB_EMBEDDED 1060#endif //KAB_EMBEDDED
1054 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1061 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1055 1062
1056 // save custom fields 1063 // save custom fields
1057 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1064 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1058 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1065 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1059 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1066 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1060 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1067 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1061 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1068 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1062 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1069 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1063 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1070 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1064 if ( mAnniversaryPicker->inputIsValid() ) { 1071 if ( mAnniversaryPicker->inputIsValid() ) {
1065
1066//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary",
1067//US mAnniversaryPicker->date().toString( Qt::ISODate ) );
1068 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1072 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1069 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1073 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1070 } 1074 }
1071 else 1075 else {
1072 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1076 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1077 mAnniversaryPicker->clear();
1078 }
1073 1079
1074 // Save the email addresses 1080 // Save the email addresses
1075 QStringList emails = mAddressee.emails(); 1081 QStringList emails = mAddressee.emails();
1076 QStringList::Iterator iter; 1082 QStringList::Iterator iter;
1077 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1083 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1078 mAddressee.removeEmail( *iter ); 1084 mAddressee.removeEmail( *iter );
1079 1085
1080 emails = mEmailWidget->emails(); 1086 emails = mEmailWidget->emails();
1081 bool first = true; 1087 bool first = true;
1082 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1088 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1083 mAddressee.insertEmail( *iter, first ); 1089 mAddressee.insertEmail( *iter, first );
1084 first = false; 1090 first = false;
@@ -1105,36 +1111,56 @@ void AddresseeEditorWidget::save()
1105 ++addressIter ) 1111 ++addressIter )
1106 mAddressee.removeAddress( *addressIter ); 1112 mAddressee.removeAddress( *addressIter );
1107 1113
1108 addresses = mAddressEditWidget->addresses(); 1114 addresses = mAddressEditWidget->addresses();
1109 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1115 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1110 ++addressIter ) 1116 ++addressIter )
1111 mAddressee.insertAddress( *addressIter ); 1117 mAddressee.insertAddress( *addressIter );
1112 mDirty = false; 1118 mDirty = false;
1113} 1119}
1114 1120
1115bool AddresseeEditorWidget::dirty() 1121bool AddresseeEditorWidget::dirty()
1116{ 1122{
1123
1124 if ( ! mDirty ) {
1125 if ( mBirthdayPicker->inputIsValid() ) {
1126 QDate da = mBirthdayPicker->date();
1127 if ( !(da == mAddressee.birthday().date()))
1128 mDirty = true;
1129 }
1130 else {
1131 mBirthdayPicker->clear();
1132 }
1133 if ( mAnniversaryPicker->inputIsValid() ) {
1134 QDate da = mAnniversaryPicker->date();
1135 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1136 "%Y-%m-%d"))
1137 mDirty = true;
1138 }
1139 else {
1140 mAnniversaryPicker->clear();
1141 }
1142 }
1117 return mDirty; 1143 return mDirty;
1118} 1144}
1119 1145
1120void AddresseeEditorWidget::nameTextChanged( const QString &text ) 1146void AddresseeEditorWidget::nameTextChanged( const QString &text )
1121{ 1147{
1122 // use the addressee class to parse the name for us 1148 // use the addressee class to parse the name for us
1123 mAConfig->setUid( mAddressee.uid() ); 1149 mAConfig->setUid( mAddressee.uid() );
1124 if ( mAConfig->automaticNameParsing() ) { 1150 if ( mAConfig->automaticNameParsing() ) {
1125 if ( !mAddressee.formattedName().isEmpty() ) { 1151 if ( !mAddressee.formattedName().isEmpty() ) {
1126 QString fn = mAddressee.formattedName(); 1152 QString fn = mAddressee.formattedName();
1127 mAddressee.setNameFromString( text ); 1153 mAddressee.setNameFromString( text );
1128 mAddressee.setFormattedName( fn ); 1154 mAddressee.setFormattedName( fn );
1129 } else { 1155 } else {
1130 // use extra addressee to avoid a formatted name assignment 1156 // use extra addressee to avoid a formatted name assignment
1131 Addressee addr; 1157 Addressee addr;
1132 addr.setNameFromString( text ); 1158 addr.setNameFromString( text );
1133 mAddressee.setPrefix( addr.prefix() ); 1159 mAddressee.setPrefix( addr.prefix() );
1134 mAddressee.setGivenName( addr.givenName() ); 1160 mAddressee.setGivenName( addr.givenName() );
1135 mAddressee.setAdditionalName( addr.additionalName() ); 1161 mAddressee.setAdditionalName( addr.additionalName() );
1136 mAddressee.setFamilyName( addr.familyName() ); 1162 mAddressee.setFamilyName( addr.familyName() );
1137 mAddressee.setSuffix( addr.suffix() ); 1163 mAddressee.setSuffix( addr.suffix() );
1138 } 1164 }
1139 } 1165 }
1140 1166
@@ -1160,25 +1186,25 @@ void AddresseeEditorWidget::nameBoxChanged()
1160 1186
1161 if ( mFormattedNameType != NameEditDialog::CustomName ) { 1187 if ( mFormattedNameType != NameEditDialog::CustomName ) {
1162 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1188 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1163 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1189 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1164 } 1190 }
1165} 1191}
1166 1192
1167void AddresseeEditorWidget::nameButtonClicked() 1193void AddresseeEditorWidget::nameButtonClicked()
1168{ 1194{
1169 // show the name dialog. 1195 // show the name dialog.
1170 NameEditDialog dialog( mAddressee, mFormattedNameType, this ); 1196 NameEditDialog dialog( mAddressee, mFormattedNameType, this );
1171 1197
1172 if ( dialog.exec() ) { 1198 if ( KApplication::execDialog( &dialog) ) {
1173 if ( dialog.changed() ) { 1199 if ( dialog.changed() ) {
1174 mAddressee.setFamilyName( dialog.familyName() ); 1200 mAddressee.setFamilyName( dialog.familyName() );
1175 mAddressee.setGivenName( dialog.givenName() ); 1201 mAddressee.setGivenName( dialog.givenName() );
1176 mAddressee.setPrefix( dialog.prefix() ); 1202 mAddressee.setPrefix( dialog.prefix() );
1177 mAddressee.setSuffix( dialog.suffix() ); 1203 mAddressee.setSuffix( dialog.suffix() );
1178 mAddressee.setAdditionalName( dialog.additionalName() ); 1204 mAddressee.setAdditionalName( dialog.additionalName() );
1179 mFormattedNameType = dialog.formattedNameType(); 1205 mFormattedNameType = dialog.formattedNameType();
1180 if ( mFormattedNameType == NameEditDialog::CustomName ) { 1206 if ( mFormattedNameType == NameEditDialog::CustomName ) {
1181 mFormattedNameLabel->setText( dialog.customFormattedName() ); 1207 mFormattedNameLabel->setText( dialog.customFormattedName() );
1182 mAddressee.setFormattedName( dialog.customFormattedName() ); 1208 mAddressee.setFormattedName( dialog.customFormattedName() );
1183 } 1209 }
1184 // Update the name edit. 1210 // Update the name edit.
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index d781f67..4230c07 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -62,24 +62,39 @@ int main( int argc, char **argv )
62#else 62#else
63 QString fileName ; 63 QString fileName ;
64 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 64 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
65 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 65 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
66 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 66 QApplication::addLibraryPath ( qApp->applicationDirPath () );
67 67
68#endif 68#endif
69 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 69 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
70 KAddressBookMain m ; 70 KAddressBookMain m ;
71//US MainWindow m; 71//US MainWindow m;
72 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 72 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
73 73
74 {
75 KConfig kon ( locateLocal( "config", "korganizerrc" ) );
76 kon.setGroup("Locale");
77 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) );
78 QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( "");
79 KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) );
80 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
81 dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" );
82 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
83 kon.setGroup("Time & Date");
84 KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ),
85 kon.readNumEntry( "DaylightsavingStart", 90),
86 kon.readNumEntry( "DaylightsavingEnd",304) );
87 KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") );
88 }
74#ifndef DESKTOP_VERSION 89#ifndef DESKTOP_VERSION
75 a.showMainWidget( &m ); 90 a.showMainWidget( &m );
76#else 91#else
77 a.setMainWidget( &m ); 92 a.setMainWidget( &m );
78 m.resize (640, 480 ); 93 m.resize (640, 480 );
79 m.show(); 94 m.show();
80#endif 95#endif
81 a.exec(); 96 a.exec();
82 97
83 } 98 }
84 qDebug("KA: Bye! "); 99 qDebug("KA: Bye! ");
85} 100}
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp
index fb7eb22..8213c2b 100644
--- a/kaddressbook/nameeditdialog.cpp
+++ b/kaddressbook/nameeditdialog.cpp
@@ -100,25 +100,25 @@ NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
100 mFormattedNameCombo->setMaximumWidth(100); 100 mFormattedNameCombo->setMaximumWidth(100);
101 101
102 layout->addMultiCellWidget( mFormattedNameCombo, 5, 5, 0, 0 ); 102 layout->addMultiCellWidget( mFormattedNameCombo, 5, 5, 0, 0 );
103 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) ); 103 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) );
104 104
105 mFormattedNameEdit = new KLineEdit( page ); 105 mFormattedNameEdit = new KLineEdit( page );
106 mFormattedNameEdit->setEnabled( type == CustomName ); 106 mFormattedNameEdit->setEnabled( type == CustomName );
107 layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 ); 107 layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 );
108 108
109 mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page ); 109 mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page );
110 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) ); 110 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) );
111 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) ); 111 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) );
112 layout->addMultiCellWidget( mParseBox, 6, 6, 0, 1 ); 112 layout->addMultiCellWidget( mParseBox, 6, 6, 0, 2 );
113 113
114 // Fill in the values 114 // Fill in the values
115 mFamilyNameEdit->setText( addr.familyName() ); 115 mFamilyNameEdit->setText( addr.familyName() );
116 mGivenNameEdit->setText( addr.givenName() ); 116 mGivenNameEdit->setText( addr.givenName() );
117 mAdditionalNameEdit->setText( addr.additionalName() ); 117 mAdditionalNameEdit->setText( addr.additionalName() );
118 mFormattedNameEdit->setText( addr.formattedName() ); 118 mFormattedNameEdit->setText( addr.formattedName() );
119 119
120 // Prefix and suffix combos 120 // Prefix and suffix combos
121//US KConfig config( "kabcrc" ); 121//US KConfig config( "kabcrc" );
122 KConfig config( locateLocal("config", "kabcrc") ); 122 KConfig config( locateLocal("config", "kabcrc") );
123 config.setGroup( "General" ); 123 config.setGroup( "General" );
124 124
@@ -166,28 +166,25 @@ NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
166 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 166 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
167 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 167 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
168 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 168 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
169 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 169 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
170 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 170 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
171 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 171 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
172 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) ); 172 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) );
173 connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 173 connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
174 174
175 updateTypeCombo(); 175 updateTypeCombo();
176 mFormattedNameCombo->setCurrentItem( type ); 176 mFormattedNameCombo->setCurrentItem( type );
177 177
178#ifdef KAB_EMBEDDED 178
179 resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300));
180#endif //KAB_EMBEDDED
181
182 mChanged = false; 179 mChanged = false;
183} 180}
184 181
185NameEditDialog::~NameEditDialog() 182NameEditDialog::~NameEditDialog()
186{ 183{
187} 184}
188 185
189QString NameEditDialog::familyName() const 186QString NameEditDialog::familyName() const
190{ 187{
191 return mFamilyNameEdit->text(); 188 return mFamilyNameEdit->text();
192} 189}
193 190