summaryrefslogtreecommitdiffabout
Unidiff
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
@@ -1133,24 +1133,25 @@ void KABCore::initGUI()
1133 1133
1134 mXXPortManager = new XXPortManager( this, this ); 1134 mXXPortManager = new XXPortManager( this, this );
1135 1135
1136#else //KAB_EMBEDDED 1136#else //KAB_EMBEDDED
1137 //US initialize viewMenu before settingup viewmanager. 1137 //US initialize viewMenu before settingup viewmanager.
1138 // Viewmanager needs this menu to plugin submenues. 1138 // Viewmanager needs this menu to plugin submenues.
1139 viewMenu = new QPopupMenu( this ); 1139 viewMenu = new QPopupMenu( this );
1140 settingsMenu = new QPopupMenu( this ); 1140 settingsMenu = new QPopupMenu( this );
1141 //filterMenu = new QPopupMenu( this ); 1141 //filterMenu = new QPopupMenu( this );
1142 ImportMenu = new QPopupMenu( this ); 1142 ImportMenu = new QPopupMenu( this );
1143 ExportMenu = new QPopupMenu( this ); 1143 ExportMenu = new QPopupMenu( this );
1144 1144
1145 changeMenu= new QPopupMenu( this );
1145 1146
1146//US since we have no splitter for the embedded system, setup 1147//US since we have no splitter for the embedded system, setup
1147// a layout with two frames. One left and one right. 1148// a layout with two frames. One left and one right.
1148 1149
1149 QBoxLayout *topLayout; 1150 QBoxLayout *topLayout;
1150 1151
1151 // = new QHBoxLayout( this ); 1152 // = new QHBoxLayout( this );
1152// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1153// QBoxLayout *topLayout = (QBoxLayout*)layout();
1153 1154
1154// QWidget *mainBox = new QWidget( this ); 1155// QWidget *mainBox = new QWidget( this );
1155// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1156// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1156 1157
@@ -1384,24 +1385,27 @@ void KABCore::initActions()
1384 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1385 //qDebug("KABCore::initActions() LDAP has to be implemented");
1385#endif //KAB_EMBEDDED 1386#endif //KAB_EMBEDDED
1386 1387
1387 1388
1388 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1389 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1389 SLOT( setWhoAmI() ), actionCollection(), 1390 SLOT( setWhoAmI() ), actionCollection(),
1390 "set_personal" ); 1391 "set_personal" );
1391 1392
1392 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1393 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1393 SLOT( setCategories() ), actionCollection(), 1394 SLOT( setCategories() ), actionCollection(),
1394 "edit_set_categories" ); 1395 "edit_set_categories" );
1395 1396
1397 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1398 SLOT( removeVoice() ), actionCollection(),
1399 "remove_voice" );
1396#ifdef KAB_EMBEDDED 1400#ifdef KAB_EMBEDDED
1397 1401
1398 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1402 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1399 this, SLOT( createAboutData() ), actionCollection(), 1403 this, SLOT( createAboutData() ), actionCollection(),
1400 "kaddressbook_about_data" ); 1404 "kaddressbook_about_data" );
1401#endif //KAB_EMBEDDED 1405#endif //KAB_EMBEDDED
1402 1406
1403 clipboardDataChanged(); 1407 clipboardDataChanged();
1404 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1408 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1405 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1409 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1406} 1410}
1407 1411
@@ -1418,42 +1422,44 @@ void KABCore::addActionsManually()
1418 1422
1419 KToolBar* tb = mMainWindow->toolBar(); 1423 KToolBar* tb = mMainWindow->toolBar();
1420 1424
1421#ifdef DESKTOP_VERSION 1425#ifdef DESKTOP_VERSION
1422 QMenuBar* mb = mMainWindow->menuBar(); 1426 QMenuBar* mb = mMainWindow->menuBar();
1423 1427
1424 //US setup menubar. 1428 //US setup menubar.
1425 //Disable the following block if you do not want to have a menubar. 1429 //Disable the following block if you do not want to have a menubar.
1426 mb->insertItem( "&File", fileMenu ); 1430 mb->insertItem( "&File", fileMenu );
1427 mb->insertItem( "&Edit", editMenu ); 1431 mb->insertItem( "&Edit", editMenu );
1428 mb->insertItem( "&View", viewMenu ); 1432 mb->insertItem( "&View", viewMenu );
1429 mb->insertItem( "&Settings", settingsMenu ); 1433 mb->insertItem( "&Settings", settingsMenu );
1434 mb->insertItem( "&Change selected", changeMenu );
1430 mb->insertItem( "&Help", helpMenu ); 1435 mb->insertItem( "&Help", helpMenu );
1431 mIncSearchWidget = new IncSearchWidget( tb ); 1436 mIncSearchWidget = new IncSearchWidget( tb );
1432 // tb->insertWidget(-1, 0, mIncSearchWidget); 1437 // tb->insertWidget(-1, 0, mIncSearchWidget);
1433 1438
1434#else 1439#else
1435 //US setup toolbar 1440 //US setup toolbar
1436 QMenuBar *menuBarTB = new QMenuBar( tb ); 1441 QMenuBar *menuBarTB = new QMenuBar( tb );
1437 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1442 QPopupMenu *popupBarTB = new QPopupMenu( this );
1438 menuBarTB->insertItem( "ME", popupBarTB); 1443 menuBarTB->insertItem( "ME", popupBarTB);
1439 tb->insertWidget(-1, 0, menuBarTB); 1444 tb->insertWidget(-1, 0, menuBarTB);
1440 mIncSearchWidget = new IncSearchWidget( tb ); 1445 mIncSearchWidget = new IncSearchWidget( tb );
1441 1446
1442 tb->enableMoving(false); 1447 tb->enableMoving(false);
1443 popupBarTB->insertItem( "&File", fileMenu ); 1448 popupBarTB->insertItem( "&File", fileMenu );
1444 popupBarTB->insertItem( "&Edit", editMenu ); 1449 popupBarTB->insertItem( "&Edit", editMenu );
1445 popupBarTB->insertItem( "&View", viewMenu ); 1450 popupBarTB->insertItem( "&View", viewMenu );
1446 popupBarTB->insertItem( "&Settings", settingsMenu ); 1451 popupBarTB->insertItem( "&Settings", settingsMenu );
1447 mViewManager->getFilterAction()->plug ( popupBarTB); 1452 mViewManager->getFilterAction()->plug ( popupBarTB);
1453 popupBarTB->insertItem( "&Change selected", changeMenu );
1448 popupBarTB->insertItem( "&Help", helpMenu ); 1454 popupBarTB->insertItem( "&Help", helpMenu );
1449 if (QApplication::desktop()->width() > 320 ) { 1455 if (QApplication::desktop()->width() > 320 ) {
1450 // mViewManager->getFilterAction()->plug ( tb); 1456 // mViewManager->getFilterAction()->plug ( tb);
1451 } 1457 }
1452#endif 1458#endif
1453 // mActionQuit->plug ( mMainWindow->toolBar()); 1459 // mActionQuit->plug ( mMainWindow->toolBar());
1454 1460
1455 1461
1456 1462
1457 //US Now connect the actions with the menue entries. 1463 //US Now connect the actions with the menue entries.
1458 mActionPrint->plug( fileMenu ); 1464 mActionPrint->plug( fileMenu );
1459 mActionMail->plug( fileMenu ); 1465 mActionMail->plug( fileMenu );
@@ -1475,25 +1481,25 @@ void KABCore::addActionsManually()
1475 1481
1476 // edit menu 1482 // edit menu
1477 mActionUndo->plug( editMenu ); 1483 mActionUndo->plug( editMenu );
1478 mActionRedo->plug( editMenu ); 1484 mActionRedo->plug( editMenu );
1479 editMenu->insertSeparator(); 1485 editMenu->insertSeparator();
1480 mActionCut->plug( editMenu ); 1486 mActionCut->plug( editMenu );
1481 mActionCopy->plug( editMenu ); 1487 mActionCopy->plug( editMenu );
1482 mActionPaste->plug( editMenu ); 1488 mActionPaste->plug( editMenu );
1483 mActionDelete->plug( editMenu ); 1489 mActionDelete->plug( editMenu );
1484 editMenu->insertSeparator(); 1490 editMenu->insertSeparator();
1485 mActionSelectAll->plug( editMenu ); 1491 mActionSelectAll->plug( editMenu );
1486 1492
1487 1493 mActionRemoveVoice->plug( changeMenu );
1488 // settings menu 1494 // settings menu
1489//US special menuentry to configure the addressbook resources. On KDE 1495//US special menuentry to configure the addressbook resources. On KDE
1490// you do that through the control center !!! 1496// you do that through the control center !!!
1491 mActionConfigResources->plug( settingsMenu ); 1497 mActionConfigResources->plug( settingsMenu );
1492 settingsMenu->insertSeparator(); 1498 settingsMenu->insertSeparator();
1493 1499
1494 mActionConfigKAddressbook->plug( settingsMenu ); 1500 mActionConfigKAddressbook->plug( settingsMenu );
1495 1501
1496 if ( mIsPart ) { 1502 if ( mIsPart ) {
1497 mActionConfigShortcuts->plug( settingsMenu ); 1503 mActionConfigShortcuts->plug( settingsMenu );
1498 mActionConfigureToolbars->plug( settingsMenu ); 1504 mActionConfigureToolbars->plug( settingsMenu );
1499 1505
@@ -1535,24 +1541,48 @@ void KABCore::addActionsManually()
1535 mIncSearchWidget = new IncSearchWidget( tb ); 1541 mIncSearchWidget = new IncSearchWidget( tb );
1536 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1542 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1537 SLOT( incrementalSearch( const QString& ) ) ); 1543 SLOT( incrementalSearch( const QString& ) ) );
1538 1544
1539 mJumpButtonBar = new JumpButtonBar( this, this ); 1545 mJumpButtonBar = new JumpButtonBar( this, this );
1540 1546
1541//US topLayout->addWidget( mJumpButtonBar ); 1547//US topLayout->addWidget( mJumpButtonBar );
1542 this->layout()->add( mJumpButtonBar ); 1548 this->layout()->add( mJumpButtonBar );
1543*/ 1549*/
1544 1550
1545#endif //KAB_EMBEDDED 1551#endif //KAB_EMBEDDED
1546} 1552}
1553void KABCore::removeVoice()
1554{
1555 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 )
1556 return;
1557 KABC::Addressee::List list = mViewManager->selectedAddressees();
1558 KABC::Addressee::List::Iterator it;
1559 for ( it = list.begin(); it != list.end(); ++it ) {
1560 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1561 PhoneNumber::List::Iterator phoneIt;
1562 bool found = false;
1563 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1564 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1565 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1566 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1567 (*it).insertPhoneNumber( (*phoneIt) );
1568 found = true;
1569 }
1570 }
1571
1572 }
1573 if ( found )
1574 contactModified((*it) );
1575 }
1576}
1547 1577
1548 1578
1549 1579
1550void KABCore::clipboardDataChanged() 1580void KABCore::clipboardDataChanged()
1551{ 1581{
1552 1582
1553 if ( mReadWrite ) 1583 if ( mReadWrite )
1554 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1584 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1555 1585
1556} 1586}
1557 1587
1558void KABCore::updateActionMenu() 1588void KABCore::updateActionMenu()
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c823f1f..8d6041e 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -314,24 +314,25 @@ class KABCore : public QWidget
314 void contactSelected( const QString &name ); 314 void contactSelected( const QString &name );
315 void contactSelected( const QPixmap &pixmap ); 315 void contactSelected( const QPixmap &pixmap );
316 public slots: 316 public slots:
317 void setDetailsVisible( bool visible ); 317 void setDetailsVisible( bool visible );
318 void setDetailsToState(); 318 void setDetailsToState();
319 private slots: 319 private slots:
320 void setJumpButtonBarVisible( bool visible ); 320 void setJumpButtonBarVisible( bool visible );
321 321
322 void extensionModified( const KABC::Addressee::List &list ); 322 void extensionModified( const KABC::Addressee::List &list );
323 void clipboardDataChanged(); 323 void clipboardDataChanged();
324 void updateActionMenu(); 324 void updateActionMenu();
325 void configureKeyBindings(); 325 void configureKeyBindings();
326 void removeVoice();
326#ifdef KAB_EMBEDDED 327#ifdef KAB_EMBEDDED
327 void configureResources(); 328 void configureResources();
328#endif //KAB_EMBEDDED 329#endif //KAB_EMBEDDED
329 330
330 void slotEditorDestroyed( const QString &uid ); 331 void slotEditorDestroyed( const QString &uid );
331 void configurationChanged(); 332 void configurationChanged();
332 void addressBookChanged(); 333 void addressBookChanged();
333 334
334 private: 335 private:
335 void initGUI(); 336 void initGUI();
336 void initActions(); 337 void initActions();
337 338
@@ -391,28 +392,31 @@ class KABCore : public QWidget
391 KAction *mActionKeyBindings; 392 KAction *mActionKeyBindings;
392 KToggleAction *mActionJumpBar; 393 KToggleAction *mActionJumpBar;
393 KToggleAction *mActionDetails; 394 KToggleAction *mActionDetails;
394 KAction *mActionWhoAmI; 395 KAction *mActionWhoAmI;
395 KAction *mActionCategories; 396 KAction *mActionCategories;
396 KAction *mActionAboutKAddressbook; 397 KAction *mActionAboutKAddressbook;
397 398
398 KAction *mActionDeleteView; 399 KAction *mActionDeleteView;
399 400
400 QPopupMenu *viewMenu; 401 QPopupMenu *viewMenu;
401 QPopupMenu *filterMenu; 402 QPopupMenu *filterMenu;
402 QPopupMenu *settingsMenu; 403 QPopupMenu *settingsMenu;
404 QPopupMenu *changeMenu;
403 405
404//US QAction *mActionSave; 406//US QAction *mActionSave;
405 QPopupMenu *ImportMenu; 407 QPopupMenu *ImportMenu;
406 QPopupMenu *ExportMenu; 408 QPopupMenu *ExportMenu;
409 //LR additional methods
410 KAction *mActionRemoveVoice;
407 411
408#ifndef KAB_EMBEDDED 412#ifndef KAB_EMBEDDED
409 KAddressBookService *mAddressBookService; 413 KAddressBookService *mAddressBookService;
410#endif //KAB_EMBEDDED 414#endif //KAB_EMBEDDED
411 415
412 class KABCorePrivate; 416 class KABCorePrivate;
413 KABCorePrivate *d; 417 KABCorePrivate *d;
414 418
415#ifdef KAB_EMBEDDED 419#ifdef KAB_EMBEDDED
416 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 420 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
417#endif //KAB_EMBEDDED 421#endif //KAB_EMBEDDED
418 422