nameeditdialog.h
00001 /* 00002 This file is part of KAddressBook. 00003 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of TQt, and distribute the resulting executable, 00021 without including the source code for TQt in the source distribution. 00022 */ 00023 00024 #ifndef NAMEEDITDIALOG_H 00025 #define NAMEEDITDIALOG_H 00026 00027 #include <kdialogbase.h> 00028 #include <kabc/addressee.h> 00029 00030 #include "addresseeconfig.h" 00031 00032 class TQCheckBox; 00033 00034 class KLineEdit; 00035 class KComboBox; 00036 00040 class NameEditDialog : public KDialogBase 00041 { 00042 Q_OBJECT 00043 TQ_OBJECT 00044 00045 public: 00046 enum FormattedNameType 00047 { 00048 CustomName, // returned by @ref customFormattedName() 00049 SimpleName, // form: givenName familyName 00050 FullName, // form: prefix givenName additionalName familyName suffix 00051 ReverseNameWithComma, // form: familyName, givenName 00052 ReverseName, // form: familyName givenName 00053 Organization // the organization name 00054 }; 00055 00056 NameEditDialog( const KABC::Addressee &addr, int type, 00057 bool readOnly, TQWidget *parent, const char *name = 0 ); 00058 ~NameEditDialog(); 00059 00060 TQString familyName() const; 00061 TQString givenName() const; 00062 TQString prefix() const; 00063 TQString suffix() const; 00064 TQString additionalName() const; 00065 TQString customFormattedName() const; 00066 int formattedNameType() const; 00067 00068 bool changed() const; 00069 00070 static TQString formattedName( const KABC::Addressee &addr, int type ); 00071 00072 protected slots: 00073 void slotHelp(); 00074 00075 private slots: 00076 void parseBoxChanged( bool ); 00077 void formattedNameTypeChanged(); 00078 void formattedNameChanged( const TQString& ); 00079 void typeChanged( int ); 00080 void initTypeCombo(); 00081 void modified(); 00082 00083 private: 00084 KComboBox *mSuffixCombo; 00085 KComboBox *mPrefixCombo; 00086 KComboBox *mFormattedNameCombo; 00087 KLineEdit *mFamilyNameEdit; 00088 KLineEdit *mGivenNameEdit; 00089 KLineEdit *mAdditionalNameEdit; 00090 KLineEdit *mFormattedNameEdit; 00091 TQCheckBox *mParseBox; 00092 00093 AddresseeConfig mAddresseeConfig; 00094 KABC::Addressee mAddressee; 00095 TQString mCustomFormattedName; 00096 bool mChanged; 00097 }; 00098 00099 #endif