-rw-r--r-- | kaddressbook/kabcore.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4c1d5da..2a3334e 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1439,957 +1439,961 @@ void KABCore::openConfigDialog() | |||
1439 | 1439 | ||
1440 | void KABCore::openLDAPDialog() | 1440 | void KABCore::openLDAPDialog() |
1441 | { | 1441 | { |
1442 | #ifndef KAB_EMBEDDED | 1442 | #ifndef KAB_EMBEDDED |
1443 | if ( !mLdapSearchDialog ) { | 1443 | if ( !mLdapSearchDialog ) { |
1444 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1444 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1445 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1445 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1446 | SLOT( refreshView() ) ); | 1446 | SLOT( refreshView() ) ); |
1447 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1447 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1448 | SLOT( setModified() ) ); | 1448 | SLOT( setModified() ) ); |
1449 | } else | 1449 | } else |
1450 | mLdapSearchDialog->restoreSettings(); | 1450 | mLdapSearchDialog->restoreSettings(); |
1451 | 1451 | ||
1452 | if ( mLdapSearchDialog->isOK() ) | 1452 | if ( mLdapSearchDialog->isOK() ) |
1453 | mLdapSearchDialog->exec(); | 1453 | mLdapSearchDialog->exec(); |
1454 | #else //KAB_EMBEDDED | 1454 | #else //KAB_EMBEDDED |
1455 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1455 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1456 | #endif //KAB_EMBEDDED | 1456 | #endif //KAB_EMBEDDED |
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | void KABCore::print() | 1459 | void KABCore::print() |
1460 | { | 1460 | { |
1461 | #ifndef KAB_EMBEDDED | 1461 | #ifndef KAB_EMBEDDED |
1462 | KPrinter printer; | 1462 | KPrinter printer; |
1463 | if ( !printer.setup( this ) ) | 1463 | if ( !printer.setup( this ) ) |
1464 | return; | 1464 | return; |
1465 | 1465 | ||
1466 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1466 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1467 | mViewManager->selectedUids(), this ); | 1467 | mViewManager->selectedUids(), this ); |
1468 | 1468 | ||
1469 | wizard.exec(); | 1469 | wizard.exec(); |
1470 | #else //KAB_EMBEDDED | 1470 | #else //KAB_EMBEDDED |
1471 | qDebug("KABCore::print() finsih method"); | 1471 | qDebug("KABCore::print() finsih method"); |
1472 | #endif //KAB_EMBEDDED | 1472 | #endif //KAB_EMBEDDED |
1473 | 1473 | ||
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | 1476 | ||
1477 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1477 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1478 | { | 1478 | { |
1479 | if ( mGUIClient ) | 1479 | if ( mGUIClient ) |
1480 | mGUIClient->insertChildClient( client ); | 1480 | mGUIClient->insertChildClient( client ); |
1481 | else | 1481 | else |
1482 | KMessageBox::error( this, "no KXMLGUICLient"); | 1482 | KMessageBox::error( this, "no KXMLGUICLient"); |
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | 1485 | ||
1486 | void KABCore::configurationChanged() | 1486 | void KABCore::configurationChanged() |
1487 | { | 1487 | { |
1488 | mExtensionManager->reconfigure(); | 1488 | mExtensionManager->reconfigure(); |
1489 | } | 1489 | } |
1490 | 1490 | ||
1491 | void KABCore::addressBookChanged() | 1491 | void KABCore::addressBookChanged() |
1492 | { | 1492 | { |
1493 | /*US | 1493 | /*US |
1494 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1494 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1495 | while ( it.current() ) { | 1495 | while ( it.current() ) { |
1496 | if ( it.current()->dirty() ) { | 1496 | if ( it.current()->dirty() ) { |
1497 | QString text = i18n( "Data has been changed externally. Unsaved " | 1497 | QString text = i18n( "Data has been changed externally. Unsaved " |
1498 | "changes will be lost." ); | 1498 | "changes will be lost." ); |
1499 | KMessageBox::information( this, text ); | 1499 | KMessageBox::information( this, text ); |
1500 | } | 1500 | } |
1501 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1501 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1502 | ++it; | 1502 | ++it; |
1503 | } | 1503 | } |
1504 | */ | 1504 | */ |
1505 | if (mEditorDialog) | 1505 | if (mEditorDialog) |
1506 | { | 1506 | { |
1507 | if (mEditorDialog->dirty()) | 1507 | if (mEditorDialog->dirty()) |
1508 | { | 1508 | { |
1509 | QString text = i18n( "Data has been changed externally. Unsaved " | 1509 | QString text = i18n( "Data has been changed externally. Unsaved " |
1510 | "changes will be lost." ); | 1510 | "changes will be lost." ); |
1511 | KMessageBox::information( this, text ); | 1511 | KMessageBox::information( this, text ); |
1512 | } | 1512 | } |
1513 | QString currentuid = mEditorDialog->addressee().uid(); | 1513 | QString currentuid = mEditorDialog->addressee().uid(); |
1514 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1514 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1515 | } | 1515 | } |
1516 | mViewManager->refreshView(); | 1516 | mViewManager->refreshView(); |
1517 | // mDetails->refreshView(); | 1517 | // mDetails->refreshView(); |
1518 | 1518 | ||
1519 | 1519 | ||
1520 | } | 1520 | } |
1521 | 1521 | ||
1522 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1522 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1523 | const char *name ) | 1523 | const char *name ) |
1524 | { | 1524 | { |
1525 | 1525 | ||
1526 | if ( mEditorDialog == 0 ) { | 1526 | if ( mEditorDialog == 0 ) { |
1527 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1527 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1528 | name ? name : "editorDialog" ); | 1528 | name ? name : "editorDialog" ); |
1529 | 1529 | ||
1530 | 1530 | ||
1531 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1531 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1532 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1532 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1533 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1533 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1534 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1534 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | return mEditorDialog; | 1537 | return mEditorDialog; |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1540 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1541 | { | 1541 | { |
1542 | //mEditorDict.remove( uid ); | 1542 | //mEditorDict.remove( uid ); |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | void KABCore::initGUI() | 1545 | void KABCore::initGUI() |
1546 | { | 1546 | { |
1547 | #ifndef KAB_EMBEDDED | 1547 | #ifndef KAB_EMBEDDED |
1548 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1548 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1549 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1549 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1550 | 1550 | ||
1551 | mExtensionBarSplitter = new QSplitter( this ); | 1551 | mExtensionBarSplitter = new QSplitter( this ); |
1552 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1552 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1553 | 1553 | ||
1554 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1554 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1555 | 1555 | ||
1556 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1556 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1557 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1557 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1558 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1558 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1559 | SLOT( incrementalSearch( const QString& ) ) ); | 1559 | SLOT( incrementalSearch( const QString& ) ) ); |
1560 | 1560 | ||
1561 | mViewManager = new ViewManager( this, viewSpace ); | 1561 | mViewManager = new ViewManager( this, viewSpace ); |
1562 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1562 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1563 | 1563 | ||
1564 | mDetails = new ViewContainer( mDetailsSplitter ); | 1564 | mDetails = new ViewContainer( mDetailsSplitter ); |
1565 | 1565 | ||
1566 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1566 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1567 | 1567 | ||
1568 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1568 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1569 | 1569 | ||
1570 | topLayout->addWidget( mExtensionBarSplitter ); | 1570 | topLayout->addWidget( mExtensionBarSplitter ); |
1571 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1571 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1572 | topLayout->addWidget( mJumpButtonBar ); | 1572 | topLayout->addWidget( mJumpButtonBar ); |
1573 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1573 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1574 | 1574 | ||
1575 | mXXPortManager = new XXPortManager( this, this ); | 1575 | mXXPortManager = new XXPortManager( this, this ); |
1576 | 1576 | ||
1577 | #else //KAB_EMBEDDED | 1577 | #else //KAB_EMBEDDED |
1578 | //US initialize viewMenu before settingup viewmanager. | 1578 | //US initialize viewMenu before settingup viewmanager. |
1579 | // Viewmanager needs this menu to plugin submenues. | 1579 | // Viewmanager needs this menu to plugin submenues. |
1580 | viewMenu = new QPopupMenu( this ); | 1580 | viewMenu = new QPopupMenu( this ); |
1581 | settingsMenu = new QPopupMenu( this ); | 1581 | settingsMenu = new QPopupMenu( this ); |
1582 | //filterMenu = new QPopupMenu( this ); | 1582 | //filterMenu = new QPopupMenu( this ); |
1583 | ImportMenu = new QPopupMenu( this ); | 1583 | ImportMenu = new QPopupMenu( this ); |
1584 | ExportMenu = new QPopupMenu( this ); | 1584 | ExportMenu = new QPopupMenu( this ); |
1585 | syncMenu = new QPopupMenu( this ); | 1585 | syncMenu = new QPopupMenu( this ); |
1586 | changeMenu= new QPopupMenu( this ); | 1586 | changeMenu= new QPopupMenu( this ); |
1587 | 1587 | ||
1588 | //US since we have no splitter for the embedded system, setup | 1588 | //US since we have no splitter for the embedded system, setup |
1589 | // a layout with two frames. One left and one right. | 1589 | // a layout with two frames. One left and one right. |
1590 | 1590 | ||
1591 | QBoxLayout *topLayout; | 1591 | QBoxLayout *topLayout; |
1592 | 1592 | ||
1593 | // = new QHBoxLayout( this ); | 1593 | // = new QHBoxLayout( this ); |
1594 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1594 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1595 | 1595 | ||
1596 | // QWidget *mainBox = new QWidget( this ); | 1596 | // QWidget *mainBox = new QWidget( this ); |
1597 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1597 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1598 | 1598 | ||
1599 | #ifdef DESKTOP_VERSION | 1599 | #ifdef DESKTOP_VERSION |
1600 | topLayout = new QHBoxLayout( this ); | 1600 | topLayout = new QHBoxLayout( this ); |
1601 | 1601 | ||
1602 | 1602 | ||
1603 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1603 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1604 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1604 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1605 | 1605 | ||
1606 | topLayout->addWidget(mMiniSplitter ); | 1606 | topLayout->addWidget(mMiniSplitter ); |
1607 | 1607 | ||
1608 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1608 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1609 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1609 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1610 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1610 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1611 | mDetails = new ViewContainer( mMiniSplitter ); | 1611 | mDetails = new ViewContainer( mMiniSplitter ); |
1612 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1612 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1613 | #else | 1613 | #else |
1614 | if ( QApplication::desktop()->width() > 480 ) { | 1614 | if ( QApplication::desktop()->width() > 480 ) { |
1615 | topLayout = new QHBoxLayout( this ); | 1615 | topLayout = new QHBoxLayout( this ); |
1616 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1616 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1617 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1617 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1618 | } else { | 1618 | } else { |
1619 | 1619 | ||
1620 | topLayout = new QHBoxLayout( this ); | 1620 | topLayout = new QHBoxLayout( this ); |
1621 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1621 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1622 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1622 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | topLayout->addWidget(mMiniSplitter ); | 1625 | topLayout->addWidget(mMiniSplitter ); |
1626 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1626 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1627 | mDetails = new ViewContainer( mMiniSplitter ); | 1627 | mDetails = new ViewContainer( mMiniSplitter ); |
1628 | 1628 | ||
1629 | 1629 | ||
1630 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1630 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1631 | #endif | 1631 | #endif |
1632 | //eh->hide(); | 1632 | //eh->hide(); |
1633 | // topLayout->addWidget(mExtensionManager ); | 1633 | // topLayout->addWidget(mExtensionManager ); |
1634 | 1634 | ||
1635 | 1635 | ||
1636 | /*US | 1636 | /*US |
1637 | #ifndef KAB_NOSPLITTER | 1637 | #ifndef KAB_NOSPLITTER |
1638 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1638 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1639 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1639 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1640 | topLayout->setSpacing( 10 ); | 1640 | topLayout->setSpacing( 10 ); |
1641 | 1641 | ||
1642 | mDetailsSplitter = new QSplitter( this ); | 1642 | mDetailsSplitter = new QSplitter( this ); |
1643 | 1643 | ||
1644 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1644 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1645 | 1645 | ||
1646 | mViewManager = new ViewManager( this, viewSpace ); | 1646 | mViewManager = new ViewManager( this, viewSpace ); |
1647 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1647 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1648 | 1648 | ||
1649 | mDetails = new ViewContainer( mDetailsSplitter ); | 1649 | mDetails = new ViewContainer( mDetailsSplitter ); |
1650 | 1650 | ||
1651 | topLayout->addWidget( mDetailsSplitter ); | 1651 | topLayout->addWidget( mDetailsSplitter ); |
1652 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1652 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1653 | #else //KAB_NOSPLITTER | 1653 | #else //KAB_NOSPLITTER |
1654 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1654 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1655 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1655 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1656 | topLayout->setSpacing( 10 ); | 1656 | topLayout->setSpacing( 10 ); |
1657 | 1657 | ||
1658 | // mDetailsSplitter = new QSplitter( this ); | 1658 | // mDetailsSplitter = new QSplitter( this ); |
1659 | 1659 | ||
1660 | QVBox *viewSpace = new QVBox( this ); | 1660 | QVBox *viewSpace = new QVBox( this ); |
1661 | 1661 | ||
1662 | mViewManager = new ViewManager( this, viewSpace ); | 1662 | mViewManager = new ViewManager( this, viewSpace ); |
1663 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1663 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1664 | 1664 | ||
1665 | mDetails = new ViewContainer( this ); | 1665 | mDetails = new ViewContainer( this ); |
1666 | 1666 | ||
1667 | topLayout->addWidget( viewSpace ); | 1667 | topLayout->addWidget( viewSpace ); |
1668 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1668 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1669 | topLayout->addWidget( mDetails ); | 1669 | topLayout->addWidget( mDetails ); |
1670 | #endif //KAB_NOSPLITTER | 1670 | #endif //KAB_NOSPLITTER |
1671 | */ | 1671 | */ |
1672 | 1672 | ||
1673 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1673 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1674 | syncManager->setBlockSave(false); | 1674 | syncManager->setBlockSave(false); |
1675 | 1675 | ||
1676 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1676 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1677 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1677 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1678 | syncManager->setDefaultFileName( sentSyncFile()); | 1678 | syncManager->setDefaultFileName( sentSyncFile()); |
1679 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1679 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1680 | 1680 | ||
1681 | #endif //KAB_EMBEDDED | 1681 | #endif //KAB_EMBEDDED |
1682 | initActions(); | 1682 | initActions(); |
1683 | 1683 | ||
1684 | #ifdef KAB_EMBEDDED | 1684 | #ifdef KAB_EMBEDDED |
1685 | addActionsManually(); | 1685 | addActionsManually(); |
1686 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1686 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1687 | mXXPortManager = new XXPortManager( this, this ); | 1687 | mXXPortManager = new XXPortManager( this, this ); |
1688 | 1688 | ||
1689 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1689 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1690 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1690 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1691 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1691 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1692 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1692 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1693 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1693 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1694 | // mIncSearchWidget->hide(); | 1694 | // mIncSearchWidget->hide(); |
1695 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1695 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1696 | SLOT( incrementalSearch( const QString& ) ) ); | 1696 | SLOT( incrementalSearch( const QString& ) ) ); |
1697 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1697 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1698 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1698 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1699 | 1699 | ||
1700 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1700 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1701 | 1701 | ||
1702 | topLayout->addWidget( mJumpButtonBar ); | 1702 | topLayout->addWidget( mJumpButtonBar ); |
1703 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1703 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1704 | 1704 | ||
1705 | // mMainWindow->getIconToolBar()->raise(); | 1705 | // mMainWindow->getIconToolBar()->raise(); |
1706 | 1706 | ||
1707 | #endif //KAB_EMBEDDED | 1707 | #endif //KAB_EMBEDDED |
1708 | 1708 | ||
1709 | } | 1709 | } |
1710 | void KABCore::initActions() | 1710 | void KABCore::initActions() |
1711 | { | 1711 | { |
1712 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1712 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1713 | 1713 | ||
1714 | #ifndef KAB_EMBEDDED | 1714 | #ifndef KAB_EMBEDDED |
1715 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1715 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1716 | SLOT( clipboardDataChanged() ) ); | 1716 | SLOT( clipboardDataChanged() ) ); |
1717 | #endif //KAB_EMBEDDED | 1717 | #endif //KAB_EMBEDDED |
1718 | 1718 | ||
1719 | // file menu | 1719 | // file menu |
1720 | if ( mIsPart ) { | 1720 | if ( mIsPart ) { |
1721 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1721 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1722 | SLOT( sendMail() ), actionCollection(), | 1722 | SLOT( sendMail() ), actionCollection(), |
1723 | "kaddressbook_mail" ); | 1723 | "kaddressbook_mail" ); |
1724 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1724 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1725 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1725 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1726 | 1726 | ||
1727 | } else { | 1727 | } else { |
1728 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1728 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1729 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1729 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1730 | } | 1730 | } |
1731 | 1731 | ||
1732 | 1732 | ||
1733 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1733 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1734 | SLOT( save() ), actionCollection(), "file_sync" ); | 1734 | SLOT( save() ), actionCollection(), "file_sync" ); |
1735 | 1735 | ||
1736 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1736 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1737 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1737 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1738 | 1738 | ||
1739 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1739 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1740 | this, SLOT( mailVCard() ), | 1740 | this, SLOT( mailVCard() ), |
1741 | actionCollection(), "file_mail_vcard"); | 1741 | actionCollection(), "file_mail_vcard"); |
1742 | 1742 | ||
1743 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, | 1743 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, |
1744 | SLOT( export2phone() ), actionCollection(), | 1744 | SLOT( export2phone() ), actionCollection(), |
1745 | "kaddressbook_ex2phone" ); | 1745 | "kaddressbook_ex2phone" ); |
1746 | 1746 | ||
1747 | mActionBeamVCard = 0; | 1747 | mActionBeamVCard = 0; |
1748 | mActionBeam = 0; | 1748 | mActionBeam = 0; |
1749 | 1749 | ||
1750 | #ifndef DESKTOP_VERSION | 1750 | #ifndef DESKTOP_VERSION |
1751 | if ( Ir::supported() ) { | 1751 | if ( Ir::supported() ) { |
1752 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1752 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1753 | SLOT( beamVCard() ), actionCollection(), | 1753 | SLOT( beamVCard() ), actionCollection(), |
1754 | "kaddressbook_beam_vcard" ); | 1754 | "kaddressbook_beam_vcard" ); |
1755 | 1755 | ||
1756 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1756 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1757 | SLOT( beamMySelf() ), actionCollection(), | 1757 | SLOT( beamMySelf() ), actionCollection(), |
1758 | "kaddressbook_beam_myself" ); | 1758 | "kaddressbook_beam_myself" ); |
1759 | } | 1759 | } |
1760 | #endif | 1760 | #endif |
1761 | 1761 | ||
1762 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1762 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1763 | this, SLOT( editContact2() ), | 1763 | this, SLOT( editContact2() ), |
1764 | actionCollection(), "file_properties" ); | 1764 | actionCollection(), "file_properties" ); |
1765 | 1765 | ||
1766 | #ifdef KAB_EMBEDDED | 1766 | #ifdef KAB_EMBEDDED |
1767 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1767 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1768 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1768 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1769 | mMainWindow, SLOT( exit() ), | 1769 | mMainWindow, SLOT( exit() ), |
1770 | actionCollection(), "quit" ); | 1770 | actionCollection(), "quit" ); |
1771 | #endif //KAB_EMBEDDED | 1771 | #endif //KAB_EMBEDDED |
1772 | 1772 | ||
1773 | // edit menu | 1773 | // edit menu |
1774 | if ( mIsPart ) { | 1774 | if ( mIsPart ) { |
1775 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1775 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1776 | SLOT( copyContacts() ), actionCollection(), | 1776 | SLOT( copyContacts() ), actionCollection(), |
1777 | "kaddressbook_copy" ); | 1777 | "kaddressbook_copy" ); |
1778 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1778 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1779 | SLOT( cutContacts() ), actionCollection(), | 1779 | SLOT( cutContacts() ), actionCollection(), |
1780 | "kaddressbook_cut" ); | 1780 | "kaddressbook_cut" ); |
1781 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1781 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1782 | SLOT( pasteContacts() ), actionCollection(), | 1782 | SLOT( pasteContacts() ), actionCollection(), |
1783 | "kaddressbook_paste" ); | 1783 | "kaddressbook_paste" ); |
1784 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1784 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1785 | SLOT( selectAllContacts() ), actionCollection(), | 1785 | SLOT( selectAllContacts() ), actionCollection(), |
1786 | "kaddressbook_select_all" ); | 1786 | "kaddressbook_select_all" ); |
1787 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1787 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1788 | SLOT( undo() ), actionCollection(), | 1788 | SLOT( undo() ), actionCollection(), |
1789 | "kaddressbook_undo" ); | 1789 | "kaddressbook_undo" ); |
1790 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1790 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1791 | this, SLOT( redo() ), actionCollection(), | 1791 | this, SLOT( redo() ), actionCollection(), |
1792 | "kaddressbook_redo" ); | 1792 | "kaddressbook_redo" ); |
1793 | } else { | 1793 | } else { |
1794 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1794 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1795 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1795 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1796 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1796 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1797 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1797 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1798 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1798 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1799 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1799 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1800 | } | 1800 | } |
1801 | 1801 | ||
1802 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1802 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1803 | Key_Delete, this, SLOT( deleteContacts() ), | 1803 | Key_Delete, this, SLOT( deleteContacts() ), |
1804 | actionCollection(), "edit_delete" ); | 1804 | actionCollection(), "edit_delete" ); |
1805 | 1805 | ||
1806 | mActionUndo->setEnabled( false ); | 1806 | mActionUndo->setEnabled( false ); |
1807 | mActionRedo->setEnabled( false ); | 1807 | mActionRedo->setEnabled( false ); |
1808 | 1808 | ||
1809 | // settings menu | 1809 | // settings menu |
1810 | #ifdef KAB_EMBEDDED | 1810 | #ifdef KAB_EMBEDDED |
1811 | //US special menuentry to configure the addressbook resources. On KDE | 1811 | //US special menuentry to configure the addressbook resources. On KDE |
1812 | // you do that through the control center !!! | 1812 | // you do that through the control center !!! |
1813 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1813 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1814 | SLOT( configureResources() ), actionCollection(), | 1814 | SLOT( configureResources() ), actionCollection(), |
1815 | "kaddressbook_configure_resources" ); | 1815 | "kaddressbook_configure_resources" ); |
1816 | #endif //KAB_EMBEDDED | 1816 | #endif //KAB_EMBEDDED |
1817 | 1817 | ||
1818 | if ( mIsPart ) { | 1818 | if ( mIsPart ) { |
1819 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1819 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1820 | SLOT( openConfigDialog() ), actionCollection(), | 1820 | SLOT( openConfigDialog() ), actionCollection(), |
1821 | "kaddressbook_configure" ); | 1821 | "kaddressbook_configure" ); |
1822 | 1822 | ||
1823 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1823 | //US not implemented yet |
1824 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1824 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1825 | "kaddressbook_configure_shortcuts" ); | 1825 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
1826 | // "kaddressbook_configure_shortcuts" ); | ||
1826 | #ifdef KAB_EMBEDDED | 1827 | #ifdef KAB_EMBEDDED |
1827 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1828 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1828 | mActionConfigureToolbars->setEnabled( false ); | 1829 | mActionConfigureToolbars->setEnabled( false ); |
1829 | #endif //KAB_EMBEDDED | 1830 | #endif //KAB_EMBEDDED |
1830 | 1831 | ||
1831 | } else { | 1832 | } else { |
1832 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1833 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1833 | 1834 | ||
1834 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1835 | //US not implemented yet |
1836 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | ||
1835 | } | 1837 | } |
1836 | 1838 | ||
1837 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1839 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1838 | actionCollection(), "options_show_jump_bar" ); | 1840 | actionCollection(), "options_show_jump_bar" ); |
1839 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1841 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1840 | 1842 | ||
1841 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1843 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1842 | actionCollection(), "options_show_details" ); | 1844 | actionCollection(), "options_show_details" ); |
1843 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1845 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1844 | 1846 | ||
1845 | 1847 | ||
1846 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 1848 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
1847 | SLOT( toggleBeamReceive() ), actionCollection(), | 1849 | SLOT( toggleBeamReceive() ), actionCollection(), |
1848 | "kaddressbook_beam_rec" ); | 1850 | "kaddressbook_beam_rec" ); |
1849 | 1851 | ||
1850 | 1852 | ||
1851 | // misc | 1853 | // misc |
1852 | // only enable LDAP lookup if we can handle the protocol | 1854 | // only enable LDAP lookup if we can handle the protocol |
1853 | #ifndef KAB_EMBEDDED | 1855 | #ifndef KAB_EMBEDDED |
1854 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1856 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1855 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1857 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1856 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1858 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1857 | "ldap_lookup" ); | 1859 | "ldap_lookup" ); |
1858 | } | 1860 | } |
1859 | #else //KAB_EMBEDDED | 1861 | #else //KAB_EMBEDDED |
1860 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1862 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1861 | #endif //KAB_EMBEDDED | 1863 | #endif //KAB_EMBEDDED |
1862 | 1864 | ||
1863 | 1865 | ||
1864 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1866 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1865 | SLOT( setWhoAmI() ), actionCollection(), | 1867 | SLOT( setWhoAmI() ), actionCollection(), |
1866 | "set_personal" ); | 1868 | "set_personal" ); |
1867 | 1869 | ||
1868 | 1870 | ||
1869 | 1871 | ||
1870 | 1872 | ||
1871 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1873 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1872 | SLOT( setCategories() ), actionCollection(), | 1874 | SLOT( setCategories() ), actionCollection(), |
1873 | "edit_set_categories" ); | 1875 | "edit_set_categories" ); |
1874 | 1876 | ||
1875 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1877 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1876 | SLOT( removeVoice() ), actionCollection(), | 1878 | SLOT( removeVoice() ), actionCollection(), |
1877 | "remove_voice" ); | 1879 | "remove_voice" ); |
1878 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 1880 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
1879 | SLOT( importFromOL() ), actionCollection(), | 1881 | SLOT( importFromOL() ), actionCollection(), |
1880 | "import_OL" ); | 1882 | "import_OL" ); |
1881 | #ifdef KAB_EMBEDDED | 1883 | #ifdef KAB_EMBEDDED |
1882 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1884 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1883 | this, SLOT( showLicence() ), actionCollection(), | 1885 | this, SLOT( showLicence() ), actionCollection(), |
1884 | "licence_about_data" ); | 1886 | "licence_about_data" ); |
1885 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1887 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1886 | this, SLOT( faq() ), actionCollection(), | 1888 | this, SLOT( faq() ), actionCollection(), |
1887 | "faq_about_data" ); | 1889 | "faq_about_data" ); |
1888 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 1890 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
1889 | this, SLOT( whatsnew() ), actionCollection(), | 1891 | this, SLOT( whatsnew() ), actionCollection(), |
1890 | "wn" ); | 1892 | "wn" ); |
1891 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 1893 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
1892 | this, SLOT( synchowto() ), actionCollection(), | 1894 | this, SLOT( synchowto() ), actionCollection(), |
1893 | "sync" ); | 1895 | "sync" ); |
1894 | 1896 | ||
1895 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1897 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1896 | this, SLOT( createAboutData() ), actionCollection(), | 1898 | this, SLOT( createAboutData() ), actionCollection(), |
1897 | "kaddressbook_about_data" ); | 1899 | "kaddressbook_about_data" ); |
1898 | #endif //KAB_EMBEDDED | 1900 | #endif //KAB_EMBEDDED |
1899 | 1901 | ||
1900 | clipboardDataChanged(); | 1902 | clipboardDataChanged(); |
1901 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1903 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1902 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1904 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1903 | } | 1905 | } |
1904 | 1906 | ||
1905 | //US we need this function, to plug all actions into the correct menues. | 1907 | //US we need this function, to plug all actions into the correct menues. |
1906 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1908 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1907 | void KABCore::addActionsManually() | 1909 | void KABCore::addActionsManually() |
1908 | { | 1910 | { |
1909 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1911 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1910 | 1912 | ||
1911 | #ifdef KAB_EMBEDDED | 1913 | #ifdef KAB_EMBEDDED |
1912 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1914 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1913 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1915 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1914 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1916 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1915 | 1917 | ||
1916 | KToolBar* tb = mMainWindow->toolBar(); | 1918 | KToolBar* tb = mMainWindow->toolBar(); |
1917 | 1919 | ||
1918 | #ifdef DESKTOP_VERSION | 1920 | #ifdef DESKTOP_VERSION |
1919 | QMenuBar* mb = mMainWindow->menuBar(); | 1921 | QMenuBar* mb = mMainWindow->menuBar(); |
1920 | 1922 | ||
1921 | //US setup menubar. | 1923 | //US setup menubar. |
1922 | //Disable the following block if you do not want to have a menubar. | 1924 | //Disable the following block if you do not want to have a menubar. |
1923 | mb->insertItem( "&File", fileMenu ); | 1925 | mb->insertItem( "&File", fileMenu ); |
1924 | mb->insertItem( "&Edit", editMenu ); | 1926 | mb->insertItem( "&Edit", editMenu ); |
1925 | mb->insertItem( "&View", viewMenu ); | 1927 | mb->insertItem( "&View", viewMenu ); |
1926 | mb->insertItem( "&Settings", settingsMenu ); | 1928 | mb->insertItem( "&Settings", settingsMenu ); |
1927 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 1929 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
1928 | mb->insertItem( "&Change selected", changeMenu ); | 1930 | mb->insertItem( "&Change selected", changeMenu ); |
1929 | mb->insertItem( "&Help", helpMenu ); | 1931 | mb->insertItem( "&Help", helpMenu ); |
1930 | mIncSearchWidget = new IncSearchWidget( tb ); | 1932 | mIncSearchWidget = new IncSearchWidget( tb ); |
1931 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1933 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1932 | 1934 | ||
1933 | #else | 1935 | #else |
1934 | //US setup toolbar | 1936 | //US setup toolbar |
1935 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 1937 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
1936 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1938 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1937 | menuBarTB->insertItem( "ME", popupBarTB); | 1939 | menuBarTB->insertItem( "ME", popupBarTB); |
1938 | tb->insertWidget(-1, 0, menuBarTB); | 1940 | tb->insertWidget(-1, 0, menuBarTB); |
1939 | mIncSearchWidget = new IncSearchWidget( tb ); | 1941 | mIncSearchWidget = new IncSearchWidget( tb ); |
1940 | 1942 | ||
1941 | tb->enableMoving(false); | 1943 | tb->enableMoving(false); |
1942 | popupBarTB->insertItem( "&File", fileMenu ); | 1944 | popupBarTB->insertItem( "&File", fileMenu ); |
1943 | popupBarTB->insertItem( "&Edit", editMenu ); | 1945 | popupBarTB->insertItem( "&Edit", editMenu ); |
1944 | popupBarTB->insertItem( "&View", viewMenu ); | 1946 | popupBarTB->insertItem( "&View", viewMenu ); |
1945 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1947 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1946 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 1948 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
1947 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1949 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1948 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1950 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1949 | popupBarTB->insertItem( "&Help", helpMenu ); | 1951 | popupBarTB->insertItem( "&Help", helpMenu ); |
1950 | if (QApplication::desktop()->width() > 320 ) { | 1952 | if (QApplication::desktop()->width() > 320 ) { |
1951 | // mViewManager->getFilterAction()->plug ( tb); | 1953 | // mViewManager->getFilterAction()->plug ( tb); |
1952 | } | 1954 | } |
1953 | #endif | 1955 | #endif |
1954 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1956 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1955 | 1957 | ||
1956 | 1958 | ||
1957 | 1959 | ||
1958 | //US Now connect the actions with the menue entries. | 1960 | //US Now connect the actions with the menue entries. |
1959 | mActionPrint->plug( fileMenu ); | 1961 | mActionPrint->plug( fileMenu ); |
1960 | mActionMail->plug( fileMenu ); | 1962 | mActionMail->plug( fileMenu ); |
1961 | fileMenu->insertSeparator(); | 1963 | fileMenu->insertSeparator(); |
1962 | 1964 | ||
1963 | mActionNewContact->plug( fileMenu ); | 1965 | mActionNewContact->plug( fileMenu ); |
1964 | mActionNewContact->plug( tb ); | 1966 | mActionNewContact->plug( tb ); |
1965 | 1967 | ||
1966 | mActionEditAddressee->plug( fileMenu ); | 1968 | mActionEditAddressee->plug( fileMenu ); |
1967 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1969 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1968 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1970 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1969 | mActionEditAddressee->plug( tb ); | 1971 | mActionEditAddressee->plug( tb ); |
1970 | 1972 | ||
1971 | fileMenu->insertSeparator(); | 1973 | fileMenu->insertSeparator(); |
1972 | mActionSave->plug( fileMenu ); | 1974 | mActionSave->plug( fileMenu ); |
1973 | fileMenu->insertItem( "&Import", ImportMenu ); | 1975 | fileMenu->insertItem( "&Import", ImportMenu ); |
1974 | fileMenu->insertItem( "&Export", ExportMenu ); | 1976 | fileMenu->insertItem( "&Export", ExportMenu ); |
1975 | fileMenu->insertSeparator(); | 1977 | fileMenu->insertSeparator(); |
1976 | mActionMailVCard->plug( fileMenu ); | 1978 | mActionMailVCard->plug( fileMenu ); |
1977 | #ifndef DESKTOP_VERSION | 1979 | #ifndef DESKTOP_VERSION |
1978 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1980 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1979 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1981 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1980 | #endif | 1982 | #endif |
1981 | fileMenu->insertSeparator(); | 1983 | fileMenu->insertSeparator(); |
1982 | mActionQuit->plug( fileMenu ); | 1984 | mActionQuit->plug( fileMenu ); |
1983 | #ifdef _WIN32_ | 1985 | #ifdef _WIN32_ |
1984 | mActionImportOL->plug( ImportMenu ); | 1986 | mActionImportOL->plug( ImportMenu ); |
1985 | #endif | 1987 | #endif |
1986 | // edit menu | 1988 | // edit menu |
1987 | mActionUndo->plug( editMenu ); | 1989 | mActionUndo->plug( editMenu ); |
1988 | mActionRedo->plug( editMenu ); | 1990 | mActionRedo->plug( editMenu ); |
1989 | editMenu->insertSeparator(); | 1991 | editMenu->insertSeparator(); |
1990 | mActionCut->plug( editMenu ); | 1992 | mActionCut->plug( editMenu ); |
1991 | mActionCopy->plug( editMenu ); | 1993 | mActionCopy->plug( editMenu ); |
1992 | mActionPaste->plug( editMenu ); | 1994 | mActionPaste->plug( editMenu ); |
1993 | mActionDelete->plug( editMenu ); | 1995 | mActionDelete->plug( editMenu ); |
1994 | editMenu->insertSeparator(); | 1996 | editMenu->insertSeparator(); |
1995 | mActionSelectAll->plug( editMenu ); | 1997 | mActionSelectAll->plug( editMenu ); |
1996 | 1998 | ||
1997 | mActionRemoveVoice->plug( changeMenu ); | 1999 | mActionRemoveVoice->plug( changeMenu ); |
1998 | // settings menu | 2000 | // settings menu |
1999 | //US special menuentry to configure the addressbook resources. On KDE | 2001 | //US special menuentry to configure the addressbook resources. On KDE |
2000 | // you do that through the control center !!! | 2002 | // you do that through the control center !!! |
2001 | mActionConfigResources->plug( settingsMenu ); | 2003 | mActionConfigResources->plug( settingsMenu ); |
2002 | settingsMenu->insertSeparator(); | 2004 | settingsMenu->insertSeparator(); |
2003 | 2005 | ||
2004 | mActionConfigKAddressbook->plug( settingsMenu ); | 2006 | mActionConfigKAddressbook->plug( settingsMenu ); |
2005 | 2007 | ||
2006 | if ( mIsPart ) { | 2008 | if ( mIsPart ) { |
2007 | mActionConfigShortcuts->plug( settingsMenu ); | 2009 | //US not implemented yet |
2008 | mActionConfigureToolbars->plug( settingsMenu ); | 2010 | //mActionConfigShortcuts->plug( settingsMenu ); |
2011 | //mActionConfigureToolbars->plug( settingsMenu ); | ||
2009 | 2012 | ||
2010 | } else { | 2013 | } else { |
2011 | mActionKeyBindings->plug( settingsMenu ); | 2014 | //US not implemented yet |
2015 | //mActionKeyBindings->plug( settingsMenu ); | ||
2012 | } | 2016 | } |
2013 | 2017 | ||
2014 | settingsMenu->insertSeparator(); | 2018 | settingsMenu->insertSeparator(); |
2015 | 2019 | ||
2016 | mActionJumpBar->plug( settingsMenu ); | 2020 | mActionJumpBar->plug( settingsMenu ); |
2017 | mActionDetails->plug( settingsMenu ); | 2021 | mActionDetails->plug( settingsMenu ); |
2018 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2022 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2019 | mActionDetails->plug( tb ); | 2023 | mActionDetails->plug( tb ); |
2020 | settingsMenu->insertSeparator(); | 2024 | settingsMenu->insertSeparator(); |
2021 | mActionBR->plug(settingsMenu ); | 2025 | mActionBR->plug(settingsMenu ); |
2022 | settingsMenu->insertSeparator(); | 2026 | settingsMenu->insertSeparator(); |
2023 | 2027 | ||
2024 | mActionWhoAmI->plug( settingsMenu ); | 2028 | mActionWhoAmI->plug( settingsMenu ); |
2025 | mActionCategories->plug( settingsMenu ); | 2029 | mActionCategories->plug( settingsMenu ); |
2026 | 2030 | ||
2027 | 2031 | ||
2028 | mActionWN->plug( helpMenu ); | 2032 | mActionWN->plug( helpMenu ); |
2029 | mActionSyncHowto->plug( helpMenu ); | 2033 | mActionSyncHowto->plug( helpMenu ); |
2030 | mActionLicence->plug( helpMenu ); | 2034 | mActionLicence->plug( helpMenu ); |
2031 | mActionFaq->plug( helpMenu ); | 2035 | mActionFaq->plug( helpMenu ); |
2032 | mActionAboutKAddressbook->plug( helpMenu ); | 2036 | mActionAboutKAddressbook->plug( helpMenu ); |
2033 | 2037 | ||
2034 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2038 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2035 | 2039 | ||
2036 | mActionSave->plug( tb ); | 2040 | mActionSave->plug( tb ); |
2037 | mViewManager->getFilterAction()->plug ( tb); | 2041 | mViewManager->getFilterAction()->plug ( tb); |
2038 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2042 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
2039 | mActionUndo->plug( tb ); | 2043 | mActionUndo->plug( tb ); |
2040 | mActionDelete->plug( tb ); | 2044 | mActionDelete->plug( tb ); |
2041 | mActionRedo->plug( tb ); | 2045 | mActionRedo->plug( tb ); |
2042 | } | 2046 | } |
2043 | } | 2047 | } |
2044 | //mActionQuit->plug ( tb ); | 2048 | //mActionQuit->plug ( tb ); |
2045 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2049 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2046 | 2050 | ||
2047 | //US link the searchwidget first to this. | 2051 | //US link the searchwidget first to this. |
2048 | // The real linkage to the toolbar happens later. | 2052 | // The real linkage to the toolbar happens later. |
2049 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2053 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2050 | //US tb->insertItem( mIncSearchWidget ); | 2054 | //US tb->insertItem( mIncSearchWidget ); |
2051 | /*US | 2055 | /*US |
2052 | mIncSearchWidget = new IncSearchWidget( tb ); | 2056 | mIncSearchWidget = new IncSearchWidget( tb ); |
2053 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2057 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2054 | SLOT( incrementalSearch( const QString& ) ) ); | 2058 | SLOT( incrementalSearch( const QString& ) ) ); |
2055 | 2059 | ||
2056 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2060 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2057 | 2061 | ||
2058 | //US topLayout->addWidget( mJumpButtonBar ); | 2062 | //US topLayout->addWidget( mJumpButtonBar ); |
2059 | this->layout()->add( mJumpButtonBar ); | 2063 | this->layout()->add( mJumpButtonBar ); |
2060 | */ | 2064 | */ |
2061 | 2065 | ||
2062 | #endif //KAB_EMBEDDED | 2066 | #endif //KAB_EMBEDDED |
2063 | 2067 | ||
2064 | mActionExport2phone->plug( ExportMenu ); | 2068 | mActionExport2phone->plug( ExportMenu ); |
2065 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2069 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2066 | syncManager->fillSyncMenu(); | 2070 | syncManager->fillSyncMenu(); |
2067 | 2071 | ||
2068 | } | 2072 | } |
2069 | void KABCore::showLicence() | 2073 | void KABCore::showLicence() |
2070 | { | 2074 | { |
2071 | KApplication::showLicence(); | 2075 | KApplication::showLicence(); |
2072 | } | 2076 | } |
2073 | void KABCore::removeVoice() | 2077 | void KABCore::removeVoice() |
2074 | { | 2078 | { |
2075 | 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 ) | 2079 | 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 ) |
2076 | return; | 2080 | return; |
2077 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 2081 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
2078 | KABC::Addressee::List::Iterator it; | 2082 | KABC::Addressee::List::Iterator it; |
2079 | for ( it = list.begin(); it != list.end(); ++it ) { | 2083 | for ( it = list.begin(); it != list.end(); ++it ) { |
2080 | 2084 | ||
2081 | if ( (*it).removeVoice() ) | 2085 | if ( (*it).removeVoice() ) |
2082 | contactModified((*it) ); | 2086 | contactModified((*it) ); |
2083 | } | 2087 | } |
2084 | } | 2088 | } |
2085 | 2089 | ||
2086 | 2090 | ||
2087 | 2091 | ||
2088 | void KABCore::clipboardDataChanged() | 2092 | void KABCore::clipboardDataChanged() |
2089 | { | 2093 | { |
2090 | 2094 | ||
2091 | if ( mReadWrite ) | 2095 | if ( mReadWrite ) |
2092 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2096 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2093 | 2097 | ||
2094 | } | 2098 | } |
2095 | 2099 | ||
2096 | void KABCore::updateActionMenu() | 2100 | void KABCore::updateActionMenu() |
2097 | { | 2101 | { |
2098 | UndoStack *undo = UndoStack::instance(); | 2102 | UndoStack *undo = UndoStack::instance(); |
2099 | RedoStack *redo = RedoStack::instance(); | 2103 | RedoStack *redo = RedoStack::instance(); |
2100 | 2104 | ||
2101 | if ( undo->isEmpty() ) | 2105 | if ( undo->isEmpty() ) |
2102 | mActionUndo->setText( i18n( "Undo" ) ); | 2106 | mActionUndo->setText( i18n( "Undo" ) ); |
2103 | else | 2107 | else |
2104 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2108 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2105 | 2109 | ||
2106 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2110 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2107 | 2111 | ||
2108 | if ( !redo->top() ) | 2112 | if ( !redo->top() ) |
2109 | mActionRedo->setText( i18n( "Redo" ) ); | 2113 | mActionRedo->setText( i18n( "Redo" ) ); |
2110 | else | 2114 | else |
2111 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2115 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2112 | 2116 | ||
2113 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2117 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2114 | } | 2118 | } |
2115 | 2119 | ||
2116 | void KABCore::configureKeyBindings() | 2120 | void KABCore::configureKeyBindings() |
2117 | { | 2121 | { |
2118 | #ifndef KAB_EMBEDDED | 2122 | #ifndef KAB_EMBEDDED |
2119 | KKeyDialog::configure( actionCollection(), true ); | 2123 | KKeyDialog::configure( actionCollection(), true ); |
2120 | #else //KAB_EMBEDDED | 2124 | #else //KAB_EMBEDDED |
2121 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2125 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2122 | #endif //KAB_EMBEDDED | 2126 | #endif //KAB_EMBEDDED |
2123 | } | 2127 | } |
2124 | 2128 | ||
2125 | #ifdef KAB_EMBEDDED | 2129 | #ifdef KAB_EMBEDDED |
2126 | void KABCore::configureResources() | 2130 | void KABCore::configureResources() |
2127 | { | 2131 | { |
2128 | KRES::KCMKResources dlg( this, "" , 0 ); | 2132 | KRES::KCMKResources dlg( this, "" , 0 ); |
2129 | 2133 | ||
2130 | if ( !dlg.exec() ) | 2134 | if ( !dlg.exec() ) |
2131 | return; | 2135 | return; |
2132 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2136 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2133 | } | 2137 | } |
2134 | #endif //KAB_EMBEDDED | 2138 | #endif //KAB_EMBEDDED |
2135 | 2139 | ||
2136 | 2140 | ||
2137 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2141 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2138 | * for the attendees list of an event. | 2142 | * for the attendees list of an event. |
2139 | */ | 2143 | */ |
2140 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2144 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2141 | { | 2145 | { |
2142 | QStringList nameList; | 2146 | QStringList nameList; |
2143 | QStringList emailList; | 2147 | QStringList emailList; |
2144 | QStringList uidList; | 2148 | QStringList uidList; |
2145 | 2149 | ||
2146 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2150 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2147 | uint i=0; | 2151 | uint i=0; |
2148 | for (i=0; i < list.count(); i++) | 2152 | for (i=0; i < list.count(); i++) |
2149 | { | 2153 | { |
2150 | nameList.append(list[i].realName()); | 2154 | nameList.append(list[i].realName()); |
2151 | emailList.append(list[i].preferredEmail()); | 2155 | emailList.append(list[i].preferredEmail()); |
2152 | uidList.append(list[i].uid()); | 2156 | uidList.append(list[i].uid()); |
2153 | } | 2157 | } |
2154 | 2158 | ||
2155 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2159 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2156 | 2160 | ||
2157 | } | 2161 | } |
2158 | 2162 | ||
2159 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2163 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2160 | * to put them into the calendar. | 2164 | * to put them into the calendar. |
2161 | */ | 2165 | */ |
2162 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2166 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2163 | { | 2167 | { |
2164 | // qDebug("KABCore::requestForBirthdayList"); | 2168 | // qDebug("KABCore::requestForBirthdayList"); |
2165 | QStringList birthdayList; | 2169 | QStringList birthdayList; |
2166 | QStringList anniversaryList; | 2170 | QStringList anniversaryList; |
2167 | QStringList realNameList; | 2171 | QStringList realNameList; |
2168 | QStringList preferredEmailList; | 2172 | QStringList preferredEmailList; |
2169 | QStringList assembledNameList; | 2173 | QStringList assembledNameList; |
2170 | QStringList uidList; | 2174 | QStringList uidList; |
2171 | 2175 | ||
2172 | KABC::AddressBook::Iterator it; | 2176 | KABC::AddressBook::Iterator it; |
2173 | 2177 | ||
2174 | int count = 0; | 2178 | int count = 0; |
2175 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2179 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2176 | ++count; | 2180 | ++count; |
2177 | } | 2181 | } |
2178 | QProgressBar bar(count,0 ); | 2182 | QProgressBar bar(count,0 ); |
2179 | int w = 300; | 2183 | int w = 300; |
2180 | if ( QApplication::desktop()->width() < 320 ) | 2184 | if ( QApplication::desktop()->width() < 320 ) |
2181 | w = 220; | 2185 | w = 220; |
2182 | int h = bar.sizeHint().height() ; | 2186 | int h = bar.sizeHint().height() ; |
2183 | int dw = QApplication::desktop()->width(); | 2187 | int dw = QApplication::desktop()->width(); |
2184 | int dh = QApplication::desktop()->height(); | 2188 | int dh = QApplication::desktop()->height(); |
2185 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2189 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2186 | bar.show(); | 2190 | bar.show(); |
2187 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2191 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2188 | qApp->processEvents(); | 2192 | qApp->processEvents(); |
2189 | 2193 | ||
2190 | QDate bday; | 2194 | QDate bday; |
2191 | QString anni; | 2195 | QString anni; |
2192 | QString formattedbday; | 2196 | QString formattedbday; |
2193 | 2197 | ||
2194 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2198 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2195 | { | 2199 | { |
2196 | if ( ! bar.isVisible() ) | 2200 | if ( ! bar.isVisible() ) |
2197 | return; | 2201 | return; |
2198 | bar.setProgress( count++ ); | 2202 | bar.setProgress( count++ ); |
2199 | qApp->processEvents(); | 2203 | qApp->processEvents(); |
2200 | bday = (*it).birthday().date(); | 2204 | bday = (*it).birthday().date(); |
2201 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2205 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2202 | 2206 | ||
2203 | if ( bday.isValid() || !anni.isEmpty()) | 2207 | if ( bday.isValid() || !anni.isEmpty()) |
2204 | { | 2208 | { |
2205 | if (bday.isValid()) | 2209 | if (bday.isValid()) |
2206 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2210 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2207 | else | 2211 | else |
2208 | formattedbday = "NOTVALID"; | 2212 | formattedbday = "NOTVALID"; |
2209 | if (anni.isEmpty()) | 2213 | if (anni.isEmpty()) |
2210 | anni = "INVALID"; | 2214 | anni = "INVALID"; |
2211 | 2215 | ||
2212 | birthdayList.append(formattedbday); | 2216 | birthdayList.append(formattedbday); |
2213 | anniversaryList.append(anni); //should be ISODate | 2217 | anniversaryList.append(anni); //should be ISODate |
2214 | realNameList.append((*it).realName()); | 2218 | realNameList.append((*it).realName()); |
2215 | preferredEmailList.append((*it).preferredEmail()); | 2219 | preferredEmailList.append((*it).preferredEmail()); |
2216 | assembledNameList.append((*it).assembledName()); | 2220 | assembledNameList.append((*it).assembledName()); |
2217 | uidList.append((*it).uid()); | 2221 | uidList.append((*it).uid()); |
2218 | 2222 | ||
2219 | qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2223 | qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2220 | } | 2224 | } |
2221 | } | 2225 | } |
2222 | 2226 | ||
2223 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2227 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2224 | 2228 | ||
2225 | } | 2229 | } |
2226 | 2230 | ||
2227 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2231 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2228 | */ | 2232 | */ |
2229 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2233 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2230 | { | 2234 | { |
2231 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2235 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2232 | 2236 | ||
2233 | QString foundUid = QString::null; | 2237 | QString foundUid = QString::null; |
2234 | if ( ! uid.isEmpty() ) { | 2238 | if ( ! uid.isEmpty() ) { |
2235 | Addressee adrr = mAddressBook->findByUid( uid ); | 2239 | Addressee adrr = mAddressBook->findByUid( uid ); |
2236 | if ( !adrr.isEmpty() ) { | 2240 | if ( !adrr.isEmpty() ) { |
2237 | foundUid = uid; | 2241 | foundUid = uid; |
2238 | } | 2242 | } |
2239 | if ( email == "sendbacklist" ) { | 2243 | if ( email == "sendbacklist" ) { |
2240 | //qDebug("ssssssssssssssssssssssend "); | 2244 | //qDebug("ssssssssssssssssssssssend "); |
2241 | QStringList nameList; | 2245 | QStringList nameList; |
2242 | QStringList emailList; | 2246 | QStringList emailList; |
2243 | QStringList uidList; | 2247 | QStringList uidList; |
2244 | nameList.append(adrr.realName()); | 2248 | nameList.append(adrr.realName()); |
2245 | emailList = adrr.emails(); | 2249 | emailList = adrr.emails(); |
2246 | uidList.append( adrr.preferredEmail()); | 2250 | uidList.append( adrr.preferredEmail()); |
2247 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2251 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2248 | return; | 2252 | return; |
2249 | } | 2253 | } |
2250 | 2254 | ||
2251 | } | 2255 | } |
2252 | 2256 | ||
2253 | if ( email == "sendbacklist" ) | 2257 | if ( email == "sendbacklist" ) |
2254 | return; | 2258 | return; |
2255 | if (foundUid.isEmpty()) | 2259 | if (foundUid.isEmpty()) |
2256 | { | 2260 | { |
2257 | //find the uid of the person first | 2261 | //find the uid of the person first |
2258 | Addressee::List namelist; | 2262 | Addressee::List namelist; |
2259 | Addressee::List emaillist; | 2263 | Addressee::List emaillist; |
2260 | 2264 | ||
2261 | if (!name.isEmpty()) | 2265 | if (!name.isEmpty()) |
2262 | namelist = mAddressBook->findByName( name ); | 2266 | namelist = mAddressBook->findByName( name ); |
2263 | 2267 | ||
2264 | if (!email.isEmpty()) | 2268 | if (!email.isEmpty()) |
2265 | emaillist = mAddressBook->findByEmail( email ); | 2269 | emaillist = mAddressBook->findByEmail( email ); |
2266 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2270 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2267 | //check if we have a match in Namelist and Emaillist | 2271 | //check if we have a match in Namelist and Emaillist |
2268 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2272 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2269 | foundUid = emaillist[0].uid(); | 2273 | foundUid = emaillist[0].uid(); |
2270 | } | 2274 | } |
2271 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2275 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2272 | foundUid = namelist[0].uid(); | 2276 | foundUid = namelist[0].uid(); |
2273 | else | 2277 | else |
2274 | { | 2278 | { |
2275 | for (int i = 0; i < namelist.count(); i++) | 2279 | for (int i = 0; i < namelist.count(); i++) |
2276 | { | 2280 | { |
2277 | for (int j = 0; j < emaillist.count(); j++) | 2281 | for (int j = 0; j < emaillist.count(); j++) |
2278 | { | 2282 | { |
2279 | if (namelist[i] == emaillist[j]) | 2283 | if (namelist[i] == emaillist[j]) |
2280 | { | 2284 | { |
2281 | foundUid = namelist[i].uid(); | 2285 | foundUid = namelist[i].uid(); |
2282 | } | 2286 | } |
2283 | } | 2287 | } |
2284 | } | 2288 | } |
2285 | } | 2289 | } |
2286 | } | 2290 | } |
2287 | else | 2291 | else |
2288 | { | 2292 | { |
2289 | foundUid = uid; | 2293 | foundUid = uid; |
2290 | } | 2294 | } |
2291 | 2295 | ||
2292 | if (!foundUid.isEmpty()) | 2296 | if (!foundUid.isEmpty()) |
2293 | { | 2297 | { |
2294 | 2298 | ||
2295 | // raise Ka/Pi if it is in the background | 2299 | // raise Ka/Pi if it is in the background |
2296 | #ifndef DESKTOP_VERSION | 2300 | #ifndef DESKTOP_VERSION |
2297 | #ifndef KORG_NODCOP | 2301 | #ifndef KORG_NODCOP |
2298 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2302 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2299 | #endif | 2303 | #endif |
2300 | #endif | 2304 | #endif |
2301 | 2305 | ||
2302 | mMainWindow->showMaximized(); | 2306 | mMainWindow->showMaximized(); |
2303 | mMainWindow-> raise(); | 2307 | mMainWindow-> raise(); |
2304 | 2308 | ||
2305 | mViewManager->setSelected( "", false); | 2309 | mViewManager->setSelected( "", false); |
2306 | mViewManager->refreshView( "" ); | 2310 | mViewManager->refreshView( "" ); |
2307 | mViewManager->setSelected( foundUid, true ); | 2311 | mViewManager->setSelected( foundUid, true ); |
2308 | mViewManager->refreshView( foundUid ); | 2312 | mViewManager->refreshView( foundUid ); |
2309 | 2313 | ||
2310 | if ( !mMultipleViewsAtOnce ) | 2314 | if ( !mMultipleViewsAtOnce ) |
2311 | { | 2315 | { |
2312 | setDetailsVisible( true ); | 2316 | setDetailsVisible( true ); |
2313 | mActionDetails->setChecked(true); | 2317 | mActionDetails->setChecked(true); |
2314 | } | 2318 | } |
2315 | } | 2319 | } |
2316 | } | 2320 | } |
2317 | 2321 | ||
2318 | void KABCore::whatsnew() | 2322 | void KABCore::whatsnew() |
2319 | { | 2323 | { |
2320 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2324 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2321 | } | 2325 | } |
2322 | void KABCore::synchowto() | 2326 | void KABCore::synchowto() |
2323 | { | 2327 | { |
2324 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2328 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2325 | } | 2329 | } |
2326 | 2330 | ||
2327 | void KABCore::faq() | 2331 | void KABCore::faq() |
2328 | { | 2332 | { |
2329 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2333 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2330 | } | 2334 | } |
2331 | 2335 | ||
2332 | #include <libkcal/syncdefines.h> | 2336 | #include <libkcal/syncdefines.h> |
2333 | 2337 | ||
2334 | KABC::Addressee KABCore::getLastSyncAddressee() | 2338 | KABC::Addressee KABCore::getLastSyncAddressee() |
2335 | { | 2339 | { |
2336 | Addressee lse; | 2340 | Addressee lse; |
2337 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2341 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2338 | 2342 | ||
2339 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2343 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
2340 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2344 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2341 | if (lse.isEmpty()) { | 2345 | if (lse.isEmpty()) { |
2342 | qDebug("Creating new last-syncAddressee "); | 2346 | qDebug("Creating new last-syncAddressee "); |
2343 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2347 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2344 | QString sum = ""; | 2348 | QString sum = ""; |
2345 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 2349 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
2346 | sum = "E: "; | 2350 | sum = "E: "; |
2347 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); | 2351 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); |
2348 | lse.setRevision( mLastAddressbookSync ); | 2352 | lse.setRevision( mLastAddressbookSync ); |
2349 | lse.setCategories( i18n("SyncEvent") ); | 2353 | lse.setCategories( i18n("SyncEvent") ); |
2350 | mAddressBook->insertAddressee( lse ); | 2354 | mAddressBook->insertAddressee( lse ); |
2351 | } | 2355 | } |
2352 | return lse; | 2356 | return lse; |
2353 | } | 2357 | } |
2354 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2358 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2355 | { | 2359 | { |
2356 | 2360 | ||
2357 | //void setZaurusId(int id); | 2361 | //void setZaurusId(int id); |
2358 | // int zaurusId() const; | 2362 | // int zaurusId() const; |
2359 | // void setZaurusUid(int id); | 2363 | // void setZaurusUid(int id); |
2360 | // int zaurusUid() const; | 2364 | // int zaurusUid() const; |
2361 | // void setZaurusStat(int id); | 2365 | // void setZaurusStat(int id); |
2362 | // int zaurusStat() const; | 2366 | // int zaurusStat() const; |
2363 | // 0 equal | 2367 | // 0 equal |
2364 | // 1 take local | 2368 | // 1 take local |
2365 | // 2 take remote | 2369 | // 2 take remote |
2366 | // 3 cancel | 2370 | // 3 cancel |
2367 | QDateTime lastSync = mLastAddressbookSync; | 2371 | QDateTime lastSync = mLastAddressbookSync; |
2368 | QDateTime localMod = local->revision(); | 2372 | QDateTime localMod = local->revision(); |
2369 | QDateTime remoteMod = remote->revision(); | 2373 | QDateTime remoteMod = remote->revision(); |
2370 | 2374 | ||
2371 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2375 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2372 | 2376 | ||
2373 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2377 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2374 | bool remCh, locCh; | 2378 | bool remCh, locCh; |
2375 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2379 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2376 | 2380 | ||
2377 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 2381 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
2378 | locCh = ( localMod > mLastAddressbookSync ); | 2382 | locCh = ( localMod > mLastAddressbookSync ); |
2379 | if ( !remCh && ! locCh ) { | 2383 | if ( !remCh && ! locCh ) { |
2380 | //qDebug("both not changed "); | 2384 | //qDebug("both not changed "); |
2381 | lastSync = localMod.addDays(1); | 2385 | lastSync = localMod.addDays(1); |
2382 | if ( mode <= SYNC_PREF_ASK ) | 2386 | if ( mode <= SYNC_PREF_ASK ) |
2383 | return 0; | 2387 | return 0; |
2384 | } else { | 2388 | } else { |
2385 | if ( locCh ) { | 2389 | if ( locCh ) { |
2386 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2390 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2387 | lastSync = localMod.addDays( -1 ); | 2391 | lastSync = localMod.addDays( -1 ); |
2388 | if ( !remCh ) | 2392 | if ( !remCh ) |
2389 | remoteMod =( lastSync.addDays( -1 ) ); | 2393 | remoteMod =( lastSync.addDays( -1 ) ); |
2390 | } else { | 2394 | } else { |
2391 | //qDebug(" not loc changed "); | 2395 | //qDebug(" not loc changed "); |
2392 | lastSync = localMod.addDays( 1 ); | 2396 | lastSync = localMod.addDays( 1 ); |
2393 | if ( remCh ) | 2397 | if ( remCh ) |
2394 | remoteMod =( lastSync.addDays( 1 ) ); | 2398 | remoteMod =( lastSync.addDays( 1 ) ); |
2395 | 2399 | ||