summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show 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
@@ -1121,48 +1121,49 @@ void KABCore::initGUI()
viewSpace->setStretchFactor( mViewManager, 1 );
mDetails = new ViewContainer( mDetailsSplitter );
mJumpButtonBar = new JumpButtonBar( this, this );
mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
topLayout->addWidget( mExtensionBarSplitter );
topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
topLayout->addWidget( mJumpButtonBar );
topLayout->setStretchFactor( mJumpButtonBar, 1 );
mXXPortManager = new XXPortManager( this, this );
#else //KAB_EMBEDDED
//US initialize viewMenu before settingup viewmanager.
// Viewmanager needs this menu to plugin submenues.
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;
// = new QHBoxLayout( this );
// QBoxLayout *topLayout = (QBoxLayout*)layout();
// QWidget *mainBox = new QWidget( this );
// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
#ifdef DESKTOP_VERSION
topLayout = new QHBoxLayout( this );
mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
topLayout->addWidget(mMiniSplitter );
mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
mViewManager = new ViewManager( this, mExtensionBarSplitter );
@@ -1372,140 +1373,145 @@ void KABCore::initActions()
actionCollection(), "options_show_details" );
connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
// misc
// only enable LDAP lookup if we can handle the protocol
#ifndef KAB_EMBEDDED
if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
this, SLOT( openLDAPDialog() ), actionCollection(),
"ldap_lookup" );
}
#else //KAB_EMBEDDED
//qDebug("KABCore::initActions() LDAP has to be implemented");
#endif //KAB_EMBEDDED
mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
SLOT( setWhoAmI() ), actionCollection(),
"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
clipboardDataChanged();
connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
}
//US we need this function, to plug all actions into the correct menues.
// KDE uses a XML format to plug the actions, but we work her without this overhead.
void KABCore::addActionsManually()
{
//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
#ifdef KAB_EMBEDDED
QPopupMenu *fileMenu = new QPopupMenu( this );
QPopupMenu *editMenu = new QPopupMenu( this );
QPopupMenu *helpMenu = new QPopupMenu( this );
KToolBar* tb = mMainWindow->toolBar();
#ifdef DESKTOP_VERSION
QMenuBar* mb = mMainWindow->menuBar();
//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
QMenuBar *menuBarTB = new QMenuBar( tb );
QPopupMenu *popupBarTB = new QPopupMenu( this );
menuBarTB->insertItem( "ME", popupBarTB);
tb->insertWidget(-1, 0, menuBarTB);
mIncSearchWidget = new IncSearchWidget( tb );
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());
//US Now connect the actions with the menue entries.
mActionPrint->plug( fileMenu );
mActionMail->plug( fileMenu );
fileMenu->insertSeparator();
mActionNewContact->plug( fileMenu );
mActionNewContact->plug( tb );
mActionEditAddressee->plug( fileMenu );
fileMenu->insertSeparator();
mActionSave->plug( fileMenu );
fileMenu->insertItem( "&Import", ImportMenu );
fileMenu->insertItem( "&Emport", ExportMenu );
fileMenu->insertSeparator();
mActionMailVCard->plug( fileMenu );
fileMenu->insertSeparator();
mActionQuit->plug( fileMenu );
// edit menu
mActionUndo->plug( editMenu );
mActionRedo->plug( editMenu );
editMenu->insertSeparator();
mActionCut->plug( editMenu );
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();
mActionConfigKAddressbook->plug( settingsMenu );
if ( mIsPart ) {
mActionConfigShortcuts->plug( settingsMenu );
mActionConfigureToolbars->plug( settingsMenu );
} else {
mActionKeyBindings->plug( settingsMenu );
}
settingsMenu->insertSeparator();
mActionJumpBar->plug( settingsMenu );
mActionDetails->plug( settingsMenu );
settingsMenu->insertSeparator();
mActionWhoAmI->plug( settingsMenu );
mActionCategories->plug( settingsMenu );
@@ -1523,48 +1529,72 @@ void KABCore::addActionsManually()
mActionDelete->plug( tb );
mActionRedo->plug( tb );
}
}
//mActionQuit->plug ( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget, 6);
//US link the searchwidget first to this.
// The real linkage to the toolbar happens later.
//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
//US tb->insertItem( mIncSearchWidget );
/*US
mIncSearchWidget = new IncSearchWidget( tb );
connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
SLOT( incrementalSearch( const QString& ) ) );
mJumpButtonBar = new JumpButtonBar( this, this );
//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()
{
if ( mReadWrite )
mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
}
void KABCore::updateActionMenu()
{
UndoStack *undo = UndoStack::instance();
RedoStack *redo = RedoStack::instance();
if ( undo->isEmpty() )
mActionUndo->setText( i18n( "Undo" ) );
else
mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
mActionUndo->setEnabled( !undo->isEmpty() );
if ( !redo->top() )
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c823f1f..8d6041e 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -302,48 +302,49 @@ class KABCore : public QWidget
/**
Creates a KAddressBookPrinter, which will display the print
dialog and do the printing.
*/
void print();
/**
Registers a new GUI client, so plugins can register its actions.
*/
void addGUIClient( KXMLGUIClient *client );
signals:
void contactSelected( const QString &name );
void contactSelected( const QPixmap &pixmap );
public slots:
void setDetailsVisible( bool visible );
void setDetailsToState();
private slots:
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();
void addressBookChanged();
private:
void initGUI();
void initActions();
AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
const char *name = 0 );
KXMLGUIClient *mGUIClient;
KABC::AddressBook *mAddressBook;
ViewManager *mViewManager;
// QSplitter *mDetailsSplitter;
KDGanttMinimizeSplitter *mExtensionBarSplitter;
ViewContainer *mDetails;
KDGanttMinimizeSplitter* mMiniSplitter;
@@ -379,43 +380,46 @@ class KABCore : public QWidget
KAction *mActionCut;
KAction *mActionPaste;
KAction *mActionSelectAll;
KAction *mActionUndo;
KAction *mActionRedo;
KAction *mActionDelete;
//US settings menu
KAction *mActionConfigResources;
KAction *mActionConfigKAddressbook;
KAction *mActionConfigShortcuts;
KAction *mActionConfigureToolbars;
KAction *mActionKeyBindings;
KToggleAction *mActionJumpBar;
KToggleAction *mActionDetails;
KAction *mActionWhoAmI;
KAction *mActionCategories;
KAction *mActionAboutKAddressbook;
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;
KABCorePrivate *d;
#ifdef KAB_EMBEDDED
KAddressBookMain *mMainWindow; // should be the same like mGUIClient
#endif //KAB_EMBEDDED
};
#endif