summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp2
-rw-r--r--kaddressbook/kaimportoldialog.cpp60
2 files changed, 59 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 013e243..f21507a 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1522,385 +1522,385 @@ void KABCore::initGUI()
1522// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1522// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1523 topLayout->addWidget( mDetails ); 1523 topLayout->addWidget( mDetails );
1524#endif //KAB_NOSPLITTER 1524#endif //KAB_NOSPLITTER
1525*/ 1525*/
1526 1526
1527 1527
1528#endif //KAB_EMBEDDED 1528#endif //KAB_EMBEDDED
1529 initActions(); 1529 initActions();
1530 1530
1531#ifdef KAB_EMBEDDED 1531#ifdef KAB_EMBEDDED
1532 addActionsManually(); 1532 addActionsManually();
1533 //US make sure the export and import menues are initialized before creating the xxPortManager. 1533 //US make sure the export and import menues are initialized before creating the xxPortManager.
1534 mXXPortManager = new XXPortManager( this, this ); 1534 mXXPortManager = new XXPortManager( this, this );
1535 1535
1536 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1536 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1537 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1537 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1538 // mActionQuit->plug ( mMainWindow->toolBar()); 1538 // mActionQuit->plug ( mMainWindow->toolBar());
1539 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1539 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1540 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1540 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1541 // mIncSearchWidget->hide(); 1541 // mIncSearchWidget->hide();
1542 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1542 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1543 SLOT( incrementalSearch( const QString& ) ) ); 1543 SLOT( incrementalSearch( const QString& ) ) );
1544 1544
1545 1545
1546 mJumpButtonBar = new JumpButtonBar( this, this ); 1546 mJumpButtonBar = new JumpButtonBar( this, this );
1547 1547
1548 topLayout->addWidget( mJumpButtonBar ); 1548 topLayout->addWidget( mJumpButtonBar );
1549//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1549//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1550 1550
1551// mMainWindow->getIconToolBar()->raise(); 1551// mMainWindow->getIconToolBar()->raise();
1552 1552
1553#endif //KAB_EMBEDDED 1553#endif //KAB_EMBEDDED
1554 1554
1555} 1555}
1556void KABCore::initActions() 1556void KABCore::initActions()
1557{ 1557{
1558//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1558//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1559 1559
1560#ifndef KAB_EMBEDDED 1560#ifndef KAB_EMBEDDED
1561 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1561 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1562 SLOT( clipboardDataChanged() ) ); 1562 SLOT( clipboardDataChanged() ) );
1563#endif //KAB_EMBEDDED 1563#endif //KAB_EMBEDDED
1564 1564
1565 // file menu 1565 // file menu
1566 if ( mIsPart ) { 1566 if ( mIsPart ) {
1567 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1567 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1568 SLOT( sendMail() ), actionCollection(), 1568 SLOT( sendMail() ), actionCollection(),
1569 "kaddressbook_mail" ); 1569 "kaddressbook_mail" );
1570 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1570 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1571 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1571 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1572 1572
1573 } else { 1573 } else {
1574 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1574 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1575 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1575 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1576 } 1576 }
1577 1577
1578 1578
1579 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1579 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1580 SLOT( save() ), actionCollection(), "file_sync" ); 1580 SLOT( save() ), actionCollection(), "file_sync" );
1581 1581
1582 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1582 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1583 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1583 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1584 1584
1585 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1585 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1586 this, SLOT( mailVCard() ), 1586 this, SLOT( mailVCard() ),
1587 actionCollection(), "file_mail_vcard"); 1587 actionCollection(), "file_mail_vcard");
1588 1588
1589 mActionBeamVCard = 0; 1589 mActionBeamVCard = 0;
1590 mActionBeam = 0; 1590 mActionBeam = 0;
1591 1591
1592#ifndef DESKTOP_VERSION 1592#ifndef DESKTOP_VERSION
1593 if ( Ir::supported() ) { 1593 if ( Ir::supported() ) {
1594 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1594 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1595 SLOT( beamVCard() ), actionCollection(), 1595 SLOT( beamVCard() ), actionCollection(),
1596 "kaddressbook_beam_vcard" ); 1596 "kaddressbook_beam_vcard" );
1597 1597
1598 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1598 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1599 SLOT( beamMySelf() ), actionCollection(), 1599 SLOT( beamMySelf() ), actionCollection(),
1600 "kaddressbook_beam_myself" ); 1600 "kaddressbook_beam_myself" );
1601 } 1601 }
1602#endif 1602#endif
1603 1603
1604 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1604 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1605 this, SLOT( editContact2() ), 1605 this, SLOT( editContact2() ),
1606 actionCollection(), "file_properties" ); 1606 actionCollection(), "file_properties" );
1607 1607
1608#ifdef KAB_EMBEDDED 1608#ifdef KAB_EMBEDDED
1609 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1609 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1610 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1610 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1611 mMainWindow, SLOT( exit() ), 1611 mMainWindow, SLOT( exit() ),
1612 actionCollection(), "quit" ); 1612 actionCollection(), "quit" );
1613#endif //KAB_EMBEDDED 1613#endif //KAB_EMBEDDED
1614 1614
1615 // edit menu 1615 // edit menu
1616 if ( mIsPart ) { 1616 if ( mIsPart ) {
1617 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1617 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1618 SLOT( copyContacts() ), actionCollection(), 1618 SLOT( copyContacts() ), actionCollection(),
1619 "kaddressbook_copy" ); 1619 "kaddressbook_copy" );
1620 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1620 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1621 SLOT( cutContacts() ), actionCollection(), 1621 SLOT( cutContacts() ), actionCollection(),
1622 "kaddressbook_cut" ); 1622 "kaddressbook_cut" );
1623 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1623 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1624 SLOT( pasteContacts() ), actionCollection(), 1624 SLOT( pasteContacts() ), actionCollection(),
1625 "kaddressbook_paste" ); 1625 "kaddressbook_paste" );
1626 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1626 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1627 SLOT( selectAllContacts() ), actionCollection(), 1627 SLOT( selectAllContacts() ), actionCollection(),
1628 "kaddressbook_select_all" ); 1628 "kaddressbook_select_all" );
1629 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1629 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1630 SLOT( undo() ), actionCollection(), 1630 SLOT( undo() ), actionCollection(),
1631 "kaddressbook_undo" ); 1631 "kaddressbook_undo" );
1632 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1632 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1633 this, SLOT( redo() ), actionCollection(), 1633 this, SLOT( redo() ), actionCollection(),
1634 "kaddressbook_redo" ); 1634 "kaddressbook_redo" );
1635 } else { 1635 } else {
1636 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1636 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1637 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1637 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1638 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1638 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1639 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1639 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1640 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1640 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1641 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1641 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1642 } 1642 }
1643 1643
1644 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1644 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1645 Key_Delete, this, SLOT( deleteContacts() ), 1645 Key_Delete, this, SLOT( deleteContacts() ),
1646 actionCollection(), "edit_delete" ); 1646 actionCollection(), "edit_delete" );
1647 1647
1648 mActionUndo->setEnabled( false ); 1648 mActionUndo->setEnabled( false );
1649 mActionRedo->setEnabled( false ); 1649 mActionRedo->setEnabled( false );
1650 1650
1651 // settings menu 1651 // settings menu
1652#ifdef KAB_EMBEDDED 1652#ifdef KAB_EMBEDDED
1653//US special menuentry to configure the addressbook resources. On KDE 1653//US special menuentry to configure the addressbook resources. On KDE
1654// you do that through the control center !!! 1654// you do that through the control center !!!
1655 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1655 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1656 SLOT( configureResources() ), actionCollection(), 1656 SLOT( configureResources() ), actionCollection(),
1657 "kaddressbook_configure_resources" ); 1657 "kaddressbook_configure_resources" );
1658#endif //KAB_EMBEDDED 1658#endif //KAB_EMBEDDED
1659 1659
1660 if ( mIsPart ) { 1660 if ( mIsPart ) {
1661 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1661 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1662 SLOT( openConfigDialog() ), actionCollection(), 1662 SLOT( openConfigDialog() ), actionCollection(),
1663 "kaddressbook_configure" ); 1663 "kaddressbook_configure" );
1664 1664
1665 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1665 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1666 this, SLOT( configureKeyBindings() ), actionCollection(), 1666 this, SLOT( configureKeyBindings() ), actionCollection(),
1667 "kaddressbook_configure_shortcuts" ); 1667 "kaddressbook_configure_shortcuts" );
1668#ifdef KAB_EMBEDDED 1668#ifdef KAB_EMBEDDED
1669 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1669 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1670 mActionConfigureToolbars->setEnabled( false ); 1670 mActionConfigureToolbars->setEnabled( false );
1671#endif //KAB_EMBEDDED 1671#endif //KAB_EMBEDDED
1672 1672
1673 } else { 1673 } else {
1674 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1674 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1675 1675
1676 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1676 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1677 } 1677 }
1678 1678
1679 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1679 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1680 actionCollection(), "options_show_jump_bar" ); 1680 actionCollection(), "options_show_jump_bar" );
1681 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1681 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1682 1682
1683 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1683 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1684 actionCollection(), "options_show_details" ); 1684 actionCollection(), "options_show_details" );
1685 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1685 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1686 1686
1687 // misc 1687 // misc
1688 // only enable LDAP lookup if we can handle the protocol 1688 // only enable LDAP lookup if we can handle the protocol
1689#ifndef KAB_EMBEDDED 1689#ifndef KAB_EMBEDDED
1690 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1690 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1691 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1691 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1692 this, SLOT( openLDAPDialog() ), actionCollection(), 1692 this, SLOT( openLDAPDialog() ), actionCollection(),
1693 "ldap_lookup" ); 1693 "ldap_lookup" );
1694 } 1694 }
1695#else //KAB_EMBEDDED 1695#else //KAB_EMBEDDED
1696 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1696 //qDebug("KABCore::initActions() LDAP has to be implemented");
1697#endif //KAB_EMBEDDED 1697#endif //KAB_EMBEDDED
1698 1698
1699 1699
1700 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1700 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1701 SLOT( setWhoAmI() ), actionCollection(), 1701 SLOT( setWhoAmI() ), actionCollection(),
1702 "set_personal" ); 1702 "set_personal" );
1703 1703
1704 1704
1705 1705
1706 1706
1707 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1707 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1708 SLOT( setCategories() ), actionCollection(), 1708 SLOT( setCategories() ), actionCollection(),
1709 "edit_set_categories" ); 1709 "edit_set_categories" );
1710 1710
1711 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1711 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1712 SLOT( removeVoice() ), actionCollection(), 1712 SLOT( removeVoice() ), actionCollection(),
1713 "remove_voice" ); 1713 "remove_voice" );
1714 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, 1714 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1715 SLOT( importFromOL() ), actionCollection(), 1715 SLOT( importFromOL() ), actionCollection(),
1716 "import_OL" ); 1716 "import_OL" );
1717#ifdef KAB_EMBEDDED 1717#ifdef KAB_EMBEDDED
1718 mActionLicence = new KAction( i18n( "Licence" ), 0, 1718 mActionLicence = new KAction( i18n( "Licence" ), 0,
1719 this, SLOT( showLicence() ), actionCollection(), 1719 this, SLOT( showLicence() ), actionCollection(),
1720 "licence_about_data" ); 1720 "licence_about_data" );
1721 mActionFaq = new KAction( i18n( "Faq" ), 0, 1721 mActionFaq = new KAction( i18n( "Faq" ), 0,
1722 this, SLOT( faq() ), actionCollection(), 1722 this, SLOT( faq() ), actionCollection(),
1723 "faq_about_data" ); 1723 "faq_about_data" );
1724 1724
1725 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1725 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1726 this, SLOT( createAboutData() ), actionCollection(), 1726 this, SLOT( createAboutData() ), actionCollection(),
1727 "kaddressbook_about_data" ); 1727 "kaddressbook_about_data" );
1728#endif //KAB_EMBEDDED 1728#endif //KAB_EMBEDDED
1729 1729
1730 clipboardDataChanged(); 1730 clipboardDataChanged();
1731 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1731 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1732 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1732 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1733} 1733}
1734 1734
1735//US we need this function, to plug all actions into the correct menues. 1735//US we need this function, to plug all actions into the correct menues.
1736// KDE uses a XML format to plug the actions, but we work her without this overhead. 1736// KDE uses a XML format to plug the actions, but we work her without this overhead.
1737void KABCore::addActionsManually() 1737void KABCore::addActionsManually()
1738{ 1738{
1739//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1739//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1740 1740
1741#ifdef KAB_EMBEDDED 1741#ifdef KAB_EMBEDDED
1742 QPopupMenu *fileMenu = new QPopupMenu( this ); 1742 QPopupMenu *fileMenu = new QPopupMenu( this );
1743 QPopupMenu *editMenu = new QPopupMenu( this ); 1743 QPopupMenu *editMenu = new QPopupMenu( this );
1744 QPopupMenu *helpMenu = new QPopupMenu( this ); 1744 QPopupMenu *helpMenu = new QPopupMenu( this );
1745 1745
1746 KToolBar* tb = mMainWindow->toolBar(); 1746 KToolBar* tb = mMainWindow->toolBar();
1747 1747
1748#ifdef DESKTOP_VERSION 1748#ifdef DESKTOP_VERSION
1749 QMenuBar* mb = mMainWindow->menuBar(); 1749 QMenuBar* mb = mMainWindow->menuBar();
1750 1750
1751 //US setup menubar. 1751 //US setup menubar.
1752 //Disable the following block if you do not want to have a menubar. 1752 //Disable the following block if you do not want to have a menubar.
1753 mb->insertItem( "&File", fileMenu ); 1753 mb->insertItem( "&File", fileMenu );
1754 mb->insertItem( "&Edit", editMenu ); 1754 mb->insertItem( "&Edit", editMenu );
1755 mb->insertItem( "&View", viewMenu ); 1755 mb->insertItem( "&View", viewMenu );
1756 mb->insertItem( "&Settings", settingsMenu ); 1756 mb->insertItem( "&Settings", settingsMenu );
1757 mb->insertItem( "&Change selected", changeMenu ); 1757 mb->insertItem( "&Change selected", changeMenu );
1758 mb->insertItem( "&Help", helpMenu ); 1758 mb->insertItem( "&Help", helpMenu );
1759 mIncSearchWidget = new IncSearchWidget( tb ); 1759 mIncSearchWidget = new IncSearchWidget( tb );
1760 // tb->insertWidget(-1, 0, mIncSearchWidget); 1760 // tb->insertWidget(-1, 0, mIncSearchWidget);
1761 1761
1762#else 1762#else
1763 //US setup toolbar 1763 //US setup toolbar
1764 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 1764 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
1765 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1765 QPopupMenu *popupBarTB = new QPopupMenu( this );
1766 menuBarTB->insertItem( "ME", popupBarTB); 1766 menuBarTB->insertItem( "ME", popupBarTB);
1767 tb->insertWidget(-1, 0, menuBarTB); 1767 tb->insertWidget(-1, 0, menuBarTB);
1768 mIncSearchWidget = new IncSearchWidget( tb ); 1768 mIncSearchWidget = new IncSearchWidget( tb );
1769 1769
1770 tb->enableMoving(false); 1770 tb->enableMoving(false);
1771 popupBarTB->insertItem( "&File", fileMenu ); 1771 popupBarTB->insertItem( "&File", fileMenu );
1772 popupBarTB->insertItem( "&Edit", editMenu ); 1772 popupBarTB->insertItem( "&Edit", editMenu );
1773 popupBarTB->insertItem( "&View", viewMenu ); 1773 popupBarTB->insertItem( "&View", viewMenu );
1774 popupBarTB->insertItem( "&Settings", settingsMenu ); 1774 popupBarTB->insertItem( "&Settings", settingsMenu );
1775 mViewManager->getFilterAction()->plug ( popupBarTB); 1775 mViewManager->getFilterAction()->plug ( popupBarTB);
1776 popupBarTB->insertItem( "&Change selected", changeMenu ); 1776 popupBarTB->insertItem( "&Change selected", changeMenu );
1777 popupBarTB->insertItem( "&Help", helpMenu ); 1777 popupBarTB->insertItem( "&Help", helpMenu );
1778 if (QApplication::desktop()->width() > 320 ) { 1778 if (QApplication::desktop()->width() > 320 ) {
1779 // mViewManager->getFilterAction()->plug ( tb); 1779 // mViewManager->getFilterAction()->plug ( tb);
1780 } 1780 }
1781#endif 1781#endif
1782 // mActionQuit->plug ( mMainWindow->toolBar()); 1782 // mActionQuit->plug ( mMainWindow->toolBar());
1783 1783
1784 1784
1785 1785
1786 //US Now connect the actions with the menue entries. 1786 //US Now connect the actions with the menue entries.
1787 mActionPrint->plug( fileMenu ); 1787 mActionPrint->plug( fileMenu );
1788 mActionMail->plug( fileMenu ); 1788 mActionMail->plug( fileMenu );
1789 fileMenu->insertSeparator(); 1789 fileMenu->insertSeparator();
1790 1790
1791 mActionNewContact->plug( fileMenu ); 1791 mActionNewContact->plug( fileMenu );
1792 mActionNewContact->plug( tb ); 1792 mActionNewContact->plug( tb );
1793 1793
1794 mActionEditAddressee->plug( fileMenu ); 1794 mActionEditAddressee->plug( fileMenu );
1795 if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 1795 if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1796 (!KABPrefs::instance()->mMultipleViewsAtOnce )) 1796 (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1797 mActionEditAddressee->plug( tb ); 1797 mActionEditAddressee->plug( tb );
1798 1798
1799 fileMenu->insertSeparator(); 1799 fileMenu->insertSeparator();
1800 mActionSave->plug( fileMenu ); 1800 mActionSave->plug( fileMenu );
1801 fileMenu->insertItem( "&Import", ImportMenu ); 1801 fileMenu->insertItem( "&Import", ImportMenu );
1802 fileMenu->insertItem( "&Export", ExportMenu ); 1802 fileMenu->insertItem( "&Export", ExportMenu );
1803 fileMenu->insertSeparator(); 1803 fileMenu->insertSeparator();
1804 mActionMailVCard->plug( fileMenu ); 1804 mActionMailVCard->plug( fileMenu );
1805#ifndef DESKTOP_VERSION 1805#ifndef DESKTOP_VERSION
1806 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1806 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1807 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1807 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1808#endif 1808#endif
1809 fileMenu->insertSeparator(); 1809 fileMenu->insertSeparator();
1810 mActionQuit->plug( fileMenu ); 1810 mActionQuit->plug( fileMenu );
1811#ifdef _WIN32_ 1811#ifdef _WIN32_
1812 mActionImportOL->plug( ImportMenu ); 1812 mActionImportOL->plug( ImportMenu );
1813#endif 1813#endif
1814 // edit menu 1814 // edit menu
1815 mActionUndo->plug( editMenu ); 1815 mActionUndo->plug( editMenu );
1816 mActionRedo->plug( editMenu ); 1816 mActionRedo->plug( editMenu );
1817 editMenu->insertSeparator(); 1817 editMenu->insertSeparator();
1818 mActionCut->plug( editMenu ); 1818 mActionCut->plug( editMenu );
1819 mActionCopy->plug( editMenu ); 1819 mActionCopy->plug( editMenu );
1820 mActionPaste->plug( editMenu ); 1820 mActionPaste->plug( editMenu );
1821 mActionDelete->plug( editMenu ); 1821 mActionDelete->plug( editMenu );
1822 editMenu->insertSeparator(); 1822 editMenu->insertSeparator();
1823 mActionSelectAll->plug( editMenu ); 1823 mActionSelectAll->plug( editMenu );
1824 1824
1825 mActionRemoveVoice->plug( changeMenu ); 1825 mActionRemoveVoice->plug( changeMenu );
1826 // settings menu 1826 // settings menu
1827//US special menuentry to configure the addressbook resources. On KDE 1827//US special menuentry to configure the addressbook resources. On KDE
1828// you do that through the control center !!! 1828// you do that through the control center !!!
1829 mActionConfigResources->plug( settingsMenu ); 1829 mActionConfigResources->plug( settingsMenu );
1830 settingsMenu->insertSeparator(); 1830 settingsMenu->insertSeparator();
1831 1831
1832 mActionConfigKAddressbook->plug( settingsMenu ); 1832 mActionConfigKAddressbook->plug( settingsMenu );
1833 1833
1834 if ( mIsPart ) { 1834 if ( mIsPart ) {
1835 mActionConfigShortcuts->plug( settingsMenu ); 1835 mActionConfigShortcuts->plug( settingsMenu );
1836 mActionConfigureToolbars->plug( settingsMenu ); 1836 mActionConfigureToolbars->plug( settingsMenu );
1837 1837
1838 } else { 1838 } else {
1839 mActionKeyBindings->plug( settingsMenu ); 1839 mActionKeyBindings->plug( settingsMenu );
1840 } 1840 }
1841 1841
1842 settingsMenu->insertSeparator(); 1842 settingsMenu->insertSeparator();
1843 1843
1844 mActionJumpBar->plug( settingsMenu ); 1844 mActionJumpBar->plug( settingsMenu );
1845 mActionDetails->plug( settingsMenu ); 1845 mActionDetails->plug( settingsMenu );
1846 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 1846 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
1847 mActionDetails->plug( tb ); 1847 mActionDetails->plug( tb );
1848 settingsMenu->insertSeparator(); 1848 settingsMenu->insertSeparator();
1849 1849
1850 mActionWhoAmI->plug( settingsMenu ); 1850 mActionWhoAmI->plug( settingsMenu );
1851 mActionCategories->plug( settingsMenu ); 1851 mActionCategories->plug( settingsMenu );
1852 1852
1853 mActionLicence->plug( helpMenu ); 1853 mActionLicence->plug( helpMenu );
1854 mActionFaq->plug( helpMenu ); 1854 mActionFaq->plug( helpMenu );
1855 mActionAboutKAddressbook->plug( helpMenu ); 1855 mActionAboutKAddressbook->plug( helpMenu );
1856 1856
1857 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1857 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1858 1858
1859 mActionSave->plug( tb ); 1859 mActionSave->plug( tb );
1860 mViewManager->getFilterAction()->plug ( tb); 1860 mViewManager->getFilterAction()->plug ( tb);
1861 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 1861 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1862 mActionUndo->plug( tb ); 1862 mActionUndo->plug( tb );
1863 mActionDelete->plug( tb ); 1863 mActionDelete->plug( tb );
1864 mActionRedo->plug( tb ); 1864 mActionRedo->plug( tb );
1865 } 1865 }
1866 } 1866 }
1867 //mActionQuit->plug ( tb ); 1867 //mActionQuit->plug ( tb );
1868 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1868 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1869 1869
1870 //US link the searchwidget first to this. 1870 //US link the searchwidget first to this.
1871 // The real linkage to the toolbar happens later. 1871 // The real linkage to the toolbar happens later.
1872//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1872//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1873//US tb->insertItem( mIncSearchWidget ); 1873//US tb->insertItem( mIncSearchWidget );
1874/*US 1874/*US
1875 mIncSearchWidget = new IncSearchWidget( tb ); 1875 mIncSearchWidget = new IncSearchWidget( tb );
1876 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1876 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1877 SLOT( incrementalSearch( const QString& ) ) ); 1877 SLOT( incrementalSearch( const QString& ) ) );
1878 1878
1879 mJumpButtonBar = new JumpButtonBar( this, this ); 1879 mJumpButtonBar = new JumpButtonBar( this, this );
1880 1880
1881//US topLayout->addWidget( mJumpButtonBar ); 1881//US topLayout->addWidget( mJumpButtonBar );
1882 this->layout()->add( mJumpButtonBar ); 1882 this->layout()->add( mJumpButtonBar );
1883*/ 1883*/
1884 1884
1885#endif //KAB_EMBEDDED 1885#endif //KAB_EMBEDDED
1886} 1886}
1887void KABCore::showLicence() 1887void KABCore::showLicence()
1888{ 1888{
1889 KApplication::showLicence(); 1889 KApplication::showLicence();
1890} 1890}
1891void KABCore::removeVoice() 1891void KABCore::removeVoice()
1892{ 1892{
1893 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 ) 1893 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 )
1894 return; 1894 return;
1895 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1895 KABC::Addressee::List list = mViewManager->selectedAddressees();
1896 KABC::Addressee::List::Iterator it; 1896 KABC::Addressee::List::Iterator it;
1897 for ( it = list.begin(); it != list.end(); ++it ) { 1897 for ( it = list.begin(); it != list.end(); ++it ) {
1898 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1898 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1899 PhoneNumber::List::Iterator phoneIt; 1899 PhoneNumber::List::Iterator phoneIt;
1900 bool found = false; 1900 bool found = false;
1901 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1901 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1902 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1902 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1903 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1903 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1904 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1904 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1905 (*it).insertPhoneNumber( (*phoneIt) ); 1905 (*it).insertPhoneNumber( (*phoneIt) );
1906 found = true; 1906 found = true;
diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp
index ef949e7..10e3c76 100644
--- a/kaddressbook/kaimportoldialog.cpp
+++ b/kaddressbook/kaimportoldialog.cpp
@@ -79,561 +79,617 @@ class OLEListViewItem : public QCheckListItem
79 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; 79 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
80 OLEListViewItem( QListViewItem *after, QString text ) : 80 OLEListViewItem( QListViewItem *after, QString text ) :
81 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; 81 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
82 ~OLEListViewItem() {}; 82 ~OLEListViewItem() {};
83 void setData( DWORD data ) {mData= data; }; 83 void setData( DWORD data ) {mData= data; };
84 DWORD data() { return mData ;}; 84 DWORD data() { return mData ;};
85 private: 85 private:
86 DWORD mData; 86 DWORD mData;
87}; 87};
88 88
89KAImportOLdialog::KAImportOLdialog( const QString &caption, 89KAImportOLdialog::KAImportOLdialog( const QString &caption,
90 KABC::AddressBook * aBook, QWidget *parent ) : 90 KABC::AddressBook * aBook, QWidget *parent ) :
91 KDialogBase( Plain, caption, User1 | Close, Ok, 91 KDialogBase( Plain, caption, User1 | Close, Ok,
92 parent, caption, true, false, i18n("Import!") ) 92 parent, caption, true, false, i18n("Import!") )
93{ 93{
94 QHBox * mw = new QHBox( this ); 94 QHBox * mw = new QHBox( this );
95 setMainWidget( mw ); 95 setMainWidget( mw );
96 mListView = new QListView( mw ); 96 mListView = new QListView( mw );
97 mListView->addColumn(i18n("Select Folder to import")); 97 mListView->addColumn(i18n("Select Folder to import"));
98 mListView->addColumn(i18n("Content Type")); 98 mListView->addColumn(i18n("Content Type"));
99 mABook = aBook; 99 mABook = aBook;
100 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); 100 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
101 setupFolderView(); 101 setupFolderView();
102 resize( sizeHint().width()+50, sizeHint().height()+50 ); 102 resize( sizeHint().width()+50, sizeHint().height()+50 );
103} 103}
104 104
105KAImportOLdialog::~KAImportOLdialog() 105KAImportOLdialog::~KAImportOLdialog()
106{ 106{
107 107
108} 108}
109 109
110KABC::Addressee::List KAImportOLdialog::getAddressList() 110KABC::Addressee::List KAImportOLdialog::getAddressList()
111{ 111{
112 return mAList; 112 return mAList;
113} 113}
114void KAImportOLdialog::setupFolderView() 114void KAImportOLdialog::setupFolderView()
115{ 115{
116 SCODE sc = ::OleInitialize(NULL); 116 SCODE sc = ::OleInitialize(NULL);
117 if ( FAILED ( sc ) ) { 117 if ( FAILED ( sc ) ) {
118 KMessageBox::information(this,"OLE initialisation failed"); 118 KMessageBox::information(this,"OLE initialisation failed");
119 return; 119 return;
120 } 120 }
121 121
122 if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ 122 if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){
123 KMessageBox::information(this,"Sorry, cannot access Outlook"); 123 KMessageBox::information(this,"Sorry, cannot access Outlook");
124 return ; 124 return ;
125 } 125 }
126 MAPIFolder mfInbox; 126 MAPIFolder mfInbox;
127 MAPIFolder mfRoot; 127 MAPIFolder mfRoot;
128 CString szName; 128 CString szName;
129 _NameSpace olNS; 129 _NameSpace olNS;
130 olNS = gOlAppAB.GetNamespace(_T("MAPI")); 130 olNS = gOlAppAB.GetNamespace(_T("MAPI"));
131 mfInbox = olNS.GetDefaultFolder(6); 131 mfInbox = olNS.GetDefaultFolder(6);
132 mfRoot = mfInbox.GetParent(); 132 mfRoot = mfInbox.GetParent();
133 szName = mfRoot.GetName(); 133 szName = mfRoot.GetName();
134 long iType = mfRoot.GetDefaultItemType(); 134 long iType = mfRoot.GetDefaultItemType();
135 QString mes; 135 QString mes;
136 mes = QString::fromUcs2( szName.GetBuffer() ); 136 mes = QString::fromUcs2( szName.GetBuffer() );
137 OLEListViewItem * root = new OLEListViewItem( mListView, mes ); 137 OLEListViewItem * root = new OLEListViewItem( mListView, mes );
138 mfRoot.m_lpDispatch->AddRef(); 138 mfRoot.m_lpDispatch->AddRef();
139 addFolder( root, mfRoot.m_lpDispatch ); 139 addFolder( root, mfRoot.m_lpDispatch );
140 root->setOpen( true ); 140 root->setOpen( true );
141 mListView->setSortColumn( 0 ); 141 mListView->setSortColumn( 0 );
142 mListView->sort( ); 142 mListView->sort( );
143} 143}
144 144
145 145
146void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) 146void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent)
147{ 147{
148 MAPIFolder mfParent(dispParent), mfChild; 148 MAPIFolder mfParent(dispParent), mfChild;
149 _Folders folders; 149 _Folders folders;
150 _variant_t fndx((long)0); 150 _variant_t fndx((long)0);
151 CString szName; 151 CString szName;
152 long iType; 152 long iType;
153 OLEListViewItem* hChild; 153 OLEListViewItem* hChild;
154 154
155 folders = mfParent.GetFolders(); 155 folders = mfParent.GetFolders();
156 for(int i=1; i <= folders.GetCount(); ++i) 156 for(int i=1; i <= folders.GetCount(); ++i)
157 { 157 {
158 fndx = (long)i; 158 fndx = (long)i;
159 mfChild = folders.Item(fndx.Detach()); 159 mfChild = folders.Item(fndx.Detach());
160 mfChild.m_lpDispatch->AddRef(); 160 mfChild.m_lpDispatch->AddRef();
161 szName = mfChild.GetName(); 161 szName = mfChild.GetName();
162 iType = mfChild.GetDefaultItemType(); 162 iType = mfChild.GetDefaultItemType();
163 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); 163 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) );
164 if ( iType != 2) 164 if ( iType != 2)
165 hChild->setEnabled( false ); 165 hChild->setEnabled( false );
166 QString ts; 166 QString ts;
167 switch( iType ) { 167 switch( iType ) {
168 case 0: 168 case 0:
169 ts = i18n("Mail"); 169 ts = i18n("Mail");
170 break; 170 break;
171 case 1: 171 case 1:
172 ts = i18n("Calendar"); 172 ts = i18n("Calendar");
173 break; 173 break;
174 case 2: 174 case 2:
175 ts = i18n("Contacts"); 175 ts = i18n("Contacts");
176 break; 176 break;
177 case 3: 177 case 3:
178 ts = i18n("Todos"); 178 ts = i18n("Todos");
179 break; 179 break;
180 case 4: 180 case 4:
181 ts = i18n("Journals"); 181 ts = i18n("Journals");
182 break; 182 break;
183 case 5: 183 case 5:
184 ts = i18n("Notes"); 184 ts = i18n("Notes");
185 break; 185 break;
186 default: 186 default:
187 ts = i18n("Unknown"); 187 ts = i18n("Unknown");
188 } 188 }
189 hChild->setText( 1,ts); 189 hChild->setText( 1,ts);
190 hChild->setData( (DWORD) mfChild.m_lpDispatch ); 190 hChild->setData( (DWORD) mfChild.m_lpDispatch );
191 mfChild.m_lpDispatch->AddRef(); 191 mfChild.m_lpDispatch->AddRef();
192 addFolder(hChild, mfChild.m_lpDispatch); 192 addFolder(hChild, mfChild.m_lpDispatch);
193 } 193 }
194} 194}
195 195
196void KAImportOLdialog::slotApply() 196void KAImportOLdialog::slotApply()
197{ 197{
198 importedItems = 0; 198 importedItems = 0;
199 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); 199 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
200 while ( child ) { 200 while ( child ) {
201 if ( child->isOn() ) 201 if ( child->isOn() )
202 readContactData( child->data() ); 202 readContactData( child->data() );
203 child = (OLEListViewItem*) child->itemBelow(); 203 child = (OLEListViewItem*) child->itemBelow();
204 } 204 }
205 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); 205 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
206 KMessageBox::information(this,mes); 206 KMessageBox::information(this,mes);
207} 207}
208void KAImportOLdialog::readContactData( DWORD folder ) 208void KAImportOLdialog::readContactData( DWORD folder )
209{ 209{
210 210
211 LPDISPATCH dispItem = (LPDISPATCH)folder; 211 LPDISPATCH dispItem = (LPDISPATCH)folder;
212 dispItem->AddRef(); 212 dispItem->AddRef();
213 MAPIFolder mf(dispItem); 213 MAPIFolder mf(dispItem);
214 mf.m_lpDispatch->AddRef(); 214 mf.m_lpDispatch->AddRef();
215 _Items folderItems; 215 _Items folderItems;
216 _variant_t indx((long)0); 216 _variant_t indx((long)0);
217 LPDISPATCH itm; 217 LPDISPATCH itm;
218 int i; 218 int i;
219 folderItems = mf.GetItems(); 219 folderItems = mf.GetItems();
220 QProgressBar bar( folderItems.GetCount(),0 ); 220 QProgressBar bar( folderItems.GetCount(),0 );
221 bar.setCaption (i18n("Importing - close to abort!") ); 221 bar.setCaption (i18n("Importing - close to abort!") );
222 int h = bar.sizeHint().height() ; 222 int h = bar.sizeHint().height() ;
223 int w = 300; 223 int w = 300;
224 int dw = QApplication::desktop()->width(); 224 int dw = QApplication::desktop()->width();
225 int dh = QApplication::desktop()->height(); 225 int dh = QApplication::desktop()->height();
226 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 226 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
227 bar.show(); 227 bar.show();
228 for(i=1; i <= folderItems.GetCount(); ++i) 228 for(i=1; i <= folderItems.GetCount(); ++i)
229 { 229 {
230 qApp->processEvents(); 230 qApp->processEvents();
231 if ( ! bar.isVisible() ) 231 if ( ! bar.isVisible() )
232 return ; 232 return ;
233 bar.setProgress( i ); 233 bar.setProgress( i );
234 indx = (long)i; 234 indx = (long)i;
235 itm = folderItems.Item(indx.Detach()); 235 itm = folderItems.Item(indx.Detach());
236 _ContactItem * pItem = (_ContactItem *)&itm; 236 _ContactItem * pItem = (_ContactItem *)&itm;
237 ol2kapiContact( pItem ); 237 ol2kapiContact( pItem );
238 itm->Release(); 238 itm->Release();
239 } 239 }
240} 240}
241void KAImportOLdialog::slotOk() 241void KAImportOLdialog::slotOk()
242{ 242{
243 QDialog::accept(); 243 QDialog::accept();
244} 244}
245 245
246void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) 246void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem )
247{ 247{
248 KABC::Addressee addressee; 248 KABC::Addressee addressee;
249 249
250 addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); 250 addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer()));
251 //GetLastModificationTime() 251 //GetLastModificationTime()
252 //addressee.setName( const QString &name ); 252 //addressee.setName( const QString &name );
253 //addressee.setFormattedName( const QString &formattedName ); 253 //addressee.setFormattedName( const QString &formattedName );
254 addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); 254 addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) );
255 addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); 255 addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) );
256 addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); 256 addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) );
257 addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); 257 addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) );
258 addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); 258 addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) );
259 addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); 259 addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) );
260 QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); 260 QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday());
261 if ( dtb.isValid() ) 261 if ( dtb.isValid() )
262 addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); 262 addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday()));
263 263
264 //QString::fromUcs2(aItem->.GetBuffer()) 264 //QString::fromUcs2(aItem->.GetBuffer())
265 //addressee.setMailer( const QString &mailer ); 265 //addressee.setMailer( const QString &mailer );
266 //addressee.setTimeZone( const TimeZone &timeZone ); 266 //addressee.setTimeZone( const TimeZone &timeZone );
267 //addressee.setGeo( const Geo &geo ); 267 //addressee.setGeo( const Geo &geo );
268 //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix 268 //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix
269 addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); 269 addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );
270 addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()) ); 270 addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()) );
271 addressee.setNote( QString::fromUcs2(aItem->GetBody().GetBuffer()) ); 271 QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer());
272 272
273 addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); 273 addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) );
274 //addressee.setRevision( const QDateTime &revision ); 274 //addressee.setRevision( const QDateTime &revision );
275 // addressee.setSortString( const QString &sortString ); 275 // addressee.setSortString( const QString &sortString );
276 addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); 276 addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) );
277 277
278 QString tempS; 278 QString tempS;
279 tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); 279 tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer());
280 if ( tempS.length() > 12 ) 280 if ( tempS.length() > 12 )
281 addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); 281 addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS );
282 tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); 282 tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer());
283 if ( !tempS.isEmpty() ) 283 if ( !tempS.isEmpty() )
284 addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS ); 284 addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS );
285 tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer()); 285 tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer());
286 if ( !tempS.isEmpty() ) 286 if ( !tempS.isEmpty() )
287 addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS ); 287 addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS );
288 tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer()); 288 tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer());
289 if ( !tempS.isEmpty() ) 289 if ( !tempS.isEmpty() )
290 addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS ); 290 addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS );
291 tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer()); 291 tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer());
292 if ( !tempS.isEmpty() ) 292 if ( !tempS.isEmpty() )
293 addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS ); 293 addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS );
294 tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()); 294 tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer());
295 if ( !tempS.isEmpty() ) 295 if ( !tempS.isEmpty() )
296 addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS ); 296 addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS );
297 tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer()); 297 tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer());
298 if ( !tempS.isEmpty() ) 298 if ( !tempS.isEmpty() )
299 addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS ); 299 addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS );
300 dtb = mDdate2Qdtr(aItem->GetAnniversary()); 300 dtb = mDdate2Qdtr(aItem->GetAnniversary());
301 if (dtb.isValid() ) { 301 if (dtb.isValid() ) {
302 QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate); 302 QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate);
303 addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 303 addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
304 } 304 }
305 int sec = aItem->GetSensitivity() ; 305 int sec = aItem->GetSensitivity() ;
306 if ( sec > 1 )// mapping pers -> private 306 if ( sec > 1 )// mapping pers -> private
307 --sec; 307 --sec;
308 addressee.setSecrecy( sec ); 308 addressee.setSecrecy( sec );
309 //addressee.setLogo( const Picture &logo ); 309 //addressee.setLogo( const Picture &logo );
310 //addressee.setPhoto( const Picture &photo ); 310 //addressee.setPhoto( const Picture &photo );
311 //addressee.setSound( const Sound &sound ); 311 //addressee.setSound( const Sound &sound );
312 //addressee.setAgent( const Agent &agent ); 312 //addressee.setAgent( const Agent &agent );
313 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); 313 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer());
314 addressee.setCategories( QStringList::split( ";", cat )); 314 addressee.setCategories( QStringList::split( ";", cat ));
315 315
316 QString phoneS; 316 QString phoneS;
317 317
318 phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer()); 318 phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer());
319 if ( ! phoneS.isEmpty()) 319 if ( ! phoneS.isEmpty())
320 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) ); 320 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) );
321 phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer()); 321 phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer());
322 if ( ! phoneS.isEmpty()) 322 if ( ! phoneS.isEmpty())
323 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); 323 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) );
324 phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer()); 324 phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer());
325 if ( ! phoneS.isEmpty()) 325 if ( ! phoneS.isEmpty())
326 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); 326 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) );
327 phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer()); 327 phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer());
328 if ( ! phoneS.isEmpty()) 328 if ( ! phoneS.isEmpty())
329 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) ); 329 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) );
330 phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer()); 330 phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer());
331 if ( ! phoneS.isEmpty()) 331 if ( ! phoneS.isEmpty())
332 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) ); 332 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) );
333 phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer()); 333 phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer());
334 if ( ! phoneS.isEmpty()) 334 if ( ! phoneS.isEmpty())
335 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); 335 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) );
336 phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer()); 336 phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer());
337 if ( ! phoneS.isEmpty()) 337 if ( ! phoneS.isEmpty())
338 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); 338 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) );
339 phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer()); 339 phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer());
340 if ( ! phoneS.isEmpty()) 340 if ( ! phoneS.isEmpty())
341 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) ); 341 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) );
342 phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer()); 342 phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer());
343 if ( ! phoneS.isEmpty()) 343 if ( ! phoneS.isEmpty())
344 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) ); 344 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) );
345 phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer()); 345 phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer());
346 if ( ! phoneS.isEmpty()) 346 if ( ! phoneS.isEmpty())
347 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) ); 347 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) );
348 phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer()); 348 phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer());
349 if ( ! phoneS.isEmpty()) 349 if ( ! phoneS.isEmpty())
350 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) ); 350 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) );
351 phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer()); 351 phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer());
352 if ( ! phoneS.isEmpty()) 352 if ( ! phoneS.isEmpty())
353 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) ); 353 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) );
354 phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer()); 354 phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer());
355 if ( ! phoneS.isEmpty()) 355 if ( ! phoneS.isEmpty())
356 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) ); 356 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) );
357 phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer()); 357 phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer());
358 if ( ! phoneS.isEmpty()) 358 if ( ! phoneS.isEmpty())
359 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) ); 359 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) );
360 phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer()); 360 phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer());
361 if ( ! phoneS.isEmpty()) 361 if ( ! phoneS.isEmpty())
362 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) ); 362 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) );
363 phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer()); 363 phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer());
364 if ( ! phoneS.isEmpty()) 364 if ( ! phoneS.isEmpty())
365 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) ); 365 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) );
366 phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer()); 366 phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer());
367 if ( ! phoneS.isEmpty()) 367 if ( ! phoneS.isEmpty())
368 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) ); 368 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) );
369 phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer()); 369 phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer());
370 if ( ! phoneS.isEmpty()) 370 if ( ! phoneS.isEmpty())
371 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) ); 371 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) );
372 phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer()); 372 phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer());
373 if ( ! phoneS.isEmpty()) 373 if ( ! phoneS.isEmpty())
374 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) ); 374 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) );
375 375
376 bool preferred = true; 376 bool preferred = true;
377 phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer()); 377 phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer());
378 if ( ! phoneS.isEmpty()) { 378 if ( ! phoneS.isEmpty()) {
379 addressee.insertEmail(phoneS , preferred ); 379 addressee.insertEmail(phoneS , preferred );
380 preferred = false; 380 preferred = false;
381 } 381 }
382 phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer()); 382 phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer());
383 if ( ! phoneS.isEmpty()) { 383 if ( ! phoneS.isEmpty()) {
384 addressee.insertEmail(phoneS , preferred ); 384 addressee.insertEmail(phoneS , preferred );
385 preferred = false; 385 preferred = false;
386 } 386 }
387 phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer()); 387 phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer());
388 if ( ! phoneS.isEmpty()) { 388 if ( ! phoneS.isEmpty()) {
389 addressee.insertEmail(phoneS , preferred ); 389 addressee.insertEmail(phoneS , preferred );
390 preferred = false; 390 preferred = false;
391 } 391 }
392 // is this the number of the preferred email? 392 // is this the number of the preferred email?
393 //long GetSelectedMailingAddress();??? 393 //long GetSelectedMailingAddress();???
394 394
395 KABC::Address addressHome; 395 KABC::Address addressHome;
396 KABC::Address* addressAdd = &addressHome; 396 KABC::Address* addressAdd = &addressHome;
397 bool insert = false; 397 bool insert = false;
398 phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer()); 398 phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer());
399 if ( ! phoneS.isEmpty()) { 399 if ( ! phoneS.isEmpty()) {
400 addressAdd->setCountry(phoneS ); 400 addressAdd->setCountry(phoneS );
401 insert = true; 401 insert = true;
402 } 402 }
403 phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer()); 403 phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer());
404 if ( ! phoneS.isEmpty()) { 404 if ( ! phoneS.isEmpty()) {
405 addressAdd->setRegion(phoneS ); 405 addressAdd->setRegion(phoneS );
406 insert = true; 406 insert = true;
407 } 407 }
408 phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer()); 408 phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer());
409 if ( ! phoneS.isEmpty()) { 409 if ( ! phoneS.isEmpty()) {
410 addressAdd->setLocality(phoneS ); 410 addressAdd->setLocality(phoneS );
411 insert = true; 411 insert = true;
412 } 412 }
413 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer()); 413 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer());
414 if ( ! phoneS.isEmpty()) { 414 if ( ! phoneS.isEmpty()) {
415 addressAdd->setPostalCode(phoneS ); 415 addressAdd->setPostalCode(phoneS );
416 insert = true; 416 insert = true;
417 } 417 }
418 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer()); 418 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer());
419 if ( ! phoneS.isEmpty()) { 419 if ( ! phoneS.isEmpty()) {
420 addressAdd->setPostOfficeBox(phoneS ); 420 addressAdd->setPostOfficeBox(phoneS );
421 insert = true; 421 insert = true;
422 } 422 }
423 phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer()); 423 phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer());
424 if ( ! phoneS.isEmpty()) { 424 if ( ! phoneS.isEmpty()) {
425 addressAdd->setStreet(phoneS ); 425 addressAdd->setStreet(phoneS );
426 insert = true; 426 insert = true;
427 } 427 }
428 phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer()); 428 phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer());
429 if ( ! phoneS.isEmpty()) { 429 if ( ! phoneS.isEmpty()) {
430 // redundant !addressAdd->setExtended(phoneS ); 430 // redundant !addressAdd->setExtended(phoneS );
431 // insert = true; 431 // insert = true;
432 } 432 }
433 addressAdd->setType( KABC::Address::Home ); 433 addressAdd->setType( KABC::Address::Home );
434 if ( insert ) 434 if ( insert )
435 addressee.insertAddress( *addressAdd ); 435 addressee.insertAddress( *addressAdd );
436 // ++++++++++++++++++++++ end of address 436 // ++++++++++++++++++++++ end of address
437 437
438 KABC::Address addressWork; 438 KABC::Address addressWork;
439 addressAdd = &addressWork; 439 addressAdd = &addressWork;
440 insert = false; 440 insert = false;
441 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer()); 441 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer());
442 if ( ! phoneS.isEmpty()) { 442 if ( ! phoneS.isEmpty()) {
443 addressAdd->setCountry(phoneS ); 443 addressAdd->setCountry(phoneS );
444 insert = true; 444 insert = true;
445 } 445 }
446 phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer()); 446 phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer());
447 if ( ! phoneS.isEmpty()) { 447 if ( ! phoneS.isEmpty()) {
448 addressAdd->setRegion(phoneS ); 448 addressAdd->setRegion(phoneS );
449 insert = true; 449 insert = true;
450 } 450 }
451 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer()); 451 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer());
452 if ( ! phoneS.isEmpty()) { 452 if ( ! phoneS.isEmpty()) {
453 addressAdd->setLocality(phoneS ); 453 addressAdd->setLocality(phoneS );
454 insert = true; 454 insert = true;
455 } 455 }
456 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer()); 456 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer());
457 if ( ! phoneS.isEmpty()) { 457 if ( ! phoneS.isEmpty()) {
458 addressAdd->setPostalCode(phoneS ); 458 addressAdd->setPostalCode(phoneS );
459 insert = true; 459 insert = true;
460 } 460 }
461 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer()); 461 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer());
462 if ( ! phoneS.isEmpty()) { 462 if ( ! phoneS.isEmpty()) {
463 addressAdd->setPostOfficeBox(phoneS ); 463 addressAdd->setPostOfficeBox(phoneS );
464 insert = true; 464 insert = true;
465 } 465 }
466 phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer()); 466 phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer());
467 if ( ! phoneS.isEmpty()) { 467 if ( ! phoneS.isEmpty()) {
468 addressAdd->setStreet(phoneS ); 468 addressAdd->setStreet(phoneS );
469 insert = true; 469 insert = true;
470 } 470 }
471 phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer()); 471 phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer());
472 if ( ! phoneS.isEmpty()) { 472 if ( ! phoneS.isEmpty()) {
473 // redundant !addressAdd->setExtended(phoneS ); 473 // redundant !addressAdd->setExtended(phoneS );
474 // insert = true; 474 // insert = true;
475 } 475 }
476 addressAdd->setType( KABC::Address::Work ); 476 addressAdd->setType( KABC::Address::Work );
477 if ( insert ) 477 if ( insert )
478 addressee.insertAddress( *addressAdd ); 478 addressee.insertAddress( *addressAdd );
479 // ++++++++++++++++++++++ end of address 479 // ++++++++++++++++++++++ end of address
480 480
481 KABC::Address addressOther; 481 KABC::Address addressOther;
482 addressAdd = &addressOther; 482 addressAdd = &addressOther;
483 insert = false; 483 insert = false;
484 phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer()); 484 phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer());
485 if ( ! phoneS.isEmpty()) { 485 if ( ! phoneS.isEmpty()) {
486 addressAdd->setCountry(phoneS ); 486 addressAdd->setCountry(phoneS );
487 insert = true; 487 insert = true;
488 } 488 }
489 phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer()); 489 phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer());
490 if ( ! phoneS.isEmpty()) { 490 if ( ! phoneS.isEmpty()) {
491 addressAdd->setRegion(phoneS ); 491 addressAdd->setRegion(phoneS );
492 insert = true; 492 insert = true;
493 } 493 }
494 phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer()); 494 phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer());
495 if ( ! phoneS.isEmpty()) { 495 if ( ! phoneS.isEmpty()) {
496 addressAdd->setLocality(phoneS ); 496 addressAdd->setLocality(phoneS );
497 insert = true; 497 insert = true;
498 } 498 }
499 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer()); 499 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer());
500 if ( ! phoneS.isEmpty()) { 500 if ( ! phoneS.isEmpty()) {
501 addressAdd->setPostalCode(phoneS ); 501 addressAdd->setPostalCode(phoneS );
502 insert = true; 502 insert = true;
503 } 503 }
504 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer()); 504 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer());
505 if ( ! phoneS.isEmpty()) { 505 if ( ! phoneS.isEmpty()) {
506 addressAdd->setPostOfficeBox(phoneS ); 506 addressAdd->setPostOfficeBox(phoneS );
507 insert = true; 507 insert = true;
508 } 508 }
509 phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer()); 509 phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer());
510 if ( ! phoneS.isEmpty()) { 510 if ( ! phoneS.isEmpty()) {
511 addressAdd->setStreet(phoneS ); 511 addressAdd->setStreet(phoneS );
512 insert = true; 512 insert = true;
513 } 513 }
514 phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer()); 514 phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer());
515 if ( ! phoneS.isEmpty()) { 515 if ( ! phoneS.isEmpty()) {
516 // redundant !addressAdd->setExtended(phoneS ); 516 // redundant !addressAdd->setExtended(phoneS );
517 //insert = true; 517 //insert = true;
518 } 518 }
519 //addressAdd->setId( ); 519 //addressAdd->setId( );
520 if ( insert ) 520 if ( insert )
521 addressee.insertAddress( *addressAdd ); 521 addressee.insertAddress( *addressAdd );
522 // ++++++++++++++++++++++ end of address 522 // ++++++++++++++++++++++ end of address
523 KABC::Address addressMail; 523 KABC::Address addressMail;
524 addressAdd = &addressMail; 524 addressAdd = &addressMail;
525 insert = false; 525 insert = false;
526 phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer()); 526 phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer());
527 if ( ! phoneS.isEmpty()) { 527 if ( ! phoneS.isEmpty()) {
528 addressAdd->setCountry(phoneS ); 528 addressAdd->setCountry(phoneS );
529 insert = true; 529 insert = true;
530 } 530 }
531 phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer()); 531 phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer());
532 if ( ! phoneS.isEmpty()) { 532 if ( ! phoneS.isEmpty()) {
533 addressAdd->setRegion(phoneS ); 533 addressAdd->setRegion(phoneS );
534 insert = true; 534 insert = true;
535 } 535 }
536 phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer()); 536 phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer());
537 if ( ! phoneS.isEmpty()) { 537 if ( ! phoneS.isEmpty()) {
538 addressAdd->setLocality(phoneS ); 538 addressAdd->setLocality(phoneS );
539 insert = true; 539 insert = true;
540 } 540 }
541 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer()); 541 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer());
542 if ( ! phoneS.isEmpty()) { 542 if ( ! phoneS.isEmpty()) {
543 addressAdd->setPostalCode(phoneS ); 543 addressAdd->setPostalCode(phoneS );
544 insert = true; 544 insert = true;
545 } 545 }
546 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer()); 546 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer());
547 if ( ! phoneS.isEmpty()) { 547 if ( ! phoneS.isEmpty()) {
548 addressAdd->setPostOfficeBox(phoneS ); 548 addressAdd->setPostOfficeBox(phoneS );
549 insert = true; 549 insert = true;
550 } 550 }
551 phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer()); 551 phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer());
552 if ( ! phoneS.isEmpty()) { 552 if ( ! phoneS.isEmpty()) {
553 addressAdd->setStreet(phoneS ); 553 addressAdd->setStreet(phoneS );
554 insert = true; 554 insert = true;
555 } 555 }
556 phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer()); 556 phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer());
557 if ( ! phoneS.isEmpty()) { 557 if ( ! phoneS.isEmpty()) {
558 // redundant ! addressAdd->setExtended(phoneS ); 558 // redundant ! addressAdd->setExtended(phoneS );
559 // insert = true; 559 // insert = true;
560 } 560 }
561 addressAdd->setType( KABC::Address::Postal ); 561 addressAdd->setType( KABC::Address::Postal );
562 if ( insert ) { 562 if ( insert ) {
563 addressee.insertAddress( *addressAdd ); 563 addressee.insertAddress( *addressAdd );
564 } 564 }
565 // the following code is disabled 565 // the following code is disabled
566 // it does not seem to be useful 566 // it does not seem to be useful
567#if 0 567#if 0
568 if ( insert ) { 568 if ( insert ) {
569 addressAdd->setType( KABC::Address::Home ); 569 addressAdd->setType( KABC::Address::Home );
570 if ( addressMail == addressHome ) { 570 if ( addressMail == addressHome ) {
571 addressHome.setType( KABC::Address::Postal+ KABC::Address::Home ); 571 addressHome.setType( KABC::Address::Postal+ KABC::Address::Home );
572 addressee.insertAddress( addressHome ); 572 addressee.insertAddress( addressHome );
573 } else { 573 } else {
574 addressAdd->setType( KABC::Address::Work ); 574 addressAdd->setType( KABC::Address::Work );
575 if ( addressMail == addressWork ){ 575 if ( addressMail == addressWork ){
576 addressWork.setType( KABC::Address::Postal+ KABC::Address::Work ); 576 addressWork.setType( KABC::Address::Postal+ KABC::Address::Work );
577 addressee.insertAddress( addressWork ); 577 addressee.insertAddress( addressWork );
578 578
579 } else { 579 } else {
580 addressAdd->setType( 0 ); 580 addressAdd->setType( 0 );
581 if ( addressOther == addressMail ){ 581 if ( addressOther == addressMail ){
582 addressOther.setType( KABC::Address::Postal ); 582 addressOther.setType( KABC::Address::Postal );
583 addressee.insertAddress( addressOther ); 583 addressee.insertAddress( addressOther );
584 } else { 584 } else {
585 addressee.insertAddress( *addressAdd ); 585 addressee.insertAddress( *addressAdd );
586 } 586 }
587 } 587 }
588 } 588 }
589 } 589 }
590#endif 590#endif
591 // ++++++++++++++++++++++ end of ALL addresses 591 // ++++++++++++++++++++++ end of ALL addresses
592 //GetUserProperties(); 592 //GetUserProperties();
593 tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer()); 593 tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer());
594 if ( !tempS.isEmpty() ) 594 if ( !tempS.isEmpty() )
595 addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS ); 595 addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS );
596 tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer()); 596 tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer());
597 if ( !tempS.isEmpty() ) 597 if ( !tempS.isEmpty() )
598 addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS ); 598 addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS );
599 int gen = aItem->GetGender(); 599 int gen = aItem->GetGender();
600 if ( gen != 0 ) { // 0 undef - 1 female - 2 male 600 if ( gen != 0 ) { // 0 undef - 1 female - 2 male
601 if ( gen == 1 ) 601 if ( gen == 1 )
602 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" ); 602 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" );
603 else 603 else
604 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" ); 604 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" );
605 } 605 }
606 606 QString additionalInfo;
607 QString tempAdd;
608 tempAdd = QString::fromUcs2(aItem->GetLanguage().GetBuffer());
609 if ( ! tempAdd.isEmpty() ) {
610 additionalInfo += i18n("\nLanguage: ");
611 additionalInfo += tempAdd;
612 }
613 tempAdd = QString::fromUcs2(aItem->GetHobby().GetBuffer());
614 if ( ! tempAdd.isEmpty() ) {
615 additionalInfo += i18n("\nHobby: ");
616 additionalInfo += tempAdd;;
617 }
618 tempAdd =QString::fromUcs2(aItem->GetPersonalHomePage().GetBuffer());
619 if ( ! tempAdd.isEmpty() ) {
620 additionalInfo += i18n("\nHomepage: ");
621 additionalInfo += tempAdd;;
622 }
623 tempAdd = QString::fromUcs2(aItem->GetBillingInformation().GetBuffer());
624 if ( ! tempAdd.isEmpty() ) {
625 additionalInfo += i18n("\nBilling information: ");
626 additionalInfo += tempAdd;;
627 }
628 tempAdd = QString::fromUcs2(aItem->GetCustomerID().GetBuffer());
629 if ( ! tempAdd.isEmpty() ) {
630 additionalInfo += i18n("\nCustomer ID: ");
631 additionalInfo += tempAdd;;
632 }
633 tempAdd = QString::fromUcs2(aItem->GetUser1().GetBuffer());
634 if ( ! tempAdd.isEmpty() ) {
635 additionalInfo += i18n("\nUser1: ");
636 additionalInfo += tempAdd;;
637 }
638 tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer());
639 if ( ! tempAdd.isEmpty() ) {
640 additionalInfo += i18n("\nUser2: ");
641 additionalInfo += tempAdd;;
642 }
643 tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer());
644 if ( ! tempAdd.isEmpty() ) {
645 additionalInfo += i18n("\nUser3: ");
646 additionalInfo += tempAdd;;
647 }
648 tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer());
649 if ( ! tempAdd.isEmpty() ) {
650 additionalInfo += i18n("\nUser4: ");
651 additionalInfo += tempAdd;;
652 }
653 if (!additionalInfo.isEmpty() ) {
654 tempAdd = notesStr;
655 notesStr = "+++++++++++++++++++++++++++\n";
656 notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:");
657 notesStr += additionalInfo;
658 notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n");
659 notesStr += "+++++++++++++++++++++++++++\n";
660 notesStr += tempAdd;
661 }
662 addressee.setNote( notesStr );
607#if 0 663#if 0
608 // pending 664 // pending
609 - IM address: no clue where to get info about the helper ID 665 - IM address: no clue where to get info about the helper ID
610 -custom fields: difficult to implement - not implemented 666 -custom fields: difficult to implement - not implemented
611 -keys: makes no sense 667 -keys: makes no sense
612#endif 668#endif
613 669
614 if ( addAddressee( addressee )) 670 if ( addAddressee( addressee ))
615 ++importedItems; 671 ++importedItems;
616} 672}
617void KAImportOLdialog::slotCancel() 673void KAImportOLdialog::slotCancel()
618{ 674{
619 reject(); 675 reject();
620} 676}
621 677
622bool KAImportOLdialog::addAddressee( KABC::Addressee a ) 678bool KAImportOLdialog::addAddressee( KABC::Addressee a )
623{ 679{
624 bool add = true; 680 bool add = true;
625 KABC::Addressee::List::Iterator it; 681 KABC::Addressee::List::Iterator it;
626 for ( it = mAList.begin(); it != mAList.end(); ++it ) { 682 for ( it = mAList.begin(); it != mAList.end(); ++it ) {
627 if ( (*it).uid() == a.uid() ) { 683 if ( (*it).uid() == a.uid() ) {
628 add = false; 684 add = false;
629 break; 685 break;
630 } 686 }
631 } 687 }
632 if ( add ) { 688 if ( add ) {
633 if ( mABook->findByUid(a.uid() ).isEmpty()) 689 if ( mABook->findByUid(a.uid() ).isEmpty())
634 mAList.append ( a ); 690 mAList.append ( a );
635 else 691 else
636 add = false; 692 add = false;
637 } 693 }
638 return add; 694 return add;
639} 695}