22 #include "nameeditdialog.h"
24 #include <QFormLayout>
26 #include <kcombobox.h>
27 #include <klineedit.h>
28 #include <klocalizedstring.h>
30 NameEditDialog::NameEditDialog( QWidget *parent )
33 setCaption( i18n(
"Edit Contact Name" ) );
34 setButtons( Ok | Cancel );
35 setDefaultButton( Ok );
37 QWidget *page =
new QWidget(
this );
38 setMainWidget( page );
40 QFormLayout *layout =
new QFormLayout( page );
42 mPrefixCombo =
new KComboBox( page );
43 mPrefixCombo->setDuplicatesEnabled(
false );
44 mPrefixCombo->setEditable(
true );
46 mGivenNameEdit =
new KLineEdit( page );
48 mAdditionalNameEdit =
new KLineEdit( page );
50 mFamilyNameEdit =
new KLineEdit( page );
52 mSuffixCombo =
new KComboBox( page );
53 mSuffixCombo->setDuplicatesEnabled(
false );
54 mSuffixCombo->setEditable(
true );
56 layout->addRow( i18n(
"Honorific prefixes:" ), mPrefixCombo );
57 layout->addRow( i18n(
"Given name:" ), mGivenNameEdit );
58 layout->addRow( i18n(
"Additional names:" ), mAdditionalNameEdit );
59 layout->addRow( i18n(
"Family names:" ), mFamilyNameEdit );
60 layout->addRow( i18n(
"Honorific suffixes:" ), mSuffixCombo );
62 QStringList prefixList;
63 prefixList += QString();
64 prefixList += i18n(
"Dr." );
65 prefixList += i18n(
"Miss" );
66 prefixList += i18n(
"Mr." );
67 prefixList += i18n(
"Mrs." );
68 prefixList += i18n(
"Ms." );
69 prefixList += i18n(
"Prof." );
72 QStringList suffixList;
73 suffixList += QString();
74 suffixList += i18n(
"I" );
75 suffixList += i18n(
"II" );
76 suffixList += i18n(
"III" );
77 suffixList += i18n(
"Jr." );
78 suffixList += i18n(
"Sr." );
81 mPrefixCombo->addItems( prefixList );
82 mSuffixCombo->addItems( suffixList );
84 mPrefixCombo->lineEdit()->setFocus();
87 void NameEditDialog::setFamilyName(
const QString &name )
89 mFamilyNameEdit->setText( name );
92 QString NameEditDialog::familyName()
const
94 return mFamilyNameEdit->text();
97 void NameEditDialog::setGivenName(
const QString &name )
99 mGivenNameEdit->setText( name );
102 QString NameEditDialog::givenName()
const
104 return mGivenNameEdit->text();
107 void NameEditDialog::setPrefix(
const QString &prefix )
109 mPrefixCombo->setItemText( mPrefixCombo->currentIndex(), prefix );
112 QString NameEditDialog::prefix()
const
114 return mPrefixCombo->currentText();
117 void NameEditDialog::setSuffix(
const QString &suffix )
119 mSuffixCombo->setItemText( mSuffixCombo->currentIndex(), suffix );
122 QString NameEditDialog::suffix()
const
124 return mSuffixCombo->currentText();
127 void NameEditDialog::setAdditionalName(
const QString &name )
129 mAdditionalNameEdit->setText( name );
132 QString NameEditDialog::additionalName()
const
134 return mAdditionalNameEdit->text();