summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp17
-rw-r--r--kaddressbook/kabcore.h4
2 files changed, 21 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f2d4cd6..282560f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1605,931 +1605,948 @@ void KABCore::initGUI()
1605 mViewManager = new ViewManager( this, mMiniSplitter ); 1605 mViewManager = new ViewManager( this, mMiniSplitter );
1606 mDetails = new ViewContainer( mMiniSplitter ); 1606 mDetails = new ViewContainer( mMiniSplitter );
1607 1607
1608 1608
1609 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1609 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1610#endif 1610#endif
1611 //eh->hide(); 1611 //eh->hide();
1612 // topLayout->addWidget(mExtensionManager ); 1612 // topLayout->addWidget(mExtensionManager );
1613 1613
1614 1614
1615/*US 1615/*US
1616#ifndef KAB_NOSPLITTER 1616#ifndef KAB_NOSPLITTER
1617 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1617 QHBoxLayout *topLayout = new QHBoxLayout( this );
1618//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1618//US topLayout->setSpacing( KDialogBase::spacingHint() );
1619 topLayout->setSpacing( 10 ); 1619 topLayout->setSpacing( 10 );
1620 1620
1621 mDetailsSplitter = new QSplitter( this ); 1621 mDetailsSplitter = new QSplitter( this );
1622 1622
1623 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1623 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1624 1624
1625 mViewManager = new ViewManager( this, viewSpace ); 1625 mViewManager = new ViewManager( this, viewSpace );
1626 viewSpace->setStretchFactor( mViewManager, 1 ); 1626 viewSpace->setStretchFactor( mViewManager, 1 );
1627 1627
1628 mDetails = new ViewContainer( mDetailsSplitter ); 1628 mDetails = new ViewContainer( mDetailsSplitter );
1629 1629
1630 topLayout->addWidget( mDetailsSplitter ); 1630 topLayout->addWidget( mDetailsSplitter );
1631 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1631 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1632#else //KAB_NOSPLITTER 1632#else //KAB_NOSPLITTER
1633 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1633 QHBoxLayout *topLayout = new QHBoxLayout( this );
1634//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1634//US topLayout->setSpacing( KDialogBase::spacingHint() );
1635 topLayout->setSpacing( 10 ); 1635 topLayout->setSpacing( 10 );
1636 1636
1637// mDetailsSplitter = new QSplitter( this ); 1637// mDetailsSplitter = new QSplitter( this );
1638 1638
1639 QVBox *viewSpace = new QVBox( this ); 1639 QVBox *viewSpace = new QVBox( this );
1640 1640
1641 mViewManager = new ViewManager( this, viewSpace ); 1641 mViewManager = new ViewManager( this, viewSpace );
1642 viewSpace->setStretchFactor( mViewManager, 1 ); 1642 viewSpace->setStretchFactor( mViewManager, 1 );
1643 1643
1644 mDetails = new ViewContainer( this ); 1644 mDetails = new ViewContainer( this );
1645 1645
1646 topLayout->addWidget( viewSpace ); 1646 topLayout->addWidget( viewSpace );
1647// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1647// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1648 topLayout->addWidget( mDetails ); 1648 topLayout->addWidget( mDetails );
1649#endif //KAB_NOSPLITTER 1649#endif //KAB_NOSPLITTER
1650*/ 1650*/
1651 1651
1652 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1652 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1653 syncManager->setBlockSave(false); 1653 syncManager->setBlockSave(false);
1654 1654
1655 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1655 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1656 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1656 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1657 syncManager->setDefaultFileName( sentSyncFile()); 1657 syncManager->setDefaultFileName( sentSyncFile());
1658 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1658 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1659 1659
1660#endif //KAB_EMBEDDED 1660#endif //KAB_EMBEDDED
1661 initActions(); 1661 initActions();
1662 1662
1663#ifdef KAB_EMBEDDED 1663#ifdef KAB_EMBEDDED
1664 addActionsManually(); 1664 addActionsManually();
1665 //US make sure the export and import menues are initialized before creating the xxPortManager. 1665 //US make sure the export and import menues are initialized before creating the xxPortManager.
1666 mXXPortManager = new XXPortManager( this, this ); 1666 mXXPortManager = new XXPortManager( this, this );
1667 1667
1668 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1668 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1669 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1669 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1670 // mActionQuit->plug ( mMainWindow->toolBar()); 1670 // mActionQuit->plug ( mMainWindow->toolBar());
1671 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1671 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1672 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1672 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1673 // mIncSearchWidget->hide(); 1673 // mIncSearchWidget->hide();
1674 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1674 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1675 SLOT( incrementalSearch( const QString& ) ) ); 1675 SLOT( incrementalSearch( const QString& ) ) );
1676 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1676 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1677 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1677 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1678 1678
1679 mJumpButtonBar = new JumpButtonBar( this, this ); 1679 mJumpButtonBar = new JumpButtonBar( this, this );
1680 1680
1681 topLayout->addWidget( mJumpButtonBar ); 1681 topLayout->addWidget( mJumpButtonBar );
1682//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1682//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1683 1683
1684// mMainWindow->getIconToolBar()->raise(); 1684// mMainWindow->getIconToolBar()->raise();
1685 1685
1686#endif //KAB_EMBEDDED 1686#endif //KAB_EMBEDDED
1687 1687
1688} 1688}
1689void KABCore::initActions() 1689void KABCore::initActions()
1690{ 1690{
1691//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1691//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1692 1692
1693#ifndef KAB_EMBEDDED 1693#ifndef KAB_EMBEDDED
1694 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1694 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1695 SLOT( clipboardDataChanged() ) ); 1695 SLOT( clipboardDataChanged() ) );
1696#endif //KAB_EMBEDDED 1696#endif //KAB_EMBEDDED
1697 1697
1698 // file menu 1698 // file menu
1699 if ( mIsPart ) { 1699 if ( mIsPart ) {
1700 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1700 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1701 SLOT( sendMail() ), actionCollection(), 1701 SLOT( sendMail() ), actionCollection(),
1702 "kaddressbook_mail" ); 1702 "kaddressbook_mail" );
1703 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1703 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1704 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1704 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1705 1705
1706 } else { 1706 } else {
1707 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1707 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1708 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1708 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1709 } 1709 }
1710 1710
1711 1711
1712 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1712 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1713 SLOT( save() ), actionCollection(), "file_sync" ); 1713 SLOT( save() ), actionCollection(), "file_sync" );
1714 1714
1715 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1715 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1716 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1716 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1717 1717
1718 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1718 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1719 this, SLOT( mailVCard() ), 1719 this, SLOT( mailVCard() ),
1720 actionCollection(), "file_mail_vcard"); 1720 actionCollection(), "file_mail_vcard");
1721 1721
1722 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, 1722 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this,
1723 SLOT( export2phone() ), actionCollection(), 1723 SLOT( export2phone() ), actionCollection(),
1724 "kaddressbook_ex2phone" ); 1724 "kaddressbook_ex2phone" );
1725 1725
1726 mActionBeamVCard = 0; 1726 mActionBeamVCard = 0;
1727 mActionBeam = 0; 1727 mActionBeam = 0;
1728 1728
1729#ifndef DESKTOP_VERSION 1729#ifndef DESKTOP_VERSION
1730 if ( Ir::supported() ) { 1730 if ( Ir::supported() ) {
1731 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1731 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1732 SLOT( beamVCard() ), actionCollection(), 1732 SLOT( beamVCard() ), actionCollection(),
1733 "kaddressbook_beam_vcard" ); 1733 "kaddressbook_beam_vcard" );
1734 1734
1735 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1735 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1736 SLOT( beamMySelf() ), actionCollection(), 1736 SLOT( beamMySelf() ), actionCollection(),
1737 "kaddressbook_beam_myself" ); 1737 "kaddressbook_beam_myself" );
1738 } 1738 }
1739#endif 1739#endif
1740 1740
1741 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1741 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1742 this, SLOT( editContact2() ), 1742 this, SLOT( editContact2() ),
1743 actionCollection(), "file_properties" ); 1743 actionCollection(), "file_properties" );
1744 1744
1745#ifdef KAB_EMBEDDED 1745#ifdef KAB_EMBEDDED
1746 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1746 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1747 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1747 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1748 mMainWindow, SLOT( exit() ), 1748 mMainWindow, SLOT( exit() ),
1749 actionCollection(), "quit" ); 1749 actionCollection(), "quit" );
1750#endif //KAB_EMBEDDED 1750#endif //KAB_EMBEDDED
1751 1751
1752 // edit menu 1752 // edit menu
1753 if ( mIsPart ) { 1753 if ( mIsPart ) {
1754 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1754 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1755 SLOT( copyContacts() ), actionCollection(), 1755 SLOT( copyContacts() ), actionCollection(),
1756 "kaddressbook_copy" ); 1756 "kaddressbook_copy" );
1757 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1757 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1758 SLOT( cutContacts() ), actionCollection(), 1758 SLOT( cutContacts() ), actionCollection(),
1759 "kaddressbook_cut" ); 1759 "kaddressbook_cut" );
1760 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1760 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1761 SLOT( pasteContacts() ), actionCollection(), 1761 SLOT( pasteContacts() ), actionCollection(),
1762 "kaddressbook_paste" ); 1762 "kaddressbook_paste" );
1763 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1763 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1764 SLOT( selectAllContacts() ), actionCollection(), 1764 SLOT( selectAllContacts() ), actionCollection(),
1765 "kaddressbook_select_all" ); 1765 "kaddressbook_select_all" );
1766 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1766 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1767 SLOT( undo() ), actionCollection(), 1767 SLOT( undo() ), actionCollection(),
1768 "kaddressbook_undo" ); 1768 "kaddressbook_undo" );
1769 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1769 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1770 this, SLOT( redo() ), actionCollection(), 1770 this, SLOT( redo() ), actionCollection(),
1771 "kaddressbook_redo" ); 1771 "kaddressbook_redo" );
1772 } else { 1772 } else {
1773 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1773 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1774 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1774 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1775 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1775 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1776 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1776 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1777 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1777 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1778 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1778 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1779 } 1779 }
1780 1780
1781 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1781 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1782 Key_Delete, this, SLOT( deleteContacts() ), 1782 Key_Delete, this, SLOT( deleteContacts() ),
1783 actionCollection(), "edit_delete" ); 1783 actionCollection(), "edit_delete" );
1784 1784
1785 mActionUndo->setEnabled( false ); 1785 mActionUndo->setEnabled( false );
1786 mActionRedo->setEnabled( false ); 1786 mActionRedo->setEnabled( false );
1787 1787
1788 // settings menu 1788 // settings menu
1789#ifdef KAB_EMBEDDED 1789#ifdef KAB_EMBEDDED
1790//US special menuentry to configure the addressbook resources. On KDE 1790//US special menuentry to configure the addressbook resources. On KDE
1791// you do that through the control center !!! 1791// you do that through the control center !!!
1792 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1792 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1793 SLOT( configureResources() ), actionCollection(), 1793 SLOT( configureResources() ), actionCollection(),
1794 "kaddressbook_configure_resources" ); 1794 "kaddressbook_configure_resources" );
1795#endif //KAB_EMBEDDED 1795#endif //KAB_EMBEDDED
1796 1796
1797 if ( mIsPart ) { 1797 if ( mIsPart ) {
1798 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1798 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1799 SLOT( openConfigDialog() ), actionCollection(), 1799 SLOT( openConfigDialog() ), actionCollection(),
1800 "kaddressbook_configure" ); 1800 "kaddressbook_configure" );
1801 1801
1802 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1802 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1803 this, SLOT( configureKeyBindings() ), actionCollection(), 1803 this, SLOT( configureKeyBindings() ), actionCollection(),
1804 "kaddressbook_configure_shortcuts" ); 1804 "kaddressbook_configure_shortcuts" );
1805#ifdef KAB_EMBEDDED 1805#ifdef KAB_EMBEDDED
1806 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1806 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1807 mActionConfigureToolbars->setEnabled( false ); 1807 mActionConfigureToolbars->setEnabled( false );
1808#endif //KAB_EMBEDDED 1808#endif //KAB_EMBEDDED
1809 1809
1810 } else { 1810 } else {
1811 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1811 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1812 1812
1813 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1813 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1814 } 1814 }
1815 1815
1816 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1816 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1817 actionCollection(), "options_show_jump_bar" ); 1817 actionCollection(), "options_show_jump_bar" );
1818 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1818 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1819 1819
1820 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1820 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1821 actionCollection(), "options_show_details" ); 1821 actionCollection(), "options_show_details" );
1822 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1822 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1823 1823
1824 // misc 1824 // misc
1825 // only enable LDAP lookup if we can handle the protocol 1825 // only enable LDAP lookup if we can handle the protocol
1826#ifndef KAB_EMBEDDED 1826#ifndef KAB_EMBEDDED
1827 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1827 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1828 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1828 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1829 this, SLOT( openLDAPDialog() ), actionCollection(), 1829 this, SLOT( openLDAPDialog() ), actionCollection(),
1830 "ldap_lookup" ); 1830 "ldap_lookup" );
1831 } 1831 }
1832#else //KAB_EMBEDDED 1832#else //KAB_EMBEDDED
1833 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1833 //qDebug("KABCore::initActions() LDAP has to be implemented");
1834#endif //KAB_EMBEDDED 1834#endif //KAB_EMBEDDED
1835 1835
1836 1836
1837 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1837 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1838 SLOT( setWhoAmI() ), actionCollection(), 1838 SLOT( setWhoAmI() ), actionCollection(),
1839 "set_personal" ); 1839 "set_personal" );
1840 1840
1841 1841
1842 1842
1843 1843
1844 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1844 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1845 SLOT( setCategories() ), actionCollection(), 1845 SLOT( setCategories() ), actionCollection(),
1846 "edit_set_categories" ); 1846 "edit_set_categories" );
1847 1847
1848 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1848 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1849 SLOT( removeVoice() ), actionCollection(), 1849 SLOT( removeVoice() ), actionCollection(),
1850 "remove_voice" ); 1850 "remove_voice" );
1851 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1851 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1852 SLOT( importFromOL() ), actionCollection(), 1852 SLOT( importFromOL() ), actionCollection(),
1853 "import_OL" ); 1853 "import_OL" );
1854#ifdef KAB_EMBEDDED 1854#ifdef KAB_EMBEDDED
1855 mActionLicence = new KAction( i18n( "Licence" ), 0, 1855 mActionLicence = new KAction( i18n( "Licence" ), 0,
1856 this, SLOT( showLicence() ), actionCollection(), 1856 this, SLOT( showLicence() ), actionCollection(),
1857 "licence_about_data" ); 1857 "licence_about_data" );
1858 mActionFaq = new KAction( i18n( "Faq" ), 0, 1858 mActionFaq = new KAction( i18n( "Faq" ), 0,
1859 this, SLOT( faq() ), actionCollection(), 1859 this, SLOT( faq() ), actionCollection(),
1860 "faq_about_data" ); 1860 "faq_about_data" );
1861 mActionWN = new KAction( i18n( "What's New?" ), 0,
1862 this, SLOT( whatsnew() ), actionCollection(),
1863 "wn" );
1864 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1865 this, SLOT( synchowto() ), actionCollection(),
1866 "sync" );
1861 1867
1862 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1868 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1863 this, SLOT( createAboutData() ), actionCollection(), 1869 this, SLOT( createAboutData() ), actionCollection(),
1864 "kaddressbook_about_data" ); 1870 "kaddressbook_about_data" );
1865#endif //KAB_EMBEDDED 1871#endif //KAB_EMBEDDED
1866 1872
1867 clipboardDataChanged(); 1873 clipboardDataChanged();
1868 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1874 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1869 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1875 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1870} 1876}
1871 1877
1872//US we need this function, to plug all actions into the correct menues. 1878//US we need this function, to plug all actions into the correct menues.
1873// KDE uses a XML format to plug the actions, but we work her without this overhead. 1879// KDE uses a XML format to plug the actions, but we work her without this overhead.
1874void KABCore::addActionsManually() 1880void KABCore::addActionsManually()
1875{ 1881{
1876//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1882//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1877 1883
1878#ifdef KAB_EMBEDDED 1884#ifdef KAB_EMBEDDED
1879 QPopupMenu *fileMenu = new QPopupMenu( this ); 1885 QPopupMenu *fileMenu = new QPopupMenu( this );
1880 QPopupMenu *editMenu = new QPopupMenu( this ); 1886 QPopupMenu *editMenu = new QPopupMenu( this );
1881 QPopupMenu *helpMenu = new QPopupMenu( this ); 1887 QPopupMenu *helpMenu = new QPopupMenu( this );
1882 1888
1883 KToolBar* tb = mMainWindow->toolBar(); 1889 KToolBar* tb = mMainWindow->toolBar();
1884 1890
1885#ifdef DESKTOP_VERSION 1891#ifdef DESKTOP_VERSION
1886 QMenuBar* mb = mMainWindow->menuBar(); 1892 QMenuBar* mb = mMainWindow->menuBar();
1887 1893
1888 //US setup menubar. 1894 //US setup menubar.
1889 //Disable the following block if you do not want to have a menubar. 1895 //Disable the following block if you do not want to have a menubar.
1890 mb->insertItem( "&File", fileMenu ); 1896 mb->insertItem( "&File", fileMenu );
1891 mb->insertItem( "&Edit", editMenu ); 1897 mb->insertItem( "&Edit", editMenu );
1892 mb->insertItem( "&View", viewMenu ); 1898 mb->insertItem( "&View", viewMenu );
1893 mb->insertItem( "&Settings", settingsMenu ); 1899 mb->insertItem( "&Settings", settingsMenu );
1894 mb->insertItem( i18n("Synchronize"), syncMenu ); 1900 mb->insertItem( i18n("Synchronize"), syncMenu );
1895 mb->insertItem( "&Change selected", changeMenu ); 1901 mb->insertItem( "&Change selected", changeMenu );
1896 mb->insertItem( "&Help", helpMenu ); 1902 mb->insertItem( "&Help", helpMenu );
1897 mIncSearchWidget = new IncSearchWidget( tb ); 1903 mIncSearchWidget = new IncSearchWidget( tb );
1898 // tb->insertWidget(-1, 0, mIncSearchWidget); 1904 // tb->insertWidget(-1, 0, mIncSearchWidget);
1899 1905
1900#else 1906#else
1901 //US setup toolbar 1907 //US setup toolbar
1902 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 1908 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
1903 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1909 QPopupMenu *popupBarTB = new QPopupMenu( this );
1904 menuBarTB->insertItem( "ME", popupBarTB); 1910 menuBarTB->insertItem( "ME", popupBarTB);
1905 tb->insertWidget(-1, 0, menuBarTB); 1911 tb->insertWidget(-1, 0, menuBarTB);
1906 mIncSearchWidget = new IncSearchWidget( tb ); 1912 mIncSearchWidget = new IncSearchWidget( tb );
1907 1913
1908 tb->enableMoving(false); 1914 tb->enableMoving(false);
1909 popupBarTB->insertItem( "&File", fileMenu ); 1915 popupBarTB->insertItem( "&File", fileMenu );
1910 popupBarTB->insertItem( "&Edit", editMenu ); 1916 popupBarTB->insertItem( "&Edit", editMenu );
1911 popupBarTB->insertItem( "&View", viewMenu ); 1917 popupBarTB->insertItem( "&View", viewMenu );
1912 popupBarTB->insertItem( "&Settings", settingsMenu ); 1918 popupBarTB->insertItem( "&Settings", settingsMenu );
1913 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 1919 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
1914 mViewManager->getFilterAction()->plug ( popupBarTB); 1920 mViewManager->getFilterAction()->plug ( popupBarTB);
1915 popupBarTB->insertItem( "&Change selected", changeMenu ); 1921 popupBarTB->insertItem( "&Change selected", changeMenu );
1916 popupBarTB->insertItem( "&Help", helpMenu ); 1922 popupBarTB->insertItem( "&Help", helpMenu );
1917 if (QApplication::desktop()->width() > 320 ) { 1923 if (QApplication::desktop()->width() > 320 ) {
1918 // mViewManager->getFilterAction()->plug ( tb); 1924 // mViewManager->getFilterAction()->plug ( tb);
1919 } 1925 }
1920#endif 1926#endif
1921 // mActionQuit->plug ( mMainWindow->toolBar()); 1927 // mActionQuit->plug ( mMainWindow->toolBar());
1922 1928
1923 1929
1924 1930
1925 //US Now connect the actions with the menue entries. 1931 //US Now connect the actions with the menue entries.
1926 mActionPrint->plug( fileMenu ); 1932 mActionPrint->plug( fileMenu );
1927 mActionMail->plug( fileMenu ); 1933 mActionMail->plug( fileMenu );
1928 fileMenu->insertSeparator(); 1934 fileMenu->insertSeparator();
1929 1935
1930 mActionNewContact->plug( fileMenu ); 1936 mActionNewContact->plug( fileMenu );
1931 mActionNewContact->plug( tb ); 1937 mActionNewContact->plug( tb );
1932 1938
1933 mActionEditAddressee->plug( fileMenu ); 1939 mActionEditAddressee->plug( fileMenu );
1934 if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 1940 if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1935 (!KABPrefs::instance()->mMultipleViewsAtOnce )) 1941 (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1936 mActionEditAddressee->plug( tb ); 1942 mActionEditAddressee->plug( tb );
1937 1943
1938 fileMenu->insertSeparator(); 1944 fileMenu->insertSeparator();
1939 mActionSave->plug( fileMenu ); 1945 mActionSave->plug( fileMenu );
1940 fileMenu->insertItem( "&Import", ImportMenu ); 1946 fileMenu->insertItem( "&Import", ImportMenu );
1941 fileMenu->insertItem( "&Export", ExportMenu ); 1947 fileMenu->insertItem( "&Export", ExportMenu );
1942 fileMenu->insertSeparator(); 1948 fileMenu->insertSeparator();
1943 mActionMailVCard->plug( fileMenu ); 1949 mActionMailVCard->plug( fileMenu );
1944#ifndef DESKTOP_VERSION 1950#ifndef DESKTOP_VERSION
1945 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1951 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1946 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1952 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1947#endif 1953#endif
1948 fileMenu->insertSeparator(); 1954 fileMenu->insertSeparator();
1949 mActionQuit->plug( fileMenu ); 1955 mActionQuit->plug( fileMenu );
1950#ifdef _WIN32_ 1956#ifdef _WIN32_
1951 mActionImportOL->plug( ImportMenu ); 1957 mActionImportOL->plug( ImportMenu );
1952#endif 1958#endif
1953 // edit menu 1959 // edit menu
1954 mActionUndo->plug( editMenu ); 1960 mActionUndo->plug( editMenu );
1955 mActionRedo->plug( editMenu ); 1961 mActionRedo->plug( editMenu );
1956 editMenu->insertSeparator(); 1962 editMenu->insertSeparator();
1957 mActionCut->plug( editMenu ); 1963 mActionCut->plug( editMenu );
1958 mActionCopy->plug( editMenu ); 1964 mActionCopy->plug( editMenu );
1959 mActionPaste->plug( editMenu ); 1965 mActionPaste->plug( editMenu );
1960 mActionDelete->plug( editMenu ); 1966 mActionDelete->plug( editMenu );
1961 editMenu->insertSeparator(); 1967 editMenu->insertSeparator();
1962 mActionSelectAll->plug( editMenu ); 1968 mActionSelectAll->plug( editMenu );
1963 1969
1964 mActionRemoveVoice->plug( changeMenu ); 1970 mActionRemoveVoice->plug( changeMenu );
1965 // settings menu 1971 // settings menu
1966//US special menuentry to configure the addressbook resources. On KDE 1972//US special menuentry to configure the addressbook resources. On KDE
1967// you do that through the control center !!! 1973// you do that through the control center !!!
1968 mActionConfigResources->plug( settingsMenu ); 1974 mActionConfigResources->plug( settingsMenu );
1969 settingsMenu->insertSeparator(); 1975 settingsMenu->insertSeparator();
1970 1976
1971 mActionConfigKAddressbook->plug( settingsMenu ); 1977 mActionConfigKAddressbook->plug( settingsMenu );
1972 1978
1973 if ( mIsPart ) { 1979 if ( mIsPart ) {
1974 mActionConfigShortcuts->plug( settingsMenu ); 1980 mActionConfigShortcuts->plug( settingsMenu );
1975 mActionConfigureToolbars->plug( settingsMenu ); 1981 mActionConfigureToolbars->plug( settingsMenu );
1976 1982
1977 } else { 1983 } else {
1978 mActionKeyBindings->plug( settingsMenu ); 1984 mActionKeyBindings->plug( settingsMenu );
1979 } 1985 }
1980 1986
1981 settingsMenu->insertSeparator(); 1987 settingsMenu->insertSeparator();
1982 1988
1983 mActionJumpBar->plug( settingsMenu ); 1989 mActionJumpBar->plug( settingsMenu );
1984 mActionDetails->plug( settingsMenu ); 1990 mActionDetails->plug( settingsMenu );
1985 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 1991 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
1986 mActionDetails->plug( tb ); 1992 mActionDetails->plug( tb );
1987 settingsMenu->insertSeparator(); 1993 settingsMenu->insertSeparator();
1988 1994
1989 mActionWhoAmI->plug( settingsMenu ); 1995 mActionWhoAmI->plug( settingsMenu );
1990 mActionCategories->plug( settingsMenu ); 1996 mActionCategories->plug( settingsMenu );
1991 1997
1998
1999 mActionWN->plug( helpMenu );
2000 mActionSyncHowto->plug( helpMenu );
1992 mActionLicence->plug( helpMenu ); 2001 mActionLicence->plug( helpMenu );
1993 mActionFaq->plug( helpMenu ); 2002 mActionFaq->plug( helpMenu );
1994 mActionAboutKAddressbook->plug( helpMenu ); 2003 mActionAboutKAddressbook->plug( helpMenu );
1995 2004
1996 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2005 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1997 2006
1998 mActionSave->plug( tb ); 2007 mActionSave->plug( tb );
1999 mViewManager->getFilterAction()->plug ( tb); 2008 mViewManager->getFilterAction()->plug ( tb);
2000 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2009 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2001 mActionUndo->plug( tb ); 2010 mActionUndo->plug( tb );
2002 mActionDelete->plug( tb ); 2011 mActionDelete->plug( tb );
2003 mActionRedo->plug( tb ); 2012 mActionRedo->plug( tb );
2004 } 2013 }
2005 } 2014 }
2006 //mActionQuit->plug ( tb ); 2015 //mActionQuit->plug ( tb );
2007 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2016 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2008 2017
2009 //US link the searchwidget first to this. 2018 //US link the searchwidget first to this.
2010 // The real linkage to the toolbar happens later. 2019 // The real linkage to the toolbar happens later.
2011//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2020//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2012//US tb->insertItem( mIncSearchWidget ); 2021//US tb->insertItem( mIncSearchWidget );
2013/*US 2022/*US
2014 mIncSearchWidget = new IncSearchWidget( tb ); 2023 mIncSearchWidget = new IncSearchWidget( tb );
2015 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2024 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2016 SLOT( incrementalSearch( const QString& ) ) ); 2025 SLOT( incrementalSearch( const QString& ) ) );
2017 2026
2018 mJumpButtonBar = new JumpButtonBar( this, this ); 2027 mJumpButtonBar = new JumpButtonBar( this, this );
2019 2028
2020//US topLayout->addWidget( mJumpButtonBar ); 2029//US topLayout->addWidget( mJumpButtonBar );
2021 this->layout()->add( mJumpButtonBar ); 2030 this->layout()->add( mJumpButtonBar );
2022*/ 2031*/
2023 2032
2024#endif //KAB_EMBEDDED 2033#endif //KAB_EMBEDDED
2025 2034
2026 mActionExport2phone->plug( ExportMenu ); 2035 mActionExport2phone->plug( ExportMenu );
2027 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2036 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2028 syncManager->fillSyncMenu(); 2037 syncManager->fillSyncMenu();
2029 2038
2030} 2039}
2031void KABCore::showLicence() 2040void KABCore::showLicence()
2032{ 2041{
2033 KApplication::showLicence(); 2042 KApplication::showLicence();
2034} 2043}
2035void KABCore::removeVoice() 2044void KABCore::removeVoice()
2036{ 2045{
2037 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 ) 2046 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 )
2038 return; 2047 return;
2039 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2048 KABC::Addressee::List list = mViewManager->selectedAddressees();
2040 KABC::Addressee::List::Iterator it; 2049 KABC::Addressee::List::Iterator it;
2041 for ( it = list.begin(); it != list.end(); ++it ) { 2050 for ( it = list.begin(); it != list.end(); ++it ) {
2042 2051
2043 if ( (*it).removeVoice() ) 2052 if ( (*it).removeVoice() )
2044 contactModified((*it) ); 2053 contactModified((*it) );
2045 } 2054 }
2046} 2055}
2047 2056
2048 2057
2049 2058
2050void KABCore::clipboardDataChanged() 2059void KABCore::clipboardDataChanged()
2051{ 2060{
2052 2061
2053 if ( mReadWrite ) 2062 if ( mReadWrite )
2054 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2063 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2055 2064
2056} 2065}
2057 2066
2058void KABCore::updateActionMenu() 2067void KABCore::updateActionMenu()
2059{ 2068{
2060 UndoStack *undo = UndoStack::instance(); 2069 UndoStack *undo = UndoStack::instance();
2061 RedoStack *redo = RedoStack::instance(); 2070 RedoStack *redo = RedoStack::instance();
2062 2071
2063 if ( undo->isEmpty() ) 2072 if ( undo->isEmpty() )
2064 mActionUndo->setText( i18n( "Undo" ) ); 2073 mActionUndo->setText( i18n( "Undo" ) );
2065 else 2074 else
2066 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2075 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2067 2076
2068 mActionUndo->setEnabled( !undo->isEmpty() ); 2077 mActionUndo->setEnabled( !undo->isEmpty() );
2069 2078
2070 if ( !redo->top() ) 2079 if ( !redo->top() )
2071 mActionRedo->setText( i18n( "Redo" ) ); 2080 mActionRedo->setText( i18n( "Redo" ) );
2072 else 2081 else
2073 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2082 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2074 2083
2075 mActionRedo->setEnabled( !redo->isEmpty() ); 2084 mActionRedo->setEnabled( !redo->isEmpty() );
2076} 2085}
2077 2086
2078void KABCore::configureKeyBindings() 2087void KABCore::configureKeyBindings()
2079{ 2088{
2080#ifndef KAB_EMBEDDED 2089#ifndef KAB_EMBEDDED
2081 KKeyDialog::configure( actionCollection(), true ); 2090 KKeyDialog::configure( actionCollection(), true );
2082#else //KAB_EMBEDDED 2091#else //KAB_EMBEDDED
2083 qDebug("KABCore::configureKeyBindings() not implemented"); 2092 qDebug("KABCore::configureKeyBindings() not implemented");
2084#endif //KAB_EMBEDDED 2093#endif //KAB_EMBEDDED
2085} 2094}
2086 2095
2087#ifdef KAB_EMBEDDED 2096#ifdef KAB_EMBEDDED
2088void KABCore::configureResources() 2097void KABCore::configureResources()
2089{ 2098{
2090 KRES::KCMKResources dlg( this, "" , 0 ); 2099 KRES::KCMKResources dlg( this, "" , 0 );
2091 2100
2092 if ( !dlg.exec() ) 2101 if ( !dlg.exec() )
2093 return; 2102 return;
2094 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2103 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2095} 2104}
2096#endif //KAB_EMBEDDED 2105#endif //KAB_EMBEDDED
2097 2106
2098 2107
2099/* this method will be called through the QCop interface from Ko/Pi to select addresses 2108/* this method will be called through the QCop interface from Ko/Pi to select addresses
2100 * for the attendees list of an event. 2109 * for the attendees list of an event.
2101 */ 2110 */
2102void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2111void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2103{ 2112{
2104 QStringList nameList; 2113 QStringList nameList;
2105 QStringList emailList; 2114 QStringList emailList;
2106 QStringList uidList; 2115 QStringList uidList;
2107 2116
2108 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2117 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2109 uint i=0; 2118 uint i=0;
2110 for (i=0; i < list.count(); i++) 2119 for (i=0; i < list.count(); i++)
2111 { 2120 {
2112 nameList.append(list[i].realName()); 2121 nameList.append(list[i].realName());
2113 emailList.append(list[i].preferredEmail()); 2122 emailList.append(list[i].preferredEmail());
2114 uidList.append(list[i].uid()); 2123 uidList.append(list[i].uid());
2115 } 2124 }
2116 2125
2117 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2126 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2118 2127
2119} 2128}
2120 2129
2121/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2130/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2122 * to put them into the calendar. 2131 * to put them into the calendar.
2123 */ 2132 */
2124void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2133void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2125{ 2134{
2126 // qDebug("KABCore::requestForBirthdayList"); 2135 // qDebug("KABCore::requestForBirthdayList");
2127 QStringList birthdayList; 2136 QStringList birthdayList;
2128 QStringList anniversaryList; 2137 QStringList anniversaryList;
2129 QStringList realNameList; 2138 QStringList realNameList;
2130 QStringList preferredEmailList; 2139 QStringList preferredEmailList;
2131 QStringList assembledNameList; 2140 QStringList assembledNameList;
2132 QStringList uidList; 2141 QStringList uidList;
2133 2142
2134 KABC::AddressBook::Iterator it; 2143 KABC::AddressBook::Iterator it;
2135 2144
2136 int count = 0; 2145 int count = 0;
2137 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2146 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2138 ++count; 2147 ++count;
2139 } 2148 }
2140 QProgressBar bar(count,0 ); 2149 QProgressBar bar(count,0 );
2141 int w = 300; 2150 int w = 300;
2142 if ( QApplication::desktop()->width() < 320 ) 2151 if ( QApplication::desktop()->width() < 320 )
2143 w = 220; 2152 w = 220;
2144 int h = bar.sizeHint().height() ; 2153 int h = bar.sizeHint().height() ;
2145 int dw = QApplication::desktop()->width(); 2154 int dw = QApplication::desktop()->width();
2146 int dh = QApplication::desktop()->height(); 2155 int dh = QApplication::desktop()->height();
2147 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2156 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2148 bar.show(); 2157 bar.show();
2149 bar.setCaption (i18n("collecting birthdays - close to abort!") ); 2158 bar.setCaption (i18n("collecting birthdays - close to abort!") );
2150 qApp->processEvents(); 2159 qApp->processEvents();
2151 2160
2152 QDate bday; 2161 QDate bday;
2153 QString anni; 2162 QString anni;
2154 QString formattedbday; 2163 QString formattedbday;
2155 2164
2156 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2165 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2157 { 2166 {
2158 if ( ! bar.isVisible() ) 2167 if ( ! bar.isVisible() )
2159 return; 2168 return;
2160 bar.setProgress( count++ ); 2169 bar.setProgress( count++ );
2161 qApp->processEvents(); 2170 qApp->processEvents();
2162 bday = (*it).birthday().date(); 2171 bday = (*it).birthday().date();
2163 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2172 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2164 2173
2165 if ( bday.isValid() || !anni.isEmpty()) 2174 if ( bday.isValid() || !anni.isEmpty())
2166 { 2175 {
2167 if (bday.isValid()) 2176 if (bday.isValid())
2168 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2177 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2169 else 2178 else
2170 formattedbday = "NOTVALID"; 2179 formattedbday = "NOTVALID";
2171 if (anni.isEmpty()) 2180 if (anni.isEmpty())
2172 anni = "INVALID"; 2181 anni = "INVALID";
2173 2182
2174 birthdayList.append(formattedbday); 2183 birthdayList.append(formattedbday);
2175 anniversaryList.append(anni); //should be ISODate 2184 anniversaryList.append(anni); //should be ISODate
2176 realNameList.append((*it).realName()); 2185 realNameList.append((*it).realName());
2177 preferredEmailList.append((*it).preferredEmail()); 2186 preferredEmailList.append((*it).preferredEmail());
2178 assembledNameList.append((*it).assembledName()); 2187 assembledNameList.append((*it).assembledName());
2179 uidList.append((*it).uid()); 2188 uidList.append((*it).uid());
2180 2189
2181 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() ); 2190 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() );
2182 } 2191 }
2183 } 2192 }
2184 2193
2185 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2194 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2186 2195
2187} 2196}
2188 2197
2189/* this method will be called through the QCop interface from other apps to show details of a contact. 2198/* this method will be called through the QCop interface from other apps to show details of a contact.
2190 */ 2199 */
2191void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2200void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2192{ 2201{
2193 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2202 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2194 2203
2195 QString foundUid = QString::null; 2204 QString foundUid = QString::null;
2196 if ( ! uid.isEmpty() ) { 2205 if ( ! uid.isEmpty() ) {
2197 Addressee adrr = mAddressBook->findByUid( uid ); 2206 Addressee adrr = mAddressBook->findByUid( uid );
2198 if ( !adrr.isEmpty() ) { 2207 if ( !adrr.isEmpty() ) {
2199 foundUid = uid; 2208 foundUid = uid;
2200 } 2209 }
2201 if ( email == "sendbacklist" ) { 2210 if ( email == "sendbacklist" ) {
2202 //qDebug("ssssssssssssssssssssssend "); 2211 //qDebug("ssssssssssssssssssssssend ");
2203 QStringList nameList; 2212 QStringList nameList;
2204 QStringList emailList; 2213 QStringList emailList;
2205 QStringList uidList; 2214 QStringList uidList;
2206 nameList.append(adrr.realName()); 2215 nameList.append(adrr.realName());
2207 emailList = adrr.emails(); 2216 emailList = adrr.emails();
2208 uidList.append( adrr.preferredEmail()); 2217 uidList.append( adrr.preferredEmail());
2209 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2218 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2210 return; 2219 return;
2211 } 2220 }
2212 2221
2213 } 2222 }
2214 2223
2215 if ( email == "sendbacklist" ) 2224 if ( email == "sendbacklist" )
2216 return; 2225 return;
2217 if (foundUid.isEmpty()) 2226 if (foundUid.isEmpty())
2218 { 2227 {
2219 //find the uid of the person first 2228 //find the uid of the person first
2220 Addressee::List namelist; 2229 Addressee::List namelist;
2221 Addressee::List emaillist; 2230 Addressee::List emaillist;
2222 2231
2223 if (!name.isEmpty()) 2232 if (!name.isEmpty())
2224 namelist = mAddressBook->findByName( name ); 2233 namelist = mAddressBook->findByName( name );
2225 2234
2226 if (!email.isEmpty()) 2235 if (!email.isEmpty())
2227 emaillist = mAddressBook->findByEmail( email ); 2236 emaillist = mAddressBook->findByEmail( email );
2228 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2237 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2229 //check if we have a match in Namelist and Emaillist 2238 //check if we have a match in Namelist and Emaillist
2230 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2239 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2231 foundUid = emaillist[0].uid(); 2240 foundUid = emaillist[0].uid();
2232 } 2241 }
2233 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2242 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2234 foundUid = namelist[0].uid(); 2243 foundUid = namelist[0].uid();
2235 else 2244 else
2236 { 2245 {
2237 for (int i = 0; i < namelist.count(); i++) 2246 for (int i = 0; i < namelist.count(); i++)
2238 { 2247 {
2239 for (int j = 0; j < emaillist.count(); j++) 2248 for (int j = 0; j < emaillist.count(); j++)
2240 { 2249 {
2241 if (namelist[i] == emaillist[j]) 2250 if (namelist[i] == emaillist[j])
2242 { 2251 {
2243 foundUid = namelist[i].uid(); 2252 foundUid = namelist[i].uid();
2244 } 2253 }
2245 } 2254 }
2246 } 2255 }
2247 } 2256 }
2248 } 2257 }
2249 else 2258 else
2250 { 2259 {
2251 foundUid = uid; 2260 foundUid = uid;
2252 } 2261 }
2253 2262
2254 if (!foundUid.isEmpty()) 2263 if (!foundUid.isEmpty())
2255 { 2264 {
2256 2265
2257 // raise Ka/Pi if it is in the background 2266 // raise Ka/Pi if it is in the background
2258#ifndef DESKTOP_VERSION 2267#ifndef DESKTOP_VERSION
2259#ifndef KORG_NODCOP 2268#ifndef KORG_NODCOP
2260 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2269 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2261#endif 2270#endif
2262#endif 2271#endif
2263 2272
2264 mMainWindow->showMaximized(); 2273 mMainWindow->showMaximized();
2265 mMainWindow-> raise(); 2274 mMainWindow-> raise();
2266 2275
2267 mViewManager->setSelected( "", false); 2276 mViewManager->setSelected( "", false);
2268 mViewManager->refreshView( "" ); 2277 mViewManager->refreshView( "" );
2269 mViewManager->setSelected( foundUid, true ); 2278 mViewManager->setSelected( foundUid, true );
2270 mViewManager->refreshView( foundUid ); 2279 mViewManager->refreshView( foundUid );
2271 2280
2272 if ( !mMultipleViewsAtOnce ) 2281 if ( !mMultipleViewsAtOnce )
2273 { 2282 {
2274 setDetailsVisible( true ); 2283 setDetailsVisible( true );
2275 mActionDetails->setChecked(true); 2284 mActionDetails->setChecked(true);
2276 } 2285 }
2277 } 2286 }
2278} 2287}
2279 2288
2289void KABCore::whatsnew()
2290{
2291 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2292}
2293void KABCore::synchowto()
2294{
2295 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2296}
2280 2297
2281void KABCore::faq() 2298void KABCore::faq()
2282{ 2299{
2283 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2300 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2284} 2301}
2285 2302
2286#include <libkcal/syncdefines.h> 2303#include <libkcal/syncdefines.h>
2287 2304
2288KABC::Addressee KABCore::getLastSyncAddressee() 2305KABC::Addressee KABCore::getLastSyncAddressee()
2289{ 2306{
2290 Addressee lse; 2307 Addressee lse;
2291 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2308 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2292 2309
2293 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2310 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2294 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2311 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2295 if (lse.isEmpty()) { 2312 if (lse.isEmpty()) {
2296 qDebug("Creating new last-syncAddressee "); 2313 qDebug("Creating new last-syncAddressee ");
2297 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2314 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2298 QString sum = ""; 2315 QString sum = "";
2299 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2316 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2300 sum = "E: "; 2317 sum = "E: ";
2301 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2318 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2302 lse.setRevision( mLastAddressbookSync ); 2319 lse.setRevision( mLastAddressbookSync );
2303 lse.setCategories( i18n("SyncEvent") ); 2320 lse.setCategories( i18n("SyncEvent") );
2304 mAddressBook->insertAddressee( lse ); 2321 mAddressBook->insertAddressee( lse );
2305 } 2322 }
2306 return lse; 2323 return lse;
2307} 2324}
2308int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2325int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2309{ 2326{
2310 2327
2311 //void setZaurusId(int id); 2328 //void setZaurusId(int id);
2312 // int zaurusId() const; 2329 // int zaurusId() const;
2313 // void setZaurusUid(int id); 2330 // void setZaurusUid(int id);
2314 // int zaurusUid() const; 2331 // int zaurusUid() const;
2315 // void setZaurusStat(int id); 2332 // void setZaurusStat(int id);
2316 // int zaurusStat() const; 2333 // int zaurusStat() const;
2317 // 0 equal 2334 // 0 equal
2318 // 1 take local 2335 // 1 take local
2319 // 2 take remote 2336 // 2 take remote
2320 // 3 cancel 2337 // 3 cancel
2321 QDateTime lastSync = mLastAddressbookSync; 2338 QDateTime lastSync = mLastAddressbookSync;
2322 QDateTime localMod = local->revision(); 2339 QDateTime localMod = local->revision();
2323 QDateTime remoteMod = remote->revision(); 2340 QDateTime remoteMod = remote->revision();
2324 2341
2325 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2342 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2326 2343
2327 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2344 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2328 bool remCh, locCh; 2345 bool remCh, locCh;
2329 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2346 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2330 2347
2331 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2348 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2332 locCh = ( localMod > mLastAddressbookSync ); 2349 locCh = ( localMod > mLastAddressbookSync );
2333 if ( !remCh && ! locCh ) { 2350 if ( !remCh && ! locCh ) {
2334 //qDebug("both not changed "); 2351 //qDebug("both not changed ");
2335 lastSync = localMod.addDays(1); 2352 lastSync = localMod.addDays(1);
2336 if ( mode <= SYNC_PREF_ASK ) 2353 if ( mode <= SYNC_PREF_ASK )
2337 return 0; 2354 return 0;
2338 } else { 2355 } else {
2339 if ( locCh ) { 2356 if ( locCh ) {
2340 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2357 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2341 lastSync = localMod.addDays( -1 ); 2358 lastSync = localMod.addDays( -1 );
2342 if ( !remCh ) 2359 if ( !remCh )
2343 remoteMod =( lastSync.addDays( -1 ) ); 2360 remoteMod =( lastSync.addDays( -1 ) );
2344 } else { 2361 } else {
2345 //qDebug(" not loc changed "); 2362 //qDebug(" not loc changed ");
2346 lastSync = localMod.addDays( 1 ); 2363 lastSync = localMod.addDays( 1 );
2347 if ( remCh ) 2364 if ( remCh )
2348 remoteMod =( lastSync.addDays( 1 ) ); 2365 remoteMod =( lastSync.addDays( 1 ) );
2349 2366
2350 } 2367 }
2351 } 2368 }
2352 full = true; 2369 full = true;
2353 if ( mode < SYNC_PREF_ASK ) 2370 if ( mode < SYNC_PREF_ASK )
2354 mode = SYNC_PREF_ASK; 2371 mode = SYNC_PREF_ASK;
2355 } else { 2372 } else {
2356 if ( localMod == remoteMod ) 2373 if ( localMod == remoteMod )
2357 return 0; 2374 return 0;
2358 2375
2359 } 2376 }
2360 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 2377 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
2361 2378
2362 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); 2379 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod);
2363 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 2380 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
2364 //full = true; //debug only 2381 //full = true; //debug only
2365 if ( full ) { 2382 if ( full ) {
2366 bool equ = ( (*local) == (*remote) ); 2383 bool equ = ( (*local) == (*remote) );
2367 if ( equ ) { 2384 if ( equ ) {
2368 //qDebug("equal "); 2385 //qDebug("equal ");
2369 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2386 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2370 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2387 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2371 } 2388 }
2372 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2389 if ( mode < SYNC_PREF_FORCE_LOCAL )
2373 return 0; 2390 return 0;
2374 2391
2375 }//else //debug only 2392 }//else //debug only
2376 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2393 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2377 } 2394 }
2378 int result; 2395 int result;
2379 bool localIsNew; 2396 bool localIsNew;
2380 //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() ); 2397 //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() );
2381 2398
2382 if ( full && mode < SYNC_PREF_NEWEST ) 2399 if ( full && mode < SYNC_PREF_NEWEST )
2383 mode = SYNC_PREF_ASK; 2400 mode = SYNC_PREF_ASK;
2384 2401
2385 switch( mode ) { 2402 switch( mode ) {
2386 case SYNC_PREF_LOCAL: 2403 case SYNC_PREF_LOCAL:
2387 if ( lastSync > remoteMod ) 2404 if ( lastSync > remoteMod )
2388 return 1; 2405 return 1;
2389 if ( lastSync > localMod ) 2406 if ( lastSync > localMod )
2390 return 2; 2407 return 2;
2391 return 1; 2408 return 1;
2392 break; 2409 break;
2393 case SYNC_PREF_REMOTE: 2410 case SYNC_PREF_REMOTE:
2394 if ( lastSync > remoteMod ) 2411 if ( lastSync > remoteMod )
2395 return 1; 2412 return 1;
2396 if ( lastSync > localMod ) 2413 if ( lastSync > localMod )
2397 return 2; 2414 return 2;
2398 return 2; 2415 return 2;
2399 break; 2416 break;
2400 case SYNC_PREF_NEWEST: 2417 case SYNC_PREF_NEWEST:
2401 if ( localMod > remoteMod ) 2418 if ( localMod > remoteMod )
2402 return 1; 2419 return 1;
2403 else 2420 else
2404 return 2; 2421 return 2;
2405 break; 2422 break;
2406 case SYNC_PREF_ASK: 2423 case SYNC_PREF_ASK:
2407 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2424 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2408 if ( lastSync > remoteMod ) 2425 if ( lastSync > remoteMod )
2409 return 1; 2426 return 1;
2410 if ( lastSync > localMod ) 2427 if ( lastSync > localMod )
2411 return 2; 2428 return 2;
2412 localIsNew = localMod >= remoteMod; 2429 localIsNew = localMod >= remoteMod;
2413 //qDebug("conflict! ************************************** "); 2430 //qDebug("conflict! ************************************** ");
2414 { 2431 {
2415 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2432 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2416 result = acd.executeD(localIsNew); 2433 result = acd.executeD(localIsNew);
2417 return result; 2434 return result;
2418 } 2435 }
2419 break; 2436 break;
2420 case SYNC_PREF_FORCE_LOCAL: 2437 case SYNC_PREF_FORCE_LOCAL:
2421 return 1; 2438 return 1;
2422 break; 2439 break;
2423 case SYNC_PREF_FORCE_REMOTE: 2440 case SYNC_PREF_FORCE_REMOTE:
2424 return 2; 2441 return 2;
2425 break; 2442 break;
2426 2443
2427 default: 2444 default:
2428 // SYNC_PREF_TAKE_BOTH not implemented 2445 // SYNC_PREF_TAKE_BOTH not implemented
2429 break; 2446 break;
2430 } 2447 }
2431 return 0; 2448 return 0;
2432} 2449}
2433 2450
2434 2451
2435bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2452bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2436{ 2453{
2437 bool syncOK = true; 2454 bool syncOK = true;
2438 int addedAddressee = 0; 2455 int addedAddressee = 0;
2439 int addedAddresseeR = 0; 2456 int addedAddresseeR = 0;
2440 int deletedAddresseeR = 0; 2457 int deletedAddresseeR = 0;
2441 int deletedAddresseeL = 0; 2458 int deletedAddresseeL = 0;
2442 int changedLocal = 0; 2459 int changedLocal = 0;
2443 int changedRemote = 0; 2460 int changedRemote = 0;
2444 2461
2445 QString mCurrentSyncName = syncManager->getCurrentSyncName(); 2462 QString mCurrentSyncName = syncManager->getCurrentSyncName();
2446 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2463 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2447 2464
2448 //QPtrList<Addressee> el = local->rawAddressees(); 2465 //QPtrList<Addressee> el = local->rawAddressees();
2449 Addressee addresseeR; 2466 Addressee addresseeR;
2450 QString uid; 2467 QString uid;
2451 int take; 2468 int take;
2452 Addressee addresseeL; 2469 Addressee addresseeL;
2453 Addressee addresseeRSync; 2470 Addressee addresseeRSync;
2454 Addressee addresseeLSync; 2471 Addressee addresseeLSync;
2455 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); 2472 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
2456 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); 2473 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
2457 bool fullDateRange = false; 2474 bool fullDateRange = false;
2458 local->resetTempSyncStat(); 2475 local->resetTempSyncStat();
2459 mLastAddressbookSync = QDateTime::currentDateTime(); 2476 mLastAddressbookSync = QDateTime::currentDateTime();
2460 QDateTime modifiedCalendar = mLastAddressbookSync;; 2477 QDateTime modifiedCalendar = mLastAddressbookSync;;
2461 addresseeLSync = getLastSyncAddressee(); 2478 addresseeLSync = getLastSyncAddressee();
2462 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); 2479 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1());
2463 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); 2480 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
2464 if ( !addresseeR.isEmpty() ) { 2481 if ( !addresseeR.isEmpty() ) {
2465 addresseeRSync = addresseeR; 2482 addresseeRSync = addresseeR;
2466 remote->removeAddressee(addresseeR ); 2483 remote->removeAddressee(addresseeR );
2467 2484
2468 } else { 2485 } else {
2469 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2486 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2470 addresseeRSync = addresseeLSync ; 2487 addresseeRSync = addresseeLSync ;
2471 } else { 2488 } else {
2472 qDebug("FULLDATE 1"); 2489 qDebug("FULLDATE 1");
2473 fullDateRange = true; 2490 fullDateRange = true;
2474 Addressee newAdd; 2491 Addressee newAdd;
2475 addresseeRSync = newAdd; 2492 addresseeRSync = newAdd;
2476 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 2493 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
2477 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 2494 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
2478 addresseeRSync.setRevision( mLastAddressbookSync ); 2495 addresseeRSync.setRevision( mLastAddressbookSync );
2479 addresseeRSync.setCategories( i18n("SyncAddressee") ); 2496 addresseeRSync.setCategories( i18n("SyncAddressee") );
2480 } 2497 }
2481 } 2498 }
2482 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 2499 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
2483 qDebug("FULLDATE 2"); 2500 qDebug("FULLDATE 2");
2484 fullDateRange = true; 2501 fullDateRange = true;
2485 } 2502 }
2486 if ( ! fullDateRange ) { 2503 if ( ! fullDateRange ) {
2487 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 2504 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
2488 2505
2489 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2506 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2490 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2507 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2491 fullDateRange = true; 2508 fullDateRange = true;
2492 qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); 2509 qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
2493 } 2510 }
2494 } 2511 }
2495 // fullDateRange = true; // debug only! 2512 // fullDateRange = true; // debug only!
2496 if ( fullDateRange ) 2513 if ( fullDateRange )
2497 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2514 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2498 else 2515 else
2499 mLastAddressbookSync = addresseeLSync.revision(); 2516 mLastAddressbookSync = addresseeLSync.revision();
2500 // for resyncing if own file has changed 2517 // for resyncing if own file has changed
2501 // PENDING fixme later when implemented 2518 // PENDING fixme later when implemented
2502#if 0 2519#if 0
2503 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2520 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2504 mLastAddressbookSync = loadedFileVersion; 2521 mLastAddressbookSync = loadedFileVersion;
2505 qDebug("setting mLastAddressbookSync "); 2522 qDebug("setting mLastAddressbookSync ");
2506 } 2523 }
2507#endif 2524#endif
2508 2525
2509 //qDebug("*************************** "); 2526 //qDebug("*************************** ");
2510 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2527 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2511 QStringList er = remote->uidList(); 2528 QStringList er = remote->uidList();
2512 Addressee inR ;//= er.first(); 2529 Addressee inR ;//= er.first();
2513 Addressee inL; 2530 Addressee inL;
2514 2531
2515 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2532 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2516 2533
2517 int modulo = (er.count()/10)+1; 2534 int modulo = (er.count()/10)+1;
2518 int incCounter = 0; 2535 int incCounter = 0;
2519 while ( incCounter < er.count()) { 2536 while ( incCounter < er.count()) {
2520 if (syncManager->isProgressBarCanceled()) 2537 if (syncManager->isProgressBarCanceled())
2521 return false; 2538 return false;
2522 if ( incCounter % modulo == 0 ) 2539 if ( incCounter % modulo == 0 )
2523 syncManager->showProgressBar(incCounter); 2540 syncManager->showProgressBar(incCounter);
2524 2541
2525 uid = er[ incCounter ]; 2542 uid = er[ incCounter ];
2526 bool skipIncidence = false; 2543 bool skipIncidence = false;
2527 if ( uid.left(19) == QString("last-syncAddressee-") ) 2544 if ( uid.left(19) == QString("last-syncAddressee-") )
2528 skipIncidence = true; 2545 skipIncidence = true;
2529 QString idS,OidS; 2546 QString idS,OidS;
2530 qApp->processEvents(); 2547 qApp->processEvents();
2531 if ( !skipIncidence ) { 2548 if ( !skipIncidence ) {
2532 inL = local->findByUid( uid ); 2549 inL = local->findByUid( uid );
2533 inR = remote->findByUid( uid ); 2550 inR = remote->findByUid( uid );
2534 //inL.setResource( 0 ); 2551 //inL.setResource( 0 );
2535 //inR.setResource( 0 ); 2552 //inR.setResource( 0 );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 04ce33d..3c33923 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,484 +1,488 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <ksyncmanager.h> 35#include <ksyncmanager.h>
36 36
37namespace KABC { 37namespace KABC {
38class AddressBook; 38class AddressBook;
39} 39}
40 40
41#ifndef KAB_EMBEDDED 41#ifndef KAB_EMBEDDED
42class KAboutData; 42class KAboutData;
43class KConfig; 43class KConfig;
44 44
45class KAddressBookService; 45class KAddressBookService;
46class LDAPSearchDialog; 46class LDAPSearchDialog;
47#else //KAB_EMBEDDED 47#else //KAB_EMBEDDED
48class KAddressBookMain; 48class KAddressBookMain;
49//US class QAction; 49//US class QAction;
50#endif //KAB_EMBEDDED 50#endif //KAB_EMBEDDED
51class KCMultiDialog; 51class KCMultiDialog;
52class KXMLGUIClient; 52class KXMLGUIClient;
53class ExtensionManager; 53class ExtensionManager;
54class XXPortManager; 54class XXPortManager;
55class JumpButtonBar; 55class JumpButtonBar;
56class IncSearchWidget; 56class IncSearchWidget;
57class KDGanttMinimizeSplitter; 57class KDGanttMinimizeSplitter;
58class KAction; 58class KAction;
59class KActionCollection; 59class KActionCollection;
60class KToggleAction; 60class KToggleAction;
61class KSyncProfile; 61class KSyncProfile;
62 62
63class QAction; 63class QAction;
64class QMenuBar; 64class QMenuBar;
65class QSplitter; 65class QSplitter;
66class ViewContainer; 66class ViewContainer;
67class ViewManager; 67class ViewManager;
68class AddresseeEditorDialog; 68class AddresseeEditorDialog;
69class Ir; 69class Ir;
70 70
71class KABCore : public QWidget, public KSyncInterface 71class KABCore : public QWidget, public KSyncInterface
72{ 72{
73 Q_OBJECT 73 Q_OBJECT
74 74
75 public: 75 public:
76 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 76 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
77 77
78 78
79 ~KABCore(); 79 ~KABCore();
80 80
81 81
82#ifdef KAB_EMBEDDED 82#ifdef KAB_EMBEDDED
83 //US added functionality 83 //US added functionality
84 QPopupMenu* getViewMenu() {return viewMenu;} 84 QPopupMenu* getViewMenu() {return viewMenu;}
85 QPopupMenu* getFilterMenu() {return filterMenu;} 85 QPopupMenu* getFilterMenu() {return filterMenu;}
86 QPopupMenu* getSettingsMenu() {return settingsMenu;} 86 QPopupMenu* getSettingsMenu() {return settingsMenu;}
87 void addActionsManually(); 87 void addActionsManually();
88#endif //KAB_EMBEDDED 88#endif //KAB_EMBEDDED
89 /** 89 /**
90 Restores the global settings. 90 Restores the global settings.
91 */ 91 */
92 void restoreSettings(); 92 void restoreSettings();
93 93
94 /** 94 /**
95 Saves the global settings. 95 Saves the global settings.
96 */ 96 */
97 void saveSettings(); 97 void saveSettings();
98 98
99 /** 99 /**
100 Returns a pointer to the StdAddressBook of the application. 100 Returns a pointer to the StdAddressBook of the application.
101 */ 101 */
102 KABC::AddressBook *addressBook() const; 102 KABC::AddressBook *addressBook() const;
103 103
104 /** 104 /**
105 Returns a pointer to the KConfig object of the application. 105 Returns a pointer to the KConfig object of the application.
106 */ 106 */
107 static KConfig *config(); 107 static KConfig *config();
108 108
109 /** 109 /**
110 Returns a pointer to the global KActionCollection object. So 110 Returns a pointer to the global KActionCollection object. So
111 other classes can register their actions easily. 111 other classes can register their actions easily.
112 */ 112 */
113 KActionCollection *actionCollection() const; 113 KActionCollection *actionCollection() const;
114 114
115 /** 115 /**
116 Returns the current search field of the Incremental Search Widget. 116 Returns the current search field of the Incremental Search Widget.
117 */ 117 */
118 KABC::Field *currentSearchField() const; 118 KABC::Field *currentSearchField() const;
119 119
120 /** 120 /**
121 Returns the uid list of the currently selected contacts. 121 Returns the uid list of the currently selected contacts.
122 */ 122 */
123 QStringList selectedUIDs() const; 123 QStringList selectedUIDs() const;
124 124
125 /** 125 /**
126 Displays the ResourceSelectDialog and returns the selected 126 Displays the ResourceSelectDialog and returns the selected
127 resource or a null pointer if no resource was selected by 127 resource or a null pointer if no resource was selected by
128 the user. 128 the user.
129 */ 129 */
130 KABC::Resource *requestResource( QWidget *parent ); 130 KABC::Resource *requestResource( QWidget *parent );
131 131
132#ifndef KAB_EMBEDDED 132#ifndef KAB_EMBEDDED
133 static KAboutData *createAboutData(); 133 static KAboutData *createAboutData();
134#endif //KAB_EMBEDDED 134#endif //KAB_EMBEDDED
135 135
136#ifdef KAB_EMBEDDED 136#ifdef KAB_EMBEDDED
137 inline QPopupMenu* getImportMenu() { return ImportMenu;} 137 inline QPopupMenu* getImportMenu() { return ImportMenu;}
138 inline QPopupMenu* getExportMenu() { return ExportMenu;} 138 inline QPopupMenu* getExportMenu() { return ExportMenu;}
139#endif //KAB_EMBEDDED 139#endif //KAB_EMBEDDED
140 140
141 public slots: 141 public slots:
142#ifdef KAB_EMBEDDED 142#ifdef KAB_EMBEDDED
143 void createAboutData(); 143 void createAboutData();
144#endif //KAB_EMBEDDED 144#endif //KAB_EMBEDDED
145 145
146 void statusMessage(QString, int time = 0 ); 146 void statusMessage(QString, int time = 0 );
147 void showLicence(); 147 void showLicence();
148 void faq(); 148 void faq();
149 void whatsnew() ;
150 void synchowto() ;
149 151
150 /** 152 /**
151 Is called whenever a contact is selected in the view. 153 Is called whenever a contact is selected in the view.
152 */ 154 */
153 void setContactSelected( const QString &uid ); 155 void setContactSelected( const QString &uid );
154 156
155 /** 157 /**
156 Opens the preferred mail composer with all selected contacts as 158 Opens the preferred mail composer with all selected contacts as
157 arguments. 159 arguments.
158 */ 160 */
159 void sendMail(); 161 void sendMail();
160 162
161 /** 163 /**
162 Opens the preferred mail composer with the given contacts as 164 Opens the preferred mail composer with the given contacts as
163 arguments. 165 arguments.
164 */ 166 */
165 void sendMail( const QString& email ); 167 void sendMail( const QString& email );
166 168
167 169
168 void mailVCard(); 170 void mailVCard();
169 void mailVCard(const QStringList& uids); 171 void mailVCard(const QStringList& uids);
170 172
171 /** 173 /**
172 Beams the "WhoAmI contact. 174 Beams the "WhoAmI contact.
173 */ 175 */
174 void beamMySelf(); 176 void beamMySelf();
175 177
176 void beamVCard(); 178 void beamVCard();
177 void export2phone(); 179 void export2phone();
178 void beamVCard(const QStringList& uids); 180 void beamVCard(const QStringList& uids);
179 void beamDone( Ir *ir ); 181 void beamDone( Ir *ir );
180 182
181 183
182 /** 184 /**
183 Starts the preferred web browser with the given URL as argument. 185 Starts the preferred web browser with the given URL as argument.
184 */ 186 */
185 void browse( const QString& url ); 187 void browse( const QString& url );
186 188
187 /** 189 /**
188 Select all contacts in the view. 190 Select all contacts in the view.
189 */ 191 */
190 void selectAllContacts(); 192 void selectAllContacts();
191 193
192 /** 194 /**
193 Deletes all selected contacts from the address book. 195 Deletes all selected contacts from the address book.
194 */ 196 */
195 void deleteContacts(); 197 void deleteContacts();
196 198
197 /** 199 /**
198 Deletes given contacts from the address book. 200 Deletes given contacts from the address book.
199 201
200 @param uids The uids of the contacts, which shall be deleted. 202 @param uids The uids of the contacts, which shall be deleted.
201 */ 203 */
202 void deleteContacts( const QStringList &uids ); 204 void deleteContacts( const QStringList &uids );
203 205
204 /** 206 /**
205 Copys the selected contacts into clipboard for later pasting. 207 Copys the selected contacts into clipboard for later pasting.
206 */ 208 */
207 void copyContacts(); 209 void copyContacts();
208 210
209 /** 211 /**
210 Cuts the selected contacts and stores them for later pasting. 212 Cuts the selected contacts and stores them for later pasting.
211 */ 213 */
212 void cutContacts(); 214 void cutContacts();
213 215
214 /** 216 /**
215 Paste contacts from clipboard into the address book. 217 Paste contacts from clipboard into the address book.
216 */ 218 */
217 void pasteContacts(); 219 void pasteContacts();
218 220
219 /** 221 /**
220 Paste given contacts into the address book. 222 Paste given contacts into the address book.
221 223
222 @param list The list of addressee, which shall be pasted. 224 @param list The list of addressee, which shall be pasted.
223 */ 225 */
224 void pasteContacts( KABC::Addressee::List &list ); 226 void pasteContacts( KABC::Addressee::List &list );
225 227
226 /** 228 /**
227 Sets the whoAmI contact, that is used by many other programs to 229 Sets the whoAmI contact, that is used by many other programs to
228 get personal information about the current user. 230 get personal information about the current user.
229 */ 231 */
230 void setWhoAmI(); 232 void setWhoAmI();
231 233
232 /** 234 /**
233 Displays the category dialog and applies the result to all 235 Displays the category dialog and applies the result to all
234 selected contacts. 236 selected contacts.
235 */ 237 */
236 void setCategories(); 238 void setCategories();
237 239
238 /** 240 /**
239 Sets the field list of the Incremental Search Widget. 241 Sets the field list of the Incremental Search Widget.
240 */ 242 */
241 void setSearchFields( const KABC::Field::List &fields ); 243 void setSearchFields( const KABC::Field::List &fields );
242 244
243 /** 245 /**
244 Search with the current search field for a contact, that matches 246 Search with the current search field for a contact, that matches
245 the given text, and selects it in the view. 247 the given text, and selects it in the view.
246 */ 248 */
247 void incrementalSearch( const QString& text ); 249 void incrementalSearch( const QString& text );
248 250
249 /** 251 /**
250 Marks the address book as modified. 252 Marks the address book as modified.
251 */ 253 */
252 void setModified(); 254 void setModified();
253 /** 255 /**
254 Marks the address book as modified without refreshing the view. 256 Marks the address book as modified without refreshing the view.
255 */ 257 */
256 void setModifiedWOrefresh(); 258 void setModifiedWOrefresh();
257 259
258 /** 260 /**
259 Marks the address book as modified concerning the argument. 261 Marks the address book as modified concerning the argument.
260 */ 262 */
261 void setModified( bool modified ); 263 void setModified( bool modified );
262 264
263 /** 265 /**
264 Returns whether the address book is modified. 266 Returns whether the address book is modified.
265 */ 267 */
266 bool modified() const; 268 bool modified() const;
267 269
268 /** 270 /**
269 Called whenever an contact is modified in the contact editor 271 Called whenever an contact is modified in the contact editor
270 dialog or the quick edit. 272 dialog or the quick edit.
271 */ 273 */
272 void contactModified( const KABC::Addressee &addr ); 274 void contactModified( const KABC::Addressee &addr );
273 275
274 /** 276 /**
275 DCOP METHODS. 277 DCOP METHODS.
276 */ 278 */
277 void addEmail( QString addr ); 279 void addEmail( QString addr );
278 void importVCard( const KURL& url, bool showPreview ); 280 void importVCard( const KURL& url, bool showPreview );
279 void importVCard( const QString& vCard, bool showPreview ); 281 void importVCard( const QString& vCard, bool showPreview );
280 void newContact(); 282 void newContact();
281 QString getNameByPhone( const QString& phone ); 283 QString getNameByPhone( const QString& phone );
282 /** 284 /**
283 END DCOP METHODS 285 END DCOP METHODS
284 */ 286 */
285 287
286 /** 288 /**
287 Saves the contents of the AddressBook back to disk. 289 Saves the contents of the AddressBook back to disk.
288 */ 290 */
289 void save(); 291 void save();
290 292
291 /** 293 /**
292 Undos the last command using the undo stack. 294 Undos the last command using the undo stack.
293 */ 295 */
294 void undo(); 296 void undo();
295 297
296 /** 298 /**
297 Redos the last command that was undone, using the redo stack. 299 Redos the last command that was undone, using the redo stack.
298 */ 300 */
299 void redo(); 301 void redo();
300 302
301 /** 303 /**
302 Shows the edit dialog for the given uid. If the uid is QString::null, 304 Shows the edit dialog for the given uid. If the uid is QString::null,
303 the method will try to find a selected addressee in the view. 305 the method will try to find a selected addressee in the view.
304 */ 306 */
305 void editContact( const QString &uid /*US = QString::null*/ ); 307 void editContact( const QString &uid /*US = QString::null*/ );
306//US added a second method without defaultparameter 308//US added a second method without defaultparameter
307 void editContact2(); 309 void editContact2();
308 310
309 /** 311 /**
310 Shows or edits the detail view for the given uid. If the uid is QString::null, 312 Shows or edits the detail view for the given uid. If the uid is QString::null,
311 the method will try to find a selected addressee in the view. 313 the method will try to find a selected addressee in the view.
312 */ 314 */
313 void executeContact( const QString &uid /*US = QString::null*/ ); 315 void executeContact( const QString &uid /*US = QString::null*/ );
314 316
315 /** 317 /**
316 Launches the configuration dialog. 318 Launches the configuration dialog.
317 */ 319 */
318 void openConfigDialog(); 320 void openConfigDialog();
319 321
320 /** 322 /**
321 Launches the ldap search dialog. 323 Launches the ldap search dialog.
322 */ 324 */
323 void openLDAPDialog(); 325 void openLDAPDialog();
324 326
325 /** 327 /**
326 Creates a KAddressBookPrinter, which will display the print 328 Creates a KAddressBookPrinter, which will display the print
327 dialog and do the printing. 329 dialog and do the printing.
328 */ 330 */
329 void print(); 331 void print();
330 332
331 /** 333 /**
332 Registers a new GUI client, so plugins can register its actions. 334 Registers a new GUI client, so plugins can register its actions.
333 */ 335 */
334 void addGUIClient( KXMLGUIClient *client ); 336 void addGUIClient( KXMLGUIClient *client );
335 337
336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 338 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 339 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 340 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
339 341
340 342
341 signals: 343 signals:
342 void contactSelected( const QString &name ); 344 void contactSelected( const QString &name );
343 void contactSelected( const QPixmap &pixmap ); 345 void contactSelected( const QPixmap &pixmap );
344 public slots: 346 public slots:
345 void recieve(QString cmsg ); 347 void recieve(QString cmsg );
346 void getFile( bool success ); 348 void getFile( bool success );
347 void syncFileRequest(); 349 void syncFileRequest();
348 void setDetailsVisible( bool visible ); 350 void setDetailsVisible( bool visible );
349 void setDetailsToState(); 351 void setDetailsToState();
350 // void slotSyncMenu( int ); 352 // void slotSyncMenu( int );
351 private slots: 353 private slots:
352 void setJumpButtonBarVisible( bool visible ); 354 void setJumpButtonBarVisible( bool visible );
353 void setCaptionBack(); 355 void setCaptionBack();
354 void importFromOL(); 356 void importFromOL();
355 void extensionModified( const KABC::Addressee::List &list ); 357 void extensionModified( const KABC::Addressee::List &list );
356 void extensionChanged( int id ); 358 void extensionChanged( int id );
357 void clipboardDataChanged(); 359 void clipboardDataChanged();
358 void updateActionMenu(); 360 void updateActionMenu();
359 void configureKeyBindings(); 361 void configureKeyBindings();
360 void removeVoice(); 362 void removeVoice();
361#ifdef KAB_EMBEDDED 363#ifdef KAB_EMBEDDED
362 void configureResources(); 364 void configureResources();
363#endif //KAB_EMBEDDED 365#endif //KAB_EMBEDDED
364 366
365 void slotEditorDestroyed( const QString &uid ); 367 void slotEditorDestroyed( const QString &uid );
366 void configurationChanged(); 368 void configurationChanged();
367 void addressBookChanged(); 369 void addressBookChanged();
368 370
369 private: 371 private:
370 void initGUI(); 372 void initGUI();
371 void initActions(); 373 void initActions();
372 374
373 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 375 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
374 const char *name = 0 ); 376 const char *name = 0 );
375 377
376 KXMLGUIClient *mGUIClient; 378 KXMLGUIClient *mGUIClient;
377 379
378 KABC::AddressBook *mAddressBook; 380 KABC::AddressBook *mAddressBook;
379 381
380 ViewManager *mViewManager; 382 ViewManager *mViewManager;
381 // QSplitter *mDetailsSplitter; 383 // QSplitter *mDetailsSplitter;
382 KDGanttMinimizeSplitter *mExtensionBarSplitter; 384 KDGanttMinimizeSplitter *mExtensionBarSplitter;
383 ViewContainer *mDetails; 385 ViewContainer *mDetails;
384 KDGanttMinimizeSplitter* mMiniSplitter; 386 KDGanttMinimizeSplitter* mMiniSplitter;
385 XXPortManager *mXXPortManager; 387 XXPortManager *mXXPortManager;
386 JumpButtonBar *mJumpButtonBar; 388 JumpButtonBar *mJumpButtonBar;
387 IncSearchWidget *mIncSearchWidget; 389 IncSearchWidget *mIncSearchWidget;
388 ExtensionManager *mExtensionManager; 390 ExtensionManager *mExtensionManager;
389 391
390 KCMultiDialog *mConfigureDialog; 392 KCMultiDialog *mConfigureDialog;
391 393
392#ifndef KAB_EMBEDDED 394#ifndef KAB_EMBEDDED
393 LDAPSearchDialog *mLdapSearchDialog; 395 LDAPSearchDialog *mLdapSearchDialog;
394#endif //KAB_EMBEDDED 396#endif //KAB_EMBEDDED
395 // QDict<AddresseeEditorDialog> mEditorDict; 397 // QDict<AddresseeEditorDialog> mEditorDict;
396 AddresseeEditorDialog *mEditorDialog; 398 AddresseeEditorDialog *mEditorDialog;
397 bool mReadWrite; 399 bool mReadWrite;
398 bool mModified; 400 bool mModified;
399 bool mIsPart; 401 bool mIsPart;
400 bool mMultipleViewsAtOnce; 402 bool mMultipleViewsAtOnce;
401 403
402 404
403 //US file menu 405 //US file menu
404 KAction *mActionMail; 406 KAction *mActionMail;
405 KAction *mActionBeam; 407 KAction *mActionBeam;
406 KAction *mActionExport2phone; 408 KAction *mActionExport2phone;
407 KAction* mActionPrint; 409 KAction* mActionPrint;
408 KAction* mActionNewContact; 410 KAction* mActionNewContact;
409 KAction *mActionSave; 411 KAction *mActionSave;
410 KAction *mActionEditAddressee; 412 KAction *mActionEditAddressee;
411 KAction *mActionMailVCard; 413 KAction *mActionMailVCard;
412 KAction *mActionBeamVCard; 414 KAction *mActionBeamVCard;
413 415
414 KAction *mActionQuit; 416 KAction *mActionQuit;
415 417
416 //US edit menu 418 //US edit menu
417 KAction *mActionCopy; 419 KAction *mActionCopy;
418 KAction *mActionCut; 420 KAction *mActionCut;
419 KAction *mActionPaste; 421 KAction *mActionPaste;
420 KAction *mActionSelectAll; 422 KAction *mActionSelectAll;
421 KAction *mActionUndo; 423 KAction *mActionUndo;
422 KAction *mActionRedo; 424 KAction *mActionRedo;
423 KAction *mActionDelete; 425 KAction *mActionDelete;
424 426
425 //US settings menu 427 //US settings menu
426 KAction *mActionConfigResources; 428 KAction *mActionConfigResources;
427 KAction *mActionConfigKAddressbook; 429 KAction *mActionConfigKAddressbook;
428 KAction *mActionConfigShortcuts; 430 KAction *mActionConfigShortcuts;
429 KAction *mActionConfigureToolbars; 431 KAction *mActionConfigureToolbars;
430 KAction *mActionKeyBindings; 432 KAction *mActionKeyBindings;
431 KToggleAction *mActionJumpBar; 433 KToggleAction *mActionJumpBar;
432 KToggleAction *mActionDetails; 434 KToggleAction *mActionDetails;
433 KAction *mActionWhoAmI; 435 KAction *mActionWhoAmI;
434 KAction *mActionCategories; 436 KAction *mActionCategories;
435 KAction *mActionAboutKAddressbook; 437 KAction *mActionAboutKAddressbook;
436 KAction *mActionLicence; 438 KAction *mActionLicence;
437 KAction *mActionFaq; 439 KAction *mActionFaq;
440 KAction *mActionWN;
441 KAction *mActionSyncHowto;
438 442
439 KAction *mActionDeleteView; 443 KAction *mActionDeleteView;
440 444
441 QPopupMenu *viewMenu; 445 QPopupMenu *viewMenu;
442 QPopupMenu *filterMenu; 446 QPopupMenu *filterMenu;
443 QPopupMenu *settingsMenu; 447 QPopupMenu *settingsMenu;
444 QPopupMenu *changeMenu; 448 QPopupMenu *changeMenu;
445//US QAction *mActionSave; 449//US QAction *mActionSave;
446 QPopupMenu *ImportMenu; 450 QPopupMenu *ImportMenu;
447 QPopupMenu *ExportMenu; 451 QPopupMenu *ExportMenu;
448 //LR additional methods 452 //LR additional methods
449 KAction *mActionRemoveVoice; 453 KAction *mActionRemoveVoice;
450 KAction * mActionImportOL; 454 KAction * mActionImportOL;
451 455
452#ifndef KAB_EMBEDDED 456#ifndef KAB_EMBEDDED
453 KAddressBookService *mAddressBookService; 457 KAddressBookService *mAddressBookService;
454#endif //KAB_EMBEDDED 458#endif //KAB_EMBEDDED
455 459
456 class KABCorePrivate; 460 class KABCorePrivate;
457 KABCorePrivate *d; 461 KABCorePrivate *d;
458 //US bool mBlockSaveFlag; 462 //US bool mBlockSaveFlag;
459 463
460#ifdef KAB_EMBEDDED 464#ifdef KAB_EMBEDDED
461 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 465 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
462#endif //KAB_EMBEDDED 466#endif //KAB_EMBEDDED
463 467
464 //this are the overwritten callbackmethods from the syncinterface 468 //this are the overwritten callbackmethods from the syncinterface
465 virtual bool sync(KSyncManager* manager, QString filename, int mode); 469 virtual bool sync(KSyncManager* manager, QString filename, int mode);
466 virtual bool syncExternal(KSyncManager* manager, QString resource); 470 virtual bool syncExternal(KSyncManager* manager, QString resource);
467 bool syncPhone(); 471 bool syncPhone();
468 void message( QString m ); 472 void message( QString m );
469 473
470 // LR ******************************* 474 // LR *******************************
471 // sync stuff! 475 // sync stuff!
472 QString sentSyncFile(); 476 QString sentSyncFile();
473 QPopupMenu *syncMenu; 477 QPopupMenu *syncMenu;
474 KSyncManager* syncManager; 478 KSyncManager* syncManager;
475 int mGlobalSyncMode; 479 int mGlobalSyncMode;
476 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 480 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
477 KABC::Addressee getLastSyncAddressee(); 481 KABC::Addressee getLastSyncAddressee();
478 QDateTime mLastAddressbookSync; 482 QDateTime mLastAddressbookSync;
479 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 483 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
480 // ********************* 484 // *********************
481 485
482}; 486};
483 487
484#endif 488#endif