• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi/contact

  • sources
  • kde-4.14
  • kdepimlibs
  • akonadi
  • contact
  • editor
nameeditdialog.cpp
1 /*
2  This file is part of Akonadi Contact.
3 
4  Copyright (c) 2010 Tobias Koenig <tokoe@kde.org>
5 
6  This library is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or (at your
9  option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14  License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301, USA.
20 */
21 
22 #include "nameeditdialog.h"
23 
24 #include <QFormLayout>
25 
26 #include <kcombobox.h>
27 #include <klineedit.h>
28 #include <klocalizedstring.h>
29 
30 NameEditDialog::NameEditDialog(QWidget *parent)
31  : KDialog(parent)
32 {
33  setCaption(i18n("Edit Contact Name"));
34  setButtons(Ok | Cancel);
35  setDefaultButton(Ok);
36 
37  QWidget *page = new QWidget(this);
38  setMainWidget(page);
39 
40  QFormLayout *layout = new QFormLayout(page);
41 
42  mPrefixCombo = new KComboBox(page);
43  mPrefixCombo->setDuplicatesEnabled(false);
44  mPrefixCombo->setEditable(true);
45 
46  mGivenNameEdit = new KLineEdit(page);
47  mGivenNameEdit->setTrapReturnKey(true);
48 
49  mAdditionalNameEdit = new KLineEdit(page);
50  mAdditionalNameEdit->setTrapReturnKey(true);
51 
52  mFamilyNameEdit = new KLineEdit(page);
53  mFamilyNameEdit->setTrapReturnKey(true);
54 
55  mSuffixCombo = new KComboBox(page);
56  mSuffixCombo->setDuplicatesEnabled(false);
57  mSuffixCombo->setEditable(true);
58 
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);
64 
65  QStringList prefixList;
66  prefixList += QString();
67  prefixList += i18n("Dr.");
68  prefixList += i18n("Miss");
69  prefixList += i18n("Mr.");
70  prefixList += i18n("Mrs.");
71  prefixList += i18n("Ms.");
72  prefixList += i18n("Prof.");
73  prefixList.sort();
74 
75  QStringList suffixList;
76  suffixList += QString();
77  suffixList += i18n("I");
78  suffixList += i18n("II");
79  suffixList += i18n("III");
80  suffixList += i18n("Jr.");
81  suffixList += i18n("Sr.");
82  suffixList.sort();
83 
84  mPrefixCombo->addItems(prefixList);
85  mSuffixCombo->addItems(suffixList);
86 
87  mPrefixCombo->lineEdit()->setFocus();
88 }
89 
90 void NameEditDialog::setFamilyName(const QString &name)
91 {
92  mFamilyNameEdit->setText(name);
93 }
94 
95 QString NameEditDialog::familyName() const
96 {
97  return mFamilyNameEdit->text();
98 }
99 
100 void NameEditDialog::setGivenName(const QString &name)
101 {
102  mGivenNameEdit->setText(name);
103 }
104 
105 QString NameEditDialog::givenName() const
106 {
107  return mGivenNameEdit->text();
108 }
109 
110 void NameEditDialog::setPrefix(const QString &prefix)
111 {
112  mPrefixCombo->setItemText(mPrefixCombo->currentIndex(), prefix);
113 }
114 
115 QString NameEditDialog::prefix() const
116 {
117  return mPrefixCombo->currentText();
118 }
119 
120 void NameEditDialog::setSuffix(const QString &suffix)
121 {
122  mSuffixCombo->setItemText(mSuffixCombo->currentIndex(), suffix);
123 }
124 
125 QString NameEditDialog::suffix() const
126 {
127  return mSuffixCombo->currentText();
128 }
129 
130 void NameEditDialog::setAdditionalName(const QString &name)
131 {
132  mAdditionalNameEdit->setText(name);
133 }
134 
135 QString NameEditDialog::additionalName() const
136 {
137  return mAdditionalNameEdit->text();
138 }
QWidget::layout
QLayout * layout() const
QWidget
QString
QFormLayout::addRow
void addRow(QWidget *label, QWidget *field)
QStringList
QWidget::QWidget
QWidget(QWidget *parent, QFlags< Qt::WindowType > f)
QWidget::setCaption
void setCaption(const QString &c)
QStringList::sort
void sort()
QFormLayout
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi/contact

Skip menu "akonadi/contact"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal