-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 21 | ||||
-rw-r--r-- | kaddressbook/phoneeditwidget.cpp | 8 | ||||
-rw-r--r-- | kaddressbook/phoneeditwidget.h | 112 |
3 files changed, 18 insertions, 123 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 966efa5..c4083a9 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -155,17 +155,17 @@ void AddresseeEditorWidget::setupTab1() | |||
155 | 155 | ||
156 | //US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); | 156 | //US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); |
157 | bool horLayout = false; | 157 | bool horLayout = false; |
158 | int maxCol = 1; | 158 | int maxCol = 1; |
159 | if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) { | 159 | if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) { |
160 | horLayout = true; | 160 | horLayout = true; |
161 | maxCol = 3; | 161 | maxCol = 3; |
162 | } | 162 | } |
163 | QGridLayout *layout = new QGridLayout( tab1, 8-maxCol, maxCol ); | 163 | QGridLayout *layout = new QGridLayout( tab1, 7-maxCol, maxCol ); |
164 | 164 | ||
165 | layout->setMargin( KDialogBase::marginHintSmall() ); | 165 | layout->setMargin( KDialogBase::marginHintSmall() ); |
166 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 166 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
167 | 167 | ||
168 | QLabel *label; | 168 | QLabel *label; |
169 | KSeparator* bar; | 169 | KSeparator* bar; |
170 | QPushButton *button; | 170 | QPushButton *button; |
171 | 171 | ||
@@ -197,19 +197,24 @@ void AddresseeEditorWidget::setupTab1() | |||
197 | 197 | ||
198 | button = new QPushButton( i18n( "Role:" ), tab1 ); | 198 | button = new QPushButton( i18n( "Role:" ), tab1 ); |
199 | connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) ); | 199 | connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) ); |
200 | //label = new QLabel( i18n( "Role:" ), tab1 ); | 200 | //label = new QLabel( i18n( "Role:" ), tab1 ); |
201 | mRoleEdit = new KLineEdit( tab1 ); | 201 | mRoleEdit = new KLineEdit( tab1 ); |
202 | connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), | 202 | connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), |
203 | SLOT( textChanged( const QString& ) ) ); | 203 | SLOT( textChanged( const QString& ) ) ); |
204 | //label->setBuddy( mRoleEdit ); | 204 | //label->setBuddy( mRoleEdit ); |
205 | layout->addWidget( button, 1, 0 ); | 205 | if ( horLayout ) { |
206 | layout->addWidget( mRoleEdit, 1, 1 ); | 206 | layout->addWidget( button, 0, 2 ); |
207 | 207 | layout->addWidget( mRoleEdit, 0, 3 ); | |
208 | |||
209 | } else { | ||
210 | layout->addWidget( button, 1, 0 ); | ||
211 | layout->addWidget( mRoleEdit, 1, 1 ); | ||
212 | } | ||
208 | // Organization | 213 | // Organization |
209 | button = new QPushButton( i18n( "Organization:" ), tab1 ); | 214 | button = new QPushButton( i18n( "Organization:" ), tab1 ); |
210 | connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) ); | 215 | connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) ); |
211 | //label = new QLabel( i18n( "Organization:" ), tab1 ); | 216 | //label = new QLabel( i18n( "Organization:" ), tab1 ); |
212 | mOrgEdit = new KLineEdit( tab1 ); | 217 | mOrgEdit = new KLineEdit( tab1 ); |
213 | //label->setBuddy( mOrgEdit ); | 218 | //label->setBuddy( mOrgEdit ); |
214 | connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), | 219 | connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), |
215 | SLOT( textChanged( const QString& ) ) ); | 220 | SLOT( textChanged( const QString& ) ) ); |
@@ -221,18 +226,18 @@ void AddresseeEditorWidget::setupTab1() | |||
221 | layout->addWidget( button, 2, 0 ); | 226 | layout->addWidget( button, 2, 0 ); |
222 | layout->addWidget( mOrgEdit, 2, 1 ); | 227 | layout->addWidget( mOrgEdit, 2, 1 ); |
223 | } | 228 | } |
224 | 229 | ||
225 | // File as (formatted name) | 230 | // File as (formatted name) |
226 | label = new QLabel( i18n( "Format.n.:" ), tab1 ); | 231 | label = new QLabel( i18n( "Format.n.:" ), tab1 ); |
227 | mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); | 232 | mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); |
228 | if ( horLayout ) { | 233 | if ( horLayout ) { |
229 | layout->addWidget( label, 0,2 ); | 234 | layout->addWidget( label, 1,0 ); |
230 | layout->addWidget( mFormattedNameLabel, 0, 3 ); | 235 | layout->addWidget( mFormattedNameLabel, 1, 1 ); |
231 | } else { | 236 | } else { |
232 | layout->addWidget( label, 3, 0 ); | 237 | layout->addWidget( label, 3, 0 ); |
233 | layout->addWidget( mFormattedNameLabel, 3, 1 ); | 238 | layout->addWidget( mFormattedNameLabel, 3, 1 ); |
234 | } | 239 | } |
235 | /* LR | 240 | /* LR |
236 | // Left hand separator. This separator doesn't go all the way | 241 | // Left hand separator. This separator doesn't go all the way |
237 | // across so the dialog still flows from top to bottom | 242 | // across so the dialog still flows from top to bottom |
238 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 243 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
@@ -253,18 +258,18 @@ void AddresseeEditorWidget::setupTab1() | |||
253 | connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); | 258 | connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); |
254 | //US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); | 259 | //US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); |
255 | int iii; | 260 | int iii; |
256 | #ifndef DESKTOP_VERSION | 261 | #ifndef DESKTOP_VERSION |
257 | iii = 7; | 262 | iii = 7; |
258 | #else | 263 | #else |
259 | iii = 8; | 264 | iii = 8; |
260 | #endif | 265 | #endif |
261 | layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, maxCol ); | 266 | layout->addMultiCellWidget( mPhoneEditWidget, 5-maxCol, 5-maxCol+4, 0, maxCol ); |
262 | ++iii; | 267 | iii = 6-maxCol+4; |
263 | /* LR | 268 | /* LR |
264 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 269 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
265 | //US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); | 270 | //US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); |
266 | layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); | 271 | layout->addMultiCellWidget( bar, 9, 9, 0, 2 ); |
267 | */ | 272 | */ |
268 | /*US | 273 | /*US |
269 | ////////////////////////////////////// | 274 | ////////////////////////////////////// |
270 | // Addresses (lower left) | 275 | // Addresses (lower left) |
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp index 7e2aec1..5639aa2 100644 --- a/kaddressbook/phoneeditwidget.cpp +++ b/kaddressbook/phoneeditwidget.cpp | |||
@@ -62,25 +62,27 @@ PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) | |||
62 | temp->setAlignment( Qt::AlignCenter ); | 62 | temp->setAlignment( Qt::AlignCenter ); |
63 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | 63 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
64 | QPushButton *addBut = new QPushButton ( "add", this ); | 64 | QPushButton *addBut = new QPushButton ( "add", this ); |
65 | addBut->setPixmap ( SmallIcon("plus")); | 65 | addBut->setPixmap ( SmallIcon("plus")); |
66 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); | 66 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); |
67 | connect(addBut,SIGNAL(clicked ()),SLOT(addNumber())); | 67 | connect(addBut,SIGNAL(clicked ()),SLOT(addNumber())); |
68 | 68 | ||
69 | sv = new QScrollView( this ); | 69 | sv = new QScrollView( this ); |
70 | sv->setFrameStyle ( QFrame::Panel | QFrame::Plain ); | 70 | sv->setFrameStyle ( QFrame::Plain ); |
71 | sv->setLineWidth ( 1 ); | 71 | sv->setLineWidth ( 0 ); |
72 | sv->setMidLineWidth ( 1 ); | 72 | sv->setMidLineWidth ( 0 ); |
73 | mw = new QWidget ( sv->viewport() ); | 73 | mw = new QWidget ( sv->viewport() ); |
74 | sv->addChild(mw); | 74 | sv->addChild(mw); |
75 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 75 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
76 | mainLayout = new QVBoxLayout ( mw ); | 76 | mainLayout = new QVBoxLayout ( mw ); |
77 | mainLayout->setMargin( 0 ); | 77 | mainLayout->setMargin( 0 ); |
78 | mainLayout->setSpacing( 0 ); | 78 | mainLayout->setSpacing( 0 ); |
79 | gridLayout->setMargin( 2 ); | ||
80 | gridLayout->setSpacing( 4 ); | ||
79 | if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) { | 81 | if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) { |
80 | gridLayout->addWidget( addBut, 0, 0 ); | 82 | gridLayout->addWidget( addBut, 0, 0 ); |
81 | gridLayout->addWidget( temp, 0, 1 ); | 83 | gridLayout->addWidget( temp, 0, 1 ); |
82 | gridLayout->addMultiCellWidget( sv, 1,1 , 0,1 ); | 84 | gridLayout->addMultiCellWidget( sv, 1,1 , 0,1 ); |
83 | } else { | 85 | } else { |
84 | gridLayout->addWidget( temp, 1, 0 ); | 86 | gridLayout->addWidget( temp, 1, 0 ); |
85 | gridLayout->addWidget( addBut, 0, 0 ); | 87 | gridLayout->addWidget( addBut, 0, 0 ); |
86 | gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); | 88 | gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); |
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h index 0477b6c..fbf9fe7 100644 --- a/kaddressbook/phoneeditwidget.h +++ b/kaddressbook/phoneeditwidget.h | |||
@@ -80,131 +80,19 @@ class PhoneEditWidget : public QWidget | |||
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 | ||
96 | class 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 | */ | ||
153 | class 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 | */ | ||
185 | class PhoneTypeDialog : public KDialogBase | ||
186 | { | ||
187 | Q___OBJECT | ||
188 | public: | ||
189 | PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 ); | ||
190 | |||
191 | KABC::PhoneNumber phoneNumber(); | ||
192 | |||
193 | private: | ||
194 | KABC::PhoneNumber mPhoneNumber; | ||
195 | KABC::PhoneNumber::TypeList mTypeList; | ||
196 | |||
197 | QButtonGroup *mGroup; | ||
198 | QCheckBox *mPreferredBox; | ||
199 | KLineEdit *mNumber; | ||
200 | }; | ||
201 | #endif | ||
202 | |||
203 | class PhoneTypeNumberEdit : public QWidget | 91 | class PhoneTypeNumberEdit : public QWidget |
204 | { | 92 | { |
205 | Q_OBJECT | 93 | Q_OBJECT |
206 | public: | 94 | public: |
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 ); |