22 #include "nameeditdialog.h"
24 #include <QFormLayout>
26 #include <kcombobox.h>
27 #include <klineedit.h>
28 #include <klocalizedstring.h>
30 NameEditDialog::NameEditDialog(
QWidget *parent)
34 setButtons(Ok | Cancel);
42 mPrefixCombo =
new KComboBox(page);
43 mPrefixCombo->setDuplicatesEnabled(
false);
44 mPrefixCombo->setEditable(
true);
46 mGivenNameEdit =
new KLineEdit(page);
47 mGivenNameEdit->setTrapReturnKey(
true);
49 mAdditionalNameEdit =
new KLineEdit(page);
50 mAdditionalNameEdit->setTrapReturnKey(
true);
52 mFamilyNameEdit =
new KLineEdit(page);
53 mFamilyNameEdit->setTrapReturnKey(
true);
55 mSuffixCombo =
new KComboBox(page);
56 mSuffixCombo->setDuplicatesEnabled(
false);
57 mSuffixCombo->setEditable(
true);
59 layout->
addRow(i18n(
"Honorific prefixes:"), mPrefixCombo);
60 layout->
addRow(i18n(
"Given name:"), mGivenNameEdit);
61 layout->
addRow(i18n(
"Additional names:"), mAdditionalNameEdit);
62 layout->
addRow(i18n(
"Family names:"), mFamilyNameEdit);
63 layout->
addRow(i18n(
"Honorific suffixes:"), mSuffixCombo);
67 prefixList += i18n(
"Dr.");
68 prefixList += i18n(
"Miss");
69 prefixList += i18n(
"Mr.");
70 prefixList += i18n(
"Mrs.");
71 prefixList += i18n(
"Ms.");
72 prefixList += i18n(
"Prof.");
77 suffixList += i18n(
"I");
78 suffixList += i18n(
"II");
79 suffixList += i18n(
"III");
80 suffixList += i18n(
"Jr.");
81 suffixList += i18n(
"Sr.");
84 mPrefixCombo->addItems(prefixList);
85 mSuffixCombo->addItems(suffixList);
87 mPrefixCombo->lineEdit()->setFocus();
90 void NameEditDialog::setFamilyName(
const QString &name)
92 mFamilyNameEdit->setText(name);
95 QString NameEditDialog::familyName()
const
97 return mFamilyNameEdit->text();
100 void NameEditDialog::setGivenName(
const QString &name)
102 mGivenNameEdit->setText(name);
105 QString NameEditDialog::givenName()
const
107 return mGivenNameEdit->text();
110 void NameEditDialog::setPrefix(
const QString &prefix)
112 mPrefixCombo->setItemText(mPrefixCombo->currentIndex(), prefix);
115 QString NameEditDialog::prefix()
const
117 return mPrefixCombo->currentText();
120 void NameEditDialog::setSuffix(
const QString &suffix)
122 mSuffixCombo->setItemText(mSuffixCombo->currentIndex(), suffix);
125 QString NameEditDialog::suffix()
const
127 return mSuffixCombo->currentText();
130 void NameEditDialog::setAdditionalName(
const QString &name)
132 mAdditionalNameEdit->setText(name);
135 QString NameEditDialog::additionalName()
const
137 return mAdditionalNameEdit->text();