author | zautrix <zautrix> | 2004-07-07 05:51:36 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-07 05:51:36 (UTC) |
commit | c9c0fefaead651c073318e8242d86675519dbcf6 (patch) (unidiff) | |
tree | c8d9f167973e7bdbf4a3c97a4c6ec1e631f819fe | |
parent | 816db8f76a1fd8b5cc586dfd5ebf8d6298221801 (diff) | |
download | kdepimpi-c9c0fefaead651c073318e8242d86675519dbcf6.zip kdepimpi-c9c0fefaead651c073318e8242d86675519dbcf6.tar.gz kdepimpi-c9c0fefaead651c073318e8242d86675519dbcf6.tar.bz2 |
Added possibility to remove voice from phone types
-rw-r--r-- | kaddressbook/kabcore.cpp | 32 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 4 |
2 files changed, 35 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index a0fec91..7e3fc7c 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1144,2 +1144,3 @@ void KABCore::initGUI() | |||
1144 | 1144 | ||
1145 | changeMenu= new QPopupMenu( this ); | ||
1145 | 1146 | ||
@@ -1395,2 +1396,5 @@ void KABCore::initActions() | |||
1395 | 1396 | ||
1397 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | ||
1398 | SLOT( removeVoice() ), actionCollection(), | ||
1399 | "remove_voice" ); | ||
1396 | #ifdef KAB_EMBEDDED | 1400 | #ifdef KAB_EMBEDDED |
@@ -1429,2 +1433,3 @@ void KABCore::addActionsManually() | |||
1429 | mb->insertItem( "&Settings", settingsMenu ); | 1433 | mb->insertItem( "&Settings", settingsMenu ); |
1434 | mb->insertItem( "&Change selected", changeMenu ); | ||
1430 | mb->insertItem( "&Help", helpMenu ); | 1435 | mb->insertItem( "&Help", helpMenu ); |
@@ -1447,2 +1452,3 @@ void KABCore::addActionsManually() | |||
1447 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1452 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1453 | popupBarTB->insertItem( "&Change selected", changeMenu ); | ||
1448 | popupBarTB->insertItem( "&Help", helpMenu ); | 1454 | popupBarTB->insertItem( "&Help", helpMenu ); |
@@ -1486,3 +1492,3 @@ void KABCore::addActionsManually() | |||
1486 | 1492 | ||
1487 | 1493 | mActionRemoveVoice->plug( changeMenu ); | |
1488 | // settings menu | 1494 | // settings menu |
@@ -1546,2 +1552,26 @@ void KABCore::addActionsManually() | |||
1546 | } | 1552 | } |
1553 | void KABCore::removeVoice() | ||
1554 | { | ||
1555 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | ||
1556 | return; | ||
1557 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | ||
1558 | KABC::Addressee::List::Iterator it; | ||
1559 | for ( it = list.begin(); it != list.end(); ++it ) { | ||
1560 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | ||
1561 | PhoneNumber::List::Iterator phoneIt; | ||
1562 | bool found = false; | ||
1563 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | ||
1564 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | ||
1565 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | ||
1566 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | ||
1567 | (*it).insertPhoneNumber( (*phoneIt) ); | ||
1568 | found = true; | ||
1569 | } | ||
1570 | } | ||
1571 | |||
1572 | } | ||
1573 | if ( found ) | ||
1574 | contactModified((*it) ); | ||
1575 | } | ||
1576 | } | ||
1547 | 1577 | ||
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c823f1f..8d6041e 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -325,2 +325,3 @@ class KABCore : public QWidget | |||
325 | void configureKeyBindings(); | 325 | void configureKeyBindings(); |
326 | void removeVoice(); | ||
326 | #ifdef KAB_EMBEDDED | 327 | #ifdef KAB_EMBEDDED |
@@ -402,2 +403,3 @@ class KABCore : public QWidget | |||
402 | QPopupMenu *settingsMenu; | 403 | QPopupMenu *settingsMenu; |
404 | QPopupMenu *changeMenu; | ||
403 | 405 | ||
@@ -406,2 +408,4 @@ class KABCore : public QWidget | |||
406 | QPopupMenu *ExportMenu; | 408 | QPopupMenu *ExportMenu; |
409 | //LR additional methods | ||
410 | KAction *mActionRemoveVoice; | ||
407 | 411 | ||