-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 @@ -1139,12 +1139,13 @@ void KABCore::initGUI() viewMenu = new QPopupMenu( this ); settingsMenu = new QPopupMenu( this ); //filterMenu = new QPopupMenu( this ); 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. QBoxLayout *topLayout; @@ -1390,12 +1391,15 @@ void KABCore::initActions() "set_personal" ); mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 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, this, SLOT( createAboutData() ), actionCollection(), "kaddressbook_about_data" ); #endif //KAB_EMBEDDED @@ -1424,12 +1428,13 @@ void KABCore::addActionsManually() //US setup menubar. //Disable the following block if you do not want to have a menubar. mb->insertItem( "&File", fileMenu ); 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); #else //US setup toolbar @@ -1442,12 +1447,13 @@ void KABCore::addActionsManually() tb->enableMoving(false); popupBarTB->insertItem( "&File", fileMenu ); popupBarTB->insertItem( "&Edit", editMenu ); 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); } #endif // mActionQuit->plug ( mMainWindow->toolBar()); @@ -1481,13 +1487,13 @@ void KABCore::addActionsManually() mActionCopy->plug( editMenu ); mActionPaste->plug( editMenu ); mActionDelete->plug( editMenu ); 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 !!! mActionConfigResources->plug( settingsMenu ); settingsMenu->insertSeparator(); @@ -1541,12 +1547,36 @@ void KABCore::addActionsManually() //US topLayout->addWidget( mJumpButtonBar ); this->layout()->add( mJumpButtonBar ); */ #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) ); + } +} void KABCore::clipboardDataChanged() { diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c823f1f..8d6041e 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -320,12 +320,13 @@ class KABCore : public QWidget void setJumpButtonBarVisible( bool visible ); void extensionModified( const KABC::Addressee::List &list ); void clipboardDataChanged(); void updateActionMenu(); void configureKeyBindings(); + void removeVoice(); #ifdef KAB_EMBEDDED void configureResources(); #endif //KAB_EMBEDDED void slotEditorDestroyed( const QString &uid ); void configurationChanged(); @@ -397,16 +398,19 @@ class KABCore : public QWidget KAction *mActionDeleteView; 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; #endif //KAB_EMBEDDED class KABCorePrivate; |