summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (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
@@ -1142,6 +1142,7 @@ void KABCore::initGUI()
ImportMenu = new QPopupMenu( this );
ExportMenu = new QPopupMenu( this );
+ changeMenu= new QPopupMenu( this );
//US since we have no splitter for the embedded system, setup
// a layout with two frames. One left and one right.
@@ -1393,6 +1394,9 @@ void KABCore::initActions()
SLOT( setCategories() ), actionCollection(),
"edit_set_categories" );
+ mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
+ SLOT( removeVoice() ), actionCollection(),
+ "remove_voice" );
#ifdef KAB_EMBEDDED
mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
@@ -1427,6 +1431,7 @@ void KABCore::addActionsManually()
mb->insertItem( "&Edit", editMenu );
mb->insertItem( "&View", viewMenu );
mb->insertItem( "&Settings", settingsMenu );
+ mb->insertItem( "&Change selected", changeMenu );
mb->insertItem( "&Help", helpMenu );
mIncSearchWidget = new IncSearchWidget( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget);
@@ -1445,6 +1450,7 @@ void KABCore::addActionsManually()
popupBarTB->insertItem( "&View", viewMenu );
popupBarTB->insertItem( "&Settings", settingsMenu );
mViewManager->getFilterAction()->plug ( popupBarTB);
+ popupBarTB->insertItem( "&Change selected", changeMenu );
popupBarTB->insertItem( "&Help", helpMenu );
if (QApplication::desktop()->width() > 320 ) {
// mViewManager->getFilterAction()->plug ( tb);
@@ -1484,7 +1490,7 @@ void KABCore::addActionsManually()
editMenu->insertSeparator();
mActionSelectAll->plug( editMenu );
-
+ mActionRemoveVoice->plug( changeMenu );
// settings menu
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
@@ -1544,6 +1550,30 @@ void KABCore::addActionsManually()
#endif //KAB_EMBEDDED
}
+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
@@ -323,6 +323,7 @@ class KABCore : public QWidget
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
+ void removeVoice();
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
@@ -400,10 +401,13 @@ class KABCore : public QWidget
QPopupMenu *viewMenu;
QPopupMenu *filterMenu;
QPopupMenu *settingsMenu;
+ QPopupMenu *changeMenu;
//US QAction *mActionSave;
QPopupMenu *ImportMenu;
QPopupMenu *ExportMenu;
+ //LR additional methods
+ KAction *mActionRemoveVoice;
#ifndef KAB_EMBEDDED
KAddressBookService *mAddressBookService;