Diffstat (limited to 'kaddressbook/phoneeditwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/phoneeditwidget.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp index b20275d..997fc05 100644 --- a/kaddressbook/phoneeditwidget.cpp +++ b/kaddressbook/phoneeditwidget.cpp | |||
@@ -30,163 +30,169 @@ | |||
30 | #include <qlistbox.h> | 30 | #include <qlistbox.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qbuttongroup.h> | 32 | #include <qbuttongroup.h> |
33 | #include <qhbox.h> | 33 | #include <qhbox.h> |
34 | 34 | ||
35 | #include <kbuttonbox.h> | 35 | #include <kbuttonbox.h> |
36 | #include <klistview.h> | 36 | #include <klistview.h> |
37 | #include <kapplication.h> | 37 | #include <kapplication.h> |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <klineedit.h> | 40 | #include <klineedit.h> |
41 | #include <kcombobox.h> | 41 | #include <kcombobox.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
43 | #include <kdebug.h> | 43 | #include <kdebug.h> |
44 | #include <kglobal.h> | 44 | #include <kglobal.h> |
45 | #include <kiconloader.h> | 45 | #include <kiconloader.h> |
46 | 46 | ||
47 | #include <kabc/phonenumber.h> | 47 | #include <kabc/phonenumber.h> |
48 | 48 | ||
49 | #include "typecombo.h" | 49 | #include "typecombo.h" |
50 | 50 | ||
51 | #include "phoneeditwidget.h" | 51 | #include "phoneeditwidget.h" |
52 | 52 | ||
53 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) | 53 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) |
54 | : QScrollView(parent,name) | 54 | : QScrollView(parent,name) |
55 | { | 55 | { |
56 | setFrameStyle ( QFrame::Panel | QFrame::Plain ); | 56 | setFrameStyle ( QFrame::Panel | QFrame::Plain ); |
57 | setLineWidth ( 1 ); | 57 | setLineWidth ( 1 ); |
58 | setMidLineWidth ( 1 ); | 58 | setMidLineWidth ( 1 ); |
59 | mw = new QWidget ( viewport() ); | 59 | mw = new QWidget ( viewport() ); |
60 | addChild(mw); | 60 | addChild(mw); |
61 | setResizePolicy( AutoOneFit ); | 61 | setResizePolicy( AutoOneFit ); |
62 | mainLayout = new QVBoxLayout ( mw ); | 62 | mainLayout = new QVBoxLayout ( mw ); |
63 | mainLayout->setMargin( 2 ); | 63 | mainLayout->setMargin( 2 ); |
64 | mainLayout->setSpacing( 2 ); | 64 | mainLayout->setSpacing( 2 ); |
65 | QWidget* hb = new QWidget ( mw ); | 65 | QWidget* hb = new QWidget ( mw ); |
66 | mainLayout->add( hb ); | 66 | mainLayout->add( hb ); |
67 | QHBoxLayout* hbLayout = new QHBoxLayout ( hb ); | 67 | QHBoxLayout* hbLayout = new QHBoxLayout ( hb ); |
68 | QPushButton *addBut = new QPushButton ( "add", hb ); | 68 | QPushButton *addBut = new QPushButton ( "add", hb ); |
69 | hbLayout->add( addBut ); | 69 | hbLayout->add( addBut ); |
70 | addBut->setPixmap ( SmallIcon("plus")); | 70 | addBut->setPixmap ( SmallIcon("plus")); |
71 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); | 71 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); |
72 | connect(addBut,SIGNAL(clicked()),SLOT(addNumber())); | 72 | connect(addBut,SIGNAL(clicked()),SLOT(addNumber())); |
73 | //QLabel * temp = new QLabel( i18n("Phone Type"), hb ); | 73 | //QLabel * temp = new QLabel( i18n("Phone Type"), hb ); |
74 | QLabel *temp = new QLabel( i18n("Phone Number"),hb ); | 74 | QLabel *temp = new QLabel( i18n("Phone Number"),hb ); |
75 | temp->setAlignment( Qt::AlignCenter ); | 75 | temp->setAlignment( Qt::AlignCenter ); |
76 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | 76 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
77 | hbLayout->add( temp ); | 77 | hbLayout->add( temp ); |
78 | appendEditCombo(); | ||
79 | appendEditCombo(); | ||
80 | appendEditCombo(); | ||
81 | setDefaults(); | 78 | setDefaults(); |
79 | mTypeNumberEditList.setAutoDelete( true ); | ||
82 | } | 80 | } |
83 | 81 | ||
84 | PhoneEditWidget::~PhoneEditWidget() | 82 | PhoneEditWidget::~PhoneEditWidget() |
85 | { | 83 | { |
86 | } | 84 | } |
87 | void PhoneEditWidget::setDefaults() | 85 | void PhoneEditWidget::setDefaults() |
88 | { | 86 | { |
89 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); | 87 | mTypeNumberEditList.clear(); |
88 | PhoneTypeNumberEdit* edit = appendEditCombo(); | ||
90 | KABC::PhoneNumber phoneNumber; | 89 | KABC::PhoneNumber phoneNumber; |
91 | phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref ); | 90 | phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref ); |
92 | edit->setPhoneNumber( phoneNumber ); | 91 | edit->setPhoneNumber( phoneNumber ); |
93 | edit = mTypeNumberEditList.next(); | 92 | edit = appendEditCombo(); |
94 | phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); | 93 | phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); |
95 | edit->setPhoneNumber( phoneNumber ); | 94 | edit->setPhoneNumber( phoneNumber ); |
96 | edit = mTypeNumberEditList.next(); | 95 | edit = appendEditCombo(); |
97 | phoneNumber.setType( KABC::PhoneNumber::Cell ); | 96 | phoneNumber.setType( KABC::PhoneNumber::Cell ); |
98 | edit->setPhoneNumber( phoneNumber ); | 97 | edit->setPhoneNumber( phoneNumber ); |
99 | edit = mTypeNumberEditList.next(); | 98 | |
100 | while ( edit ) { | ||
101 | edit->hide(); | ||
102 | edit = mTypeNumberEditList.next(); | ||
103 | } | ||
104 | } | 99 | } |
105 | void PhoneEditWidget::addNumber() | 100 | void PhoneEditWidget::addNumber() |
106 | { | 101 | { |
107 | 102 | ||
108 | } | 103 | } |
109 | PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo() | 104 | PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo() |
110 | { | 105 | { |
111 | PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw ); | 106 | PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw ); |
112 | connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) ); | 107 | connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) ); |
113 | connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) ); | 108 | connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) ); |
109 | connect ( edit, SIGNAL ( deleteMe( PhoneTypeNumberEdit* ) ), this, SLOT ( deleteEdit( PhoneTypeNumberEdit*) ) ); | ||
114 | connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) ); | 110 | connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) ); |
115 | 111 | ||
116 | mainLayout->add( edit ); | 112 | mainLayout->add( edit ); |
117 | mTypeNumberEditList.append( edit ); | 113 | mTypeNumberEditList.append( edit ); |
118 | return edit; | 114 | return edit; |
119 | } | 115 | } |
120 | 116 | ||
117 | void PhoneEditWidget::deleteEdit( PhoneTypeNumberEdit* ew ) | ||
118 | { | ||
119 | mPendingDelete = ew; | ||
120 | QTimer::singleShot( 0, this, SLOT ( pendingDelete() ) ); | ||
121 | } | ||
122 | void PhoneEditWidget::pendingDelete() | ||
123 | { | ||
124 | mTypeNumberEditList.removeRef( mPendingDelete ); | ||
125 | emit modified(); | ||
126 | } | ||
127 | |||
121 | void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li ) | 128 | void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li ) |
122 | { | 129 | { |
123 | if ( li.isEmpty() ) { | 130 | if ( li.isEmpty() ) { |
124 | setDefaults(); | 131 | setDefaults(); |
125 | return; | 132 | return; |
126 | } | 133 | } |
134 | mTypeNumberEditList.clear(); | ||
127 | KABC::PhoneNumber::List::Iterator it; | 135 | KABC::PhoneNumber::List::Iterator it; |
128 | KABC::PhoneNumber::List list = li; | 136 | KABC::PhoneNumber::List list = li; |
129 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); | 137 | PhoneTypeNumberEdit* edit = 0;//mTypeNumberEditList.first(); |
130 | for ( it = list.begin(); it != list.end(); ++it ) { | 138 | for ( it = list.begin(); it != list.end(); ++it ) { |
131 | if ( edit ) { | 139 | if ( edit ) { |
132 | edit->setPhoneNumber( (*it ) ); | 140 | edit->setPhoneNumber( (*it ) ); |
133 | edit = mTypeNumberEditList.next(); | 141 | edit = mTypeNumberEditList.next(); |
134 | } else { | 142 | } else { |
135 | PhoneTypeNumberEdit* editNew = appendEditCombo(); | 143 | PhoneTypeNumberEdit* editNew = appendEditCombo(); |
136 | editNew->setPhoneNumber( (*it ) ); | 144 | editNew->setPhoneNumber( (*it ) ); |
137 | } | 145 | } |
138 | } | 146 | } |
139 | while ( edit ) { | 147 | while ( edit ) { |
140 | edit->hide(); | 148 | edit->hide(); |
141 | edit = mTypeNumberEditList.next(); | 149 | edit = mTypeNumberEditList.next(); |
142 | } | 150 | } |
143 | //mainLayout->invalidate (); | ||
144 | mw->update(); | ||
145 | } | 151 | } |
146 | KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() | 152 | KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() |
147 | { | 153 | { |
148 | KABC::PhoneNumber::List retList; | 154 | KABC::PhoneNumber::List retList; |
149 | 155 | ||
150 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); | 156 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); |
151 | while ( edit ) { | 157 | while ( edit ) { |
152 | if ( edit->isValid() ) { | 158 | if ( edit->isValid() ) { |
153 | retList.append( edit->phoneNumber()); | 159 | retList.append( edit->phoneNumber()); |
154 | } | 160 | } |
155 | edit = mTypeNumberEditList.next(); | 161 | edit = mTypeNumberEditList.next(); |
156 | 162 | ||
157 | } | 163 | } |
158 | return retList; | 164 | return retList; |
159 | } | 165 | } |
160 | 166 | ||
161 | #if 0 | 167 | #if 0 |
162 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) | 168 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) |
163 | : QWidget( parent, name ) | 169 | : QWidget( parent, name ) |
164 | { | 170 | { |
165 | QGridLayout *layout = new QGridLayout( this, 4, 1 ); | 171 | QGridLayout *layout = new QGridLayout( this, 4, 1 ); |
166 | //US layout->setSpacing( KDialog::spacingHint() ); | 172 | //US layout->setSpacing( KDialog::spacingHint() ); |
167 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 173 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
168 | 174 | ||
169 | 175 | ||
170 | 176 | ||
171 | QLabel* label = new QLabel( this ); | 177 | QLabel* label = new QLabel( this ); |
172 | //US loadIcon call is ambiguous. Add one more parameter | 178 | //US loadIcon call is ambiguous. Add one more parameter |
173 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); | 179 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); |
174 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | 180 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
175 | label->setAlignment( AlignCenter ); | 181 | label->setAlignment( AlignCenter ); |
176 | //US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); | 182 | //US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); |
177 | layout->addWidget( label, 0, 0 ); | 183 | layout->addWidget( label, 0, 0 ); |
178 | 184 | ||
179 | QPushButton *editButton = new QPushButton( i18n( "Edit Phone Numbers..." ), | 185 | QPushButton *editButton = new QPushButton( i18n( "Edit Phone Numbers..." ), |
180 | this ); | 186 | this ); |
181 | if ( QApplication::desktop()->width() < 640 ) | 187 | if ( QApplication::desktop()->width() < 640 ) |
182 | layout->addWidget( editButton, 0, 1 ); | 188 | layout->addWidget( editButton, 0, 1 ); |
183 | else | 189 | else |
184 | layout->addMultiCellWidget( editButton, 0, 0, 1, 3); | 190 | layout->addMultiCellWidget( editButton, 0, 0, 1, 3); |
185 | 191 | ||
186 | mPrefCombo = new PhoneTypeCombo( mPhoneList, this ); | 192 | mPrefCombo = new PhoneTypeCombo( mPhoneList, this ); |
187 | mPrefEdit = new KLineEdit( this ); | 193 | mPrefEdit = new KLineEdit( this ); |
188 | //mPrefEdit->setMinimumWidth( int(mPrefEdit->sizeHint().width() * 1.5) ); | 194 | //mPrefEdit->setMinimumWidth( int(mPrefEdit->sizeHint().width() * 1.5) ); |
189 | mPrefCombo->setLineEdit( mPrefEdit ); | 195 | mPrefCombo->setLineEdit( mPrefEdit ); |
190 | layout->addWidget( mPrefCombo, 1, 0 ); | 196 | layout->addWidget( mPrefCombo, 1, 0 ); |
191 | layout->addWidget( mPrefEdit, 1, 1 ); | 197 | layout->addWidget( mPrefEdit, 1, 1 ); |
192 | int x = 1, y = 2; | 198 | int x = 1, y = 2; |
@@ -470,96 +476,97 @@ void PhoneViewItem::makeText() | |||
470 | setText( 0, mPhoneNumber.number() ); | 476 | setText( 0, mPhoneNumber.number() ); |
471 | setText( 1, mPhoneNumber.typeLabel() ); | 477 | setText( 1, mPhoneNumber.typeLabel() ); |
472 | } | 478 | } |
473 | 479 | ||
474 | PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name ) | 480 | PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name ) |
475 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ), | 481 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ), |
476 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, | 482 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, |
477 | parent, name, true) | 483 | parent, name, true) |
478 | { | 484 | { |
479 | mPhoneNumberList = list; | 485 | mPhoneNumberList = list; |
480 | 486 | ||
481 | QWidget *page = plainPage(); | 487 | QWidget *page = plainPage(); |
482 | 488 | ||
483 | QGridLayout *layout = new QGridLayout( page, 1, 2 ); | 489 | QGridLayout *layout = new QGridLayout( page, 1, 2 ); |
484 | layout->setSpacing( spacingHint() ); | 490 | layout->setSpacing( spacingHint() ); |
485 | 491 | ||
486 | mListView = new KListView( page ); | 492 | mListView = new KListView( page ); |
487 | mListView->setAllColumnsShowFocus( true ); | 493 | mListView->setAllColumnsShowFocus( true ); |
488 | mListView->addColumn( i18n( "Number" ) ); | 494 | mListView->addColumn( i18n( "Number" ) ); |
489 | mListView->addColumn( i18n( "Type" ) ); | 495 | mListView->addColumn( i18n( "Type" ) ); |
490 | 496 | ||
491 | KButtonBox *buttonBox = new KButtonBox( page, Vertical ); | 497 | KButtonBox *buttonBox = new KButtonBox( page, Vertical ); |
492 | 498 | ||
493 | buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) ); | 499 | buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) ); |
494 | mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) ); | 500 | mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) ); |
495 | mEditButton->setEnabled( false ); | 501 | mEditButton->setEnabled( false ); |
496 | mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) ); | 502 | mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) ); |
497 | mRemoveButton->setEnabled( false ); | 503 | mRemoveButton->setEnabled( false ); |
498 | buttonBox->layout(); | 504 | buttonBox->layout(); |
499 | 505 | ||
500 | layout->addWidget( mListView, 0, 0 ); | 506 | layout->addWidget( mListView, 0, 0 ); |
501 | layout->addWidget( buttonBox, 0, 1 ); | 507 | layout->addWidget( buttonBox, 0, 1 ); |
502 | 508 | ||
503 | connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) ); | 509 | connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) ); |
504 | connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber())); | 510 | connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber())); |
505 | 511 | ||
506 | KABC::PhoneNumber::List::Iterator it; | 512 | KABC::PhoneNumber::List::Iterator it; |
507 | for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it ) | 513 | for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it ) |
508 | new PhoneViewItem( mListView, *it ); | 514 | new PhoneViewItem( mListView, *it ); |
509 | if (QApplication::desktop()->width() < 480 ) | 515 | if (QApplication::desktop()->width() < 480 ) |
510 | showMaximized(); | 516 | showMaximized(); |
511 | else | 517 | else |
512 | resize( 400, 400 ); | 518 | resize( 400, 400 ); |
513 | mChanged = false; | 519 | mChanged = false; |
514 | } | 520 | } |
515 | 521 | ||
516 | PhoneEditDialog::~PhoneEditDialog() | 522 | PhoneEditDialog::~PhoneEditDialog() |
517 | { | 523 | { |
524 | qDebug("PhoneEditDialog::~PhoneEditDialog() "); | ||
518 | } | 525 | } |
519 | 526 | ||
520 | void PhoneEditDialog::slotAddPhoneNumber() | 527 | void PhoneEditDialog::slotAddPhoneNumber() |
521 | { | 528 | { |
522 | KABC::PhoneNumber tmp( "", 0 ); | 529 | KABC::PhoneNumber tmp( "", 0 ); |
523 | PhoneTypeDialog dlg( tmp, this ); | 530 | PhoneTypeDialog dlg( tmp, this ); |
524 | 531 | ||
525 | if ( dlg.exec() ) { | 532 | if ( dlg.exec() ) { |
526 | QListViewItem* i = mListView->firstChild(); | 533 | QListViewItem* i = mListView->firstChild(); |
527 | KABC::PhoneNumber phoneNumber = dlg.phoneNumber(); | 534 | KABC::PhoneNumber phoneNumber = dlg.phoneNumber(); |
528 | bool insert = true; | 535 | bool insert = true; |
529 | while ( i ) { | 536 | while ( i ) { |
530 | PhoneViewItem* p = ( PhoneViewItem* ) i; | 537 | PhoneViewItem* p = ( PhoneViewItem* ) i; |
531 | KABC::PhoneNumber pn = p->phoneNumber(); | 538 | KABC::PhoneNumber pn = p->phoneNumber(); |
532 | if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) { | 539 | if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) { |
533 | if ( p->text(0).isEmpty()) { | 540 | if ( p->text(0).isEmpty()) { |
534 | p->setPhoneNumber( phoneNumber ); | 541 | p->setPhoneNumber( phoneNumber ); |
535 | mPhoneNumberList.remove( pn ); | 542 | mPhoneNumberList.remove( pn ); |
536 | mPhoneNumberList.append( phoneNumber ); | 543 | mPhoneNumberList.append( phoneNumber ); |
537 | insert = false; | 544 | insert = false; |
538 | break; | 545 | break; |
539 | } | 546 | } |
540 | } | 547 | } |
541 | i = i->nextSibling(); | 548 | i = i->nextSibling(); |
542 | } | 549 | } |
543 | if ( insert ) { | 550 | if ( insert ) { |
544 | mPhoneNumberList.append( phoneNumber ); | 551 | mPhoneNumberList.append( phoneNumber ); |
545 | new PhoneViewItem( mListView, phoneNumber ); | 552 | new PhoneViewItem( mListView, phoneNumber ); |
546 | } | 553 | } |
547 | mChanged = true; | 554 | mChanged = true; |
548 | } | 555 | } |
549 | } | 556 | } |
550 | 557 | ||
551 | void PhoneEditDialog::slotRemovePhoneNumber() | 558 | void PhoneEditDialog::slotRemovePhoneNumber() |
552 | { | 559 | { |
553 | PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); | 560 | PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); |
554 | if ( !item ) | 561 | if ( !item ) |
555 | return; | 562 | return; |
556 | 563 | ||
557 | mPhoneNumberList.remove( item->phoneNumber() ); | 564 | mPhoneNumberList.remove( item->phoneNumber() ); |
558 | QListViewItem *currItem = mListView->currentItem(); | 565 | QListViewItem *currItem = mListView->currentItem(); |
559 | mListView->takeItem( currItem ); | 566 | mListView->takeItem( currItem ); |
560 | delete currItem; | 567 | delete currItem; |
561 | 568 | ||
562 | mChanged = true; | 569 | mChanged = true; |
563 | } | 570 | } |
564 | 571 | ||
565 | void PhoneEditDialog::slotEditPhoneNumber() | 572 | void PhoneEditDialog::slotEditPhoneNumber() |