summaryrefslogtreecommitdiffabout
path: root/kaddressbook/phoneeditwidget.h
Unidiff
Diffstat (limited to 'kaddressbook/phoneeditwidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.h112
1 files changed, 0 insertions, 112 deletions
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index 0477b6c..fbf9fe7 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -40,211 +40,99 @@ class QCheckBox;
40class PhoneTypeNumberEdit; 40class PhoneTypeNumberEdit;
41 41
42#include <klineedit.h> 42#include <klineedit.h>
43#include <kcombobox.h> 43#include <kcombobox.h>
44#include <kabc/phonenumber.h> 44#include <kabc/phonenumber.h>
45 45
46typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; 46typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo;
47 47
48/** 48/**
49 Widget for editing phone numbers. 49 Widget for editing phone numbers.
50*/ 50*/
51class PhoneEditWidget : public QWidget 51class PhoneEditWidget : public QWidget
52{ 52{
53 Q_OBJECT 53 Q_OBJECT
54 54
55 public: 55 public:
56 PhoneEditWidget( QWidget *parent, const char *name = 0 ); 56 PhoneEditWidget( QWidget *parent, const char *name = 0 );
57 ~PhoneEditWidget(); 57 ~PhoneEditWidget();
58 58
59 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 59 void setPhoneNumbers( const KABC::PhoneNumber::List &list );
60 KABC::PhoneNumber::List phoneNumbers(); 60 KABC::PhoneNumber::List phoneNumbers();
61 61
62 // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); 62 // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
63 //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); 63 //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
64 64
65 signals: 65 signals:
66 void modified(); 66 void modified();
67 void typeChange( int oldType, int newType ); 67 void typeChange( int oldType, int newType );
68 68
69 private slots: 69 private slots:
70 void bottomVisible(); 70 void bottomVisible();
71 void addNumberInt( int ); 71 void addNumberInt( int );
72 void deleteEdit( PhoneTypeNumberEdit* ew ); 72 void deleteEdit( PhoneTypeNumberEdit* ew );
73 void addNumber(); 73 void addNumber();
74 void pendingDelete(); 74 void pendingDelete();
75 protected: 75 protected:
76 76
77 private: 77 private:
78 QScrollView* sv; 78 QScrollView* sv;
79 QPopupMenu *mPopup; 79 QPopupMenu *mPopup;
80 int mPopupCount; 80 int mPopupCount;
81 PhoneTypeNumberEdit* mPendingDelete; 81 PhoneTypeNumberEdit* mPendingDelete;
82 void setDefaults(); 82 void setDefaults();
83 PhoneTypeNumberEdit* appendEditCombo(); 83 PhoneTypeNumberEdit* appendEditCombo();
84 QWidget* mw; 84 QWidget* mw;
85 QVBoxLayout* mainLayout; 85 QVBoxLayout* mainLayout;
86 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; 86 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
87 87
88 KABC::PhoneNumber::List mPhoneList;
89}; 88};
90 89
91 90
92
93
94
95#if 0
96class PhoneEditWidget : public QWidget
97{
98 Q___OBJECT
99
100 public:
101 PhoneEditWidget( QWidget *parent, const char *name = 0 );
102 ~PhoneEditWidget();
103
104 void setPhoneNumbers( const KABC::PhoneNumber::List &list );
105 KABC::PhoneNumber::List phoneNumbers();
106
107 void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
108 KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
109
110 sig_nals:
111 void modified();
112 void typeChange( int oldType, int newType );
113
114 private sl_ots:
115 void edit();
116
117 void updatePrefEdit();
118 void updateSecondEdit();
119 void updateThirdEdit();
120 void updateFourthEdit();
121
122 void slotPrefEditChanged();
123 void slotSecondEditChanged();
124 void slotThirdEditChanged();
125 void slotFourthEditChanged();
126
127 protected:
128 void updateLineEdits();
129 void updateCombos();
130
131 private:
132 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
133 void updateEdit( PhoneTypeCombo *combo );
134 void updatePhoneNumber( PhoneTypeCombo *combo );
135 void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo );
136
137 PhoneTypeCombo *mPrefCombo;
138 PhoneTypeCombo *mSecondCombo;
139 PhoneTypeCombo *mThirdCombo;
140 PhoneTypeCombo *mFourthCombo;
141
142 KLineEdit *mPrefEdit;
143 KLineEdit *mSecondEdit;
144 KLineEdit *mThirdEdit;
145 KLineEdit *mFourthEdit;
146
147 KABC::PhoneNumber::List mPhoneList;
148};
149
150/**
151 Dialog for editing lists of phonenumbers.
152*/
153class PhoneEditDialog : public KDialogBase
154{
155 Q___OBJECT
156
157 public:
158 PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 );
159 ~PhoneEditDialog();
160
161 const KABC::PhoneNumber::List &phoneNumbers();
162 bool changed() const;
163
164 protected s__lots:
165 void slotAddPhoneNumber();
166 void slotRemovePhoneNumber();
167 void slotEditPhoneNumber();
168 void slotSelectionChanged();
169
170 private:
171 KABC::PhoneNumber::List mPhoneNumberList;
172 KABC::PhoneNumber::TypeList mTypeList;
173 KComboBox *mTypeBox;
174 KListView *mListView;
175
176 QPushButton *mRemoveButton;
177 QPushButton *mEditButton;
178
179 bool mChanged;
180};
181
182/**
183 Dialog for editing phone number types.
184*/
185class PhoneTypeDialog : public KDialogBase
186{
187 Q___OBJECT
188public:
189 PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 );
190
191 KABC::PhoneNumber phoneNumber();
192
193private:
194 KABC::PhoneNumber mPhoneNumber;
195 KABC::PhoneNumber::TypeList mTypeList;
196
197 QButtonGroup *mGroup;
198 QCheckBox *mPreferredBox;
199 KLineEdit *mNumber;
200};
201#endif
202
203class PhoneTypeNumberEdit : public QWidget 91class PhoneTypeNumberEdit : public QWidget
204{ 92{
205 Q_OBJECT 93 Q_OBJECT
206public: 94public:
207 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) 95 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent )
208 { 96 {
209 QHBoxLayout * lay = new QHBoxLayout( this ); 97 QHBoxLayout * lay = new QHBoxLayout( this );
210 lay->setSpacing( 2 ); 98 lay->setSpacing( 2 );
211 lay->setMargin( 0 ); 99 lay->setMargin( 0 );
212 mMinusButton = new QPushButton ( this ); 100 mMinusButton = new QPushButton ( this );
213 mMinusButton->setPixmap ( SmallIcon("minus")); 101 mMinusButton->setPixmap ( SmallIcon("minus"));
214 mCombo = new KComboBox( this ); 102 mCombo = new KComboBox( this );
215 mNumber = new KLineEdit( this ); 103 mNumber = new KLineEdit( this );
216 mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6); 104 mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6);
217 lay->addWidget( mMinusButton ); 105 lay->addWidget( mMinusButton );
218 lay->addWidget( mCombo ); 106 lay->addWidget( mCombo );
219 lay->addWidget( mNumber ); 107 lay->addWidget( mNumber );
220 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); 108 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
221 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); 109 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
222 connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), 110 connect( mNumber , SIGNAL ( textChanged ( const QString & ) ),
223 this, SLOT ( textChanged ( const QString & ) ) ); 111 this, SLOT ( textChanged ( const QString & ) ) );
224 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); 112 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
225 } 113 }
226 ~PhoneTypeNumberEdit() { 114 ~PhoneTypeNumberEdit() {
227 // qDebug("~PhoneTypeNumberEdit() "); 115 // qDebug("~PhoneTypeNumberEdit() ");
228 } 116 }
229 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) 117 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
230 { 118 {
231 mPhoneNumber = phoneNumber; 119 mPhoneNumber = phoneNumber;
232 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); 120 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
233 mCombo->setCurrentItem( index ); 121 mCombo->setCurrentItem( index );
234 mNumber->setText( mPhoneNumber.number() ); 122 mNumber->setText( mPhoneNumber.number() );
235 show(); 123 show();
236 mNumber->setFocus(); 124 mNumber->setFocus();
237 } 125 }
238 KABC::PhoneNumber phoneNumber() 126 KABC::PhoneNumber phoneNumber()
239 { 127 {
240 mPhoneNumber.setNumber( mNumber->text() ); 128 mPhoneNumber.setNumber( mNumber->text() );
241 int index = mCombo->currentItem(); 129 int index = mCombo->currentItem();
242 mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); 130 mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
243 return mPhoneNumber; 131 return mPhoneNumber;
244 } 132 }
245 bool isValid() 133 bool isValid()
246 { 134 {
247 if ( mNumber->text().isEmpty() )return false; 135 if ( mNumber->text().isEmpty() )return false;
248 return true; 136 return true;
249 } 137 }
250 int currentType() 138 int currentType()