summaryrefslogtreecommitdiffabout
path: root/kaddressbook/addresseditwidget.h
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kaddressbook/addresseditwidget.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'kaddressbook/addresseditwidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseditwidget.h159
1 files changed, 159 insertions, 0 deletions
diff --git a/kaddressbook/addresseditwidget.h b/kaddressbook/addresseditwidget.h
new file mode 100644
index 0000000..bc96d74
--- a/dev/null
+++ b/kaddressbook/addresseditwidget.h
@@ -0,0 +1,159 @@
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24#ifndef ADDRESSEDITWIDGET_H
25#define ADDRESSEDITWIDGET_H
26
27#include <qwidget.h>
28
29#include <kdialogbase.h>
30#include <kabc/address.h>
31#include <kabc/addressee.h>
32
33#include "addresseeconfig.h"
34#include "typecombo.h"
35
36class QButtonGroup;
37class QCheckBox;
38class QListView;
39#ifndef KAB_EMBEDDED
40class QTextEdit;
41#else //KAB_EMBEDDED
42class QMultiLineEdit;
43#endif //KAB_EMBEDDED
44class QToolButton;
45
46class KComboBox;
47class KLineEdit;
48class KListView;
49
50typedef TypeCombo<KABC::Address> AddressTypeCombo;
51
52/**
53 Editor widget for addresses.
54 */
55class AddressEditWidget : public QWidget
56{
57 Q_OBJECT
58
59 public:
60 AddressEditWidget( QWidget *parent, const char *name = 0 );
61 ~AddressEditWidget();
62
63 KABC::Address::List addresses();
64 void setAddresses( const KABC::Addressee &addr,
65 const KABC::Address::List &list );
66
67 void updateTypeCombo( const KABC::Address::List&, KComboBox* );
68 KABC::Address currentAddress( KComboBox*, int );
69
70 signals:
71 void modified();
72
73 protected slots:
74 void updateAddressEdit();
75
76 void edit();
77
78 private:
79 AddresseeConfig * mConfig;
80 AddressTypeCombo *mTypeCombo;
81
82 QPushButton *mEditButton;
83#ifndef KAB_EMBEDDED
84 QTextEdit *mAddressTextEdit;
85#else //KAB_EMBEDDED
86 QMultiLineEdit *mAddressTextEdit;
87#endif //KAB_EMBEDDED
88
89 KABC::Address::List mAddressList;
90 KABC::Addressee mAddressee;
91 int mIndex;
92};
93
94/**
95 Dialog for editing address details.
96 */
97class AddressEditDialog : public KDialogBase
98{
99 Q_OBJECT
100
101 public:
102 AddressEditDialog( const KABC::Address::List &list, int selected,
103 QWidget *parent, const char *name = 0 );
104 ~AddressEditDialog();
105
106 KABC::Address::List addresses();
107 bool changed() const;
108
109 protected slots:
110 void addAddress();
111 void removeAddress();
112 void changeType();
113
114 void updateAddressEdits();
115 void modified();
116
117 private:
118 void saveAddress( KABC::Address &addr );
119 void fillCountryCombo();
120
121 AddressTypeCombo *mTypeCombo;
122#ifndef KAB_EMBEDDED
123 QTextEdit *mStreetTextEdit;
124#else //KAB_EMBEDDED
125 QMultiLineEdit *mStreetTextEdit;
126#endif //KAB_EMBEDDED
127 KComboBox *mCountryCombo;
128 KLineEdit *mRegionEdit;
129 KLineEdit *mLocalityEdit;
130 KLineEdit *mPostalCodeEdit;
131 KLineEdit *mPOBoxEdit;
132 QCheckBox *mPreferredCheckBox;
133
134 QPushButton *mRemoveButton;
135 QPushButton *mChangeTypeButton;
136
137 KABC::Address::List mAddressList;
138 KABC::Address *mPreviousAddress;
139 bool mChanged;
140};
141
142/**
143 Dialog for selecting an address type.
144 */
145class AddressTypeDialog : public KDialogBase
146{
147 public:
148 AddressTypeDialog( int type, QWidget *parent );
149 ~AddressTypeDialog();
150
151 int type() const;
152
153 private:
154 QButtonGroup *mGroup;
155
156 KABC::Address::TypeList mTypeList;
157};
158
159#endif