kaddressbook

addresseditwidget.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 ADDRESSEDITWIDGET_H
25 #define ADDRESSEDITWIDGET_H
26 
27 #include <tqwidget.h>
28 
29 #include <kdialogbase.h>
30 #include <tdeabc/address.h>
31 #include <tdeabc/addressee.h>
32 
33 #include "addresseeconfig.h"
34 #include "typecombo.h"
35 
36 class TQButtonGroup;
37 class TQCheckBox;
38 class TQListView;
39 class TQTextEdit;
40 class TQToolButton;
41 
42 class KActiveLabel;
43 class KComboBox;
44 class KLineEdit;
45 class TDEListView;
46 
48 
52 class AddressEditWidget : public TQWidget
53 {
54  TQ_OBJECT
55 
56 
57  public:
58  AddressEditWidget( TQWidget *parent, const char *name = 0 );
60 
61  TDEABC::Address::List addresses();
62  void setAddresses( const TDEABC::Addressee &addr,
63  const TDEABC::Address::List &list );
64  void updateAddressee( const TDEABC::Addressee &addr );
65 
66  void updateTypeCombo( const TDEABC::Address::List&, KComboBox* );
67  TDEABC::Address currentAddress( KComboBox*, int );
68 
69  void setReadOnly( bool readOnly );
70 
71  signals:
72  void modified();
73 
74  protected slots:
75  void updateAddressEdit();
76 
77  void edit();
78 
79  private:
80  AddressTypeCombo *mTypeCombo;
81 
82  TQPushButton *mEditButton;
83  KActiveLabel *mAddressField;
84 
85  TDEABC::Address::List mAddressList;
86  TDEABC::Addressee mAddressee;
87  int mIndex;
88 };
89 
93 class AddressEditDialog : public KDialogBase
94 {
95  TQ_OBJECT
96 
97 
98  public:
99  AddressEditDialog( const TDEABC::Address::List &list, int selected,
100  TQWidget *parent, const char *name = 0 );
102 
103  TDEABC::Address::List addresses();
104  bool changed() const;
105 
106  protected slots:
107  void addAddress();
108  void removeAddress();
109  void changeType();
110  void editLabel();
111 
112  void updateAddressEdits();
113  void modified();
114 
115  private:
116  void saveAddress( TDEABC::Address &addr );
117  void fillCountryCombo();
118  TQStringList sortLocaleAware( const TQStringList& );
119 
120  AddressTypeCombo *mTypeCombo;
121  TQTextEdit *mStreetTextEdit;
122  KComboBox *mCountryCombo;
123  KLineEdit *mRegionEdit;
124  KLineEdit *mLocalityEdit;
125  KLineEdit *mPostalCodeEdit;
126  KLineEdit *mPOBoxEdit;
127  TQCheckBox *mPreferredCheckBox;
128 
129  TQPushButton *mRemoveButton;
130  TQPushButton *mChangeTypeButton;
131 
132  TDEABC::Address::List mAddressList;
133  TDEABC::Address *mPreviousAddress;
134  bool mChanged;
135 
136  TQString mLabel;
137 };
138 
142 class AddressTypeDialog : public KDialogBase
143 {
144  public:
145  AddressTypeDialog( int type, TQWidget *parent );
147 
148  int type() const;
149 
150  private:
151  TQButtonGroup *mGroup;
152 
153  TDEABC::Address::TypeList mTypeList;
154 };
155 
156 #endif
Dialog for editing address details.
Editor widget for addresses.
Dialog for selecting an address type.
Combo box for type information of Addresses and Phone numbers.
Definition: typecombo.h:35