25 #include <tqbuttongroup.h>
26 #include <tqcheckbox.h>
30 #include <tqlistbox.h>
31 #include <tqlistview.h>
32 #include <tqpushbutton.h>
35 #include <tqtextedit.h>
36 #include <tqtoolbutton.h>
37 #include <tqtooltip.h>
39 #include <tdeaccelmanager.h>
40 #include <kactivelabel.h>
41 #include <tdeapplication.h>
42 #include <kbuttonbox.h>
43 #include <kcombobox.h>
44 #include <tdeconfig.h>
47 #include <kiconloader.h>
48 #include <kinputdialog.h>
49 #include <klineedit.h>
50 #include <tdelistview.h>
51 #include <tdelocale.h>
52 #include <tdemessagebox.h>
53 #include <kseparator.h>
55 #include "addresseditwidget.h"
57 class TabPressEater : public TQObject
60 TabPressEater( TQObject *parent )
61 : TQObject( parent, "TabPressEater" )
66 bool eventFilter( TQObject*, TQEvent *event )
68 if ( event->type() == TQEvent::KeyPress ) {
69 TQKeyEvent *keyEvent = (TQKeyEvent*)event;
70 if ( keyEvent->key() == TQt::Key_Tab ) {
71 TQApplication::sendEvent( parent(), event );
82 AddressEditWidget::AddressEditWidget( TQWidget *parent, const char *name )
83 : TQWidget( parent, name )
85 TQBoxLayout *layout = new TQVBoxLayout( this, 4, 2 );
86 layout->setSpacing( KDialog::spacingHint() );
89 connect( mTypeCombo, TQ_SIGNAL( activated( int ) ),
90 TQ_SLOT( updateAddressEdit() ) );
91 layout->addWidget( mTypeCombo );
93 mAddressField = new KActiveLabel( this );
94 mAddressField->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
95 mAddressField->setMinimumHeight( 20 );
96 mAddressField->setAlignment( TQt::AlignTop );
97 mAddressField->setTextFormat( TQt::PlainText );
98 layout->addWidget( mAddressField );
100 mEditButton = new TQPushButton( i18n( "street/postal", "&Edit Addresses..." ), this );
101 connect( mEditButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( edit() ) );
103 layout->addWidget( mEditButton );
106 AddressEditWidget::~AddressEditWidget()
110 void AddressEditWidget::setReadOnly( bool readOnly )
112 mEditButton->setEnabled( !readOnly );
115 TDEABC::Address::List AddressEditWidget::addresses()
117 TDEABC::Address::List retList;
119 TDEABC::Address::List::ConstIterator it;
120 for ( it = mAddressList.begin(); it != mAddressList.end(); ++it )
121 if ( !(*it).isEmpty() )
122 retList.append( *it );
127 void AddressEditWidget::setAddresses( const TDEABC::Addressee &addr,
128 const TDEABC::Address::List &list )
132 mAddressList.clear();
135 mTypeCombo->insertTypeList( list );
137 TQValueList<int> defaultTypes;
138 defaultTypes << TDEABC::Address::Home;
139 defaultTypes << TDEABC::Address::Work;
141 AddresseeConfig config( mAddressee );
142 const TQValueList<int> configList = config.noDefaultAddrTypes();
143 TQValueList<int>::ConstIterator it;
144 for ( it = configList.begin(); it != configList.end(); ++it )
145 defaultTypes.remove( *it );
150 for ( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) {
151 if ( !mTypeCombo->hasType( *it ) )
152 mTypeCombo->insertType( list, *it, Address( *it ) );
155 mTypeCombo->updateTypes();
158 int preferred = TDEABC::Address::Home;
159 TDEABC::Address::List::ConstIterator addrIt;
160 for ( addrIt = list.begin(); addrIt != list.end(); ++addrIt )
161 if ( (*addrIt).type() & TDEABC::Address::Pref ) {
162 preferred = (*addrIt).type();
166 mTypeCombo->selectType( preferred );
171 void AddressEditWidget::updateAddressee( const TDEABC::Addressee &addr )
177 void AddressEditWidget::edit()
180 if ( dialog.exec() ) {
181 if ( dialog.changed() ) {
182 mAddressList = dialog.addresses();
184 bool hasHome = false, hasWork = false;
185 TDEABC::Address::List::ConstIterator it;
186 for ( it = mAddressList.begin(); it != mAddressList.end(); ++it ) {
187 if ( (*it).type() == TDEABC::Address::Home ) {
188 if ( !(*it).isEmpty() )
191 if ( (*it).type() == TDEABC::Address::Work ) {
192 if ( !(*it).isEmpty() )
197 AddresseeConfig config( mAddressee );
198 TQValueList<int> configList;
200 configList << TDEABC::Address::Home;
202 configList << TDEABC::Address::Work;
203 config.setNoDefaultAddrTypes( configList );
205 mTypeCombo->updateTypes();
212 void AddressEditWidget::updateAddressEdit()
214 TDEABC::Address::List::Iterator it = mTypeCombo->selectedElement();
216 bool block = signalsBlocked();
217 blockSignals( true );
219 mAddressField->setText( "" );
221 if ( it != mAddressList.end() ) {
222 TDEABC::Address a = *it;
223 if ( !a.isEmpty() ) {
224 #if TDE_VERSION >= 319
225 if ( a.type() & TDEABC::Address::Work && mAddressee.realName() != mAddressee.organization() ) {
226 mAddressField->setText( a.formattedAddress( mAddressee.realName(),
227 mAddressee.organization() ) );
229 mAddressField->setText( a.formattedAddress( mAddressee.realName() ) );
233 if ( !a.street().isEmpty() )
234 text += a.street() + "\n";
236 if ( !a.postOfficeBox().isEmpty() )
237 text += a.postOfficeBox() + "\n";
239 text += a.locality() + TQString( " ") + a.region();
241 if ( !a.postalCode().isEmpty() )
242 text += TQString( ", ") + a.postalCode();
246 if ( !a.country().isEmpty() )
247 text += a.country() + "\n";
249 text += a.extended();
251 mAddressField->setText( text );
256 blockSignals( block );
259 AddressEditDialog::AddressEditDialog( const TDEABC::Address::List &list,
260 int selected, TQWidget *parent,
262 : KDialogBase( Plain, i18n( "street/postal", "Edit Address" ), Ok | Cancel, Ok,
263 parent, name, true, true ),
264 mPreviousAddress( 0 )
268 TQWidget *page = plainPage();
270 TQGridLayout *topLayout = new TQGridLayout( page, 8, 2 );
271 topLayout->setSpacing( spacingHint() );
274 topLayout->addMultiCellWidget( mTypeCombo, 0, 0, 0, 1 );
276 TQLabel *label = new TQLabel( i18n( "<streetLabel>:", "%1:" ).arg( TDEABC::Address::streetLabel() ), page );
277 label->setAlignment( TQt::AlignTop | TQt::AlignLeft );
278 topLayout->addWidget( label, 1, 0 );
279 mStreetTextEdit = new TQTextEdit( page );
280 mStreetTextEdit->setTextFormat( TQt::PlainText );
281 label->setBuddy( mStreetTextEdit );
282 topLayout->addWidget( mStreetTextEdit, 1, 1 );
284 TabPressEater *eater = new TabPressEater( this );
285 mStreetTextEdit->installEventFilter( eater );
287 label = new TQLabel( i18n( "<postOfficeBoxLabel>:", "%1:" ).arg( TDEABC::Address::postOfficeBoxLabel() ), page );
288 topLayout->addWidget( label, 2 , 0 );
289 mPOBoxEdit = new KLineEdit( page );
290 label->setBuddy( mPOBoxEdit );
291 topLayout->addWidget( mPOBoxEdit, 2, 1 );
293 label = new TQLabel( i18n( "<localityLabel>:", "%1:" ).arg( TDEABC::Address::localityLabel() ), page );
294 topLayout->addWidget( label, 3, 0 );
295 mLocalityEdit = new KLineEdit( page );
296 label->setBuddy( mLocalityEdit );
297 topLayout->addWidget( mLocalityEdit, 3, 1 );
299 label = new TQLabel( i18n( "<regionLabel>:", "%1:" ).arg( TDEABC::Address::regionLabel() ), page );
300 topLayout->addWidget( label, 4, 0 );
301 mRegionEdit = new KLineEdit( page );
302 label->setBuddy( mRegionEdit );
303 topLayout->addWidget( mRegionEdit, 4, 1 );
305 label = new TQLabel( i18n( "<postalCodeLabel>:", "%1:" ).arg( TDEABC::Address::postalCodeLabel() ), page );
306 topLayout->addWidget( label, 5, 0 );
307 mPostalCodeEdit = new KLineEdit( page );
308 label->setBuddy( mPostalCodeEdit );
309 topLayout->addWidget( mPostalCodeEdit, 5, 1 );
311 label = new TQLabel( i18n( "<countryLabel>:", "%1:" ).arg( TDEABC::Address::countryLabel() ), page );
312 topLayout->addWidget( label, 6, 0 );
313 mCountryCombo = new KComboBox( page );
314 mCountryCombo->setEditable( true );
315 mCountryCombo->setDuplicatesEnabled( false );
317 #if KDE_IS_VERSION(3,3,0)
318 TQPushButton *labelButton = new TQPushButton( i18n( "Edit Label..." ), page );
319 topLayout->addMultiCellWidget( labelButton, 7, 7, 0, 1 );
320 connect( labelButton, TQ_SIGNAL( clicked() ), TQ_SLOT( editLabel() ) );
324 label->setBuddy( mCountryCombo );
325 topLayout->addWidget( mCountryCombo, 6, 1 );
327 mPreferredCheckBox = new TQCheckBox( i18n( "street/postal", "This is the preferred address" ), page );
328 topLayout->addMultiCellWidget( mPreferredCheckBox, 8, 8, 0, 1 );
330 KSeparator *sep = new KSeparator( KSeparator::HLine, page );
331 topLayout->addMultiCellWidget( sep, 9, 9, 0, 1 );
333 TQHBox *buttonBox = new TQHBox( page );
334 buttonBox->setSpacing( spacingHint() );
335 topLayout->addMultiCellWidget( buttonBox, 10, 10, 0, 1 );
337 TQPushButton *addButton = new TQPushButton( i18n( "New..." ), buttonBox );
338 connect( addButton, TQ_SIGNAL( clicked() ), TQ_SLOT( addAddress() ) );
340 mRemoveButton = new TQPushButton( i18n( "Remove" ), buttonBox );
341 connect( mRemoveButton, TQ_SIGNAL( clicked() ), TQ_SLOT( removeAddress() ) );
343 mChangeTypeButton = new TQPushButton( i18n( "Change Type..." ), buttonBox );
344 connect( mChangeTypeButton, TQ_SIGNAL( clicked() ), TQ_SLOT( changeType() ) );
346 mTypeCombo->updateTypes();
347 mTypeCombo->setCurrentItem( selected );
349 updateAddressEdits();
351 connect( mTypeCombo, TQ_SIGNAL( activated( int ) ),
352 TQ_SLOT( updateAddressEdits() ) );
353 connect( mStreetTextEdit, TQ_SIGNAL( textChanged() ), TQ_SLOT( modified() ) );
354 connect( mPOBoxEdit, TQ_SIGNAL( textChanged( const TQString& ) ), TQ_SLOT( modified() ) );
355 connect( mLocalityEdit, TQ_SIGNAL( textChanged( const TQString& ) ), TQ_SLOT( modified() ) );
356 connect( mRegionEdit, TQ_SIGNAL( textChanged( const TQString& ) ), TQ_SLOT( modified() ) );
357 connect( mPostalCodeEdit, TQ_SIGNAL( textChanged( const TQString& ) ), TQ_SLOT( modified() ) );
358 connect( mCountryCombo, TQ_SIGNAL( textChanged( const TQString& ) ), TQ_SLOT( modified() ) );
359 connect( mPreferredCheckBox, TQ_SIGNAL( toggled( bool ) ), TQ_SLOT( modified() ) );
361 TDEAcceleratorManager::manage( this );
365 bool state = (mAddressList.count() > 0);
366 mRemoveButton->setEnabled( state );
367 mChangeTypeButton->setEnabled( state );
370 AddressEditDialog::~AddressEditDialog()
374 TDEABC::Address::List AddressEditDialog::addresses()
376 saveAddress( *(mTypeCombo->selectedElement()) );
381 bool AddressEditDialog::changed() const
386 void AddressEditDialog::addAddress()
390 mAddressList.append( Address( dlg.type() ) );
392 mTypeCombo->updateTypes();
393 mTypeCombo->setCurrentItem( mTypeCombo->count() - 1 );
394 updateAddressEdits();
398 mRemoveButton->setEnabled( true );
399 mChangeTypeButton->setEnabled( true );
403 void AddressEditDialog::removeAddress()
405 if ( mAddressList.count() > 0 ) {
406 TDEABC::Address::List::Iterator it = mTypeCombo->selectedElement();
407 if ( mPreviousAddress && mPreviousAddress->id() == (*it).id() )
408 mPreviousAddress = 0;
410 mAddressList.remove( it );
411 mTypeCombo->updateTypes();
412 updateAddressEdits();
417 bool state = ( mAddressList.count() > 0 );
418 mRemoveButton->setEnabled( state );
419 mChangeTypeButton->setEnabled( state );
422 void AddressEditDialog::changeType()
424 TDEABC::Address::List::Iterator a = mTypeCombo->selectedElement();
428 (*a).setType( dlg.type() );
430 mTypeCombo->updateTypes();
436 void AddressEditDialog::editLabel()
438 #if KDE_IS_VERSION(3,3,0)
440 TQString result = KInputDialog::getMultiLineText( TDEABC::Address::labelLabel(),
441 TDEABC::Address::labelLabel(),
450 void AddressEditDialog::updateAddressEdits()
452 if ( mPreviousAddress )
453 saveAddress( *mPreviousAddress );
455 TDEABC::Address::List::Iterator it = mTypeCombo->selectedElement();
456 TDEABC::Address a = *it;
457 mPreviousAddress = &(*it);
461 mStreetTextEdit->setText( a.street() );
462 mRegionEdit->setText( a.region() );
463 mLocalityEdit->setText( a.locality() );
464 mPostalCodeEdit->setText( a.postalCode() );
465 mPOBoxEdit->setText( a.postOfficeBox() );
466 mCountryCombo->setCurrentText( a.country() );
469 mPreferredCheckBox->setChecked( a.type() & TDEABC::Address::Pref );
472 mCountryCombo->setCurrentText( TDEGlobal::locale()->twoAlphaToCountryName( TDEGlobal::locale()->country() ) );
474 mStreetTextEdit->setFocus();
479 void AddressEditDialog::modified()
484 void AddressEditDialog::saveAddress( TDEABC::Address &addr )
486 addr.setLocality( mLocalityEdit->text() );
487 addr.setRegion( mRegionEdit->text() );
488 addr.setPostalCode( mPostalCodeEdit->text() );
489 addr.setCountry( mCountryCombo->currentText() );
490 addr.setPostOfficeBox( mPOBoxEdit->text() );
491 addr.setStreet( mStreetTextEdit->text() );
492 addr.setLabel( mLabel );
495 if ( mPreferredCheckBox->isChecked() ) {
496 TDEABC::Address::List::Iterator it;
497 for ( it = mAddressList.begin(); it != mAddressList.end(); ++it )
498 (*it).setType( (*it).type() & ~( TDEABC::Address::Pref ) );
500 addr.setType( addr.type() | TDEABC::Address::Pref );
502 addr.setType( addr.type() & ~( TDEABC::Address::Pref ) );
505 void AddressEditDialog::fillCountryCombo()
507 TQString country[] = {
508 i18n( "Afghanistan" ), i18n( "Albania" ), i18n( "Algeria" ),
509 i18n( "American Samoa" ), i18n( "Andorra" ), i18n( "Angola" ),
510 i18n( "Anguilla" ), i18n( "Antarctica" ), i18n( "Antigua and Barbuda" ),
511 i18n( "Argentina" ), i18n( "Armenia" ), i18n( "Aruba" ),
512 i18n( "Ashmore and Cartier Islands" ), i18n( "Australia" ),
513 i18n( "Austria" ), i18n( "Azerbaijan" ), i18n( "Bahamas" ),
514 i18n( "Bahrain" ), i18n( "Bangladesh" ), i18n( "Barbados" ),
515 i18n( "Belarus" ), i18n( "Belgium" ), i18n( "Belize" ),
516 i18n( "Benin" ), i18n( "Bermuda" ), i18n( "Bhutan" ),
517 i18n( "Bolivia" ), i18n( "Bosnia and Herzegovina" ), i18n( "Botswana" ),
518 i18n( "Brazil" ), i18n( "Brunei" ), i18n( "Bulgaria" ),
519 i18n( "Burkina Faso" ), i18n( "Burundi" ), i18n( "Cambodia" ),
520 i18n( "Cameroon" ), i18n( "Canada" ), i18n( "Cape Verde" ),
521 i18n( "Cayman Islands" ), i18n( "Central African Republic" ),
522 i18n( "Chad" ), i18n( "Chile" ), i18n( "China" ), i18n( "Colombia" ),
523 i18n( "Comoros" ), i18n( "Congo" ), i18n( "Congo, Dem. Rep." ),
524 i18n( "Costa Rica" ), i18n( "Croatia" ),
525 i18n( "Cuba" ), i18n( "Cyprus" ), i18n( "Czech Republic" ),
526 i18n( "Denmark" ), i18n( "Djibouti" ),
527 i18n( "Dominica" ), i18n( "Dominican Republic" ), i18n( "Ecuador" ),
528 i18n( "Egypt" ), i18n( "El Salvador" ), i18n( "Equatorial Guinea" ),
529 i18n( "Eritrea" ), i18n( "Estonia" ), i18n( "England" ),
530 i18n( "Ethiopia" ), i18n( "European Union" ), i18n( "Faroe Islands" ),
531 i18n( "Fiji" ), i18n( "Finland" ), i18n( "France" ),
532 i18n( "French Polynesia" ), i18n( "Gabon" ), i18n( "Gambia" ),
533 i18n( "Georgia" ), i18n( "Germany" ), i18n( "Ghana" ),
534 i18n( "Greece" ), i18n( "Greenland" ), i18n( "Grenada" ),
535 i18n( "Guam" ), i18n( "Guatemala" ), i18n( "Guinea" ),
536 i18n( "Guinea-Bissau" ), i18n( "Guyana" ), i18n( "Haiti" ),
537 i18n( "Honduras" ), i18n( "Hong Kong" ), i18n( "Hungary" ),
538 i18n( "Iceland" ), i18n( "India" ), i18n( "Indonesia" ),
539 i18n( "Iran" ), i18n( "Iraq" ), i18n( "Ireland" ),
540 i18n( "Israel" ), i18n( "Italy" ), i18n( "Ivory Coast" ),
541 i18n( "Jamaica" ), i18n( "Japan" ), i18n( "Jordan" ),
542 i18n( "Kazakhstan" ), i18n( "Kenya" ), i18n( "Kiribati" ),
543 i18n( "Korea, North" ), i18n( "Korea, South" ),
544 i18n( "Kuwait" ), i18n( "Kyrgyzstan" ), i18n( "Laos" ),
545 i18n( "Latvia" ), i18n( "Lebanon" ), i18n( "Lesotho" ),
546 i18n( "Liberia" ), i18n( "Libya" ), i18n( "Liechtenstein" ),
547 i18n( "Lithuania" ), i18n( "Luxembourg" ), i18n( "Macau" ),
548 i18n( "Madagascar" ), i18n( "Malawi" ), i18n( "Malaysia" ),
549 i18n( "Maldives" ), i18n( "Mali" ), i18n( "Malta" ),
550 i18n( "Marshall Islands" ), i18n( "Martinique" ), i18n( "Mauritania" ),
551 i18n( "Mauritius" ), i18n( "Mexico" ),
552 i18n( "Micronesia, Federated States Of" ), i18n( "Moldova" ),
553 i18n( "Monaco" ), i18n( "Mongolia" ), i18n( "Montserrat" ),
554 i18n( "Morocco" ), i18n( "Mozambique" ), i18n( "Myanmar" ),
556 i18n( "Nauru" ), i18n( "Nepal" ), i18n( "Netherlands" ),
557 i18n( "Netherlands Antilles" ), i18n( "New Caledonia" ),
558 i18n( "New Zealand" ), i18n( "Nicaragua" ), i18n( "Niger" ),
559 i18n( "Nigeria" ), i18n( "Niue" ), i18n( "North Korea" ),
560 i18n( "Northern Ireland" ), i18n( "Northern Mariana Islands" ),
561 i18n( "Norway" ), i18n( "Oman" ), i18n( "Pakistan" ), i18n( "Palau" ),
562 i18n( "Palestinian" ), i18n( "Panama" ), i18n( "Papua New Guinea" ),
563 i18n( "Paraguay" ), i18n( "Peru" ), i18n( "Philippines" ),
564 i18n( "Poland" ), i18n( "Portugal" ), i18n( "Puerto Rico" ),
565 i18n( "Qatar" ), i18n( "Romania" ), i18n( "Russia" ), i18n( "Rwanda" ),
566 i18n( "St. Kitts and Nevis" ), i18n( "St. Lucia" ),
567 i18n( "St. Vincent and the Grenadines" ), i18n( "San Marino" ),
568 i18n( "Sao Tome and Principe" ), i18n( "Saudi Arabia" ),
569 i18n( "Senegal" ), i18n( "Serbia & Montenegro" ), i18n( "Seychelles" ),
570 i18n( "Sierra Leone" ), i18n( "Singapore" ), i18n( "Slovakia" ),
571 i18n( "Slovenia" ), i18n( "Solomon Islands" ), i18n( "Somalia" ),
572 i18n( "South Africa" ), i18n( "South Korea" ), i18n( "Spain" ),
573 i18n( "Sri Lanka" ), i18n( "St. Kitts and Nevis" ), i18n( "Sudan" ),
574 i18n( "Suriname" ), i18n( "Swaziland" ), i18n( "Sweden" ),
575 i18n( "Switzerland" ), i18n( "Syria" ), i18n( "Taiwan" ),
576 i18n( "Tajikistan" ), i18n( "Tanzania" ), i18n( "Thailand" ),
577 i18n( "Tibet" ), i18n( "Togo" ), i18n( "Tonga" ),
578 i18n( "Trinidad and Tobago" ), i18n( "Tunisia" ), i18n( "Turkey" ),
579 i18n( "Turkmenistan" ), i18n( "Turks and Caicos Islands" ),
580 i18n( "Tuvalu" ), i18n( "Uganda" ), i18n( "Ukraine" ),
581 i18n( "United Arab Emirates" ), i18n( "United Kingdom" ),
582 i18n( "United States" ), i18n( "Uruguay" ), i18n( "Uzbekistan" ),
583 i18n( "Vanuatu" ), i18n( "Vatican City" ), i18n( "Venezuela" ),
584 i18n( "Vietnam" ), i18n( "Western Samoa" ), i18n( "Yemen" ),
585 i18n( "Yugoslavia" ), i18n( "Zaire" ), i18n( "Zambia" ),
590 TQStringList countries;
591 for ( int i = 0; !country[ i ].isEmpty(); ++i )
592 countries.append( country[ i ] );
594 countries = sortLocaleAware( countries );
596 mCountryCombo->insertStringList( countries );
597 mCountryCombo->completionObject()->setItems( countries );
598 mCountryCombo->setAutoCompletion( true );
602 AddressTypeDialog::AddressTypeDialog( int type, TQWidget *parent )
603 : KDialogBase( Plain, i18n( "street/postal", "Edit Address Type" ), Ok | Cancel, Ok,
604 parent, "AddressTypeDialog" )
606 TQWidget *page = plainPage();
607 TQVBoxLayout *layout = new TQVBoxLayout( page );
609 mGroup = new TQButtonGroup( 2, TQt::Horizontal, i18n( "street/postal", "Address Types" ), page );
610 layout->addWidget( mGroup );
612 mTypeList = TDEABC::Address::typeList();
613 mTypeList.remove( TDEABC::Address::Pref );
615 TDEABC::Address::TypeList::ConstIterator it;
616 for ( it = mTypeList.begin(); it != mTypeList.end(); ++it )
617 new TQCheckBox( TDEABC::Address::typeLabel( *it ), mGroup );
619 for ( int i = 0; i < mGroup->count(); ++i ) {
620 TQCheckBox *box = (TQCheckBox*)mGroup->find( i );
621 box->setChecked( type & mTypeList[ i ] );
625 AddressTypeDialog::~AddressTypeDialog()
629 int AddressTypeDialog::type() const
632 for ( int i = 0; i < mGroup->count(); ++i ) {
633 TQCheckBox *box = (TQCheckBox*)mGroup->find( i );
634 if ( box->isChecked() )
635 type += mTypeList[ i ];
645 class LocaleAwareString : public TQString
648 LocaleAwareString() : TQString()
651 LocaleAwareString( const TQString &str ) : TQString( str )
655 static bool operator<( const LocaleAwareString &s1, const LocaleAwareString &s2 )
657 return ( TQString::localeAwareCompare( s1, s2 ) < 0 );
660 TQStringList AddressEditDialog::sortLocaleAware( const TQStringList &list )
662 TQValueList<LocaleAwareString> sortedList;
664 TQStringList::ConstIterator it;
665 for ( it = list.begin(); it != list.end(); ++it )
666 sortedList.append( LocaleAwareString( *it ) );
668 qHeapSort( sortedList );
671 TQValueList<LocaleAwareString>::ConstIterator retIt;
672 for ( retIt = sortedList.begin(); retIt != sortedList.end(); ++retIt )
673 retval.append( *retIt );
678 #include "addresseditwidget.moc"
Dialog for editing address details.
Dialog for selecting an address type.
Combo box for type information of Addresses and Phone numbers.
|