kaddressbook

nameeditdialog.h
1 /*
2  This file is part of KAddressBook.
3  Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 
19  As a special exception, permission is given to link this program
20  with any edition of TQt, and distribute the resulting executable,
21  without including the source code for TQt in the source distribution.
22 */
23 
24 #ifndef NAMEEDITDIALOG_H
25 #define NAMEEDITDIALOG_H
26 
27 #include <kdialogbase.h>
28 #include <tdeabc/addressee.h>
29 
30 #include "addresseeconfig.h"
31 
32 class TQCheckBox;
33 
34 class KLineEdit;
35 class KComboBox;
36 
40 class NameEditDialog : public KDialogBase
41 {
42  TQ_OBJECT
43 
44 
45  public:
46  enum FormattedNameType
47  {
48  CustomName, // returned by @ref customFormattedName()
49  SimpleName, // form: givenName familyName
50  FullName, // form: prefix givenName additionalName familyName suffix
51  ReverseNameWithComma, // form: familyName, givenName
52  ReverseName, // form: familyName givenName
53  Organization // the organization name
54  };
55 
56  NameEditDialog( const TDEABC::Addressee &addr, int type,
57  bool readOnly, TQWidget *parent, const char *name = 0 );
58  ~NameEditDialog();
59 
60  TQString familyName() const;
61  TQString givenName() const;
62  TQString prefix() const;
63  TQString suffix() const;
64  TQString additionalName() const;
65  TQString customFormattedName() const;
66  int formattedNameType() const;
67 
68  bool changed() const;
69 
70  static TQString formattedName( const TDEABC::Addressee &addr, int type );
71 
72  protected slots:
73  void slotHelp();
74 
75  private slots:
76  void parseBoxChanged( bool );
77  void formattedNameTypeChanged();
78  void formattedNameChanged( const TQString& );
79  void typeChanged( int );
80  void initTypeCombo();
81  void modified();
82 
83  private:
84  KComboBox *mSuffixCombo;
85  KComboBox *mPrefixCombo;
86  KComboBox *mFormattedNameCombo;
87  KLineEdit *mFamilyNameEdit;
88  KLineEdit *mGivenNameEdit;
89  KLineEdit *mAdditionalNameEdit;
90  KLineEdit *mFormattedNameEdit;
91  TQCheckBox *mParseBox;
92 
93  AddresseeConfig mAddresseeConfig;
94  TDEABC::Addressee mAddressee;
95  TQString mCustomFormattedName;
96  bool mChanged;
97 };
98 
99 #endif
Editor dialog for name details, like given name, family name etc.