summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp32
-rw-r--r--kaddressbook/kabcore.h4
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()
+ changeMenu= new QPopupMenu( this );
@@ -1395,2 +1396,5 @@ void KABCore::initActions()
+ mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
+ SLOT( removeVoice() ), actionCollection(),
+ "remove_voice" );
#ifdef KAB_EMBEDDED
@@ -1429,2 +1433,3 @@ void KABCore::addActionsManually()
mb->insertItem( "&Settings", settingsMenu );
+ mb->insertItem( "&Change selected", changeMenu );
mb->insertItem( "&Help", helpMenu );
@@ -1447,2 +1452,3 @@ void KABCore::addActionsManually()
mViewManager->getFilterAction()->plug ( popupBarTB);
+ popupBarTB->insertItem( "&Change selected", changeMenu );
popupBarTB->insertItem( "&Help", helpMenu );
@@ -1486,3 +1492,3 @@ void KABCore::addActionsManually()
-
+ mActionRemoveVoice->plug( changeMenu );
// settings menu
@@ -1546,2 +1552,26 @@ void KABCore::addActionsManually()
}
+void KABCore::removeVoice()
+{
+ 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 )
+ return;
+ KABC::Addressee::List list = mViewManager->selectedAddressees();
+ KABC::Addressee::List::Iterator it;
+ for ( it = list.begin(); it != list.end(); ++it ) {
+ PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
+ PhoneNumber::List::Iterator phoneIt;
+ bool found = false;
+ for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
+ if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
+ if ((*phoneIt).type() - PhoneNumber::Voice ) {
+ (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
+ (*it).insertPhoneNumber( (*phoneIt) );
+ found = true;
+ }
+ }
+
+ }
+ if ( found )
+ contactModified((*it) );
+ }
+}
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
void configureKeyBindings();
+ void removeVoice();
#ifdef KAB_EMBEDDED
@@ -402,2 +403,3 @@ class KABCore : public QWidget
QPopupMenu *settingsMenu;
+ QPopupMenu *changeMenu;
@@ -406,2 +408,4 @@ class KABCore : public QWidget
QPopupMenu *ExportMenu;
+ //LR additional methods
+ KAction *mActionRemoveVoice;