kaddressbook

phoneeditwidget.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 PHONEEDITWIDGET_H
25 #define PHONEEDITWIDGET_H
26 
27 #include <kcombobox.h>
28 #include <kdialogbase.h>
29 
30 #include "addresseeconfig.h"
31 
32 class TQButtonGroup;
33 class TQCheckBox;
34 class TQSignalMapper;
35 
36 class KLineEdit;
37 class KComboBox;
38 
39 class PhoneTypeCombo : public KComboBox
40 {
41  TQ_OBJECT
42 
43 
44  public:
45  PhoneTypeCombo( TQWidget *parent );
46  ~PhoneTypeCombo();
47 
48  void setType( int type );
49  int type() const;
50 
51  signals:
52  void modified();
53 
54  protected slots:
55  void selected( int );
56  void otherSelected();
57 
58  private:
59  void update();
60 
61  int mType;
62  int mLastSelected;
63  TQValueList<int> mTypeList;
64 };
65 
66 class PhoneNumberWidget : public TQWidget
67 {
68  TQ_OBJECT
69 
70 
71  public:
72  PhoneNumberWidget( TQWidget *parent );
73 
74  void setNumber( const TDEABC::PhoneNumber &number );
75  TDEABC::PhoneNumber number() const;
76 
77  void setReadOnly( bool readOnly );
78 
79  signals:
80  void modified();
81 
82  private:
83  PhoneTypeCombo *mTypeCombo;
84  KLineEdit *mNumberEdit;
85  TDEABC::PhoneNumber mNumber;
86 };
87 
91 class PhoneEditWidget : public TQWidget
92 {
93  TQ_OBJECT
94 
95 
96  public:
97  PhoneEditWidget( TQWidget *parent, const char *name = 0 );
98  ~PhoneEditWidget();
99 
100  void setPhoneNumbers( const TDEABC::PhoneNumber::List &list );
101  TDEABC::PhoneNumber::List phoneNumbers() const;
102 
103  void setReadOnly( bool readOnly );
104 
105  signals:
106  void modified();
107 
108  protected slots:
109  void add();
110  void remove();
111  void changed();
112  void changed( int pos );
113 
114  private:
115  void recreateNumberWidgets();
116 
117  TDEABC::PhoneNumber::List mPhoneNumberList;
118  TQPtrList<PhoneNumberWidget> mWidgets;
119 
120  TQPushButton *mAddButton;
121  TQPushButton *mRemoveButton;
122  TQVBoxLayout *mWidgetLayout;
123 
124  bool mReadOnly;
125  TQSignalMapper *mMapper;
126 };
127 
131 class PhoneTypeDialog : public KDialogBase
132 {
133  TQ_OBJECT
134 
135  public:
136  PhoneTypeDialog( int type, TQWidget *parent );
137 
138  int type() const;
139 
140  private:
141  int mType;
142  TDEABC::PhoneNumber::TypeList mTypeList;
143 
144  TQButtonGroup *mGroup;
145  TQCheckBox *mPreferredBox;
146 };
147 
148 #endif
Widget for editing phone numbers.
Dialog for editing phone number types.