author | zautrix <zautrix> | 2005-07-06 11:34:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-06 11:34:56 (UTC) |
commit | 1e5f0fbaac9814c7289137a74a460494553245c2 (patch) (unidiff) | |
tree | 670330f38ba364590c9404c135a8b6d9ac9bfb2e | |
parent | 62a3094163367227c98494d7f69724aba4927584 (diff) | |
download | kdepimpi-1e5f0fbaac9814c7289137a74a460494553245c2.zip kdepimpi-1e5f0fbaac9814c7289137a74a460494553245c2.tar.gz kdepimpi-1e5f0fbaac9814c7289137a74a460494553245c2.tar.bz2 |
fixx
-rw-r--r-- | kaddressbook/phoneeditwidget.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp index a435959..2bce39a 100644 --- a/kaddressbook/phoneeditwidget.cpp +++ b/kaddressbook/phoneeditwidget.cpp | |||
@@ -351,97 +351,100 @@ void PhoneViewItem::makeText() | |||
351 | /** | 351 | /** |
352 | * Will be used in future versions of kaddressbook/libkabc | 352 | * Will be used in future versions of kaddressbook/libkabc |
353 | 353 | ||
354 | setText( 0, mPhoneNumber.country() ); | 354 | setText( 0, mPhoneNumber.country() ); |
355 | setText( 1, mPhoneNumber.region() ); | 355 | setText( 1, mPhoneNumber.region() ); |
356 | setText( 2, mPhoneNumber.number() ); | 356 | setText( 2, mPhoneNumber.number() ); |
357 | setText( 3, mPhoneNumber.typeLabel() ); | 357 | setText( 3, mPhoneNumber.typeLabel() ); |
358 | */ | 358 | */ |
359 | 359 | ||
360 | setText( 0, mPhoneNumber.number() ); | 360 | setText( 0, mPhoneNumber.number() ); |
361 | setText( 1, mPhoneNumber.typeLabel() ); | 361 | setText( 1, mPhoneNumber.typeLabel() ); |
362 | } | 362 | } |
363 | 363 | ||
364 | PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name ) | 364 | PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name ) |
365 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ), | 365 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ), |
366 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, | 366 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, |
367 | parent, name, true) | 367 | parent, name, true) |
368 | { | 368 | { |
369 | mPhoneNumberList = list; | 369 | mPhoneNumberList = list; |
370 | 370 | ||
371 | QWidget *page = plainPage(); | 371 | QWidget *page = plainPage(); |
372 | 372 | ||
373 | QGridLayout *layout = new QGridLayout( page, 1, 2 ); | 373 | QGridLayout *layout = new QGridLayout( page, 1, 2 ); |
374 | layout->setSpacing( spacingHint() ); | 374 | layout->setSpacing( spacingHint() ); |
375 | 375 | ||
376 | mListView = new KListView( page ); | 376 | mListView = new KListView( page ); |
377 | mListView->setAllColumnsShowFocus( true ); | 377 | mListView->setAllColumnsShowFocus( true ); |
378 | mListView->addColumn( i18n( "Number" ) ); | 378 | mListView->addColumn( i18n( "Number" ) ); |
379 | mListView->addColumn( i18n( "Type" ) ); | 379 | mListView->addColumn( i18n( "Type" ) ); |
380 | 380 | ||
381 | KButtonBox *buttonBox = new KButtonBox( page, Vertical ); | 381 | KButtonBox *buttonBox = new KButtonBox( page, Vertical ); |
382 | 382 | ||
383 | buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) ); | 383 | buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) ); |
384 | mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) ); | 384 | mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) ); |
385 | mEditButton->setEnabled( false ); | 385 | mEditButton->setEnabled( false ); |
386 | mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) ); | 386 | mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) ); |
387 | mRemoveButton->setEnabled( false ); | 387 | mRemoveButton->setEnabled( false ); |
388 | buttonBox->layout(); | 388 | buttonBox->layout(); |
389 | 389 | ||
390 | layout->addWidget( mListView, 0, 0 ); | 390 | layout->addWidget( mListView, 0, 0 ); |
391 | layout->addWidget( buttonBox, 0, 1 ); | 391 | layout->addWidget( buttonBox, 0, 1 ); |
392 | 392 | ||
393 | connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) ); | 393 | connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) ); |
394 | connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber())); | 394 | connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber())); |
395 | 395 | ||
396 | KABC::PhoneNumber::List::Iterator it; | 396 | KABC::PhoneNumber::List::Iterator it; |
397 | for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it ) | 397 | for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it ) |
398 | new PhoneViewItem( mListView, *it ); | 398 | new PhoneViewItem( mListView, *it ); |
399 | 399 | if (QApplication::desktop()->width() < 480 ) | |
400 | showMaximized(); | ||
401 | else | ||
402 | resize( 400, 400 ); | ||
400 | mChanged = false; | 403 | mChanged = false; |
401 | } | 404 | } |
402 | 405 | ||
403 | PhoneEditDialog::~PhoneEditDialog() | 406 | PhoneEditDialog::~PhoneEditDialog() |
404 | { | 407 | { |
405 | } | 408 | } |
406 | 409 | ||
407 | void PhoneEditDialog::slotAddPhoneNumber() | 410 | void PhoneEditDialog::slotAddPhoneNumber() |
408 | { | 411 | { |
409 | KABC::PhoneNumber tmp( "", 0 ); | 412 | KABC::PhoneNumber tmp( "", 0 ); |
410 | PhoneTypeDialog dlg( tmp, this ); | 413 | PhoneTypeDialog dlg( tmp, this ); |
411 | 414 | ||
412 | if ( dlg.exec() ) { | 415 | if ( dlg.exec() ) { |
413 | QListViewItem* i = mListView->firstChild(); | 416 | QListViewItem* i = mListView->firstChild(); |
414 | KABC::PhoneNumber phoneNumber = dlg.phoneNumber(); | 417 | KABC::PhoneNumber phoneNumber = dlg.phoneNumber(); |
415 | bool insert = true; | 418 | bool insert = true; |
416 | while ( i ) { | 419 | while ( i ) { |
417 | PhoneViewItem* p = ( PhoneViewItem* ) i; | 420 | PhoneViewItem* p = ( PhoneViewItem* ) i; |
418 | KABC::PhoneNumber pn = p->phoneNumber(); | 421 | KABC::PhoneNumber pn = p->phoneNumber(); |
419 | if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) { | 422 | if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) { |
420 | if ( p->text(0).isEmpty()) { | 423 | if ( p->text(0).isEmpty()) { |
421 | p->setPhoneNumber( phoneNumber ); | 424 | p->setPhoneNumber( phoneNumber ); |
422 | mPhoneNumberList.remove( pn ); | 425 | mPhoneNumberList.remove( pn ); |
423 | mPhoneNumberList.append( phoneNumber ); | 426 | mPhoneNumberList.append( phoneNumber ); |
424 | insert = false; | 427 | insert = false; |
425 | break; | 428 | break; |
426 | } | 429 | } |
427 | } | 430 | } |
428 | i = i->nextSibling(); | 431 | i = i->nextSibling(); |
429 | } | 432 | } |
430 | if ( insert ) { | 433 | if ( insert ) { |
431 | mPhoneNumberList.append( phoneNumber ); | 434 | mPhoneNumberList.append( phoneNumber ); |
432 | new PhoneViewItem( mListView, phoneNumber ); | 435 | new PhoneViewItem( mListView, phoneNumber ); |
433 | } | 436 | } |
434 | mChanged = true; | 437 | mChanged = true; |
435 | } | 438 | } |
436 | } | 439 | } |
437 | 440 | ||
438 | void PhoneEditDialog::slotRemovePhoneNumber() | 441 | void PhoneEditDialog::slotRemovePhoneNumber() |
439 | { | 442 | { |
440 | PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); | 443 | PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); |
441 | if ( !item ) | 444 | if ( !item ) |
442 | return; | 445 | return; |
443 | 446 | ||
444 | mPhoneNumberList.remove( item->phoneNumber() ); | 447 | mPhoneNumberList.remove( item->phoneNumber() ); |
445 | QListViewItem *currItem = mListView->currentItem(); | 448 | QListViewItem *currItem = mListView->currentItem(); |
446 | mListView->takeItem( currItem ); | 449 | mListView->takeItem( currItem ); |
447 | delete currItem; | 450 | delete currItem; |