• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 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 
23 #include "nameeditdialog.h"
24 
25 #include <QFormLayout>
26 
27 #include <kcombobox.h>
28 #include <klineedit.h>
29 #include <klocale.h>
30 
31 NameEditDialog::NameEditDialog( QWidget *parent )
32  : KDialog( parent)
33 {
34  setCaption( i18n( "Edit Contact Name" ) );
35  setButtons( Ok | Cancel );
36  setDefaultButton( Ok );
37 
38  QWidget *page = new QWidget( this );
39  setMainWidget( page );
40 
41  QFormLayout *layout = new QFormLayout( page );
42 
43  mPrefixCombo = new KComboBox( page );
44  mPrefixCombo->setDuplicatesEnabled( false );
45  mPrefixCombo->setEditable( true );
46 
47  mGivenNameEdit = new KLineEdit( page );
48 
49  mAdditionalNameEdit = new KLineEdit( page );
50 
51  mFamilyNameEdit = new KLineEdit( page );
52 
53  mSuffixCombo = new KComboBox( page );
54  mSuffixCombo->setDuplicatesEnabled( false );
55  mSuffixCombo->setEditable( true );
56 
57  layout->addRow( i18n( "Honorific prefixes:" ), mPrefixCombo );
58  layout->addRow( i18n( "Given name:" ), mGivenNameEdit );
59  layout->addRow( i18n( "Additional names:" ), mAdditionalNameEdit );
60  layout->addRow( i18n( "Family names:" ), mFamilyNameEdit );
61  layout->addRow( i18n( "Honorific suffixes:" ), mSuffixCombo );
62 
63  QStringList prefixList;
64  prefixList += QString();
65  prefixList += i18n( "Dr." );
66  prefixList += i18n( "Miss" );
67  prefixList += i18n( "Mr." );
68  prefixList += i18n( "Mrs." );
69  prefixList += i18n( "Ms." );
70  prefixList += i18n( "Prof." );
71  prefixList.sort();
72 
73  QStringList suffixList;
74  suffixList += QString();
75  suffixList += i18n( "I" );
76  suffixList += i18n( "II" );
77  suffixList += i18n( "III" );
78  suffixList += i18n( "Jr." );
79  suffixList += i18n( "Sr." );
80  suffixList.sort();
81 
82  mPrefixCombo->addItems( prefixList );
83  mSuffixCombo->addItems( suffixList );
84 
85  mPrefixCombo->lineEdit()->setFocus();
86 }
87 
88 void NameEditDialog::setFamilyName( const QString &name )
89 {
90  mFamilyNameEdit->setText( name );
91 }
92 
93 QString NameEditDialog::familyName() const
94 {
95  return mFamilyNameEdit->text();
96 }
97 
98 void NameEditDialog::setGivenName( const QString &name )
99 {
100  mGivenNameEdit->setText( name );
101 }
102 
103 QString NameEditDialog::givenName() const
104 {
105  return mGivenNameEdit->text();
106 }
107 
108 void NameEditDialog::setPrefix( const QString &prefix )
109 {
110  mPrefixCombo->setItemText( mPrefixCombo->currentIndex(), prefix );
111 }
112 
113 QString NameEditDialog::prefix() const
114 {
115  return mPrefixCombo->currentText();
116 }
117 
118 void NameEditDialog::setSuffix( const QString &suffix )
119 {
120  mSuffixCombo->setItemText( mSuffixCombo->currentIndex(), suffix );
121 }
122 
123 QString NameEditDialog::suffix() const
124 {
125  return mSuffixCombo->currentText();
126 }
127 
128 void NameEditDialog::setAdditionalName( const QString &name )
129 {
130  mAdditionalNameEdit->setText( name );
131 }
132 
133 QString NameEditDialog::additionalName() const
134 {
135  return mAdditionalNameEdit->text();
136 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:27:39 by doxygen 1.8.3.1 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.10.5 API Reference

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