9#include "nameeditdialog.h"
13#include <KLocalizedString>
15#include <QDialogButtonBox>
19NameEditDialog::NameEditDialog(
QWidget *parent)
22 setWindowTitle(
i18nc(
"@title:window",
"Edit Contact Name"));
27 mainLayout->addLayout(layout);
30 mPrefixCombo->setDuplicatesEnabled(
false);
31 mPrefixCombo->setEditable(
true);
34 mGivenNameEdit->setTrapReturnKey(
true);
36 mAdditionalNameEdit =
new KLineEdit(
this);
37 mAdditionalNameEdit->setTrapReturnKey(
true);
40 mFamilyNameEdit->setTrapReturnKey(
true);
43 mSuffixCombo->setDuplicatesEnabled(
false);
44 mSuffixCombo->setEditable(
true);
46 mDisplayNameEdit =
new DisplayNameEditWidget(
this);
48 layout->addRow(
i18n(
"Honorific prefixes:"), mPrefixCombo);
49 layout->addRow(
i18n(
"Given name:"), mGivenNameEdit);
50 layout->addRow(
i18n(
"Additional names:"), mAdditionalNameEdit);
51 layout->addRow(
i18n(
"Family names:"), mFamilyNameEdit);
52 layout->addRow(
i18n(
"Honorific suffixes:"), mSuffixCombo);
53 layout->addRow(
i18n(
"Display:"), mDisplayNameEdit);
57 prefixList +=
i18n(
"Dr.");
58 prefixList +=
i18n(
"Miss");
59 prefixList +=
i18n(
"Mr.");
60 prefixList +=
i18n(
"Mrs.");
61 prefixList +=
i18n(
"Ms.");
62 prefixList +=
i18n(
"Prof.");
67 suffixList +=
i18n(
"I");
68 suffixList +=
i18n(
"II");
69 suffixList +=
i18n(
"III");
70 suffixList +=
i18n(
"Jr.");
71 suffixList +=
i18n(
"Sr.");
74 mPrefixCombo->addItems(prefixList);
75 mSuffixCombo->addItems(suffixList);
77 mPrefixCombo->lineEdit()->setFocus();
84 mainLayout->addWidget(buttonBox);
87void NameEditDialog::setFamilyName(
const QString &name)
89 mFamilyNameEdit->setText(name);
92QString NameEditDialog::familyName()
const
94 return mFamilyNameEdit->text();
97void NameEditDialog::setGivenName(
const QString &name)
99 mGivenNameEdit->setText(name);
102QString NameEditDialog::givenName()
const
104 return mGivenNameEdit->text();
107void NameEditDialog::setPrefix(
const QString &prefix)
109 mPrefixCombo->setItemText(mPrefixCombo->currentIndex(), prefix);
112QString NameEditDialog::prefix()
const
114 return mPrefixCombo->currentText();
117void NameEditDialog::setSuffix(
const QString &suffix)
119 mSuffixCombo->setItemText(mSuffixCombo->currentIndex(), suffix);
122QString NameEditDialog::suffix()
const
124 return mSuffixCombo->currentText();
127void NameEditDialog::setAdditionalName(
const QString &name)
129 mAdditionalNameEdit->setText(name);
132QString NameEditDialog::additionalName()
const
134 return mAdditionalNameEdit->text();
137void NameEditDialog::loadContact(
const KContacts::Addressee &contact)
139 setPrefix(contact.
prefix());
143 setSuffix(contact.
suffix());
144 mDisplayNameEdit->loadContact(contact);
147void NameEditDialog::storeContact(KContacts::Addressee &contact)
const
155 mDisplayNameEdit->changeName(contact);
156 mDisplayNameEdit->storeContact(contact);
159void NameEditDialog::setDisplayType(DisplayNameEditWidget::DisplayType type)
161 mDisplayNameEdit->setDisplayType(type);
164DisplayNameEditWidget::DisplayType NameEditDialog::displayType()
const
166 return mDisplayNameEdit->displayType();
169#include "moc_nameeditdialog.cpp"
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
A widget for editing the display name of a contact.
void sort(Qt::CaseSensitivity cs)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)