summaryrefslogtreecommitdiffabout
path: root/kaddressbook/addresseditwidget.cpp
Unidiff
Diffstat (limited to 'kaddressbook/addresseditwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseditwidget.cpp55
1 files changed, 31 insertions, 24 deletions
diff --git a/kaddressbook/addresseditwidget.cpp b/kaddressbook/addresseditwidget.cpp
index 3dcd592..83908d0 100644
--- a/kaddressbook/addresseditwidget.cpp
+++ b/kaddressbook/addresseditwidget.cpp
@@ -1,622 +1,629 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 2003 Tobias Koenig <tokoe@kde.org> 4 2003 Tobias Koenig <tokoe@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qbuttongroup.h> 25#include <q3buttongroup.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qhbox.h> 27#include <q3hbox.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qlistbox.h> 30#include <q3listbox.h>
31#include <qlistview.h> 31#include <q3listview.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qsignal.h> 33#include <q3signal.h>
34#include <qstring.h> 34#include <qstring.h>
35#include <qapplication.h> 35#include <qapplication.h>
36#include <QDesktopWidget>
37
38#include <Q3VBoxLayout>
39#include <Q3GridLayout>
36 40
37#ifndef KAB_EMBEDDED 41#ifndef KAB_EMBEDDED
38#include <qtextedit.h> 42#include <q3textedit.h>
43//Added by qt3to4:
44#include <Q3ValueList>
45#include <Q3VBoxLayout>
39#include <kaccelmanager.h> 46#include <kaccelmanager.h>
40#include <kbuttonbox.h> 47#include <kbuttonbox.h>
41#else //KAB_EMBEDDED 48#else //KAB_EMBEDDED
42#include <qmultilineedit.h> 49#include <q3multilineedit.h>
43#endif //KAB_EMBEDDED 50#endif //KAB_EMBEDDED
44 51
45#include <qtoolbutton.h> 52#include <qtoolbutton.h>
46#include <qtooltip.h> 53#include <qtooltip.h>
47 54
48#include <kapplication.h> 55#include <kapplication.h>
49#include <kcombobox.h> 56#include <kcombobox.h>
50#include <kconfig.h> 57#include <kconfig.h>
51#include <kdebug.h> 58#include <kdebug.h>
52#include <kdialog.h> 59#include <kdialog.h>
53#include <kiconloader.h> 60#include <kiconloader.h>
54#include <klineedit.h> 61#include <klineedit.h>
55#include <klistview.h> 62#include <klistview.h>
56#include <klocale.h> 63#include <klocale.h>
57#include <kglobal.h> 64#include <kglobal.h>
58#include <kmessagebox.h> 65#include <kmessagebox.h>
59#include <kseparator.h> 66#include <kseparator.h>
60 67
61#include "addresseditwidget.h" 68#include "addresseditwidget.h"
62 69
63 70
64 71
65AddressEditWidget::AddressEditWidget( QWidget *parent, const char *name ) 72AddressEditWidget::AddressEditWidget( QWidget *parent, const char *name )
66 : QWidget( parent, name ) 73 : QWidget( parent, name )
67{ 74{
68 75
69 mConfig = AddresseeConfig::instance(); 76 mConfig = AddresseeConfig::instance();
70 QVBoxLayout *layout = new QVBoxLayout( this ); 77 Q3VBoxLayout *layout = new Q3VBoxLayout( this );
71 layout->setSpacing( KDialog::spacingHintSmall() ); 78 layout->setSpacing( KDialog::spacingHintSmall() );
72 QHBox *b1 = new QHBox( this); 79 Q3HBox *b1 = new Q3HBox( this);
73 //QLabel * label = new QLabel( b1 ); 80 //QLabel * label = new QLabel( b1 );
74 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); 81 //label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
75 82
76 83
77 //label->setAlignment( AlignCenter); 84 //label->setAlignment( AlignCenter);
78 layout->addWidget( b1 ); 85 layout->addWidget( b1 );
79 mTypeCombo = new AddressTypeCombo( mAddressList, b1 ); 86 mTypeCombo = new AddressTypeCombo( mAddressList, b1 );
80 QPushButton *editButton = new QPushButton( i18n( "&Edit Addresses..." ), 87 QPushButton *editButton = new QPushButton( i18n( "&Edit Addresses..." ),
81 b1 ); 88 b1 );
82 connect( mTypeCombo, SIGNAL( activated( int ) ), 89 connect( mTypeCombo, SIGNAL( activated( int ) ),
83 SLOT( updateAddressEdit() ) ); 90 SLOT( updateAddressEdit() ) );
84 // layout->addWidget( mTypeCombo ); 91 // layout->addWidget( mTypeCombo );
85 92
86#ifndef KAB_EMBEDDED 93#ifndef KAB_EMBEDDED
87 mAddressTextEdit = new QTextEdit( this ); 94 mAddressTextEdit = new Q3TextEdit( this );
88 mAddressTextEdit->setReadOnly( true ); 95 mAddressTextEdit->setReadOnly( true );
89 mAddressTextEdit->setMinimumHeight( 20 ); 96 mAddressTextEdit->setMinimumHeight( 20 );
90#else //KAB_EMBEDDED 97#else //KAB_EMBEDDED
91 mAddressTextEdit = new QMultiLineEdit( this ); 98 mAddressTextEdit = new Q3MultiLineEdit( this );
92 mAddressTextEdit->setReadOnly( true ); 99 mAddressTextEdit->setReadOnly( true );
93 mAddressTextEdit->setMinimumHeight( 20 ); 100 mAddressTextEdit->setMinimumHeight( 20 );
94#endif //KAB_EMBEDDED 101#endif //KAB_EMBEDDED
95 102
96 layout->addWidget( mAddressTextEdit ); 103 layout->addWidget( mAddressTextEdit );
97 104
98 105
99 connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) ); 106 connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) );
100} 107}
101 108
102AddressEditWidget::~AddressEditWidget() 109AddressEditWidget::~AddressEditWidget()
103{ 110{
104 111
105} 112}
106 113
107KABC::Address::List AddressEditWidget::addresses() 114KABC::Address::List AddressEditWidget::addresses()
108{ 115{
109 KABC::Address::List retList; 116 KABC::Address::List retList;
110 117
111 KABC::Address::List::Iterator it; 118 KABC::Address::List::Iterator it;
112 for ( it = mAddressList.begin(); it != mAddressList.end(); ++it ) 119 for ( it = mAddressList.begin(); it != mAddressList.end(); ++it )
113 if ( !(*it).isEmpty() ) 120 if ( !(*it).isEmpty() )
114 retList.append( *it ); 121 retList.append( *it );
115 122
116 return retList; 123 return retList;
117} 124}
118 125
119void AddressEditWidget::setAddresses( const KABC::Addressee &addr, 126void AddressEditWidget::setAddresses( const KABC::Addressee &addr,
120 const KABC::Address::List &list ) 127 const KABC::Address::List &list )
121{ 128{
122 mAddressee = addr; 129 mAddressee = addr;
123 130
124 mAddressList.clear(); 131 mAddressList.clear();
125 132
126 // Insert types for existing numbers. 133 // Insert types for existing numbers.
127 mTypeCombo->insertTypeList( list ); 134 mTypeCombo->insertTypeList( list );
128 135
129 QValueList<int> defaultTypes; 136 Q3ValueList<int> defaultTypes;
130 defaultTypes << KABC::Address::Home; 137 defaultTypes << KABC::Address::Home;
131 defaultTypes << KABC::Address::Work; 138 defaultTypes << KABC::Address::Work;
132 139
133 mConfig->setUid( mAddressee.uid() ); 140 mConfig->setUid( mAddressee.uid() );
134 QValueList<int> configList = mConfig->noDefaultAddrTypes(); 141 Q3ValueList<int> configList = mConfig->noDefaultAddrTypes();
135 QValueList<int>::ConstIterator it; 142 Q3ValueList<int>::ConstIterator it;
136 for ( it = configList.begin(); it != configList.end(); ++it ) 143 for ( it = configList.begin(); it != configList.end(); ++it )
137 defaultTypes.remove( *it ); 144 defaultTypes.remove( *it );
138 145
139 // Insert default types. 146 // Insert default types.
140 // Doing this for mPrefCombo is enough because the list is shared by all 147 // Doing this for mPrefCombo is enough because the list is shared by all
141 // combos. 148 // combos.
142 for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) { 149 for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) {
143 if ( !mTypeCombo->hasType( *it ) ) 150 if ( !mTypeCombo->hasType( *it ) )
144 mTypeCombo->insertType( list, *it, Address( *it ) ); 151 mTypeCombo->insertType( list, *it, Address( *it ) );
145 } 152 }
146 153
147 mTypeCombo->updateTypes(); 154 mTypeCombo->updateTypes();
148 155
149 // find preferred address which will be shown 156 // find preferred address which will be shown
150 int preferred = KABC::Address::Home; // default if no preferred address set 157 int preferred = KABC::Address::Home; // default if no preferred address set
151 uint i; 158 uint i;
152 for (i = 0; i < list.count(); i++) 159 for (i = 0; i < list.count(); i++)
153 if ( list[i].type() & KABC::Address::Pref ) { 160 if ( list[i].type() & KABC::Address::Pref ) {
154 preferred = list[i].type(); 161 preferred = list[i].type();
155 break; 162 break;
156 } 163 }
157 164
158 mTypeCombo->selectType( preferred ); 165 mTypeCombo->selectType( preferred );
159 166
160 updateAddressEdit(); 167 updateAddressEdit();
161} 168}
162 169
163void AddressEditWidget::edit() 170void AddressEditWidget::edit()
164{ 171{
165 AddressEditDialog dialog( mAddressList, mTypeCombo->currentItem(), this ); 172 AddressEditDialog dialog( mAddressList, mTypeCombo->currentItem(), this );
166 if ( dialog.exec() ) { 173 if ( dialog.exec() ) {
167 if ( dialog.changed() ) { 174 if ( dialog.changed() ) {
168 mAddressList = dialog.addresses(); 175 mAddressList = dialog.addresses();
169 176
170 bool hasHome = false, hasWork = false; 177 bool hasHome = false, hasWork = false;
171 KABC::Address::List::Iterator it; 178 KABC::Address::List::Iterator it;
172 for ( it = mAddressList.begin(); it != mAddressList.end(); ++it ) { 179 for ( it = mAddressList.begin(); it != mAddressList.end(); ++it ) {
173 if ( (*it).type() == KABC::Address::Home ) { 180 if ( (*it).type() == KABC::Address::Home ) {
174 if ( !(*it).isEmpty() ) 181 if ( !(*it).isEmpty() )
175 hasHome = true; 182 hasHome = true;
176 } 183 }
177 if ( (*it).type() == KABC::Address::Work ) { 184 if ( (*it).type() == KABC::Address::Work ) {
178 if ( !(*it).isEmpty() ) 185 if ( !(*it).isEmpty() )
179 hasWork = true; 186 hasWork = true;
180 } 187 }
181 } 188 }
182 189
183 mConfig->setUid( mAddressee.uid() ); 190 mConfig->setUid( mAddressee.uid() );
184 QValueList<int> configList; 191 Q3ValueList<int> configList;
185 if ( !hasHome ) { 192 if ( !hasHome ) {
186 configList << KABC::Address::Home; 193 configList << KABC::Address::Home;
187 } 194 }
188 if ( !hasWork ) { 195 if ( !hasWork ) {
189 configList << KABC::Address::Work; 196 configList << KABC::Address::Work;
190 } 197 }
191 mConfig->setNoDefaultAddrTypes( configList ); 198 mConfig->setNoDefaultAddrTypes( configList );
192 199
193 mTypeCombo->updateTypes(); 200 mTypeCombo->updateTypes();
194 updateAddressEdit(); 201 updateAddressEdit();
195 emit modified(); 202 emit modified();
196 } 203 }
197 } 204 }
198} 205}
199 206
200void AddressEditWidget::updateAddressEdit() 207void AddressEditWidget::updateAddressEdit()
201{ 208{
202 KABC::Address::List::Iterator it = mTypeCombo->selectedElement(); 209 KABC::Address::List::Iterator it = mTypeCombo->selectedElement();
203 210
204 bool block = signalsBlocked(); 211 bool block = signalsBlocked();
205 blockSignals( true ); 212 blockSignals( true );
206 213
207 mAddressTextEdit->setText( "" ); 214 mAddressTextEdit->setText( "" );
208 215
209 if ( it != mAddressList.end() ) { 216 if ( it != mAddressList.end() ) {
210 KABC::Address a = *it; 217 KABC::Address a = *it;
211 if ( !a.isEmpty() ) { 218 if ( !a.isEmpty() ) {
212#if KDE_VERSION >= 319 219#if KDE_VERSION >= 319
213 if ( a.type() & KABC::Address::Work ) { 220 if ( a.type() & KABC::Address::Work ) {
214 mAddressTextEdit->setText( a.formattedAddress( mAddressee.realName(), 221 mAddressTextEdit->setText( a.formattedAddress( mAddressee.realName(),
215 mAddressee.organization() ) ); 222 mAddressee.organization() ) );
216 } else { 223 } else {
217 mAddressTextEdit->setText( a.formattedAddress( mAddressee.realName() ) ); 224 mAddressTextEdit->setText( a.formattedAddress( mAddressee.realName() ) );
218 } 225 }
219#else 226#else
220 QString text; 227 QString text;
221 if ( !a.street().isEmpty() ) 228 if ( !a.street().isEmpty() )
222 text += a.street() + "\n"; 229 text += a.street() + "\n";
223 230
224 if ( !a.postOfficeBox().isEmpty() ) 231 if ( !a.postOfficeBox().isEmpty() )
225 text += a.postOfficeBox() + "\n"; 232 text += a.postOfficeBox() + "\n";
226 233
227 text += a.locality() + QString(" ") + a.region(); 234 text += a.locality() + QString(" ") + a.region();
228 235
229 if ( !a.postalCode().isEmpty() ) 236 if ( !a.postalCode().isEmpty() )
230 text += QString(", ") + a.postalCode(); 237 text += QString(", ") + a.postalCode();
231 238
232 text += "\n"; 239 text += "\n";
233 240
234 if ( !a.country().isEmpty() ) 241 if ( !a.country().isEmpty() )
235 text += a.country() + "\n"; 242 text += a.country() + "\n";
236 243
237 text += a.extended(); 244 text += a.extended();
238 245
239 mAddressTextEdit->setText( text ); 246 mAddressTextEdit->setText( text );
240#endif 247#endif
241 } 248 }
242 } 249 }
243 250
244 blockSignals( block ); 251 blockSignals( block );
245} 252}
246 253
247AddressEditDialog::AddressEditDialog( const KABC::Address::List &list, 254AddressEditDialog::AddressEditDialog( const KABC::Address::List &list,
248 int selected, QWidget *parent, 255 int selected, QWidget *parent,
249 const char *name ) 256 const char *name )
250 : KDialogBase( Plain, i18n( "Edit Address" ), Ok | Cancel, Ok, 257 : KDialogBase( Plain, i18n( "Edit Address" ), Ok | Cancel, Ok,
251 parent, name, true, true ), 258 parent, name, true, true ),
252 mPreviousAddress( 0 ) 259 mPreviousAddress( 0 )
253{ 260{
254 mAddressList = list; 261 mAddressList = list;
255 262
256 QWidget *page = plainPage(); 263 QWidget *page = plainPage();
257 264
258 QGridLayout *topLayout = new QGridLayout( page, 8, 2 ); 265 Q3GridLayout *topLayout = new Q3GridLayout( page, 8, 2 );
259 topLayout->setSpacing( spacingHintSmall() ); 266 topLayout->setSpacing( spacingHintSmall() );
260 267
261 mTypeCombo = new AddressTypeCombo( mAddressList, page ); 268 mTypeCombo = new AddressTypeCombo( mAddressList, page );
262 topLayout->addMultiCellWidget( mTypeCombo, 0, 0, 0, 1 ); 269 topLayout->addMultiCellWidget( mTypeCombo, 0, 0, 0, 1 );
263 270
264 QLabel *label = new QLabel( i18n( "Street:" ), page ); 271 QLabel *label = new QLabel( i18n( "Street:" ), page );
265 label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); 272 label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
266 topLayout->addWidget( label, 1, 0 ); 273 topLayout->addWidget( label, 1, 0 );
267 274
268#ifndef KAB_EMBEDDED 275#ifndef KAB_EMBEDDED
269 mStreetTextEdit = new QTextEdit( page ); 276 mStreetTextEdit = new Q3TextEdit( page );
270#else //KAB_EMBEDDED 277#else //KAB_EMBEDDED
271 mStreetTextEdit = new QMultiLineEdit( page ); 278 mStreetTextEdit = new Q3MultiLineEdit( page );
272//US qDebug("AddressEditDialog::AddressEditDialog has to be changed"); 279//US qDebug("AddressEditDialog::AddressEditDialog has to be changed");
273#endif //KAB_EMBEDDED 280#endif //KAB_EMBEDDED
274 281
275 label->setBuddy( mStreetTextEdit ); 282 label->setBuddy( mStreetTextEdit );
276 topLayout->addWidget( mStreetTextEdit, 1, 1 ); 283 topLayout->addWidget( mStreetTextEdit, 1, 1 );
277 284
278 label = new QLabel( i18n( "Post office box:" ), page ); 285 label = new QLabel( i18n( "Post office box:" ), page );
279 topLayout->addWidget( label, 2 , 0 ); 286 topLayout->addWidget( label, 2 , 0 );
280 mPOBoxEdit = new KLineEdit( page ); 287 mPOBoxEdit = new KLineEdit( page );
281 label->setBuddy( mPOBoxEdit ); 288 label->setBuddy( mPOBoxEdit );
282 topLayout->addWidget( mPOBoxEdit, 2, 1 ); 289 topLayout->addWidget( mPOBoxEdit, 2, 1 );
283 int maxwid = QApplication::desktop()->width(); 290 int maxwid = QApplication::desktop()->width();
284 maxwid -= (spacingHintSmall()+label->sizeHint().width() ); 291 maxwid -= (spacingHintSmall()+label->sizeHint().width() );
285 label = new QLabel( i18n( "Locality:" ), page ); 292 label = new QLabel( i18n( "Locality:" ), page );
286 topLayout->addWidget( label, 3, 0 ); 293 topLayout->addWidget( label, 3, 0 );
287 mLocalityEdit = new KLineEdit( page ); 294 mLocalityEdit = new KLineEdit( page );
288 label->setBuddy( mLocalityEdit ); 295 label->setBuddy( mLocalityEdit );
289 topLayout->addWidget( mLocalityEdit, 3, 1 ); 296 topLayout->addWidget( mLocalityEdit, 3, 1 );
290 297
291 label = new QLabel( i18n( "Region:" ), page ); 298 label = new QLabel( i18n( "Region:" ), page );
292 topLayout->addWidget( label, 4, 0 ); 299 topLayout->addWidget( label, 4, 0 );
293 mRegionEdit = new KLineEdit( page ); 300 mRegionEdit = new KLineEdit( page );
294 label->setBuddy( mRegionEdit ); 301 label->setBuddy( mRegionEdit );
295 topLayout->addWidget( mRegionEdit, 4, 1 ); 302 topLayout->addWidget( mRegionEdit, 4, 1 );
296 303
297 label = new QLabel( i18n( "Postal code:" ), page ); 304 label = new QLabel( i18n( "Postal code:" ), page );
298 topLayout->addWidget( label, 5, 0 ); 305 topLayout->addWidget( label, 5, 0 );
299 mPostalCodeEdit = new KLineEdit( page ); 306 mPostalCodeEdit = new KLineEdit( page );
300 label->setBuddy( mPostalCodeEdit ); 307 label->setBuddy( mPostalCodeEdit );
301 topLayout->addWidget( mPostalCodeEdit, 5, 1 ); 308 topLayout->addWidget( mPostalCodeEdit, 5, 1 );
302 309
303 label = new QLabel( i18n( "Country:" ), page ); 310 label = new QLabel( i18n( "Country:" ), page );
304 topLayout->addWidget( label, 6, 0 ); 311 topLayout->addWidget( label, 6, 0 );
305 mCountryCombo = new KComboBox( page ); 312 mCountryCombo = new KComboBox( page );
306 313
307 mCountryCombo->setMaximumWidth( maxwid -10 ); 314 mCountryCombo->setMaximumWidth( maxwid -10 );
308 mCountryCombo->setEditable( true ); 315 mCountryCombo->setEditable( true );
309 mCountryCombo->setDuplicatesEnabled( false ); 316 mCountryCombo->setDuplicatesEnabled( false );
310 mCountryCombo->setAutoCompletion( true ); 317 mCountryCombo->setAutoCompletion( true );
311 fillCountryCombo(); 318 fillCountryCombo();
312 label->setBuddy( mCountryCombo ); 319 label->setBuddy( mCountryCombo );
313 topLayout->addWidget( mCountryCombo, 6, 1 ); 320 topLayout->addWidget( mCountryCombo, 6, 1 );
314 mCountryCombo->setSizeLimit( 8); 321 mCountryCombo->setMaxVisibleItems( 8);
315 mPreferredCheckBox = new QCheckBox( i18n( "This is the preferred address" ), page ); 322 mPreferredCheckBox = new QCheckBox( i18n( "This is the preferred address" ), page );
316 topLayout->addMultiCellWidget( mPreferredCheckBox, 7, 7, 0, 1 ); 323 topLayout->addMultiCellWidget( mPreferredCheckBox, 7, 7, 0, 1 );
317 /* 324 /*
318 KSeparator *sep = new KSeparator( KSeparator::HLine, page ); 325 KSeparator *sep = new KSeparator( KSeparator::HLine, page );
319 topLayout->addMultiCellWidget( sep, 8, 8, 0, 1 ); 326 topLayout->addMultiCellWidget( sep, 8, 8, 0, 1 );
320 */ 327 */
321 QHBox *buttonBox = new QHBox( page ); 328 Q3HBox *buttonBox = new Q3HBox( page );
322 buttonBox->setSpacing( spacingHint() ); 329 buttonBox->setSpacing( spacingHint() );
323 topLayout->addMultiCellWidget( buttonBox, 9, 9, 0, 1 ); 330 topLayout->addMultiCellWidget( buttonBox, 9, 9, 0, 1 );
324 331
325 QPushButton *addButton = new QPushButton( i18n( "New..." ), buttonBox ); 332 QPushButton *addButton = new QPushButton( i18n( "New..." ), buttonBox );
326 connect( addButton, SIGNAL( clicked() ), SLOT( addAddress() ) ); 333 connect( addButton, SIGNAL( clicked() ), SLOT( addAddress() ) );
327 334
328 mRemoveButton = new QPushButton( i18n( "Remove" ), buttonBox ); 335 mRemoveButton = new QPushButton( i18n( "Remove" ), buttonBox );
329 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeAddress() ) ); 336 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeAddress() ) );
330 337
331 mChangeTypeButton = new QPushButton( i18n( "Change Type" ), buttonBox ); 338 mChangeTypeButton = new QPushButton( i18n( "Change Type" ), buttonBox );
332 connect( mChangeTypeButton, SIGNAL( clicked() ), SLOT( changeType() ) ); 339 connect( mChangeTypeButton, SIGNAL( clicked() ), SLOT( changeType() ) );
333 340
334 mTypeCombo->updateTypes(); 341 mTypeCombo->updateTypes();
335 mTypeCombo->setCurrentItem( selected ); 342 mTypeCombo->setCurrentItem( selected );
336 343
337 updateAddressEdits(); 344 updateAddressEdits();
338 345
339 connect( mTypeCombo, SIGNAL( activated( int ) ), 346 connect( mTypeCombo, SIGNAL( activated( int ) ),
340 SLOT( updateAddressEdits() ) ); 347 SLOT( updateAddressEdits() ) );
341 connect( mStreetTextEdit, SIGNAL( textChanged() ), SLOT( modified() ) ); 348 connect( mStreetTextEdit, SIGNAL( textChanged() ), SLOT( modified() ) );
342 connect( mPOBoxEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 349 connect( mPOBoxEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
343 connect( mLocalityEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 350 connect( mLocalityEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
344 connect( mRegionEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 351 connect( mRegionEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
345 connect( mPostalCodeEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 352 connect( mPostalCodeEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
346 connect( mCountryCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 353 connect( mCountryCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
347 connect( mPreferredCheckBox, SIGNAL( toggled( bool ) ), SLOT( modified() ) ); 354 connect( mPreferredCheckBox, SIGNAL( toggled( bool ) ), SLOT( modified() ) );
348 355
349#ifndef KAB_EMBEDDED 356#ifndef KAB_EMBEDDED
350 KAcceleratorManager::manage( this ); 357 KAcceleratorManager::manage( this );
351#else //KAB_EMBEDDED 358#else //KAB_EMBEDDED
352//US qDebug("AddressEditDialog::AddressEditDialog has to be changed 2"); 359//US qDebug("AddressEditDialog::AddressEditDialog has to be changed 2");
353#endif //KAB_EMBEDDED 360#endif //KAB_EMBEDDED
354 361
355 mChanged = false; 362 mChanged = false;
356 363
357 bool state = (mAddressList.count() > 0); 364 bool state = (mAddressList.count() > 0);
358 mRemoveButton->setEnabled( state ); 365 mRemoveButton->setEnabled( state );
359 mChangeTypeButton->setEnabled( state ); 366 mChangeTypeButton->setEnabled( state );
360#ifndef DESKTOP_VERSION 367#ifndef DESKTOP_VERSION
361 showMaximized(); 368 showMaximized();
362#endif 369#endif
363} 370}
364 371
365AddressEditDialog::~AddressEditDialog() 372AddressEditDialog::~AddressEditDialog()
366{ 373{
367} 374}
368 375
369KABC::Address::List AddressEditDialog::addresses() 376KABC::Address::List AddressEditDialog::addresses()
370{ 377{
371 saveAddress( *(mTypeCombo->selectedElement()) ); 378 saveAddress( *(mTypeCombo->selectedElement()) );
372 379
373 return mAddressList; 380 return mAddressList;
374} 381}
375 382
376bool AddressEditDialog::changed() const 383bool AddressEditDialog::changed() const
377{ 384{
378 return mChanged; 385 return mChanged;
379} 386}
380 387
381void AddressEditDialog::addAddress() 388void AddressEditDialog::addAddress()
382{ 389{
383 AddressTypeDialog dlg( mTypeCombo->selectedType(), this ); 390 AddressTypeDialog dlg( mTypeCombo->selectedType(), this );
384 if ( dlg.exec() ) { 391 if ( dlg.exec() ) {
385 mAddressList.append( Address( dlg.type() ) ); 392 mAddressList.append( Address( dlg.type() ) );
386 393
387 mTypeCombo->updateTypes(); 394 mTypeCombo->updateTypes();
388 mTypeCombo->setCurrentItem( mTypeCombo->count() - 1 ); 395 mTypeCombo->setCurrentItem( mTypeCombo->count() - 1 );
389 updateAddressEdits(); 396 updateAddressEdits();
390 397
391 modified(); 398 modified();
392 399
393 mRemoveButton->setEnabled( true ); 400 mRemoveButton->setEnabled( true );
394 mChangeTypeButton->setEnabled( true ); 401 mChangeTypeButton->setEnabled( true );
395 } 402 }
396} 403}
397 404
398void AddressEditDialog::removeAddress() 405void AddressEditDialog::removeAddress()
399{ 406{
400 if ( mAddressList.count() > 0 ) { 407 if ( mAddressList.count() > 0 ) {
401 KABC::Address::List::Iterator it = mTypeCombo->selectedElement(); 408 KABC::Address::List::Iterator it = mTypeCombo->selectedElement();
402 if ( mPreviousAddress && mPreviousAddress->id() == (*it).id() ) 409 if ( mPreviousAddress && mPreviousAddress->id() == (*it).id() )
403 mPreviousAddress = 0; 410 mPreviousAddress = 0;
404 411
405 mAddressList.remove( it ); 412 mAddressList.remove( it );
406 mTypeCombo->updateTypes(); 413 mTypeCombo->updateTypes();
407 updateAddressEdits(); 414 updateAddressEdits();
408 415
409 modified(); 416 modified();
410 } 417 }
411 418
412 bool state = ( mAddressList.count() > 0 ); 419 bool state = ( mAddressList.count() > 0 );
413 mRemoveButton->setEnabled( state ); 420 mRemoveButton->setEnabled( state );
414 mChangeTypeButton->setEnabled( state ); 421 mChangeTypeButton->setEnabled( state );
415} 422}
416 423
417void AddressEditDialog::changeType() 424void AddressEditDialog::changeType()
418{ 425{
419 KABC::Address::List::Iterator a = mTypeCombo->selectedElement(); 426 KABC::Address::List::Iterator a = mTypeCombo->selectedElement();
420 427
421 AddressTypeDialog dlg( (*a).type(), this ); 428 AddressTypeDialog dlg( (*a).type(), this );
422 if ( dlg.exec() ) { 429 if ( dlg.exec() ) {
423 (*a).setType( dlg.type() ); 430 (*a).setType( dlg.type() );
424 431
425 mTypeCombo->updateTypes(); 432 mTypeCombo->updateTypes();
426 433
427 modified(); 434 modified();
428 } 435 }
429} 436}
430 437
431void AddressEditDialog::updateAddressEdits() 438void AddressEditDialog::updateAddressEdits()
432{ 439{
433 if ( mPreviousAddress ) 440 if ( mPreviousAddress )
434 saveAddress( *mPreviousAddress ); 441 saveAddress( *mPreviousAddress );
435 442
436 KABC::Address::List::Iterator it = mTypeCombo->selectedElement(); 443 KABC::Address::List::Iterator it = mTypeCombo->selectedElement();
437 KABC::Address a = *it; 444 KABC::Address a = *it;
438 mPreviousAddress = &(*it); 445 mPreviousAddress = &(*it);
439 446
440 bool tmp = mChanged; 447 bool tmp = mChanged;
441 448
442 mStreetTextEdit->setText( a.street() ); 449 mStreetTextEdit->setText( a.street() );
443 mRegionEdit->setText( a.region() ); 450 mRegionEdit->setText( a.region() );
444 mLocalityEdit->setText( a.locality() ); 451 mLocalityEdit->setText( a.locality() );
445 mPostalCodeEdit->setText( a.postalCode() ); 452 mPostalCodeEdit->setText( a.postalCode() );
446 mPOBoxEdit->setText( a.postOfficeBox() ); 453 mPOBoxEdit->setText( a.postOfficeBox() );
447 454
448#ifndef KAB_EMBEDDED 455#ifndef KAB_EMBEDDED
449 mCountryCombo->setCurrentText( a.country() ); 456 mCountryCombo->setCurrentText( a.country() );
450#else //KAB_EMBEDDED 457#else //KAB_EMBEDDED
451 mCountryCombo->setEditText( a.country() ); 458 mCountryCombo->setEditText( a.country() );
452//US qDebug("AddressEditDialog::updateAddressEdits has to be changed 1"); 459//US qDebug("AddressEditDialog::updateAddressEdits has to be changed 1");
453#endif //KAB_EMBEDDED 460#endif //KAB_EMBEDDED
454 461
455 mPreferredCheckBox->setChecked( a.type() & KABC::Address::Pref ); 462 mPreferredCheckBox->setChecked( a.type() & KABC::Address::Pref );
456 463
457 mStreetTextEdit->setFocus(); 464 mStreetTextEdit->setFocus();
458 465
459 mChanged = tmp; 466 mChanged = tmp;
460} 467}
461 468
462void AddressEditDialog::modified() 469void AddressEditDialog::modified()
463{ 470{
464 mChanged = true; 471 mChanged = true;
465} 472}
466 473
467void AddressEditDialog::saveAddress( KABC::Address &addr ) 474void AddressEditDialog::saveAddress( KABC::Address &addr )
468{ 475{
469 addr.setLocality( mLocalityEdit->text() ); 476 addr.setLocality( mLocalityEdit->text() );
470 addr.setRegion( mRegionEdit->text() ); 477 addr.setRegion( mRegionEdit->text() );
471 addr.setPostalCode( mPostalCodeEdit->text() ); 478 addr.setPostalCode( mPostalCodeEdit->text() );
472 addr.setCountry( mCountryCombo->currentText() ); 479 addr.setCountry( mCountryCombo->currentText() );
473 addr.setPostOfficeBox( mPOBoxEdit->text() ); 480 addr.setPostOfficeBox( mPOBoxEdit->text() );
474 addr.setStreet( mStreetTextEdit->text() ); 481 addr.setStreet( mStreetTextEdit->text() );
475 482
476 483
477 if ( mPreferredCheckBox->isChecked() ) { 484 if ( mPreferredCheckBox->isChecked() ) {
478 KABC::Address::List::Iterator it; 485 KABC::Address::List::Iterator it;
479 for ( it = mAddressList.begin(); it != mAddressList.end(); ++it ) 486 for ( it = mAddressList.begin(); it != mAddressList.end(); ++it )
480 (*it).setType( (*it).type() & ~( KABC::Address::Pref ) ); 487 (*it).setType( (*it).type() & ~( KABC::Address::Pref ) );
481 488
482 addr.setType( addr.type() | KABC::Address::Pref ); 489 addr.setType( addr.type() | KABC::Address::Pref );
483 } 490 }
484} 491}
485 492
486void AddressEditDialog::fillCountryCombo() 493void AddressEditDialog::fillCountryCombo()
487{ 494{
488 QString country[] = { 495 QString country[] = {
489 i18n( "Afghanistan" ), i18n( "Albania" ), i18n( "Algeria" ), 496 i18n( "Afghanistan" ), i18n( "Albania" ), i18n( "Algeria" ),
490 i18n( "American Samoa" ), i18n( "Andorra" ), i18n( "Angola" ), 497 i18n( "American Samoa" ), i18n( "Andorra" ), i18n( "Angola" ),
491 i18n( "Anguilla" ), i18n( "Antarctica" ), i18n( "Antigua and Barbuda" ), 498 i18n( "Anguilla" ), i18n( "Antarctica" ), i18n( "Antigua and Barbuda" ),
492 i18n( "Argentina" ), i18n( "Armenia" ), i18n( "Aruba" ), 499 i18n( "Argentina" ), i18n( "Armenia" ), i18n( "Aruba" ),
493 i18n( "Ashmore and Cartier Islands" ), i18n( "Australia" ), 500 i18n( "Ashmore and Cartier Islands" ), i18n( "Australia" ),
494 i18n( "Austria" ), i18n( "Azerbaijan" ), i18n( "Bahamas" ), 501 i18n( "Austria" ), i18n( "Azerbaijan" ), i18n( "Bahamas" ),
495 i18n( "Bahrain" ), i18n( "Bangladesh" ), i18n( "Barbados" ), 502 i18n( "Bahrain" ), i18n( "Bangladesh" ), i18n( "Barbados" ),
496 i18n( "Belarus" ), i18n( "Belgium" ), i18n( "Belize" ), 503 i18n( "Belarus" ), i18n( "Belgium" ), i18n( "Belize" ),
497 i18n( "Benin" ), i18n( "Bermuda" ), i18n( "Bhutan" ), 504 i18n( "Benin" ), i18n( "Bermuda" ), i18n( "Bhutan" ),
498 i18n( "Bolivia" ), i18n( "Bosnia and Herzegovina" ), i18n( "Botswana" ), 505 i18n( "Bolivia" ), i18n( "Bosnia and Herzegovina" ), i18n( "Botswana" ),
499 i18n( "Brazil" ), i18n( "Brunei" ), i18n( "Bulgaria" ), 506 i18n( "Brazil" ), i18n( "Brunei" ), i18n( "Bulgaria" ),
500 i18n( "Burkina Faso" ), i18n( "Burundi" ), i18n( "Cambodia" ), 507 i18n( "Burkina Faso" ), i18n( "Burundi" ), i18n( "Cambodia" ),
501 i18n( "Cameroon" ), i18n( "Canada" ), i18n( "Cape Verde" ), 508 i18n( "Cameroon" ), i18n( "Canada" ), i18n( "Cape Verde" ),
502 i18n( "Cayman Islands" ), i18n( "Central African Republic" ), 509 i18n( "Cayman Islands" ), i18n( "Central African Republic" ),
503 i18n( "Chad" ), i18n( "Chile" ), i18n( "China" ), i18n( "Colombia" ), 510 i18n( "Chad" ), i18n( "Chile" ), i18n( "China" ), i18n( "Colombia" ),
504 i18n( "Comoros" ), i18n( "Congo" ), i18n( "Congo, Dem. Rep." ), 511 i18n( "Comoros" ), i18n( "Congo" ), i18n( "Congo, Dem. Rep." ),
505 i18n( "Costa Rica" ), i18n( "Croatia" ), 512 i18n( "Costa Rica" ), i18n( "Croatia" ),
506 i18n( "Cuba" ), i18n( "Cyprus" ), i18n( "Czech Republic" ), 513 i18n( "Cuba" ), i18n( "Cyprus" ), i18n( "Czech Republic" ),
507 i18n( "Denmark" ), i18n( "Djibouti" ), 514 i18n( "Denmark" ), i18n( "Djibouti" ),
508 i18n( "Dominica" ), i18n( "Dominican Republic" ), i18n( "Ecuador" ), 515 i18n( "Dominica" ), i18n( "Dominican Republic" ), i18n( "Ecuador" ),
509 i18n( "Egypt" ), i18n( "El Salvador" ), i18n( "Equatorial Guinea" ), 516 i18n( "Egypt" ), i18n( "El Salvador" ), i18n( "Equatorial Guinea" ),
510 i18n( "Eritrea" ), i18n( "Estonia" ), i18n( "England" ), 517 i18n( "Eritrea" ), i18n( "Estonia" ), i18n( "England" ),
511 i18n( "Ethiopia" ), i18n( "European Union" ), i18n( "Faroe Islands" ), 518 i18n( "Ethiopia" ), i18n( "European Union" ), i18n( "Faroe Islands" ),
512 i18n( "Fiji" ), i18n( "Finland" ), i18n( "France" ), 519 i18n( "Fiji" ), i18n( "Finland" ), i18n( "France" ),
513 i18n( "French Polynesia" ), i18n( "Gabon" ), i18n( "Gambia" ), 520 i18n( "French Polynesia" ), i18n( "Gabon" ), i18n( "Gambia" ),
514 i18n( "Georgia" ), i18n( "Germany" ), i18n( "Ghana" ), 521 i18n( "Georgia" ), i18n( "Germany" ), i18n( "Ghana" ),
515 i18n( "Greece" ), i18n( "Greenland" ), i18n( "Grenada" ), 522 i18n( "Greece" ), i18n( "Greenland" ), i18n( "Grenada" ),
516 i18n( "Guam" ), i18n( "Guatemala" ), i18n( "Guinea" ), 523 i18n( "Guam" ), i18n( "Guatemala" ), i18n( "Guinea" ),
517 i18n( "Guinea-Bissau" ), i18n( "Guyana" ), i18n( "Haiti" ), 524 i18n( "Guinea-Bissau" ), i18n( "Guyana" ), i18n( "Haiti" ),
518 i18n( "Honduras" ), i18n( "Hong Kong" ), i18n( "Hungary" ), 525 i18n( "Honduras" ), i18n( "Hong Kong" ), i18n( "Hungary" ),
519 i18n( "Iceland" ), i18n( "India" ), i18n( "Indonesia" ), 526 i18n( "Iceland" ), i18n( "India" ), i18n( "Indonesia" ),
520 i18n( "Iran" ), i18n( "Iraq" ), i18n( "Ireland" ), 527 i18n( "Iran" ), i18n( "Iraq" ), i18n( "Ireland" ),
521 i18n( "Israel" ), i18n( "Italy" ), i18n( "Ivory Coast" ), 528 i18n( "Israel" ), i18n( "Italy" ), i18n( "Ivory Coast" ),
522 i18n( "Jamaica" ), i18n( "Japan" ), i18n( "Jordan" ), 529 i18n( "Jamaica" ), i18n( "Japan" ), i18n( "Jordan" ),
523 i18n( "Kazakhstan" ), i18n( "Kenya" ), i18n( "Kiribati" ), 530 i18n( "Kazakhstan" ), i18n( "Kenya" ), i18n( "Kiribati" ),
524 i18n( "Korea, North" ), i18n( "Korea, South" ), 531 i18n( "Korea, North" ), i18n( "Korea, South" ),
525 i18n( "Kuwait" ), i18n( "Kyrgyzstan" ), i18n( "Laos" ), 532 i18n( "Kuwait" ), i18n( "Kyrgyzstan" ), i18n( "Laos" ),
526 i18n( "Latvia" ), i18n( "Lebanon" ), i18n( "Lesotho" ), 533 i18n( "Latvia" ), i18n( "Lebanon" ), i18n( "Lesotho" ),
527 i18n( "Liberia" ), i18n( "Libya" ), i18n( "Liechtenstein" ), 534 i18n( "Liberia" ), i18n( "Libya" ), i18n( "Liechtenstein" ),
528 i18n( "Lithuania" ), i18n( "Luxembourg" ), i18n( "Macau" ), 535 i18n( "Lithuania" ), i18n( "Luxembourg" ), i18n( "Macau" ),
529 i18n( "Madagascar" ), i18n( "Malawi" ), i18n( "Malaysia" ), 536 i18n( "Madagascar" ), i18n( "Malawi" ), i18n( "Malaysia" ),
530 i18n( "Maldives" ), i18n( "Mali" ), i18n( "Malta" ), 537 i18n( "Maldives" ), i18n( "Mali" ), i18n( "Malta" ),
531 i18n( "Marshall Islands" ), i18n( "Martinique" ), i18n( "Mauritania" ), 538 i18n( "Marshall Islands" ), i18n( "Martinique" ), i18n( "Mauritania" ),
532 i18n( "Mauritius" ), i18n( "Mexico" ), 539 i18n( "Mauritius" ), i18n( "Mexico" ),
533 i18n( "Micronesia, Federated States Of" ), i18n( "Moldova" ), 540 i18n( "Micronesia, Federated States Of" ), i18n( "Moldova" ),
534 i18n( "Monaco" ), i18n( "Mongolia" ), i18n( "Montserrat" ), 541 i18n( "Monaco" ), i18n( "Mongolia" ), i18n( "Montserrat" ),
535 i18n( "Morocco" ), i18n( "Mozambique" ), i18n( "Myanmar" ), 542 i18n( "Morocco" ), i18n( "Mozambique" ), i18n( "Myanmar" ),
536 i18n( "Namibia" ), 543 i18n( "Namibia" ),
537 i18n( "Nauru" ), i18n( "Nepal" ), i18n( "Netherlands" ), 544 i18n( "Nauru" ), i18n( "Nepal" ), i18n( "Netherlands" ),
538 i18n( "Netherlands Antilles" ), i18n( "New Caledonia" ), 545 i18n( "Netherlands Antilles" ), i18n( "New Caledonia" ),
539 i18n( "New Zealand" ), i18n( "Nicaragua" ), i18n( "Niger" ), 546 i18n( "New Zealand" ), i18n( "Nicaragua" ), i18n( "Niger" ),
540 i18n( "Nigeria" ), i18n( "Niue" ), i18n( "North Korea" ), 547 i18n( "Nigeria" ), i18n( "Niue" ), i18n( "North Korea" ),
541 i18n( "Northern Ireland" ), i18n( "Northern Mariana Islands" ), 548 i18n( "Northern Ireland" ), i18n( "Northern Mariana Islands" ),
542 i18n( "Norway" ), i18n( "Oman" ), i18n( "Pakistan" ), i18n( "Palau" ), 549 i18n( "Norway" ), i18n( "Oman" ), i18n( "Pakistan" ), i18n( "Palau" ),
543 i18n( "Palestinian" ), i18n( "Panama" ), i18n( "Papua New Guinea" ), 550 i18n( "Palestinian" ), i18n( "Panama" ), i18n( "Papua New Guinea" ),
544 i18n( "Paraguay" ), i18n( "Peru" ), i18n( "Philippines" ), 551 i18n( "Paraguay" ), i18n( "Peru" ), i18n( "Philippines" ),
545 i18n( "Poland" ), i18n( "Portugal" ), i18n( "Puerto Rico" ), 552 i18n( "Poland" ), i18n( "Portugal" ), i18n( "Puerto Rico" ),
546 i18n( "Qatar" ), i18n( "Romania" ), i18n( "Russia" ), i18n( "Rwanda" ), 553 i18n( "Qatar" ), i18n( "Romania" ), i18n( "Russia" ), i18n( "Rwanda" ),
547 i18n( "St. Kitts and Nevis" ), i18n( "St. Lucia" ), 554 i18n( "St. Kitts and Nevis" ), i18n( "St. Lucia" ),
548 i18n( "St. Vincent and the Grenadines" ), i18n( "San Marino" ), 555 i18n( "St. Vincent and the Grenadines" ), i18n( "San Marino" ),
549 i18n( "Sao Tome and Principe" ), i18n( "Saudi Arabia" ), 556 i18n( "Sao Tome and Principe" ), i18n( "Saudi Arabia" ),
550 i18n( "Senegal" ), i18n( "Serbia & Montenegro" ), i18n( "Seychelles" ), 557 i18n( "Senegal" ), i18n( "Serbia & Montenegro" ), i18n( "Seychelles" ),
551 i18n( "Sierra Leone" ), i18n( "Singapore" ), i18n( "Slovakia" ), 558 i18n( "Sierra Leone" ), i18n( "Singapore" ), i18n( "Slovakia" ),
552 i18n( "Slovenia" ), i18n( "Solomon Islands" ), i18n( "Somalia" ), 559 i18n( "Slovenia" ), i18n( "Solomon Islands" ), i18n( "Somalia" ),
553 i18n( "South Africa" ), i18n( "South Korea" ), i18n( "Spain" ), 560 i18n( "South Africa" ), i18n( "South Korea" ), i18n( "Spain" ),
554 i18n( "Sri Lanka" ), i18n( "St. Kitts and Nevis" ), i18n( "Sudan" ), 561 i18n( "Sri Lanka" ), i18n( "St. Kitts and Nevis" ), i18n( "Sudan" ),
555 i18n( "Suriname" ), i18n( "Swaziland" ), i18n( "Sweden" ), 562 i18n( "Suriname" ), i18n( "Swaziland" ), i18n( "Sweden" ),
556 i18n( "Switzerland" ), i18n( "Syria" ), i18n( "Taiwan" ), 563 i18n( "Switzerland" ), i18n( "Syria" ), i18n( "Taiwan" ),
557 i18n( "Tajikistan" ), i18n( "Tanzania" ), i18n( "Thailand" ), 564 i18n( "Tajikistan" ), i18n( "Tanzania" ), i18n( "Thailand" ),
558 i18n( "Tibet" ), i18n( "Togo" ), i18n( "Tonga" ), 565 i18n( "Tibet" ), i18n( "Togo" ), i18n( "Tonga" ),
559 i18n( "Trinidad and Tobago" ), i18n( "Tunisia" ), i18n( "Turkey" ), 566 i18n( "Trinidad and Tobago" ), i18n( "Tunisia" ), i18n( "Turkey" ),
560 i18n( "Turkmenistan" ), i18n( "Turks and Caicos Islands" ), 567 i18n( "Turkmenistan" ), i18n( "Turks and Caicos Islands" ),
561 i18n( "Tuvalu" ), i18n( "Uganda " ), i18n( "Ukraine" ), 568 i18n( "Tuvalu" ), i18n( "Uganda " ), i18n( "Ukraine" ),
562 i18n( "United Arab Emirates" ), i18n( "United Kingdom" ), 569 i18n( "United Arab Emirates" ), i18n( "United Kingdom" ),
563 i18n( "United States" ), i18n( "Uruguay" ), i18n( "Uzbekistan" ), 570 i18n( "United States" ), i18n( "Uruguay" ), i18n( "Uzbekistan" ),
564 i18n( "Vanuatu" ), i18n( "Vatican City" ), i18n( "Venezuela" ), 571 i18n( "Vanuatu" ), i18n( "Vatican City" ), i18n( "Venezuela" ),
565 i18n( "Vietnam" ), i18n( "Western Samoa" ), i18n( "Yemen" ), 572 i18n( "Vietnam" ), i18n( "Western Samoa" ), i18n( "Yemen" ),
566 i18n( "Yugoslavia" ), i18n( "Zaire" ), i18n( "Zambia" ), 573 i18n( "Yugoslavia" ), i18n( "Zaire" ), i18n( "Zambia" ),
567 i18n( "Zimbabwe" ), 574 i18n( "Zimbabwe" ),
568 "" 575 ""
569 }; 576 };
570 577
571 QStringList countries; 578 QStringList countries;
572 for ( int i = 0; !country[ i ].isEmpty(); ++i ) 579 for ( int i = 0; !country[ i ].isEmpty(); ++i )
573 countries.append( country[ i ] ); 580 countries.append( country[ i ] );
574 581
575 countries.sort(); 582 countries.sort();
576 583
577 mCountryCombo->insertStringList( countries ); 584 mCountryCombo->insertStringList( countries );
578} 585}
579 586
580 587
581AddressTypeDialog::AddressTypeDialog( int type, QWidget *parent ) 588AddressTypeDialog::AddressTypeDialog( int type, QWidget *parent )
582 : KDialogBase( Plain, i18n( "Edit Address Type" ), Ok | Cancel, Ok, 589 : KDialogBase( Plain, i18n( "Edit Address Type" ), Ok | Cancel, Ok,
583 parent, "AddressTypeDialog" ) 590 parent, "AddressTypeDialog" )
584{ 591{
585 QWidget *page = plainPage(); 592 QWidget *page = plainPage();
586 QVBoxLayout *layout = new QVBoxLayout( page ); 593 Q3VBoxLayout *layout = new Q3VBoxLayout( page );
587 594
588 mGroup = new QButtonGroup( 2, Horizontal, i18n( "Address Types" ), page ); 595 mGroup = new Q3ButtonGroup( 2, Qt::Horizontal, i18n( "Address Types" ), page );
589 layout->addWidget( mGroup ); 596 layout->addWidget( mGroup );
590 597
591 mTypeList = KABC::Address::typeList(); 598 mTypeList = KABC::Address::typeList();
592 mTypeList.remove( KABC::Address::Pref ); 599 mTypeList.remove( KABC::Address::Pref );
593 600
594 KABC::Address::TypeList::Iterator it; 601 KABC::Address::TypeList::Iterator it;
595 for ( it = mTypeList.begin(); it != mTypeList.end(); ++it ) 602 for ( it = mTypeList.begin(); it != mTypeList.end(); ++it )
596 new QCheckBox( KABC::Address::typeLabel( *it ), mGroup ); 603 new QCheckBox( KABC::Address::typeLabel( *it ), mGroup );
597 604
598 for ( int i = 0; i < mGroup->count(); ++i ) { 605 for ( int i = 0; i < mGroup->count(); ++i ) {
599 QCheckBox *box = (QCheckBox*)mGroup->find( i ); 606 QCheckBox *box = (QCheckBox*)mGroup->find( i );
600 box->setChecked( type & mTypeList[ i ] ); 607 box->setChecked( type & mTypeList[ i ] );
601 } 608 }
602} 609}
603 610
604AddressTypeDialog::~AddressTypeDialog() 611AddressTypeDialog::~AddressTypeDialog()
605{ 612{
606} 613}
607 614
608int AddressTypeDialog::type() const 615int AddressTypeDialog::type() const
609{ 616{
610 int type = 0; 617 int type = 0;
611 for ( int i = 0; i < mGroup->count(); ++i ) { 618 for ( int i = 0; i < mGroup->count(); ++i ) {
612 QCheckBox *box = (QCheckBox*)mGroup->find( i ); 619 QCheckBox *box = (QCheckBox*)mGroup->find( i );
613 if ( box->isChecked() ) 620 if ( box->isChecked() )
614 type += mTypeList[ i ]; 621 type += mTypeList[ i ];
615 } 622 }
616 623
617 return type; 624 return type;
618} 625}
619 626
620#ifndef KAB_EMBEDDED 627#ifndef KAB_EMBEDDED_
621#include "addresseditwidget.moc" 628#include "moc_addresseditwidget.cpp"
622#endif //KAB_EMBEDDED 629#endif //KAB_EMBEDDED