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

akonadi

  • 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 
48  mAdditionalNameEdit = new KLineEdit(page);
49 
50  mFamilyNameEdit = new KLineEdit(page);
51 
52  mSuffixCombo = new KComboBox(page);
53  mSuffixCombo->setDuplicatesEnabled(false);
54  mSuffixCombo->setEditable(true);
55 
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);
61 
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.");
70  prefixList.sort();
71 
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.");
79  suffixList.sort();
80 
81  mPrefixCombo->addItems(prefixList);
82  mSuffixCombo->addItems(suffixList);
83 
84  mPrefixCombo->lineEdit()->setFocus();
85 }
86 
87 void NameEditDialog::setFamilyName(const QString &name)
88 {
89  mFamilyNameEdit->setText(name);
90 }
91 
92 QString NameEditDialog::familyName() const
93 {
94  return mFamilyNameEdit->text();
95 }
96 
97 void NameEditDialog::setGivenName(const QString &name)
98 {
99  mGivenNameEdit->setText(name);
100 }
101 
102 QString NameEditDialog::givenName() const
103 {
104  return mGivenNameEdit->text();
105 }
106 
107 void NameEditDialog::setPrefix(const QString &prefix)
108 {
109  mPrefixCombo->setItemText(mPrefixCombo->currentIndex(), prefix);
110 }
111 
112 QString NameEditDialog::prefix() const
113 {
114  return mPrefixCombo->currentText();
115 }
116 
117 void NameEditDialog::setSuffix(const QString &suffix)
118 {
119  mSuffixCombo->setItemText(mSuffixCombo->currentIndex(), suffix);
120 }
121 
122 QString NameEditDialog::suffix() const
123 {
124  return mSuffixCombo->currentText();
125 }
126 
127 void NameEditDialog::setAdditionalName(const QString &name)
128 {
129  mAdditionalNameEdit->setText(name);
130 }
131 
132 QString NameEditDialog::additionalName() const
133 {
134  return mAdditionalNameEdit->text();
135 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Fri Nov 14 2014 05:53:27 by doxygen 1.8.8 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs-4.14.3 API Reference

Skip menu "kdepimlibs-4.14.3 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
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