summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-07 05:51:36 (UTC)
committer zautrix <zautrix>2004-07-07 05:51:36 (UTC)
commitc9c0fefaead651c073318e8242d86675519dbcf6 (patch) (side-by-side diff)
treec8d9f167973e7bdbf4a3c97a4c6ec1e631f819fe
parent816db8f76a1fd8b5cc586dfd5ebf8d6298221801 (diff)
downloadkdepimpi-c9c0fefaead651c073318e8242d86675519dbcf6.zip
kdepimpi-c9c0fefaead651c073318e8242d86675519dbcf6.tar.gz
kdepimpi-c9c0fefaead651c073318e8242d86675519dbcf6.tar.bz2
Added possibility to remove voice from phone types
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
@@ -1143,4 +1143,5 @@ void KABCore::initGUI()
ExportMenu = new QPopupMenu( this );
+ changeMenu= new QPopupMenu( this );
//US since we have no splitter for the embedded system, setup
@@ -1394,4 +1395,7 @@ void KABCore::initActions()
"edit_set_categories" );
+ mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
+ SLOT( removeVoice() ), actionCollection(),
+ "remove_voice" );
#ifdef KAB_EMBEDDED
@@ -1428,4 +1432,5 @@ void KABCore::addActionsManually()
mb->insertItem( "&View", viewMenu );
mb->insertItem( "&Settings", settingsMenu );
+ mb->insertItem( "&Change selected", changeMenu );
mb->insertItem( "&Help", helpMenu );
mIncSearchWidget = new IncSearchWidget( tb );
@@ -1446,4 +1451,5 @@ void KABCore::addActionsManually()
popupBarTB->insertItem( "&Settings", settingsMenu );
mViewManager->getFilterAction()->plug ( popupBarTB);
+ popupBarTB->insertItem( "&Change selected", changeMenu );
popupBarTB->insertItem( "&Help", helpMenu );
if (QApplication::desktop()->width() > 320 ) {
@@ -1485,5 +1491,5 @@ void KABCore::addActionsManually()
mActionSelectAll->plug( editMenu );
-
+ mActionRemoveVoice->plug( changeMenu );
// settings menu
//US special menuentry to configure the addressbook resources. On KDE
@@ -1545,4 +1551,28 @@ 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
@@ -324,4 +324,5 @@ class KABCore : public QWidget
void updateActionMenu();
void configureKeyBindings();
+ void removeVoice();
#ifdef KAB_EMBEDDED
void configureResources();
@@ -401,8 +402,11 @@ class KABCore : public QWidget
QPopupMenu *filterMenu;
QPopupMenu *settingsMenu;
+ QPopupMenu *changeMenu;
//US QAction *mActionSave;
QPopupMenu *ImportMenu;
QPopupMenu *ExportMenu;
+ //LR additional methods
+ KAction *mActionRemoveVoice;
#ifndef KAB_EMBEDDED