summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-16 16:09:49 (UTC)
committer zautrix <zautrix>2005-01-16 16:09:49 (UTC)
commita704468d5fd02d30cf962c8b2d6815c7e9208e5d (patch) (unidiff)
tree2ba2253c8fd73c752a437a201df1d3be7e9e4131
parentde5f08d69c716f85cc92f20700cd24fb1ad41295 (diff)
downloadkdepimpi-a704468d5fd02d30cf962c8b2d6815c7e9208e5d.zip
kdepimpi-a704468d5fd02d30cf962c8b2d6815c7e9208e5d.tar.gz
kdepimpi-a704468d5fd02d30cf962c8b2d6815c7e9208e5d.tar.bz2
menu fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index c5a36e2..4098dda 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1372,1559 +1372,1563 @@ void KABCore::save()
1372 "address book. Please check that some \nother application is " 1372 "address book. Please check that some \nother application is "
1373 "not using it. " ); 1373 "not using it. " );
1374 message(i18n("Saving addressbook ... ")); 1374 message(i18n("Saving addressbook ... "));
1375#ifndef KAB_EMBEDDED 1375#ifndef KAB_EMBEDDED
1376 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1376 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1377 if ( !b || !b->save() ) { 1377 if ( !b || !b->save() ) {
1378 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1378 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1379 } 1379 }
1380#else //KAB_EMBEDDED 1380#else //KAB_EMBEDDED
1381 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1381 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1382 if ( !b || !b->save() ) { 1382 if ( !b || !b->save() ) {
1383 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1383 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1384 } 1384 }
1385#endif //KAB_EMBEDDED 1385#endif //KAB_EMBEDDED
1386 1386
1387 message(i18n("Addressbook saved!")); 1387 message(i18n("Addressbook saved!"));
1388 setModified( false ); 1388 setModified( false );
1389 syncManager->setBlockSave(false); 1389 syncManager->setBlockSave(false);
1390} 1390}
1391 1391
1392 1392
1393void KABCore::undo() 1393void KABCore::undo()
1394{ 1394{
1395 UndoStack::instance()->undo(); 1395 UndoStack::instance()->undo();
1396 1396
1397 // Refresh the view 1397 // Refresh the view
1398 mViewManager->refreshView(); 1398 mViewManager->refreshView();
1399} 1399}
1400 1400
1401void KABCore::redo() 1401void KABCore::redo()
1402{ 1402{
1403 RedoStack::instance()->redo(); 1403 RedoStack::instance()->redo();
1404 1404
1405 // Refresh the view 1405 // Refresh the view
1406 mViewManager->refreshView(); 1406 mViewManager->refreshView();
1407} 1407}
1408 1408
1409void KABCore::setJumpButtonBarVisible( bool visible ) 1409void KABCore::setJumpButtonBarVisible( bool visible )
1410{ 1410{
1411 if (mMultipleViewsAtOnce) 1411 if (mMultipleViewsAtOnce)
1412 { 1412 {
1413 if ( visible ) 1413 if ( visible )
1414 mJumpButtonBar->show(); 1414 mJumpButtonBar->show();
1415 else 1415 else
1416 mJumpButtonBar->hide(); 1416 mJumpButtonBar->hide();
1417 } 1417 }
1418 else 1418 else
1419 { 1419 {
1420 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1420 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1421 if (mViewManager->isVisible()) 1421 if (mViewManager->isVisible())
1422 { 1422 {
1423 if ( visible ) 1423 if ( visible )
1424 mJumpButtonBar->show(); 1424 mJumpButtonBar->show();
1425 else 1425 else
1426 mJumpButtonBar->hide(); 1426 mJumpButtonBar->hide();
1427 } 1427 }
1428 else 1428 else
1429 { 1429 {
1430 mJumpButtonBar->hide(); 1430 mJumpButtonBar->hide();
1431 } 1431 }
1432 } 1432 }
1433} 1433}
1434 1434
1435 1435
1436void KABCore::setDetailsToState() 1436void KABCore::setDetailsToState()
1437{ 1437{
1438 setDetailsVisible( mActionDetails->isChecked() ); 1438 setDetailsVisible( mActionDetails->isChecked() );
1439} 1439}
1440void KABCore::setDetailsToggle() 1440void KABCore::setDetailsToggle()
1441{ 1441{
1442 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1442 mActionDetails->setChecked( !mActionDetails->isChecked() );
1443 setDetailsToState(); 1443 setDetailsToState();
1444} 1444}
1445 1445
1446 1446
1447 1447
1448void KABCore::setDetailsVisible( bool visible ) 1448void KABCore::setDetailsVisible( bool visible )
1449{ 1449{
1450 if (visible && mDetails->isHidden()) 1450 if (visible && mDetails->isHidden())
1451 { 1451 {
1452 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1452 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1453 if ( addrList.count() > 0 ) 1453 if ( addrList.count() > 0 )
1454 mDetails->setAddressee( addrList[ 0 ] ); 1454 mDetails->setAddressee( addrList[ 0 ] );
1455 } 1455 }
1456 1456
1457 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1457 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1458 // the listview and the detailview. We do that by changing the splitbar size. 1458 // the listview and the detailview. We do that by changing the splitbar size.
1459 if (mMultipleViewsAtOnce) 1459 if (mMultipleViewsAtOnce)
1460 { 1460 {
1461 if ( visible ) 1461 if ( visible )
1462 mDetails->show(); 1462 mDetails->show();
1463 else 1463 else
1464 mDetails->hide(); 1464 mDetails->hide();
1465 } 1465 }
1466 else 1466 else
1467 { 1467 {
1468 if ( visible ) { 1468 if ( visible ) {
1469 mViewManager->hide(); 1469 mViewManager->hide();
1470 mDetails->show(); 1470 mDetails->show();
1471 mIncSearchWidget->setFocus(); 1471 mIncSearchWidget->setFocus();
1472 } 1472 }
1473 else { 1473 else {
1474 mViewManager->show(); 1474 mViewManager->show();
1475 mDetails->hide(); 1475 mDetails->hide();
1476 mViewManager->setFocusAV(); 1476 mViewManager->setFocusAV();
1477 } 1477 }
1478 setJumpButtonBarVisible( !visible ); 1478 setJumpButtonBarVisible( !visible );
1479 } 1479 }
1480 1480
1481} 1481}
1482 1482
1483void KABCore::extensionChanged( int id ) 1483void KABCore::extensionChanged( int id )
1484{ 1484{
1485 //change the details view only for non desktop systems 1485 //change the details view only for non desktop systems
1486#ifndef DESKTOP_VERSION 1486#ifndef DESKTOP_VERSION
1487 1487
1488 if (id == 0) 1488 if (id == 0)
1489 { 1489 {
1490 //the user disabled the extension. 1490 //the user disabled the extension.
1491 1491
1492 if (mMultipleViewsAtOnce) 1492 if (mMultipleViewsAtOnce)
1493 { // enable detailsview again 1493 { // enable detailsview again
1494 setDetailsVisible( true ); 1494 setDetailsVisible( true );
1495 mActionDetails->setChecked( true ); 1495 mActionDetails->setChecked( true );
1496 } 1496 }
1497 else 1497 else
1498 { //go back to the listview 1498 { //go back to the listview
1499 setDetailsVisible( false ); 1499 setDetailsVisible( false );
1500 mActionDetails->setChecked( false ); 1500 mActionDetails->setChecked( false );
1501 mActionDetails->setEnabled(true); 1501 mActionDetails->setEnabled(true);
1502 } 1502 }
1503 1503
1504 } 1504 }
1505 else 1505 else
1506 { 1506 {
1507 //the user enabled the extension. 1507 //the user enabled the extension.
1508 setDetailsVisible( false ); 1508 setDetailsVisible( false );
1509 mActionDetails->setChecked( false ); 1509 mActionDetails->setChecked( false );
1510 1510
1511 if (!mMultipleViewsAtOnce) 1511 if (!mMultipleViewsAtOnce)
1512 { 1512 {
1513 mActionDetails->setEnabled(false); 1513 mActionDetails->setEnabled(false);
1514 } 1514 }
1515 1515
1516 mExtensionManager->setSelectionChanged(); 1516 mExtensionManager->setSelectionChanged();
1517 1517
1518 } 1518 }
1519 1519
1520#endif// DESKTOP_VERSION 1520#endif// DESKTOP_VERSION
1521 1521
1522} 1522}
1523 1523
1524 1524
1525void KABCore::extensionModified( const KABC::Addressee::List &list ) 1525void KABCore::extensionModified( const KABC::Addressee::List &list )
1526{ 1526{
1527 1527
1528 if ( list.count() != 0 ) { 1528 if ( list.count() != 0 ) {
1529 KABC::Addressee::List::ConstIterator it; 1529 KABC::Addressee::List::ConstIterator it;
1530 for ( it = list.begin(); it != list.end(); ++it ) 1530 for ( it = list.begin(); it != list.end(); ++it )
1531 mAddressBook->insertAddressee( *it ); 1531 mAddressBook->insertAddressee( *it );
1532 if ( list.count() > 1 ) 1532 if ( list.count() > 1 )
1533 setModified(); 1533 setModified();
1534 else 1534 else
1535 setModifiedWOrefresh(); 1535 setModifiedWOrefresh();
1536 } 1536 }
1537 if ( list.count() == 0 ) 1537 if ( list.count() == 0 )
1538 mViewManager->refreshView(); 1538 mViewManager->refreshView();
1539 else 1539 else
1540 mViewManager->refreshView( list[ 0 ].uid() ); 1540 mViewManager->refreshView( list[ 0 ].uid() );
1541 1541
1542 1542
1543 1543
1544} 1544}
1545 1545
1546QString KABCore::getNameByPhone( const QString &phone ) 1546QString KABCore::getNameByPhone( const QString &phone )
1547{ 1547{
1548#ifndef KAB_EMBEDDED 1548#ifndef KAB_EMBEDDED
1549 QRegExp r( "[/*/-/ ]" ); 1549 QRegExp r( "[/*/-/ ]" );
1550 QString localPhone( phone ); 1550 QString localPhone( phone );
1551 1551
1552 bool found = false; 1552 bool found = false;
1553 QString ownerName = ""; 1553 QString ownerName = "";
1554 KABC::AddressBook::Iterator iter; 1554 KABC::AddressBook::Iterator iter;
1555 KABC::PhoneNumber::List::Iterator phoneIter; 1555 KABC::PhoneNumber::List::Iterator phoneIter;
1556 KABC::PhoneNumber::List phoneList; 1556 KABC::PhoneNumber::List phoneList;
1557 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1557 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1558 phoneList = (*iter).phoneNumbers(); 1558 phoneList = (*iter).phoneNumbers();
1559 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1559 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1560 ++phoneIter) { 1560 ++phoneIter) {
1561 // Get rid of separator chars so just the numbers are compared. 1561 // Get rid of separator chars so just the numbers are compared.
1562 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1562 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1563 ownerName = (*iter).formattedName(); 1563 ownerName = (*iter).formattedName();
1564 found = true; 1564 found = true;
1565 } 1565 }
1566 } 1566 }
1567 } 1567 }
1568 1568
1569 return ownerName; 1569 return ownerName;
1570#else //KAB_EMBEDDED 1570#else //KAB_EMBEDDED
1571 qDebug("KABCore::getNameByPhone finsih method"); 1571 qDebug("KABCore::getNameByPhone finsih method");
1572 return ""; 1572 return "";
1573#endif //KAB_EMBEDDED 1573#endif //KAB_EMBEDDED
1574 1574
1575} 1575}
1576 1576
1577void KABCore::openConfigDialog() 1577void KABCore::openConfigDialog()
1578{ 1578{
1579 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1579 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1580 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1580 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1581 ConfigureDialog->addModule(kabcfg ); 1581 ConfigureDialog->addModule(kabcfg );
1582 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1582 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1583 ConfigureDialog->addModule(kdelibcfg ); 1583 ConfigureDialog->addModule(kdelibcfg );
1584 1584
1585 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1585 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1586 this, SLOT( configurationChanged() ) ); 1586 this, SLOT( configurationChanged() ) );
1587 connect( ConfigureDialog, SIGNAL( okClicked() ), 1587 connect( ConfigureDialog, SIGNAL( okClicked() ),
1588 this, SLOT( configurationChanged() ) ); 1588 this, SLOT( configurationChanged() ) );
1589 saveSettings(); 1589 saveSettings();
1590#ifndef DESKTOP_VERSION 1590#ifndef DESKTOP_VERSION
1591 ConfigureDialog->showMaximized(); 1591 ConfigureDialog->showMaximized();
1592#endif 1592#endif
1593 if ( ConfigureDialog->exec() ) 1593 if ( ConfigureDialog->exec() )
1594 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1594 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1595 delete ConfigureDialog; 1595 delete ConfigureDialog;
1596} 1596}
1597 1597
1598void KABCore::openLDAPDialog() 1598void KABCore::openLDAPDialog()
1599{ 1599{
1600#ifndef KAB_EMBEDDED 1600#ifndef KAB_EMBEDDED
1601 if ( !mLdapSearchDialog ) { 1601 if ( !mLdapSearchDialog ) {
1602 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1602 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1603 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1603 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1604 SLOT( refreshView() ) ); 1604 SLOT( refreshView() ) );
1605 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1605 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1606 SLOT( setModified() ) ); 1606 SLOT( setModified() ) );
1607 } else 1607 } else
1608 mLdapSearchDialog->restoreSettings(); 1608 mLdapSearchDialog->restoreSettings();
1609 1609
1610 if ( mLdapSearchDialog->isOK() ) 1610 if ( mLdapSearchDialog->isOK() )
1611 mLdapSearchDialog->exec(); 1611 mLdapSearchDialog->exec();
1612#else //KAB_EMBEDDED 1612#else //KAB_EMBEDDED
1613 qDebug("KABCore::openLDAPDialog() finsih method"); 1613 qDebug("KABCore::openLDAPDialog() finsih method");
1614#endif //KAB_EMBEDDED 1614#endif //KAB_EMBEDDED
1615} 1615}
1616 1616
1617void KABCore::print() 1617void KABCore::print()
1618{ 1618{
1619#ifndef KAB_EMBEDDED 1619#ifndef KAB_EMBEDDED
1620 KPrinter printer; 1620 KPrinter printer;
1621 if ( !printer.setup( this ) ) 1621 if ( !printer.setup( this ) )
1622 return; 1622 return;
1623 1623
1624 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1624 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1625 mViewManager->selectedUids(), this ); 1625 mViewManager->selectedUids(), this );
1626 1626
1627 wizard.exec(); 1627 wizard.exec();
1628#else //KAB_EMBEDDED 1628#else //KAB_EMBEDDED
1629 qDebug("KABCore::print() finsih method"); 1629 qDebug("KABCore::print() finsih method");
1630#endif //KAB_EMBEDDED 1630#endif //KAB_EMBEDDED
1631 1631
1632} 1632}
1633 1633
1634 1634
1635void KABCore::addGUIClient( KXMLGUIClient *client ) 1635void KABCore::addGUIClient( KXMLGUIClient *client )
1636{ 1636{
1637 if ( mGUIClient ) 1637 if ( mGUIClient )
1638 mGUIClient->insertChildClient( client ); 1638 mGUIClient->insertChildClient( client );
1639 else 1639 else
1640 KMessageBox::error( this, "no KXMLGUICLient"); 1640 KMessageBox::error( this, "no KXMLGUICLient");
1641} 1641}
1642 1642
1643 1643
1644void KABCore::configurationChanged() 1644void KABCore::configurationChanged()
1645{ 1645{
1646 mExtensionManager->reconfigure(); 1646 mExtensionManager->reconfigure();
1647} 1647}
1648 1648
1649void KABCore::addressBookChanged() 1649void KABCore::addressBookChanged()
1650{ 1650{
1651/*US 1651/*US
1652 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1652 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1653 while ( it.current() ) { 1653 while ( it.current() ) {
1654 if ( it.current()->dirty() ) { 1654 if ( it.current()->dirty() ) {
1655 QString text = i18n( "Data has been changed externally. Unsaved " 1655 QString text = i18n( "Data has been changed externally. Unsaved "
1656 "changes will be lost." ); 1656 "changes will be lost." );
1657 KMessageBox::information( this, text ); 1657 KMessageBox::information( this, text );
1658 } 1658 }
1659 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1659 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1660 ++it; 1660 ++it;
1661 } 1661 }
1662*/ 1662*/
1663 if (mEditorDialog) 1663 if (mEditorDialog)
1664 { 1664 {
1665 if (mEditorDialog->dirty()) 1665 if (mEditorDialog->dirty())
1666 { 1666 {
1667 QString text = i18n( "Data has been changed externally. Unsaved " 1667 QString text = i18n( "Data has been changed externally. Unsaved "
1668 "changes will be lost." ); 1668 "changes will be lost." );
1669 KMessageBox::information( this, text ); 1669 KMessageBox::information( this, text );
1670 } 1670 }
1671 QString currentuid = mEditorDialog->addressee().uid(); 1671 QString currentuid = mEditorDialog->addressee().uid();
1672 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1672 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1673 } 1673 }
1674 mViewManager->refreshView(); 1674 mViewManager->refreshView();
1675 1675
1676 1676
1677} 1677}
1678 1678
1679AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1679AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1680 const char *name ) 1680 const char *name )
1681{ 1681{
1682 1682
1683 if ( mEditorDialog == 0 ) { 1683 if ( mEditorDialog == 0 ) {
1684 mEditorDialog = new AddresseeEditorDialog( this, parent, 1684 mEditorDialog = new AddresseeEditorDialog( this, parent,
1685 name ? name : "editorDialog" ); 1685 name ? name : "editorDialog" );
1686 1686
1687 1687
1688 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1688 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1689 SLOT( contactModified( const KABC::Addressee& ) ) ); 1689 SLOT( contactModified( const KABC::Addressee& ) ) );
1690 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1690 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1691 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1691 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1692 } 1692 }
1693 1693
1694 return mEditorDialog; 1694 return mEditorDialog;
1695} 1695}
1696 1696
1697void KABCore::slotEditorDestroyed( const QString &uid ) 1697void KABCore::slotEditorDestroyed( const QString &uid )
1698{ 1698{
1699 //mEditorDict.remove( uid ); 1699 //mEditorDict.remove( uid );
1700} 1700}
1701 1701
1702void KABCore::initGUI() 1702void KABCore::initGUI()
1703{ 1703{
1704#ifndef KAB_EMBEDDED 1704#ifndef KAB_EMBEDDED
1705 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1705 QHBoxLayout *topLayout = new QHBoxLayout( this );
1706 topLayout->setSpacing( KDialogBase::spacingHint() ); 1706 topLayout->setSpacing( KDialogBase::spacingHint() );
1707 1707
1708 mExtensionBarSplitter = new QSplitter( this ); 1708 mExtensionBarSplitter = new QSplitter( this );
1709 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1709 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1710 1710
1711 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1711 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1712 1712
1713 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1713 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1714 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1714 mIncSearchWidget = new IncSearchWidget( viewSpace );
1715 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1715 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1716 SLOT( incrementalSearch( const QString& ) ) ); 1716 SLOT( incrementalSearch( const QString& ) ) );
1717 1717
1718 mViewManager = new ViewManager( this, viewSpace ); 1718 mViewManager = new ViewManager( this, viewSpace );
1719 viewSpace->setStretchFactor( mViewManager, 1 ); 1719 viewSpace->setStretchFactor( mViewManager, 1 );
1720 1720
1721 mDetails = new ViewContainer( mDetailsSplitter ); 1721 mDetails = new ViewContainer( mDetailsSplitter );
1722 1722
1723 mJumpButtonBar = new JumpButtonBar( this, this ); 1723 mJumpButtonBar = new JumpButtonBar( this, this );
1724 1724
1725 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1725 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1726 1726
1727 topLayout->addWidget( mExtensionBarSplitter ); 1727 topLayout->addWidget( mExtensionBarSplitter );
1728 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1728 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1729 topLayout->addWidget( mJumpButtonBar ); 1729 topLayout->addWidget( mJumpButtonBar );
1730 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1730 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1731 1731
1732 mXXPortManager = new XXPortManager( this, this ); 1732 mXXPortManager = new XXPortManager( this, this );
1733 1733
1734#else //KAB_EMBEDDED 1734#else //KAB_EMBEDDED
1735 //US initialize viewMenu before settingup viewmanager. 1735 //US initialize viewMenu before settingup viewmanager.
1736 // Viewmanager needs this menu to plugin submenues. 1736 // Viewmanager needs this menu to plugin submenues.
1737 viewMenu = new QPopupMenu( this ); 1737 viewMenu = new QPopupMenu( this );
1738 settingsMenu = new QPopupMenu( this ); 1738 settingsMenu = new QPopupMenu( this );
1739 //filterMenu = new QPopupMenu( this ); 1739 //filterMenu = new QPopupMenu( this );
1740 ImportMenu = new QPopupMenu( this ); 1740 ImportMenu = new QPopupMenu( this );
1741 ExportMenu = new QPopupMenu( this ); 1741 ExportMenu = new QPopupMenu( this );
1742 syncMenu = new QPopupMenu( this ); 1742 syncMenu = new QPopupMenu( this );
1743 changeMenu= new QPopupMenu( this ); 1743 changeMenu= new QPopupMenu( this );
1744 beamMenu= new QPopupMenu( this ); 1744 beamMenu= new QPopupMenu( this );
1745 1745
1746//US since we have no splitter for the embedded system, setup 1746//US since we have no splitter for the embedded system, setup
1747// a layout with two frames. One left and one right. 1747// a layout with two frames. One left and one right.
1748 1748
1749 QBoxLayout *topLayout; 1749 QBoxLayout *topLayout;
1750 1750
1751 // = new QHBoxLayout( this ); 1751 // = new QHBoxLayout( this );
1752// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1752// QBoxLayout *topLayout = (QBoxLayout*)layout();
1753 1753
1754// QWidget *mainBox = new QWidget( this ); 1754// QWidget *mainBox = new QWidget( this );
1755// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1755// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1756 1756
1757#ifdef DESKTOP_VERSION 1757#ifdef DESKTOP_VERSION
1758 topLayout = new QHBoxLayout( this ); 1758 topLayout = new QHBoxLayout( this );
1759 1759
1760 1760
1761 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1761 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1762 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1762 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1763 1763
1764 topLayout->addWidget(mMiniSplitter ); 1764 topLayout->addWidget(mMiniSplitter );
1765 1765
1766 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1766 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1767 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1767 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1768 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1768 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1769 mDetails = new ViewContainer( mMiniSplitter ); 1769 mDetails = new ViewContainer( mMiniSplitter );
1770 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1770 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1771#else 1771#else
1772 if ( QApplication::desktop()->width() > 480 ) { 1772 if ( QApplication::desktop()->width() > 480 ) {
1773 topLayout = new QHBoxLayout( this ); 1773 topLayout = new QHBoxLayout( this );
1774 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1774 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1775 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1775 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1776 } else { 1776 } else {
1777 1777
1778 topLayout = new QHBoxLayout( this ); 1778 topLayout = new QHBoxLayout( this );
1779 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1779 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1780 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1780 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1781 } 1781 }
1782 1782
1783 topLayout->addWidget(mMiniSplitter ); 1783 topLayout->addWidget(mMiniSplitter );
1784 mViewManager = new ViewManager( this, mMiniSplitter ); 1784 mViewManager = new ViewManager( this, mMiniSplitter );
1785 mDetails = new ViewContainer( mMiniSplitter ); 1785 mDetails = new ViewContainer( mMiniSplitter );
1786 1786
1787 1787
1788 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1788 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1789#endif 1789#endif
1790 //eh->hide(); 1790 //eh->hide();
1791 // topLayout->addWidget(mExtensionManager ); 1791 // topLayout->addWidget(mExtensionManager );
1792 1792
1793 1793
1794/*US 1794/*US
1795#ifndef KAB_NOSPLITTER 1795#ifndef KAB_NOSPLITTER
1796 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1796 QHBoxLayout *topLayout = new QHBoxLayout( this );
1797//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1797//US topLayout->setSpacing( KDialogBase::spacingHint() );
1798 topLayout->setSpacing( 10 ); 1798 topLayout->setSpacing( 10 );
1799 1799
1800 mDetailsSplitter = new QSplitter( this ); 1800 mDetailsSplitter = new QSplitter( this );
1801 1801
1802 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1802 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1803 1803
1804 mViewManager = new ViewManager( this, viewSpace ); 1804 mViewManager = new ViewManager( this, viewSpace );
1805 viewSpace->setStretchFactor( mViewManager, 1 ); 1805 viewSpace->setStretchFactor( mViewManager, 1 );
1806 1806
1807 mDetails = new ViewContainer( mDetailsSplitter ); 1807 mDetails = new ViewContainer( mDetailsSplitter );
1808 1808
1809 topLayout->addWidget( mDetailsSplitter ); 1809 topLayout->addWidget( mDetailsSplitter );
1810 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1810 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1811#else //KAB_NOSPLITTER 1811#else //KAB_NOSPLITTER
1812 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1812 QHBoxLayout *topLayout = new QHBoxLayout( this );
1813//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1813//US topLayout->setSpacing( KDialogBase::spacingHint() );
1814 topLayout->setSpacing( 10 ); 1814 topLayout->setSpacing( 10 );
1815 1815
1816// mDetailsSplitter = new QSplitter( this ); 1816// mDetailsSplitter = new QSplitter( this );
1817 1817
1818 QVBox *viewSpace = new QVBox( this ); 1818 QVBox *viewSpace = new QVBox( this );
1819 1819
1820 mViewManager = new ViewManager( this, viewSpace ); 1820 mViewManager = new ViewManager( this, viewSpace );
1821 viewSpace->setStretchFactor( mViewManager, 1 ); 1821 viewSpace->setStretchFactor( mViewManager, 1 );
1822 1822
1823 mDetails = new ViewContainer( this ); 1823 mDetails = new ViewContainer( this );
1824 1824
1825 topLayout->addWidget( viewSpace ); 1825 topLayout->addWidget( viewSpace );
1826// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1826// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1827 topLayout->addWidget( mDetails ); 1827 topLayout->addWidget( mDetails );
1828#endif //KAB_NOSPLITTER 1828#endif //KAB_NOSPLITTER
1829*/ 1829*/
1830 1830
1831 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1831 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1832 syncManager->setBlockSave(false); 1832 syncManager->setBlockSave(false);
1833 1833
1834 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1834 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1835 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1835 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1836 QString sync_file = sentSyncFile(); 1836 QString sync_file = sentSyncFile();
1837 qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); 1837 qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1838 syncManager->setDefaultFileName( sync_file ); 1838 syncManager->setDefaultFileName( sync_file );
1839 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1839 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1840 1840
1841#endif //KAB_EMBEDDED 1841#endif //KAB_EMBEDDED
1842 initActions(); 1842 initActions();
1843 1843
1844#ifdef KAB_EMBEDDED 1844#ifdef KAB_EMBEDDED
1845 addActionsManually(); 1845 addActionsManually();
1846 //US make sure the export and import menues are initialized before creating the xxPortManager. 1846 //US make sure the export and import menues are initialized before creating the xxPortManager.
1847 mXXPortManager = new XXPortManager( this, this ); 1847 mXXPortManager = new XXPortManager( this, this );
1848 1848
1849 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1849 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1850 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1850 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1851 // mActionQuit->plug ( mMainWindow->toolBar()); 1851 // mActionQuit->plug ( mMainWindow->toolBar());
1852 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1852 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1853 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1853 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1854 // mIncSearchWidget->hide(); 1854 // mIncSearchWidget->hide();
1855 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1855 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1856 SLOT( incrementalSearch( const QString& ) ) ); 1856 SLOT( incrementalSearch( const QString& ) ) );
1857 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1857 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1858 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1858 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1859 1859
1860 mJumpButtonBar = new JumpButtonBar( this, this ); 1860 mJumpButtonBar = new JumpButtonBar( this, this );
1861 1861
1862 topLayout->addWidget( mJumpButtonBar ); 1862 topLayout->addWidget( mJumpButtonBar );
1863//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1863//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1864 1864
1865// mMainWindow->getIconToolBar()->raise(); 1865// mMainWindow->getIconToolBar()->raise();
1866 1866
1867#endif //KAB_EMBEDDED 1867#endif //KAB_EMBEDDED
1868 1868
1869} 1869}
1870void KABCore::initActions() 1870void KABCore::initActions()
1871{ 1871{
1872//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1872//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1873 1873
1874#ifndef KAB_EMBEDDED 1874#ifndef KAB_EMBEDDED
1875 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1875 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1876 SLOT( clipboardDataChanged() ) ); 1876 SLOT( clipboardDataChanged() ) );
1877#endif //KAB_EMBEDDED 1877#endif //KAB_EMBEDDED
1878 1878
1879 // file menu 1879 // file menu
1880 if ( mIsPart ) { 1880 if ( mIsPart ) {
1881 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1881 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1882 SLOT( sendMail() ), actionCollection(), 1882 SLOT( sendMail() ), actionCollection(),
1883 "kaddressbook_mail" ); 1883 "kaddressbook_mail" );
1884 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1884 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1885 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1885 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1886 1886
1887 } else { 1887 } else {
1888 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1888 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1889 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1889 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1890 } 1890 }
1891 1891
1892 1892
1893 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1893 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1894 SLOT( save() ), actionCollection(), "file_sync" ); 1894 SLOT( save() ), actionCollection(), "file_sync" );
1895 1895
1896 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1896 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1897 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1897 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1898 1898
1899 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1899 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1900 this, SLOT( mailVCard() ), 1900 this, SLOT( mailVCard() ),
1901 actionCollection(), "file_mail_vcard"); 1901 actionCollection(), "file_mail_vcard");
1902 1902
1903 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1903 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1904 SLOT( export2phone() ), actionCollection(), 1904 SLOT( export2phone() ), actionCollection(),
1905 "kaddressbook_ex2phone" ); 1905 "kaddressbook_ex2phone" );
1906 1906
1907 mActionBeamVCard = 0; 1907 mActionBeamVCard = 0;
1908 mActionBeam = 0; 1908 mActionBeam = 0;
1909 1909
1910#ifndef DESKTOP_VERSION 1910#ifndef DESKTOP_VERSION
1911 if ( Ir::supported() ) { 1911 if ( Ir::supported() ) {
1912 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 1912 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
1913 SLOT( beamVCard() ), actionCollection(), 1913 SLOT( beamVCard() ), actionCollection(),
1914 "kaddressbook_beam_vcard" ); 1914 "kaddressbook_beam_vcard" );
1915 1915
1916 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1916 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1917 SLOT( beamMySelf() ), actionCollection(), 1917 SLOT( beamMySelf() ), actionCollection(),
1918 "kaddressbook_beam_myself" ); 1918 "kaddressbook_beam_myself" );
1919 } 1919 }
1920#endif 1920#endif
1921 1921
1922 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1922 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1923 this, SLOT( editContact2() ), 1923 this, SLOT( editContact2() ),
1924 actionCollection(), "file_properties" ); 1924 actionCollection(), "file_properties" );
1925 1925
1926#ifdef KAB_EMBEDDED 1926#ifdef KAB_EMBEDDED
1927 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1927 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1928 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1928 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1929 mMainWindow, SLOT( exit() ), 1929 mMainWindow, SLOT( exit() ),
1930 actionCollection(), "quit" ); 1930 actionCollection(), "quit" );
1931#endif //KAB_EMBEDDED 1931#endif //KAB_EMBEDDED
1932 1932
1933 // edit menu 1933 // edit menu
1934 if ( mIsPart ) { 1934 if ( mIsPart ) {
1935 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1935 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1936 SLOT( copyContacts() ), actionCollection(), 1936 SLOT( copyContacts() ), actionCollection(),
1937 "kaddressbook_copy" ); 1937 "kaddressbook_copy" );
1938 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1938 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1939 SLOT( cutContacts() ), actionCollection(), 1939 SLOT( cutContacts() ), actionCollection(),
1940 "kaddressbook_cut" ); 1940 "kaddressbook_cut" );
1941 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1941 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1942 SLOT( pasteContacts() ), actionCollection(), 1942 SLOT( pasteContacts() ), actionCollection(),
1943 "kaddressbook_paste" ); 1943 "kaddressbook_paste" );
1944 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1944 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1945 SLOT( selectAllContacts() ), actionCollection(), 1945 SLOT( selectAllContacts() ), actionCollection(),
1946 "kaddressbook_select_all" ); 1946 "kaddressbook_select_all" );
1947 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1947 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1948 SLOT( undo() ), actionCollection(), 1948 SLOT( undo() ), actionCollection(),
1949 "kaddressbook_undo" ); 1949 "kaddressbook_undo" );
1950 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1950 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1951 this, SLOT( redo() ), actionCollection(), 1951 this, SLOT( redo() ), actionCollection(),
1952 "kaddressbook_redo" ); 1952 "kaddressbook_redo" );
1953 } else { 1953 } else {
1954 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1954 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1955 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1955 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1956 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1956 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1957 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1957 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1958 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1958 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1959 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1959 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1960 } 1960 }
1961 1961
1962 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1962 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1963 Key_Delete, this, SLOT( deleteContacts() ), 1963 Key_Delete, this, SLOT( deleteContacts() ),
1964 actionCollection(), "edit_delete" ); 1964 actionCollection(), "edit_delete" );
1965 1965
1966 mActionUndo->setEnabled( false ); 1966 mActionUndo->setEnabled( false );
1967 mActionRedo->setEnabled( false ); 1967 mActionRedo->setEnabled( false );
1968 1968
1969 // settings menu 1969 // settings menu
1970#ifdef KAB_EMBEDDED 1970#ifdef KAB_EMBEDDED
1971//US special menuentry to configure the addressbook resources. On KDE 1971//US special menuentry to configure the addressbook resources. On KDE
1972// you do that through the control center !!! 1972// you do that through the control center !!!
1973 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1973 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1974 SLOT( configureResources() ), actionCollection(), 1974 SLOT( configureResources() ), actionCollection(),
1975 "kaddressbook_configure_resources" ); 1975 "kaddressbook_configure_resources" );
1976#endif //KAB_EMBEDDED 1976#endif //KAB_EMBEDDED
1977 1977
1978 if ( mIsPart ) { 1978 if ( mIsPart ) {
1979 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1979 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1980 SLOT( openConfigDialog() ), actionCollection(), 1980 SLOT( openConfigDialog() ), actionCollection(),
1981 "kaddressbook_configure" ); 1981 "kaddressbook_configure" );
1982 1982
1983 //US not implemented yet 1983 //US not implemented yet
1984 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1984 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1985 // this, SLOT( configureKeyBindings() ), actionCollection(), 1985 // this, SLOT( configureKeyBindings() ), actionCollection(),
1986 // "kaddressbook_configure_shortcuts" ); 1986 // "kaddressbook_configure_shortcuts" );
1987#ifdef KAB_EMBEDDED 1987#ifdef KAB_EMBEDDED
1988 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1988 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1989 mActionConfigureToolbars->setEnabled( false ); 1989 mActionConfigureToolbars->setEnabled( false );
1990#endif //KAB_EMBEDDED 1990#endif //KAB_EMBEDDED
1991 1991
1992 } else { 1992 } else {
1993 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1993 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1994 1994
1995 //US not implemented yet 1995 //US not implemented yet
1996 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1996 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1997 } 1997 }
1998 1998
1999 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1999 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
2000 actionCollection(), "options_show_jump_bar" ); 2000 actionCollection(), "options_show_jump_bar" );
2001 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 2001 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
2002 2002
2003 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 2003 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
2004 actionCollection(), "options_show_details" ); 2004 actionCollection(), "options_show_details" );
2005 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 2005 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
2006 2006
2007 2007
2008 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 2008 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
2009 SLOT( toggleBeamReceive() ), actionCollection(), 2009 SLOT( toggleBeamReceive() ), actionCollection(),
2010 "kaddressbook_beam_rec" ); 2010 "kaddressbook_beam_rec" );
2011 2011
2012 2012
2013 // misc 2013 // misc
2014 // only enable LDAP lookup if we can handle the protocol 2014 // only enable LDAP lookup if we can handle the protocol
2015#ifndef KAB_EMBEDDED 2015#ifndef KAB_EMBEDDED
2016 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 2016 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
2017 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 2017 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
2018 this, SLOT( openLDAPDialog() ), actionCollection(), 2018 this, SLOT( openLDAPDialog() ), actionCollection(),
2019 "ldap_lookup" ); 2019 "ldap_lookup" );
2020 } 2020 }
2021#else //KAB_EMBEDDED 2021#else //KAB_EMBEDDED
2022 //qDebug("KABCore::initActions() LDAP has to be implemented"); 2022 //qDebug("KABCore::initActions() LDAP has to be implemented");
2023#endif //KAB_EMBEDDED 2023#endif //KAB_EMBEDDED
2024 2024
2025 2025
2026 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 2026 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
2027 SLOT( setWhoAmI() ), actionCollection(), 2027 SLOT( setWhoAmI() ), actionCollection(),
2028 "set_personal" ); 2028 "set_personal" );
2029 2029
2030 2030
2031 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 2031 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
2032 SLOT( setCategories() ), actionCollection(), 2032 SLOT( setCategories() ), actionCollection(),
2033 "edit_set_categories" ); 2033 "edit_set_categories" );
2034 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, 2034 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this,
2035 SLOT( editCategories() ), actionCollection(), 2035 SLOT( editCategories() ), actionCollection(),
2036 "edit__categories" ); 2036 "edit__categories" );
2037 2037
2038 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 2038 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
2039 SLOT( removeVoice() ), actionCollection(), 2039 SLOT( removeVoice() ), actionCollection(),
2040 "remove_voice" ); 2040 "remove_voice" );
2041 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, 2041 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
2042 SLOT( setFormattedName() ), actionCollection(), 2042 SLOT( setFormattedName() ), actionCollection(),
2043 "set_formatted" ); 2043 "set_formatted" );
2044 2044
2045 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 2045 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
2046 SLOT( manageCategories() ), actionCollection(), 2046 SLOT( manageCategories() ), actionCollection(),
2047 "remove_voice" ); 2047 "remove_voice" );
2048 2048
2049 2049
2050 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 2050 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
2051 SLOT( importFromOL() ), actionCollection(), 2051 SLOT( importFromOL() ), actionCollection(),
2052 "import_OL" ); 2052 "import_OL" );
2053#ifdef KAB_EMBEDDED 2053#ifdef KAB_EMBEDDED
2054 mActionLicence = new KAction( i18n( "Licence" ), 0, 2054 mActionLicence = new KAction( i18n( "Licence" ), 0,
2055 this, SLOT( showLicence() ), actionCollection(), 2055 this, SLOT( showLicence() ), actionCollection(),
2056 "licence_about_data" ); 2056 "licence_about_data" );
2057 mActionFaq = new KAction( i18n( "Faq" ), 0, 2057 mActionFaq = new KAction( i18n( "Faq" ), 0,
2058 this, SLOT( faq() ), actionCollection(), 2058 this, SLOT( faq() ), actionCollection(),
2059 "faq_about_data" ); 2059 "faq_about_data" );
2060 mActionWN = new KAction( i18n( "What's New?" ), 0, 2060 mActionWN = new KAction( i18n( "What's New?" ), 0,
2061 this, SLOT( whatsnew() ), actionCollection(), 2061 this, SLOT( whatsnew() ), actionCollection(),
2062 "wn" ); 2062 "wn" );
2063 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2063 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2064 this, SLOT( synchowto() ), actionCollection(), 2064 this, SLOT( synchowto() ), actionCollection(),
2065 "sync" ); 2065 "sync" );
2066 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2066 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2067 this, SLOT( kdesynchowto() ), actionCollection(), 2067 this, SLOT( kdesynchowto() ), actionCollection(),
2068 "kdesync" ); 2068 "kdesync" );
2069 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2069 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2070 this, SLOT( multisynchowto() ), actionCollection(), 2070 this, SLOT( multisynchowto() ), actionCollection(),
2071 "multisync" ); 2071 "multisync" );
2072 2072
2073 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2073 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2074 this, SLOT( createAboutData() ), actionCollection(), 2074 this, SLOT( createAboutData() ), actionCollection(),
2075 "kaddressbook_about_data" ); 2075 "kaddressbook_about_data" );
2076#endif //KAB_EMBEDDED 2076#endif //KAB_EMBEDDED
2077 2077
2078 clipboardDataChanged(); 2078 clipboardDataChanged();
2079 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2079 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2080 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2080 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2081} 2081}
2082 2082
2083//US we need this function, to plug all actions into the correct menues. 2083//US we need this function, to plug all actions into the correct menues.
2084// KDE uses a XML format to plug the actions, but we work her without this overhead. 2084// KDE uses a XML format to plug the actions, but we work her without this overhead.
2085void KABCore::addActionsManually() 2085void KABCore::addActionsManually()
2086{ 2086{
2087//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2087//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2088 2088
2089#ifdef KAB_EMBEDDED 2089#ifdef KAB_EMBEDDED
2090 QPopupMenu *fileMenu = new QPopupMenu( this ); 2090 QPopupMenu *fileMenu = new QPopupMenu( this );
2091 QPopupMenu *editMenu = new QPopupMenu( this ); 2091 QPopupMenu *editMenu = new QPopupMenu( this );
2092 QPopupMenu *helpMenu = new QPopupMenu( this ); 2092 QPopupMenu *helpMenu = new QPopupMenu( this );
2093 2093
2094 KToolBar* tb = mMainWindow->toolBar(); 2094 KToolBar* tb = mMainWindow->toolBar();
2095 2095
2096#ifndef DESKTOP_VERSION 2096#ifndef DESKTOP_VERSION
2097 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2097 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2098#endif 2098#endif
2099 QMenuBar* mb = mMainWindow->menuBar(); 2099 QMenuBar* mb = mMainWindow->menuBar();
2100 2100
2101 //US setup menubar. 2101 //US setup menubar.
2102 //Disable the following block if you do not want to have a menubar. 2102 //Disable the following block if you do not want to have a menubar.
2103 mb->insertItem( i18n("&File"), fileMenu ); 2103 mb->insertItem( i18n("&File"), fileMenu );
2104 mb->insertItem( i18n("&Edit"), editMenu ); 2104 mb->insertItem( i18n("&Edit"), editMenu );
2105 mb->insertItem( i18n("&View"), viewMenu ); 2105 mb->insertItem( i18n("&View"), viewMenu );
2106 mb->insertItem( i18n("&Settings"), settingsMenu ); 2106 mb->insertItem( i18n("&Settings"), settingsMenu );
2107 mb->insertItem( i18n("Synchronize"), syncMenu ); 2107 mb->insertItem( i18n("Synchronize"), syncMenu );
2108 //mb->insertItem( i18n("&Change"), changeMenu ); 2108 //mb->insertItem( i18n("&Change"), changeMenu );
2109 mb->insertItem( i18n("&Help"), helpMenu ); 2109 mb->insertItem( i18n("&Help"), helpMenu );
2110 mIncSearchWidget = new IncSearchWidget( tb ); 2110 mIncSearchWidget = new IncSearchWidget( tb );
2111 // tb->insertWidget(-1, 0, mIncSearchWidget); 2111 // tb->insertWidget(-1, 0, mIncSearchWidget);
2112#ifndef DESKTOP_VERSION 2112#ifndef DESKTOP_VERSION
2113 } else { 2113 } else {
2114 //US setup toolbar 2114 //US setup toolbar
2115 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2115 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2116 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2116 QPopupMenu *popupBarTB = new QPopupMenu( this );
2117 menuBarTB->insertItem( "ME", popupBarTB); 2117 menuBarTB->insertItem( "ME", popupBarTB);
2118 tb->insertWidget(-1, 0, menuBarTB); 2118 tb->insertWidget(-1, 0, menuBarTB);
2119 mIncSearchWidget = new IncSearchWidget( tb ); 2119 mIncSearchWidget = new IncSearchWidget( tb );
2120 2120
2121 tb->enableMoving(false); 2121 tb->enableMoving(false);
2122 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2122 popupBarTB->insertItem( i18n("&File"), fileMenu );
2123 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2123 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2124 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2124 popupBarTB->insertItem( i18n("&View"), viewMenu );
2125 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2125 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2126 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2126 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2127 mViewManager->getFilterAction()->plug ( popupBarTB); 2127 mViewManager->getFilterAction()->plug ( popupBarTB);
2128 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2128 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2129 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2129 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2130 if (QApplication::desktop()->width() > 320 ) { 2130 if (QApplication::desktop()->width() > 320 ) {
2131 // mViewManager->getFilterAction()->plug ( tb); 2131 // mViewManager->getFilterAction()->plug ( tb);
2132 } 2132 }
2133 } 2133 }
2134#endif 2134#endif
2135 // mActionQuit->plug ( mMainWindow->toolBar()); 2135 // mActionQuit->plug ( mMainWindow->toolBar());
2136 2136
2137 2137
2138 2138
2139 //US Now connect the actions with the menue entries. 2139 //US Now connect the actions with the menue entries.
2140#ifdef DESKTOP_VERSION
2140 mActionPrint->plug( fileMenu ); 2141 mActionPrint->plug( fileMenu );
2142#endif
2141 mActionMail->plug( fileMenu ); 2143 mActionMail->plug( fileMenu );
2142 fileMenu->insertSeparator(); 2144 fileMenu->insertSeparator();
2143 2145
2144 mActionNewContact->plug( fileMenu ); 2146 mActionNewContact->plug( fileMenu );
2145 mActionNewContact->plug( tb ); 2147 mActionNewContact->plug( tb );
2146 2148
2147 mActionEditAddressee->plug( fileMenu ); 2149 mActionEditAddressee->plug( fileMenu );
2148 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2150 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2149 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2151 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2150 mActionEditAddressee->plug( tb ); 2152 mActionEditAddressee->plug( tb );
2151 2153
2152 fileMenu->insertSeparator(); 2154 fileMenu->insertSeparator();
2153 mActionSave->plug( fileMenu ); 2155 mActionSave->plug( fileMenu );
2154 fileMenu->insertItem( "&Import", ImportMenu ); 2156 fileMenu->insertItem( "&Import", ImportMenu );
2155 fileMenu->insertItem( "&Export", ExportMenu ); 2157 fileMenu->insertItem( "&Export", ExportMenu );
2156 fileMenu->insertItem( i18n("&Change"), changeMenu ); 2158 fileMenu->insertItem( i18n("&Change"), changeMenu );
2157#ifndef DESKTOP_VERSION 2159#ifndef DESKTOP_VERSION
2158 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2160 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2159#endif 2161#endif
2160 2162#if 0
2163 // PENDING fix MailVCard
2161 fileMenu->insertSeparator(); 2164 fileMenu->insertSeparator();
2162 mActionMailVCard->plug( fileMenu ); 2165 mActionMailVCard->plug( fileMenu );
2166#endif
2163#ifndef DESKTOP_VERSION 2167#ifndef DESKTOP_VERSION
2164 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2168 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2165 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2169 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2166 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2170 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2167#endif 2171#endif
2168 fileMenu->insertSeparator(); 2172 fileMenu->insertSeparator();
2169 mActionQuit->plug( fileMenu ); 2173 mActionQuit->plug( fileMenu );
2170#ifdef _WIN32_ 2174#ifdef _WIN32_
2171 mActionImportOL->plug( ImportMenu ); 2175 mActionImportOL->plug( ImportMenu );
2172#endif 2176#endif
2173 // edit menu 2177 // edit menu
2174 mActionUndo->plug( editMenu ); 2178 mActionUndo->plug( editMenu );
2175 mActionRedo->plug( editMenu ); 2179 mActionRedo->plug( editMenu );
2176 editMenu->insertSeparator(); 2180 editMenu->insertSeparator();
2177 mActionCut->plug( editMenu ); 2181 mActionCut->plug( editMenu );
2178 mActionCopy->plug( editMenu ); 2182 mActionCopy->plug( editMenu );
2179 mActionPaste->plug( editMenu ); 2183 mActionPaste->plug( editMenu );
2180 mActionDelete->plug( editMenu ); 2184 mActionDelete->plug( editMenu );
2181 editMenu->insertSeparator(); 2185 editMenu->insertSeparator();
2182 mActionSelectAll->plug( editMenu ); 2186 mActionSelectAll->plug( editMenu );
2183 2187
2184 mActionSetFormattedName->plug( changeMenu ); 2188 mActionSetFormattedName->plug( changeMenu );
2185 mActionRemoveVoice->plug( changeMenu ); 2189 mActionRemoveVoice->plug( changeMenu );
2186 // settings menu 2190 // settings menu
2187//US special menuentry to configure the addressbook resources. On KDE 2191//US special menuentry to configure the addressbook resources. On KDE
2188// you do that through the control center !!! 2192// you do that through the control center !!!
2189 mActionConfigResources->plug( settingsMenu ); 2193 mActionConfigResources->plug( settingsMenu );
2190 settingsMenu->insertSeparator(); 2194 settingsMenu->insertSeparator();
2191 2195
2192 mActionConfigKAddressbook->plug( settingsMenu ); 2196 mActionConfigKAddressbook->plug( settingsMenu );
2193 2197
2194 if ( mIsPart ) { 2198 if ( mIsPart ) {
2195 //US not implemented yet 2199 //US not implemented yet
2196 //mActionConfigShortcuts->plug( settingsMenu ); 2200 //mActionConfigShortcuts->plug( settingsMenu );
2197 //mActionConfigureToolbars->plug( settingsMenu ); 2201 //mActionConfigureToolbars->plug( settingsMenu );
2198 2202
2199 } else { 2203 } else {
2200 //US not implemented yet 2204 //US not implemented yet
2201 //mActionKeyBindings->plug( settingsMenu ); 2205 //mActionKeyBindings->plug( settingsMenu );
2202 } 2206 }
2203 2207
2204 settingsMenu->insertSeparator(); 2208 settingsMenu->insertSeparator();
2205 2209
2206 mActionJumpBar->plug( settingsMenu ); 2210 mActionJumpBar->plug( settingsMenu );
2207 mActionDetails->plug( settingsMenu ); 2211 mActionDetails->plug( settingsMenu );
2208 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2212 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2209 mActionDetails->plug( tb ); 2213 mActionDetails->plug( tb );
2210 settingsMenu->insertSeparator(); 2214 settingsMenu->insertSeparator();
2211#ifndef DESKTOP_VERSION 2215#ifndef DESKTOP_VERSION
2212 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2216 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2213#endif 2217#endif
2214 settingsMenu->insertSeparator(); 2218 settingsMenu->insertSeparator();
2215 2219
2216 mActionWhoAmI->plug( settingsMenu ); 2220 mActionWhoAmI->plug( settingsMenu );
2217 mActionEditCategories->plug( settingsMenu ); 2221 mActionEditCategories->plug( settingsMenu );
2218 mActionEditCategories->plug( changeMenu ); 2222 mActionEditCategories->plug( changeMenu );
2219 mActionCategories->plug( changeMenu ); 2223 mActionCategories->plug( changeMenu );
2220 mActionManageCategories->plug( changeMenu ); 2224 mActionManageCategories->plug( changeMenu );
2221 2225
2222 mActionCategories->plug( settingsMenu ); 2226 mActionCategories->plug( settingsMenu );
2223 mActionManageCategories->plug( settingsMenu ); 2227 mActionManageCategories->plug( settingsMenu );
2224 2228
2225 2229
2226 mActionWN->plug( helpMenu ); 2230 mActionWN->plug( helpMenu );
2227 mActionSyncHowto->plug( helpMenu ); 2231 mActionSyncHowto->plug( helpMenu );
2228 mActionKdeSyncHowto->plug( helpMenu ); 2232 mActionKdeSyncHowto->plug( helpMenu );
2229 mActionMultiSyncHowto->plug( helpMenu ); 2233 mActionMultiSyncHowto->plug( helpMenu );
2230 mActionFaq->plug( helpMenu ); 2234 mActionFaq->plug( helpMenu );
2231 mActionLicence->plug( helpMenu ); 2235 mActionLicence->plug( helpMenu );
2232 mActionAboutKAddressbook->plug( helpMenu ); 2236 mActionAboutKAddressbook->plug( helpMenu );
2233 2237
2234 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2238 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2235 2239
2236 mActionSave->plug( tb ); 2240 mActionSave->plug( tb );
2237 mViewManager->getFilterAction()->plug ( tb); 2241 mViewManager->getFilterAction()->plug ( tb);
2238 //LR hide filteraction on started in 480x640 2242 //LR hide filteraction on started in 480x640
2239 if (QApplication::desktop()->width() == 480 ) { 2243 if (QApplication::desktop()->width() == 480 ) {
2240 mViewManager->getFilterAction()->setComboWidth( 0 ); 2244 mViewManager->getFilterAction()->setComboWidth( 0 );
2241 } 2245 }
2242 mActionUndo->plug( tb ); 2246 mActionUndo->plug( tb );
2243 mActionDelete->plug( tb ); 2247 mActionDelete->plug( tb );
2244 mActionRedo->plug( tb ); 2248 mActionRedo->plug( tb );
2245 } else { 2249 } else {
2246 mActionSave->plug( tb ); 2250 mActionSave->plug( tb );
2247 tb->enableMoving(false); 2251 tb->enableMoving(false);
2248 } 2252 }
2249 //mActionQuit->plug ( tb ); 2253 //mActionQuit->plug ( tb );
2250 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2254 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2251 2255
2252 //US link the searchwidget first to this. 2256 //US link the searchwidget first to this.
2253 // The real linkage to the toolbar happens later. 2257 // The real linkage to the toolbar happens later.
2254//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2258//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2255//US tb->insertItem( mIncSearchWidget ); 2259//US tb->insertItem( mIncSearchWidget );
2256/*US 2260/*US
2257 mIncSearchWidget = new IncSearchWidget( tb ); 2261 mIncSearchWidget = new IncSearchWidget( tb );
2258 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2262 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2259 SLOT( incrementalSearch( const QString& ) ) ); 2263 SLOT( incrementalSearch( const QString& ) ) );
2260 2264
2261 mJumpButtonBar = new JumpButtonBar( this, this ); 2265 mJumpButtonBar = new JumpButtonBar( this, this );
2262 2266
2263//US topLayout->addWidget( mJumpButtonBar ); 2267//US topLayout->addWidget( mJumpButtonBar );
2264 this->layout()->add( mJumpButtonBar ); 2268 this->layout()->add( mJumpButtonBar );
2265*/ 2269*/
2266 2270
2267#endif //KAB_EMBEDDED 2271#endif //KAB_EMBEDDED
2268 2272
2269 mActionExport2phone->plug( ExportMenu ); 2273 mActionExport2phone->plug( ExportMenu );
2270 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2274 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2271 syncManager->fillSyncMenu(); 2275 syncManager->fillSyncMenu();
2272 2276
2273} 2277}
2274void KABCore::showLicence() 2278void KABCore::showLicence()
2275{ 2279{
2276 KApplication::showLicence(); 2280 KApplication::showLicence();
2277} 2281}
2278 2282
2279void KABCore::manageCategories( ) 2283void KABCore::manageCategories( )
2280{ 2284{
2281 KABCatPrefs* cp = new KABCatPrefs(); 2285 KABCatPrefs* cp = new KABCatPrefs();
2282 cp->show(); 2286 cp->show();
2283 int w =cp->sizeHint().width() ; 2287 int w =cp->sizeHint().width() ;
2284 int h = cp->sizeHint().height() ; 2288 int h = cp->sizeHint().height() ;
2285 int dw = QApplication::desktop()->width(); 2289 int dw = QApplication::desktop()->width();
2286 int dh = QApplication::desktop()->height(); 2290 int dh = QApplication::desktop()->height();
2287 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2291 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2288 if ( !cp->exec() ) { 2292 if ( !cp->exec() ) {
2289 delete cp; 2293 delete cp;
2290 return; 2294 return;
2291 } 2295 }
2292 int count = 0; 2296 int count = 0;
2293 message( i18n("Please wait, processing categories...")); 2297 message( i18n("Please wait, processing categories..."));
2294 if ( cp->addCat() ) { 2298 if ( cp->addCat() ) {
2295 KABC::AddressBook::Iterator it; 2299 KABC::AddressBook::Iterator it;
2296 QStringList catList = KABPrefs::instance()->mCustomCategories; 2300 QStringList catList = KABPrefs::instance()->mCustomCategories;
2297 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2301 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2298 QStringList catIncList = (*it).categories(); 2302 QStringList catIncList = (*it).categories();
2299 int i; 2303 int i;
2300 for( i = 0; i< catIncList.count(); ++i ) { 2304 for( i = 0; i< catIncList.count(); ++i ) {
2301 if ( !catList.contains (catIncList[i])) { 2305 if ( !catList.contains (catIncList[i])) {
2302 catList.append( catIncList[i] ); 2306 catList.append( catIncList[i] );
2303 //qDebug("add cat %s ", catIncList[i].latin1()); 2307 //qDebug("add cat %s ", catIncList[i].latin1());
2304 ++count; 2308 ++count;
2305 } 2309 }
2306 } 2310 }
2307 } 2311 }
2308 catList.sort(); 2312 catList.sort();
2309 KABPrefs::instance()->mCustomCategories = catList; 2313 KABPrefs::instance()->mCustomCategories = catList;
2310 KABPrefs::instance()->writeConfig(); 2314 KABPrefs::instance()->writeConfig();
2311 message(QString::number( count )+ i18n(" categories added to list! ")); 2315 message(QString::number( count )+ i18n(" categories added to list! "));
2312 } else { 2316 } else {
2313 QStringList catList = KABPrefs::instance()->mCustomCategories; 2317 QStringList catList = KABPrefs::instance()->mCustomCategories;
2314 QStringList catIncList; 2318 QStringList catIncList;
2315 QStringList newCatList; 2319 QStringList newCatList;
2316 KABC::AddressBook::Iterator it; 2320 KABC::AddressBook::Iterator it;
2317 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2321 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2318 QStringList catIncList = (*it).categories(); 2322 QStringList catIncList = (*it).categories();
2319 int i; 2323 int i;
2320 if ( catIncList.count() ) { 2324 if ( catIncList.count() ) {
2321 newCatList.clear(); 2325 newCatList.clear();
2322 for( i = 0; i< catIncList.count(); ++i ) { 2326 for( i = 0; i< catIncList.count(); ++i ) {
2323 if ( catList.contains (catIncList[i])) { 2327 if ( catList.contains (catIncList[i])) {
2324 newCatList.append( catIncList[i] ); 2328 newCatList.append( catIncList[i] );
2325 } 2329 }
2326 } 2330 }
2327 newCatList.sort(); 2331 newCatList.sort();
2328 (*it).setCategories( newCatList ); 2332 (*it).setCategories( newCatList );
2329 mAddressBook->insertAddressee( (*it) ); 2333 mAddressBook->insertAddressee( (*it) );
2330 } 2334 }
2331 } 2335 }
2332 setModified( true ); 2336 setModified( true );
2333 mViewManager->refreshView(); 2337 mViewManager->refreshView();
2334 message( i18n("Removing categories done!")); 2338 message( i18n("Removing categories done!"));
2335 } 2339 }
2336 delete cp; 2340 delete cp;
2337} 2341}
2338void KABCore::removeVoice() 2342void KABCore::removeVoice()
2339{ 2343{
2340 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 ) 2344 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 )
2341 return; 2345 return;
2342 KABC::Addressee::List list; 2346 KABC::Addressee::List list;
2343 XXPortSelectDialog dlg( this, false, this ); 2347 XXPortSelectDialog dlg( this, false, this );
2344 if ( dlg.exec() ) 2348 if ( dlg.exec() )
2345 list = dlg.contacts(); 2349 list = dlg.contacts();
2346 else 2350 else
2347 return; 2351 return;
2348 KABC::Addressee::List::Iterator it; 2352 KABC::Addressee::List::Iterator it;
2349 for ( it = list.begin(); it != list.end(); ++it ) { 2353 for ( it = list.begin(); it != list.end(); ++it ) {
2350 if ( (*it).removeVoice() ) 2354 if ( (*it).removeVoice() )
2351 addrModified((*it), false ); 2355 addrModified((*it), false );
2352 } 2356 }
2353} 2357}
2354 2358
2355void KABCore::setFormattedName() 2359void KABCore::setFormattedName()
2356{ 2360{
2357 KABFormatPrefs setpref; 2361 KABFormatPrefs setpref;
2358 if ( !setpref.exec() ) { 2362 if ( !setpref.exec() ) {
2359 return; 2363 return;
2360 } 2364 }
2361 KABC::Addressee::List list; 2365 KABC::Addressee::List list;
2362 XXPortSelectDialog dlg( this, false, this ); 2366 XXPortSelectDialog dlg( this, false, this );
2363 if ( dlg.exec() ) 2367 if ( dlg.exec() )
2364 list = dlg.contacts(); 2368 list = dlg.contacts();
2365 else 2369 else
2366 return; 2370 return;
2367 KABC::Addressee::List::Iterator it; 2371 KABC::Addressee::List::Iterator it;
2368 for ( it = list.begin(); it != list.end(); ++it ) { 2372 for ( it = list.begin(); it != list.end(); ++it ) {
2369 QString fName; 2373 QString fName;
2370 if ( setpref.simple->isChecked() ) 2374 if ( setpref.simple->isChecked() )
2371 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2375 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2372 else if ( setpref.full->isChecked() ) 2376 else if ( setpref.full->isChecked() )
2373 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2377 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2374 else if ( setpref.reverse->isChecked() ) 2378 else if ( setpref.reverse->isChecked() )
2375 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2379 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2376 else 2380 else
2377 fName = (*it).organization(); 2381 fName = (*it).organization();
2378 if ( setpref.setCompany->isChecked() ) 2382 if ( setpref.setCompany->isChecked() )
2379 if ( fName.isEmpty() || fName =="," ) 2383 if ( fName.isEmpty() || fName =="," )
2380 fName = (*it).organization(); 2384 fName = (*it).organization();
2381 (*it).setFormattedName( fName ); 2385 (*it).setFormattedName( fName );
2382 addrModified((*it),false ); 2386 addrModified((*it),false );
2383 } 2387 }
2384 Addressee add; 2388 Addressee add;
2385 mDetails->setAddressee( add ); 2389 mDetails->setAddressee( add );
2386} 2390}
2387 2391
2388void KABCore::clipboardDataChanged() 2392void KABCore::clipboardDataChanged()
2389{ 2393{
2390 2394
2391 if ( mReadWrite ) 2395 if ( mReadWrite )
2392 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2396 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2393 2397
2394} 2398}
2395 2399
2396void KABCore::updateActionMenu() 2400void KABCore::updateActionMenu()
2397{ 2401{
2398 UndoStack *undo = UndoStack::instance(); 2402 UndoStack *undo = UndoStack::instance();
2399 RedoStack *redo = RedoStack::instance(); 2403 RedoStack *redo = RedoStack::instance();
2400 2404
2401 if ( undo->isEmpty() ) 2405 if ( undo->isEmpty() )
2402 mActionUndo->setText( i18n( "Undo" ) ); 2406 mActionUndo->setText( i18n( "Undo" ) );
2403 else 2407 else
2404 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2408 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2405 2409
2406 mActionUndo->setEnabled( !undo->isEmpty() ); 2410 mActionUndo->setEnabled( !undo->isEmpty() );
2407 2411
2408 if ( !redo->top() ) 2412 if ( !redo->top() )
2409 mActionRedo->setText( i18n( "Redo" ) ); 2413 mActionRedo->setText( i18n( "Redo" ) );
2410 else 2414 else
2411 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2415 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2412 2416
2413 mActionRedo->setEnabled( !redo->isEmpty() ); 2417 mActionRedo->setEnabled( !redo->isEmpty() );
2414} 2418}
2415 2419
2416void KABCore::configureKeyBindings() 2420void KABCore::configureKeyBindings()
2417{ 2421{
2418#ifndef KAB_EMBEDDED 2422#ifndef KAB_EMBEDDED
2419 KKeyDialog::configure( actionCollection(), true ); 2423 KKeyDialog::configure( actionCollection(), true );
2420#else //KAB_EMBEDDED 2424#else //KAB_EMBEDDED
2421 qDebug("KABCore::configureKeyBindings() not implemented"); 2425 qDebug("KABCore::configureKeyBindings() not implemented");
2422#endif //KAB_EMBEDDED 2426#endif //KAB_EMBEDDED
2423} 2427}
2424 2428
2425#ifdef KAB_EMBEDDED 2429#ifdef KAB_EMBEDDED
2426void KABCore::configureResources() 2430void KABCore::configureResources()
2427{ 2431{
2428 KRES::KCMKResources dlg( this, "" , 0 ); 2432 KRES::KCMKResources dlg( this, "" , 0 );
2429 2433
2430 if ( !dlg.exec() ) 2434 if ( !dlg.exec() )
2431 return; 2435 return;
2432 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2436 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2433} 2437}
2434#endif //KAB_EMBEDDED 2438#endif //KAB_EMBEDDED
2435 2439
2436 2440
2437/* this method will be called through the QCop interface from Ko/Pi to select addresses 2441/* this method will be called through the QCop interface from Ko/Pi to select addresses
2438 * for the attendees list of an event. 2442 * for the attendees list of an event.
2439 */ 2443 */
2440void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2444void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2441{ 2445{
2442 QStringList nameList; 2446 QStringList nameList;
2443 QStringList emailList; 2447 QStringList emailList;
2444 QStringList uidList; 2448 QStringList uidList;
2445 2449
2446 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2450 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2447 uint i=0; 2451 uint i=0;
2448 for (i=0; i < list.count(); i++) 2452 for (i=0; i < list.count(); i++)
2449 { 2453 {
2450 nameList.append(list[i].realName()); 2454 nameList.append(list[i].realName());
2451 emailList.append(list[i].preferredEmail()); 2455 emailList.append(list[i].preferredEmail());
2452 uidList.append(list[i].uid()); 2456 uidList.append(list[i].uid());
2453 } 2457 }
2454 2458
2455 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2459 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2456 2460
2457} 2461}
2458 2462
2459/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2463/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2460 * to put them into the calendar. 2464 * to put them into the calendar.
2461 */ 2465 */
2462void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2466void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2463{ 2467{
2464 // qDebug("KABCore::requestForBirthdayList"); 2468 // qDebug("KABCore::requestForBirthdayList");
2465 QStringList birthdayList; 2469 QStringList birthdayList;
2466 QStringList anniversaryList; 2470 QStringList anniversaryList;
2467 QStringList realNameList; 2471 QStringList realNameList;
2468 QStringList preferredEmailList; 2472 QStringList preferredEmailList;
2469 QStringList assembledNameList; 2473 QStringList assembledNameList;
2470 QStringList uidList; 2474 QStringList uidList;
2471 2475
2472 KABC::AddressBook::Iterator it; 2476 KABC::AddressBook::Iterator it;
2473 2477
2474 int count = 0; 2478 int count = 0;
2475 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2479 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2476 ++count; 2480 ++count;
2477 } 2481 }
2478 QProgressBar bar(count,0 ); 2482 QProgressBar bar(count,0 );
2479 int w = 300; 2483 int w = 300;
2480 if ( QApplication::desktop()->width() < 320 ) 2484 if ( QApplication::desktop()->width() < 320 )
2481 w = 220; 2485 w = 220;
2482 int h = bar.sizeHint().height() ; 2486 int h = bar.sizeHint().height() ;
2483 int dw = QApplication::desktop()->width(); 2487 int dw = QApplication::desktop()->width();
2484 int dh = QApplication::desktop()->height(); 2488 int dh = QApplication::desktop()->height();
2485 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2489 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2486 bar.show(); 2490 bar.show();
2487 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2491 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2488 qApp->processEvents(); 2492 qApp->processEvents();
2489 2493
2490 QDate bday; 2494 QDate bday;
2491 QString anni; 2495 QString anni;
2492 QString formattedbday; 2496 QString formattedbday;
2493 2497
2494 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2498 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2495 { 2499 {
2496 if ( ! bar.isVisible() ) 2500 if ( ! bar.isVisible() )
2497 return; 2501 return;
2498 bar.setProgress( count++ ); 2502 bar.setProgress( count++ );
2499 qApp->processEvents(); 2503 qApp->processEvents();
2500 bday = (*it).birthday().date(); 2504 bday = (*it).birthday().date();
2501 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2505 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2502 2506
2503 if ( bday.isValid() || !anni.isEmpty()) 2507 if ( bday.isValid() || !anni.isEmpty())
2504 { 2508 {
2505 if (bday.isValid()) 2509 if (bday.isValid())
2506 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2510 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2507 else 2511 else
2508 formattedbday = "NOTVALID"; 2512 formattedbday = "NOTVALID";
2509 if (anni.isEmpty()) 2513 if (anni.isEmpty())
2510 anni = "INVALID"; 2514 anni = "INVALID";
2511 2515
2512 birthdayList.append(formattedbday); 2516 birthdayList.append(formattedbday);
2513 anniversaryList.append(anni); //should be ISODate 2517 anniversaryList.append(anni); //should be ISODate
2514 realNameList.append((*it).realName()); 2518 realNameList.append((*it).realName());
2515 preferredEmailList.append((*it).preferredEmail()); 2519 preferredEmailList.append((*it).preferredEmail());
2516 assembledNameList.append((*it).assembledName()); 2520 assembledNameList.append((*it).assembledName());
2517 uidList.append((*it).uid()); 2521 uidList.append((*it).uid());
2518 2522
2519 //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() ); 2523 //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() );
2520 } 2524 }
2521 } 2525 }
2522 2526
2523 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2527 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2524 2528
2525} 2529}
2526 2530
2527/* this method will be called through the QCop interface from other apps to show details of a contact. 2531/* this method will be called through the QCop interface from other apps to show details of a contact.
2528 */ 2532 */
2529void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2533void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2530{ 2534{
2531 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2535 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2532 2536
2533 QString foundUid = QString::null; 2537 QString foundUid = QString::null;
2534 if ( ! uid.isEmpty() ) { 2538 if ( ! uid.isEmpty() ) {
2535 Addressee adrr = mAddressBook->findByUid( uid ); 2539 Addressee adrr = mAddressBook->findByUid( uid );
2536 if ( !adrr.isEmpty() ) { 2540 if ( !adrr.isEmpty() ) {
2537 foundUid = uid; 2541 foundUid = uid;
2538 } 2542 }
2539 if ( email == "sendbacklist" ) { 2543 if ( email == "sendbacklist" ) {
2540 //qDebug("ssssssssssssssssssssssend "); 2544 //qDebug("ssssssssssssssssssssssend ");
2541 QStringList nameList; 2545 QStringList nameList;
2542 QStringList emailList; 2546 QStringList emailList;
2543 QStringList uidList; 2547 QStringList uidList;
2544 nameList.append(adrr.realName()); 2548 nameList.append(adrr.realName());
2545 emailList = adrr.emails(); 2549 emailList = adrr.emails();
2546 uidList.append( adrr.preferredEmail()); 2550 uidList.append( adrr.preferredEmail());
2547 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2551 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2548 return; 2552 return;
2549 } 2553 }
2550 2554
2551 } 2555 }
2552 2556
2553 if ( email == "sendbacklist" ) 2557 if ( email == "sendbacklist" )
2554 return; 2558 return;
2555 if (foundUid.isEmpty()) 2559 if (foundUid.isEmpty())
2556 { 2560 {
2557 //find the uid of the person first 2561 //find the uid of the person first
2558 Addressee::List namelist; 2562 Addressee::List namelist;
2559 Addressee::List emaillist; 2563 Addressee::List emaillist;
2560 2564
2561 if (!name.isEmpty()) 2565 if (!name.isEmpty())
2562 namelist = mAddressBook->findByName( name ); 2566 namelist = mAddressBook->findByName( name );
2563 2567
2564 if (!email.isEmpty()) 2568 if (!email.isEmpty())
2565 emaillist = mAddressBook->findByEmail( email ); 2569 emaillist = mAddressBook->findByEmail( email );
2566 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2570 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2567 //check if we have a match in Namelist and Emaillist 2571 //check if we have a match in Namelist and Emaillist
2568 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2572 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2569 foundUid = emaillist[0].uid(); 2573 foundUid = emaillist[0].uid();
2570 } 2574 }
2571 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2575 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2572 foundUid = namelist[0].uid(); 2576 foundUid = namelist[0].uid();
2573 else 2577 else
2574 { 2578 {
2575 for (int i = 0; i < namelist.count(); i++) 2579 for (int i = 0; i < namelist.count(); i++)
2576 { 2580 {
2577 for (int j = 0; j < emaillist.count(); j++) 2581 for (int j = 0; j < emaillist.count(); j++)
2578 { 2582 {
2579 if (namelist[i] == emaillist[j]) 2583 if (namelist[i] == emaillist[j])
2580 { 2584 {
2581 foundUid = namelist[i].uid(); 2585 foundUid = namelist[i].uid();
2582 } 2586 }
2583 } 2587 }
2584 } 2588 }
2585 } 2589 }
2586 } 2590 }
2587 else 2591 else
2588 { 2592 {
2589 foundUid = uid; 2593 foundUid = uid;
2590 } 2594 }
2591 2595
2592 if (!foundUid.isEmpty()) 2596 if (!foundUid.isEmpty())
2593 { 2597 {
2594 2598
2595 // raise Ka/Pi if it is in the background 2599 // raise Ka/Pi if it is in the background
2596#ifndef DESKTOP_VERSION 2600#ifndef DESKTOP_VERSION
2597#ifndef KORG_NODCOP 2601#ifndef KORG_NODCOP
2598 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2602 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2599#endif 2603#endif
2600#endif 2604#endif
2601 2605
2602 mMainWindow->showMaximized(); 2606 mMainWindow->showMaximized();
2603 mMainWindow-> raise(); 2607 mMainWindow-> raise();
2604 2608
2605 mViewManager->setSelected( "", false); 2609 mViewManager->setSelected( "", false);
2606 mViewManager->refreshView( "" ); 2610 mViewManager->refreshView( "" );
2607 mViewManager->setSelected( foundUid, true ); 2611 mViewManager->setSelected( foundUid, true );
2608 mViewManager->refreshView( foundUid ); 2612 mViewManager->refreshView( foundUid );
2609 2613
2610 if ( !mMultipleViewsAtOnce ) 2614 if ( !mMultipleViewsAtOnce )
2611 { 2615 {
2612 setDetailsVisible( true ); 2616 setDetailsVisible( true );
2613 mActionDetails->setChecked(true); 2617 mActionDetails->setChecked(true);
2614 } 2618 }
2615 } 2619 }
2616} 2620}
2617 2621
2618void KABCore::whatsnew() 2622void KABCore::whatsnew()
2619{ 2623{
2620 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2624 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2621} 2625}
2622void KABCore::synchowto() 2626void KABCore::synchowto()
2623{ 2627{
2624 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2628 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2625} 2629}
2626void KABCore::kdesynchowto() 2630void KABCore::kdesynchowto()
2627{ 2631{
2628 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2632 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2629} 2633}
2630void KABCore::multisynchowto() 2634void KABCore::multisynchowto()
2631{ 2635{
2632 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2636 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2633} 2637}
2634void KABCore::faq() 2638void KABCore::faq()
2635{ 2639{
2636 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2640 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2637} 2641}
2638 2642
2639#include <libkcal/syncdefines.h> 2643#include <libkcal/syncdefines.h>
2640 2644
2641KABC::Addressee KABCore::getLastSyncAddressee() 2645KABC::Addressee KABCore::getLastSyncAddressee()
2642{ 2646{
2643 Addressee lse; 2647 Addressee lse;
2644 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2648 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2645 2649
2646 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2650 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2647 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2651 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2648 if (lse.isEmpty()) { 2652 if (lse.isEmpty()) {
2649 qDebug("Creating new last-syncAddressee "); 2653 qDebug("Creating new last-syncAddressee ");
2650 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2654 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2651 QString sum = ""; 2655 QString sum = "";
2652 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2656 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2653 sum = "E: "; 2657 sum = "E: ";
2654 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2658 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2655 lse.setRevision( mLastAddressbookSync ); 2659 lse.setRevision( mLastAddressbookSync );
2656 lse.setCategories( i18n("SyncEvent") ); 2660 lse.setCategories( i18n("SyncEvent") );
2657 mAddressBook->insertAddressee( lse ); 2661 mAddressBook->insertAddressee( lse );
2658 } 2662 }
2659 return lse; 2663 return lse;
2660} 2664}
2661int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2665int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2662{ 2666{
2663 2667
2664 //void setZaurusId(int id); 2668 //void setZaurusId(int id);
2665 // int zaurusId() const; 2669 // int zaurusId() const;
2666 // void setZaurusUid(int id); 2670 // void setZaurusUid(int id);
2667 // int zaurusUid() const; 2671 // int zaurusUid() const;
2668 // void setZaurusStat(int id); 2672 // void setZaurusStat(int id);
2669 // int zaurusStat() const; 2673 // int zaurusStat() const;
2670 // 0 equal 2674 // 0 equal
2671 // 1 take local 2675 // 1 take local
2672 // 2 take remote 2676 // 2 take remote
2673 // 3 cancel 2677 // 3 cancel
2674 QDateTime lastSync = mLastAddressbookSync; 2678 QDateTime lastSync = mLastAddressbookSync;
2675 QDateTime localMod = local->revision(); 2679 QDateTime localMod = local->revision();
2676 QDateTime remoteMod = remote->revision(); 2680 QDateTime remoteMod = remote->revision();
2677 2681
2678 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2682 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2679 2683
2680 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2684 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2681 bool remCh, locCh; 2685 bool remCh, locCh;
2682 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2686 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2683 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2687 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2684 locCh = ( localMod > mLastAddressbookSync ); 2688 locCh = ( localMod > mLastAddressbookSync );
2685 if ( !remCh && ! locCh ) { 2689 if ( !remCh && ! locCh ) {
2686 //qDebug("both not changed "); 2690 //qDebug("both not changed ");
2687 lastSync = localMod.addDays(1); 2691 lastSync = localMod.addDays(1);
2688 if ( mode <= SYNC_PREF_ASK ) 2692 if ( mode <= SYNC_PREF_ASK )
2689 return 0; 2693 return 0;
2690 } else { 2694 } else {
2691 if ( locCh ) { 2695 if ( locCh ) {
2692 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2696 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2693 lastSync = localMod.addDays( -1 ); 2697 lastSync = localMod.addDays( -1 );
2694 if ( !remCh ) 2698 if ( !remCh )
2695 remoteMod =( lastSync.addDays( -1 ) ); 2699 remoteMod =( lastSync.addDays( -1 ) );
2696 } else { 2700 } else {
2697 //qDebug(" not loc changed "); 2701 //qDebug(" not loc changed ");
2698 lastSync = localMod.addDays( 1 ); 2702 lastSync = localMod.addDays( 1 );
2699 if ( remCh ) { 2703 if ( remCh ) {
2700 //qDebug("rem changed "); 2704 //qDebug("rem changed ");
2701 remoteMod =( lastSync.addDays( 1 ) ); 2705 remoteMod =( lastSync.addDays( 1 ) );
2702 } 2706 }
2703 2707
2704 } 2708 }
2705 } 2709 }
2706 full = true; 2710 full = true;
2707 if ( mode < SYNC_PREF_ASK ) 2711 if ( mode < SYNC_PREF_ASK )
2708 mode = SYNC_PREF_ASK; 2712 mode = SYNC_PREF_ASK;
2709 } else { 2713 } else {
2710 if ( localMod == remoteMod ) 2714 if ( localMod == remoteMod )
2711 return 0; 2715 return 0;
2712 2716
2713 } 2717 }
2714 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); 2718 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec());
2715 //qDebug("lastsync %s ", lastSync.toString().latin1() ); 2719 //qDebug("lastsync %s ", lastSync.toString().latin1() );
2716 //full = true; //debug only 2720 //full = true; //debug only
2717 if ( full ) { 2721 if ( full ) {
2718 bool equ = ( (*local) == (*remote) ); 2722 bool equ = ( (*local) == (*remote) );
2719 if ( equ ) { 2723 if ( equ ) {
2720 //qDebug("equal "); 2724 //qDebug("equal ");
2721 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2725 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2722 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2726 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2723 } 2727 }
2724 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2728 if ( mode < SYNC_PREF_FORCE_LOCAL )
2725 return 0; 2729 return 0;
2726 2730
2727 }//else //debug only 2731 }//else //debug only
2728 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2732 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2729 } 2733 }
2730 int result; 2734 int result;
2731 bool localIsNew; 2735 bool localIsNew;
2732 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 2736 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
2733 2737
2734 if ( full && mode < SYNC_PREF_NEWEST ) 2738 if ( full && mode < SYNC_PREF_NEWEST )
2735 mode = SYNC_PREF_ASK; 2739 mode = SYNC_PREF_ASK;
2736 2740
2737 switch( mode ) { 2741 switch( mode ) {
2738 case SYNC_PREF_LOCAL: 2742 case SYNC_PREF_LOCAL:
2739 if ( lastSync > remoteMod ) 2743 if ( lastSync > remoteMod )
2740 return 1; 2744 return 1;
2741 if ( lastSync > localMod ) 2745 if ( lastSync > localMod )
2742 return 2; 2746 return 2;
2743 return 1; 2747 return 1;
2744 break; 2748 break;
2745 case SYNC_PREF_REMOTE: 2749 case SYNC_PREF_REMOTE:
2746 if ( lastSync > remoteMod ) 2750 if ( lastSync > remoteMod )
2747 return 1; 2751 return 1;
2748 if ( lastSync > localMod ) 2752 if ( lastSync > localMod )
2749 return 2; 2753 return 2;
2750 return 2; 2754 return 2;
2751 break; 2755 break;
2752 case SYNC_PREF_NEWEST: 2756 case SYNC_PREF_NEWEST:
2753 if ( localMod > remoteMod ) 2757 if ( localMod > remoteMod )
2754 return 1; 2758 return 1;
2755 else 2759 else
2756 return 2; 2760 return 2;
2757 break; 2761 break;
2758 case SYNC_PREF_ASK: 2762 case SYNC_PREF_ASK:
2759 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2763 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2760 if ( lastSync > remoteMod ) 2764 if ( lastSync > remoteMod )
2761 return 1; 2765 return 1;
2762 if ( lastSync > localMod ) 2766 if ( lastSync > localMod )
2763 return 2; 2767 return 2;
2764 localIsNew = localMod >= remoteMod; 2768 localIsNew = localMod >= remoteMod;
2765 //qDebug("conflict! ************************************** "); 2769 //qDebug("conflict! ************************************** ");
2766 { 2770 {
2767 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2771 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2768 result = acd.executeD(localIsNew); 2772 result = acd.executeD(localIsNew);
2769 return result; 2773 return result;
2770 } 2774 }
2771 break; 2775 break;
2772 case SYNC_PREF_FORCE_LOCAL: 2776 case SYNC_PREF_FORCE_LOCAL:
2773 return 1; 2777 return 1;
2774 break; 2778 break;
2775 case SYNC_PREF_FORCE_REMOTE: 2779 case SYNC_PREF_FORCE_REMOTE:
2776 return 2; 2780 return 2;
2777 break; 2781 break;
2778 2782
2779 default: 2783 default:
2780 // SYNC_PREF_TAKE_BOTH not implemented 2784 // SYNC_PREF_TAKE_BOTH not implemented
2781 break; 2785 break;
2782 } 2786 }
2783 return 0; 2787 return 0;
2784} 2788}
2785 2789
2786 2790
2787bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2791bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2788{ 2792{
2789 bool syncOK = true; 2793 bool syncOK = true;
2790 int addedAddressee = 0; 2794 int addedAddressee = 0;
2791 int addedAddresseeR = 0; 2795 int addedAddresseeR = 0;
2792 int deletedAddresseeR = 0; 2796 int deletedAddresseeR = 0;
2793 int deletedAddresseeL = 0; 2797 int deletedAddresseeL = 0;
2794 int changedLocal = 0; 2798 int changedLocal = 0;
2795 int changedRemote = 0; 2799 int changedRemote = 0;
2796 2800
2797 QString mCurrentSyncName = syncManager->getCurrentSyncName(); 2801 QString mCurrentSyncName = syncManager->getCurrentSyncName();
2798 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2802 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2799 2803
2800 //QPtrList<Addressee> el = local->rawAddressees(); 2804 //QPtrList<Addressee> el = local->rawAddressees();
2801 Addressee addresseeR; 2805 Addressee addresseeR;
2802 QString uid; 2806 QString uid;
2803 int take; 2807 int take;
2804 Addressee addresseeL; 2808 Addressee addresseeL;
2805 Addressee addresseeRSync; 2809 Addressee addresseeRSync;
2806 Addressee addresseeLSync; 2810 Addressee addresseeLSync;
2807 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); 2811 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
2808 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); 2812 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
2809 bool fullDateRange = false; 2813 bool fullDateRange = false;
2810 local->resetTempSyncStat(); 2814 local->resetTempSyncStat();
2811 mLastAddressbookSync = QDateTime::currentDateTime(); 2815 mLastAddressbookSync = QDateTime::currentDateTime();
2812 if ( syncManager->syncWithDesktop() ) { 2816 if ( syncManager->syncWithDesktop() ) {
2813 // remote->removeSyncInfo( QString());//remove all info 2817 // remote->removeSyncInfo( QString());//remove all info
2814 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 2818 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
2815 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; 2819 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent;
2816 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); 2820 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
2817 } else { 2821 } else {
2818 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 2822 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
2819 } 2823 }
2820 } 2824 }
2821 QDateTime modifiedCalendar = mLastAddressbookSync; 2825 QDateTime modifiedCalendar = mLastAddressbookSync;
2822 addresseeLSync = getLastSyncAddressee(); 2826 addresseeLSync = getLastSyncAddressee();
2823 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); 2827 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1());
2824 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); 2828 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
2825 if ( !addresseeR.isEmpty() ) { 2829 if ( !addresseeR.isEmpty() ) {
2826 addresseeRSync = addresseeR; 2830 addresseeRSync = addresseeR;
2827 remote->removeAddressee(addresseeR ); 2831 remote->removeAddressee(addresseeR );
2828 2832
2829 } else { 2833 } else {
2830 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2834 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2831 addresseeRSync = addresseeLSync ; 2835 addresseeRSync = addresseeLSync ;
2832 } else { 2836 } else {
2833 //qDebug("FULLDATE 1"); 2837 //qDebug("FULLDATE 1");
2834 fullDateRange = true; 2838 fullDateRange = true;
2835 Addressee newAdd; 2839 Addressee newAdd;
2836 addresseeRSync = newAdd; 2840 addresseeRSync = newAdd;
2837 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 2841 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
2838 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 2842 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
2839 addresseeRSync.setRevision( mLastAddressbookSync ); 2843 addresseeRSync.setRevision( mLastAddressbookSync );
2840 addresseeRSync.setCategories( i18n("SyncAddressee") ); 2844 addresseeRSync.setCategories( i18n("SyncAddressee") );
2841 } 2845 }
2842 } 2846 }
2843 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 2847 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
2844 // qDebug("FULLDATE 2"); 2848 // qDebug("FULLDATE 2");
2845 fullDateRange = true; 2849 fullDateRange = true;
2846 } 2850 }
2847 if ( ! fullDateRange ) { 2851 if ( ! fullDateRange ) {
2848 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 2852 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
2849 2853
2850 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2854 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2851 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2855 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2852 fullDateRange = true; 2856 fullDateRange = true;
2853 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); 2857 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
2854 } 2858 }
2855 } 2859 }
2856 // fullDateRange = true; // debug only! 2860 // fullDateRange = true; // debug only!
2857 if ( fullDateRange ) 2861 if ( fullDateRange )
2858 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2862 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2859 else 2863 else
2860 mLastAddressbookSync = addresseeLSync.revision(); 2864 mLastAddressbookSync = addresseeLSync.revision();
2861 // for resyncing if own file has changed 2865 // for resyncing if own file has changed
2862 // PENDING fixme later when implemented 2866 // PENDING fixme later when implemented
2863#if 0 2867#if 0
2864 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2868 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2865 mLastAddressbookSync = loadedFileVersion; 2869 mLastAddressbookSync = loadedFileVersion;
2866 qDebug("setting mLastAddressbookSync "); 2870 qDebug("setting mLastAddressbookSync ");
2867 } 2871 }
2868#endif 2872#endif
2869 2873
2870 2874
2871 // ********** setting filters **************** 2875 // ********** setting filters ****************
2872 Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); 2876 Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB );
2873 Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); 2877 Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB );
2874 2878
2875 //qDebug("*************************** "); 2879 //qDebug("*************************** ");
2876 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2880 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2877 QStringList er = remote->uidList(); 2881 QStringList er = remote->uidList();
2878 Addressee inR ;//= er.first(); 2882 Addressee inR ;//= er.first();
2879 Addressee inL; 2883 Addressee inL;
2880 2884
2881 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2885 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2882 2886
2883 int modulo = (er.count()/10)+1; 2887 int modulo = (er.count()/10)+1;
2884 int incCounter = 0; 2888 int incCounter = 0;
2885 while ( incCounter < er.count()) { 2889 while ( incCounter < er.count()) {
2886 if (syncManager->isProgressBarCanceled()) 2890 if (syncManager->isProgressBarCanceled())
2887 return false; 2891 return false;
2888 if ( incCounter % modulo == 0 ) 2892 if ( incCounter % modulo == 0 )
2889 syncManager->showProgressBar(incCounter); 2893 syncManager->showProgressBar(incCounter);
2890 2894
2891 uid = er[ incCounter ]; 2895 uid = er[ incCounter ];
2892 bool skipIncidence = false; 2896 bool skipIncidence = false;
2893 if ( uid.left(19) == QString("last-syncAddressee-") ) 2897 if ( uid.left(19) == QString("last-syncAddressee-") )
2894 skipIncidence = true; 2898 skipIncidence = true;
2895 QString idS,OidS; 2899 QString idS,OidS;
2896 qApp->processEvents(); 2900 qApp->processEvents();
2897 if ( !skipIncidence ) { 2901 if ( !skipIncidence ) {
2898 inL = local->findByUid( uid ); 2902 inL = local->findByUid( uid );
2899 inR = remote->findByUid( uid ); 2903 inR = remote->findByUid( uid );
2900 //inL.setResource( 0 ); 2904 //inL.setResource( 0 );
2901 //inR.setResource( 0 ); 2905 //inR.setResource( 0 );
2902 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars 2906 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
2903 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2907 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2904 if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { 2908 if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) {
2905 //qDebug("take %d %s ", take, inL.summary().latin1()); 2909 //qDebug("take %d %s ", take, inL.summary().latin1());
2906 if ( take == 3 ) 2910 if ( take == 3 )
2907 return false; 2911 return false;
2908 if ( take == 1 ) {// take local ********************** 2912 if ( take == 1 ) {// take local **********************
2909 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2913 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2910 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2914 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2911 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2915 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2912 local->insertAddressee( inL, false ); 2916 local->insertAddressee( inL, false );
2913 idS = inR.externalUID(); 2917 idS = inR.externalUID();
2914 OidS = inR.originalExternalUID(); 2918 OidS = inR.originalExternalUID();
2915 } 2919 }
2916 else 2920 else
2917 idS = inR.IDStr(); 2921 idS = inR.IDStr();
2918 remote->removeAddressee( inR ); 2922 remote->removeAddressee( inR );
2919 inR = inL; 2923 inR = inL;
2920 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 2924 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
2921 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2925 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2922 inR.setOriginalExternalUID( OidS ); 2926 inR.setOriginalExternalUID( OidS );
2923 inR.setExternalUID( idS ); 2927 inR.setExternalUID( idS );
2924 if ( syncManager->syncWithDesktop() ) { 2928 if ( syncManager->syncWithDesktop() ) {
2925 inR.setIDStr("changed" ); 2929 inR.setIDStr("changed" );
2926 } 2930 }
2927 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); 2931 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" );
2928 } else { 2932 } else {
2929 inR.setIDStr( idS ); 2933 inR.setIDStr( idS );
2930 } 2934 }