akonadi
nameeditdialog.cpp
00001 /* 00002 This file is part of Akonadi Contact. 00003 00004 Copyright (c) 2010 Tobias Koenig <tokoe@kde.org> 00005 00006 This library is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU Library General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or (at your 00009 option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00014 License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to the 00018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 02110-1301, USA. 00020 */ 00021 00022 00023 #include "nameeditdialog.h" 00024 00025 #include <QtGui/QFormLayout> 00026 00027 #include <kcombobox.h> 00028 #include <klineedit.h> 00029 #include <klocale.h> 00030 00031 NameEditDialog::NameEditDialog( QWidget *parent ) 00032 : KDialog( parent) 00033 { 00034 setCaption( i18n( "Edit Contact Name" ) ); 00035 setButtons( Ok | Cancel ); 00036 setDefaultButton( Ok ); 00037 00038 QWidget *page = new QWidget( this ); 00039 setMainWidget( page ); 00040 00041 QFormLayout *layout = new QFormLayout( page ); 00042 00043 mPrefixCombo = new KComboBox( page ); 00044 mPrefixCombo->setDuplicatesEnabled( false ); 00045 mPrefixCombo->setEditable( true ); 00046 00047 mGivenNameEdit = new KLineEdit( page ); 00048 00049 mAdditionalNameEdit = new KLineEdit( page ); 00050 00051 mFamilyNameEdit = new KLineEdit( page ); 00052 00053 mSuffixCombo = new KComboBox( page ); 00054 mSuffixCombo->setDuplicatesEnabled( false ); 00055 mSuffixCombo->setEditable( true ); 00056 00057 layout->addRow( i18n( "Honorific prefixes:" ), mPrefixCombo ); 00058 layout->addRow( i18n( "Given name:" ), mGivenNameEdit ); 00059 layout->addRow( i18n( "Additional names:" ), mAdditionalNameEdit ); 00060 layout->addRow( i18n( "Family names:" ), mFamilyNameEdit ); 00061 layout->addRow( i18n( "Honorific suffixes:" ), mSuffixCombo ); 00062 00063 QStringList prefixList; 00064 prefixList += QString(); 00065 prefixList += i18n( "Dr." ); 00066 prefixList += i18n( "Miss" ); 00067 prefixList += i18n( "Mr." ); 00068 prefixList += i18n( "Mrs." ); 00069 prefixList += i18n( "Ms." ); 00070 prefixList += i18n( "Prof." ); 00071 prefixList.sort(); 00072 00073 QStringList suffixList; 00074 suffixList += QString(); 00075 suffixList += i18n( "I" ); 00076 suffixList += i18n( "II" ); 00077 suffixList += i18n( "III" ); 00078 suffixList += i18n( "Jr." ); 00079 suffixList += i18n( "Sr." ); 00080 suffixList.sort(); 00081 00082 mPrefixCombo->addItems( prefixList ); 00083 mSuffixCombo->addItems( suffixList ); 00084 00085 mPrefixCombo->lineEdit()->setFocus(); 00086 } 00087 00088 void NameEditDialog::setFamilyName( const QString &name ) 00089 { 00090 mFamilyNameEdit->setText( name ); 00091 } 00092 00093 QString NameEditDialog::familyName() const 00094 { 00095 return mFamilyNameEdit->text(); 00096 } 00097 00098 void NameEditDialog::setGivenName( const QString &name ) 00099 { 00100 mGivenNameEdit->setText( name ); 00101 } 00102 00103 QString NameEditDialog::givenName() const 00104 { 00105 return mGivenNameEdit->text(); 00106 } 00107 00108 void NameEditDialog::setPrefix( const QString &prefix ) 00109 { 00110 mPrefixCombo->setItemText( mPrefixCombo->currentIndex(), prefix ); 00111 } 00112 00113 QString NameEditDialog::prefix() const 00114 { 00115 return mPrefixCombo->currentText(); 00116 } 00117 00118 void NameEditDialog::setSuffix( const QString &suffix ) 00119 { 00120 mSuffixCombo->setItemText( mSuffixCombo->currentIndex(), suffix ); 00121 } 00122 00123 QString NameEditDialog::suffix() const 00124 { 00125 return mSuffixCombo->currentText(); 00126 } 00127 00128 void NameEditDialog::setAdditionalName( const QString &name ) 00129 { 00130 mAdditionalNameEdit->setText( name ); 00131 } 00132 00133 QString NameEditDialog::additionalName() const 00134 { 00135 return mAdditionalNameEdit->text(); 00136 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Apr 30 2012 21:49:15 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Apr 30 2012 21:49:15 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.