summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-10-28 11:03:42 (UTC)
committer zautrix <zautrix>2004-10-28 11:03:42 (UTC)
commit01cd4ef94b8604532181c390e9abd560aebaf372 (patch) (unidiff)
tree96ca1a524512ae2e2868f0bd3df03e4da5c445f9 /kaddressbook
parent61d9eb436349a841410559f51e2601a34ceb5794 (diff)
downloadkdepimpi-01cd4ef94b8604532181c390e9abd560aebaf372.zip
kdepimpi-01cd4ef94b8604532181c390e9abd560aebaf372.tar.gz
kdepimpi-01cd4ef94b8604532181c390e9abd560aebaf372.tar.bz2
added howto to menus
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp32
-rw-r--r--kaddressbook/kabcore.h4
2 files changed, 30 insertions, 6 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 5ebd3a4..bdc5bd8 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1785,399 +1785,407 @@ void KABCore::initActions()
1785 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1785 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1786 mMainWindow, SLOT( exit() ), 1786 mMainWindow, SLOT( exit() ),
1787 actionCollection(), "quit" ); 1787 actionCollection(), "quit" );
1788#endif //KAB_EMBEDDED 1788#endif //KAB_EMBEDDED
1789 1789
1790 // edit menu 1790 // edit menu
1791 if ( mIsPart ) { 1791 if ( mIsPart ) {
1792 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1792 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1793 SLOT( copyContacts() ), actionCollection(), 1793 SLOT( copyContacts() ), actionCollection(),
1794 "kaddressbook_copy" ); 1794 "kaddressbook_copy" );
1795 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1795 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1796 SLOT( cutContacts() ), actionCollection(), 1796 SLOT( cutContacts() ), actionCollection(),
1797 "kaddressbook_cut" ); 1797 "kaddressbook_cut" );
1798 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1798 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1799 SLOT( pasteContacts() ), actionCollection(), 1799 SLOT( pasteContacts() ), actionCollection(),
1800 "kaddressbook_paste" ); 1800 "kaddressbook_paste" );
1801 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1801 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1802 SLOT( selectAllContacts() ), actionCollection(), 1802 SLOT( selectAllContacts() ), actionCollection(),
1803 "kaddressbook_select_all" ); 1803 "kaddressbook_select_all" );
1804 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1804 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1805 SLOT( undo() ), actionCollection(), 1805 SLOT( undo() ), actionCollection(),
1806 "kaddressbook_undo" ); 1806 "kaddressbook_undo" );
1807 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1807 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1808 this, SLOT( redo() ), actionCollection(), 1808 this, SLOT( redo() ), actionCollection(),
1809 "kaddressbook_redo" ); 1809 "kaddressbook_redo" );
1810 } else { 1810 } else {
1811 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1811 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1812 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1812 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1813 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1813 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1814 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1814 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1815 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1815 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1816 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1816 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1817 } 1817 }
1818 1818
1819 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1819 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1820 Key_Delete, this, SLOT( deleteContacts() ), 1820 Key_Delete, this, SLOT( deleteContacts() ),
1821 actionCollection(), "edit_delete" ); 1821 actionCollection(), "edit_delete" );
1822 1822
1823 mActionUndo->setEnabled( false ); 1823 mActionUndo->setEnabled( false );
1824 mActionRedo->setEnabled( false ); 1824 mActionRedo->setEnabled( false );
1825 1825
1826 // settings menu 1826 // settings menu
1827#ifdef KAB_EMBEDDED 1827#ifdef KAB_EMBEDDED
1828//US special menuentry to configure the addressbook resources. On KDE 1828//US special menuentry to configure the addressbook resources. On KDE
1829// you do that through the control center !!! 1829// you do that through the control center !!!
1830 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1830 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1831 SLOT( configureResources() ), actionCollection(), 1831 SLOT( configureResources() ), actionCollection(),
1832 "kaddressbook_configure_resources" ); 1832 "kaddressbook_configure_resources" );
1833#endif //KAB_EMBEDDED 1833#endif //KAB_EMBEDDED
1834 1834
1835 if ( mIsPart ) { 1835 if ( mIsPart ) {
1836 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1836 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1837 SLOT( openConfigDialog() ), actionCollection(), 1837 SLOT( openConfigDialog() ), actionCollection(),
1838 "kaddressbook_configure" ); 1838 "kaddressbook_configure" );
1839 1839
1840 //US not implemented yet 1840 //US not implemented yet
1841 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1841 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1842 // this, SLOT( configureKeyBindings() ), actionCollection(), 1842 // this, SLOT( configureKeyBindings() ), actionCollection(),
1843 // "kaddressbook_configure_shortcuts" ); 1843 // "kaddressbook_configure_shortcuts" );
1844#ifdef KAB_EMBEDDED 1844#ifdef KAB_EMBEDDED
1845 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1845 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1846 mActionConfigureToolbars->setEnabled( false ); 1846 mActionConfigureToolbars->setEnabled( false );
1847#endif //KAB_EMBEDDED 1847#endif //KAB_EMBEDDED
1848 1848
1849 } else { 1849 } else {
1850 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1850 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1851 1851
1852 //US not implemented yet 1852 //US not implemented yet
1853 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1853 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1854 } 1854 }
1855 1855
1856 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1856 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1857 actionCollection(), "options_show_jump_bar" ); 1857 actionCollection(), "options_show_jump_bar" );
1858 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1858 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1859 1859
1860 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1860 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1861 actionCollection(), "options_show_details" ); 1861 actionCollection(), "options_show_details" );
1862 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1862 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1863 1863
1864 1864
1865 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 1865 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1866 SLOT( toggleBeamReceive() ), actionCollection(), 1866 SLOT( toggleBeamReceive() ), actionCollection(),
1867 "kaddressbook_beam_rec" ); 1867 "kaddressbook_beam_rec" );
1868 1868
1869 1869
1870 // misc 1870 // misc
1871 // only enable LDAP lookup if we can handle the protocol 1871 // only enable LDAP lookup if we can handle the protocol
1872#ifndef KAB_EMBEDDED 1872#ifndef KAB_EMBEDDED
1873 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1873 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1874 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1874 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1875 this, SLOT( openLDAPDialog() ), actionCollection(), 1875 this, SLOT( openLDAPDialog() ), actionCollection(),
1876 "ldap_lookup" ); 1876 "ldap_lookup" );
1877 } 1877 }
1878#else //KAB_EMBEDDED 1878#else //KAB_EMBEDDED
1879 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1879 //qDebug("KABCore::initActions() LDAP has to be implemented");
1880#endif //KAB_EMBEDDED 1880#endif //KAB_EMBEDDED
1881 1881
1882 1882
1883 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1883 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1884 SLOT( setWhoAmI() ), actionCollection(), 1884 SLOT( setWhoAmI() ), actionCollection(),
1885 "set_personal" ); 1885 "set_personal" );
1886 1886
1887 1887
1888 1888
1889 1889
1890 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1890 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1891 SLOT( setCategories() ), actionCollection(), 1891 SLOT( setCategories() ), actionCollection(),
1892 "edit_set_categories" ); 1892 "edit_set_categories" );
1893 1893
1894 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1894 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1895 SLOT( removeVoice() ), actionCollection(), 1895 SLOT( removeVoice() ), actionCollection(),
1896 "remove_voice" ); 1896 "remove_voice" );
1897 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1897 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1898 SLOT( importFromOL() ), actionCollection(), 1898 SLOT( importFromOL() ), actionCollection(),
1899 "import_OL" ); 1899 "import_OL" );
1900#ifdef KAB_EMBEDDED 1900#ifdef KAB_EMBEDDED
1901 mActionLicence = new KAction( i18n( "Licence" ), 0, 1901 mActionLicence = new KAction( i18n( "Licence" ), 0,
1902 this, SLOT( showLicence() ), actionCollection(), 1902 this, SLOT( showLicence() ), actionCollection(),
1903 "licence_about_data" ); 1903 "licence_about_data" );
1904 mActionFaq = new KAction( i18n( "Faq" ), 0, 1904 mActionFaq = new KAction( i18n( "Faq" ), 0,
1905 this, SLOT( faq() ), actionCollection(), 1905 this, SLOT( faq() ), actionCollection(),
1906 "faq_about_data" ); 1906 "faq_about_data" );
1907 mActionWN = new KAction( i18n( "What's New?" ), 0, 1907 mActionWN = new KAction( i18n( "What's New?" ), 0,
1908 this, SLOT( whatsnew() ), actionCollection(), 1908 this, SLOT( whatsnew() ), actionCollection(),
1909 "wn" ); 1909 "wn" );
1910 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 1910 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1911 this, SLOT( synchowto() ), actionCollection(), 1911 this, SLOT( synchowto() ), actionCollection(),
1912 "sync" ); 1912 "sync" );
1913 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
1914 this, SLOT( kdesynchowto() ), actionCollection(),
1915 "kdesync" );
1916 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
1917 this, SLOT( multisynchowto() ), actionCollection(),
1918 "multisync" );
1913 1919
1914 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1920 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1915 this, SLOT( createAboutData() ), actionCollection(), 1921 this, SLOT( createAboutData() ), actionCollection(),
1916 "kaddressbook_about_data" ); 1922 "kaddressbook_about_data" );
1917#endif //KAB_EMBEDDED 1923#endif //KAB_EMBEDDED
1918 1924
1919 clipboardDataChanged(); 1925 clipboardDataChanged();
1920 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1926 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1921 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1927 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1922} 1928}
1923 1929
1924//US we need this function, to plug all actions into the correct menues. 1930//US we need this function, to plug all actions into the correct menues.
1925// KDE uses a XML format to plug the actions, but we work her without this overhead. 1931// KDE uses a XML format to plug the actions, but we work her without this overhead.
1926void KABCore::addActionsManually() 1932void KABCore::addActionsManually()
1927{ 1933{
1928//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1934//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1929 1935
1930#ifdef KAB_EMBEDDED 1936#ifdef KAB_EMBEDDED
1931 QPopupMenu *fileMenu = new QPopupMenu( this ); 1937 QPopupMenu *fileMenu = new QPopupMenu( this );
1932 QPopupMenu *editMenu = new QPopupMenu( this ); 1938 QPopupMenu *editMenu = new QPopupMenu( this );
1933 QPopupMenu *helpMenu = new QPopupMenu( this ); 1939 QPopupMenu *helpMenu = new QPopupMenu( this );
1934 1940
1935 KToolBar* tb = mMainWindow->toolBar(); 1941 KToolBar* tb = mMainWindow->toolBar();
1936 1942
1937#ifndef DESKTOP_VERSION 1943#ifndef DESKTOP_VERSION
1938 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 1944 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
1939#endif 1945#endif
1940 QMenuBar* mb = mMainWindow->menuBar(); 1946 QMenuBar* mb = mMainWindow->menuBar();
1941 1947
1942 //US setup menubar. 1948 //US setup menubar.
1943 //Disable the following block if you do not want to have a menubar. 1949 //Disable the following block if you do not want to have a menubar.
1944 mb->insertItem( "&File", fileMenu ); 1950 mb->insertItem( "&File", fileMenu );
1945 mb->insertItem( "&Edit", editMenu ); 1951 mb->insertItem( "&Edit", editMenu );
1946 mb->insertItem( "&View", viewMenu ); 1952 mb->insertItem( "&View", viewMenu );
1947 mb->insertItem( "&Settings", settingsMenu ); 1953 mb->insertItem( "&Settings", settingsMenu );
1948 mb->insertItem( i18n("Synchronize"), syncMenu ); 1954 mb->insertItem( i18n("Synchronize"), syncMenu );
1949 mb->insertItem( "&Change selected", changeMenu ); 1955 mb->insertItem( "&Change selected", changeMenu );
1950 mb->insertItem( "&Help", helpMenu ); 1956 mb->insertItem( "&Help", helpMenu );
1951 mIncSearchWidget = new IncSearchWidget( tb ); 1957 mIncSearchWidget = new IncSearchWidget( tb );
1952 // tb->insertWidget(-1, 0, mIncSearchWidget); 1958 // tb->insertWidget(-1, 0, mIncSearchWidget);
1953#ifndef DESKTOP_VERSION 1959#ifndef DESKTOP_VERSION
1954 } else { 1960 } else {
1955 //US setup toolbar 1961 //US setup toolbar
1956 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 1962 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
1957 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1963 QPopupMenu *popupBarTB = new QPopupMenu( this );
1958 menuBarTB->insertItem( "ME", popupBarTB); 1964 menuBarTB->insertItem( "ME", popupBarTB);
1959 tb->insertWidget(-1, 0, menuBarTB); 1965 tb->insertWidget(-1, 0, menuBarTB);
1960 mIncSearchWidget = new IncSearchWidget( tb ); 1966 mIncSearchWidget = new IncSearchWidget( tb );
1961 1967
1962 tb->enableMoving(false); 1968 tb->enableMoving(false);
1963 popupBarTB->insertItem( "&File", fileMenu ); 1969 popupBarTB->insertItem( "&File", fileMenu );
1964 popupBarTB->insertItem( "&Edit", editMenu ); 1970 popupBarTB->insertItem( "&Edit", editMenu );
1965 popupBarTB->insertItem( "&View", viewMenu ); 1971 popupBarTB->insertItem( "&View", viewMenu );
1966 popupBarTB->insertItem( "&Settings", settingsMenu ); 1972 popupBarTB->insertItem( "&Settings", settingsMenu );
1967 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 1973 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
1968 mViewManager->getFilterAction()->plug ( popupBarTB); 1974 mViewManager->getFilterAction()->plug ( popupBarTB);
1969 popupBarTB->insertItem( "&Change selected", changeMenu ); 1975 popupBarTB->insertItem( "&Change selected", changeMenu );
1970 popupBarTB->insertItem( "&Help", helpMenu ); 1976 popupBarTB->insertItem( "&Help", helpMenu );
1971 if (QApplication::desktop()->width() > 320 ) { 1977 if (QApplication::desktop()->width() > 320 ) {
1972 // mViewManager->getFilterAction()->plug ( tb); 1978 // mViewManager->getFilterAction()->plug ( tb);
1973 } 1979 }
1974 } 1980 }
1975#endif 1981#endif
1976 // mActionQuit->plug ( mMainWindow->toolBar()); 1982 // mActionQuit->plug ( mMainWindow->toolBar());
1977 1983
1978 1984
1979 1985
1980 //US Now connect the actions with the menue entries. 1986 //US Now connect the actions with the menue entries.
1981 mActionPrint->plug( fileMenu ); 1987 mActionPrint->plug( fileMenu );
1982 mActionMail->plug( fileMenu ); 1988 mActionMail->plug( fileMenu );
1983 fileMenu->insertSeparator(); 1989 fileMenu->insertSeparator();
1984 1990
1985 mActionNewContact->plug( fileMenu ); 1991 mActionNewContact->plug( fileMenu );
1986 mActionNewContact->plug( tb ); 1992 mActionNewContact->plug( tb );
1987 1993
1988 mActionEditAddressee->plug( fileMenu ); 1994 mActionEditAddressee->plug( fileMenu );
1989 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 1995 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1990 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 1996 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1991 mActionEditAddressee->plug( tb ); 1997 mActionEditAddressee->plug( tb );
1992 1998
1993 fileMenu->insertSeparator(); 1999 fileMenu->insertSeparator();
1994 mActionSave->plug( fileMenu ); 2000 mActionSave->plug( fileMenu );
1995 fileMenu->insertItem( "&Import", ImportMenu ); 2001 fileMenu->insertItem( "&Import", ImportMenu );
1996 fileMenu->insertItem( "&Export", ExportMenu ); 2002 fileMenu->insertItem( "&Export", ExportMenu );
1997 fileMenu->insertSeparator(); 2003 fileMenu->insertSeparator();
1998 mActionMailVCard->plug( fileMenu ); 2004 mActionMailVCard->plug( fileMenu );
1999#ifndef DESKTOP_VERSION 2005#ifndef DESKTOP_VERSION
2000 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 2006 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
2001 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 2007 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
2002#endif 2008#endif
2003 fileMenu->insertSeparator(); 2009 fileMenu->insertSeparator();
2004 mActionQuit->plug( fileMenu ); 2010 mActionQuit->plug( fileMenu );
2005#ifdef _WIN32_ 2011#ifdef _WIN32_
2006 mActionImportOL->plug( ImportMenu ); 2012 mActionImportOL->plug( ImportMenu );
2007#endif 2013#endif
2008 // edit menu 2014 // edit menu
2009 mActionUndo->plug( editMenu ); 2015 mActionUndo->plug( editMenu );
2010 mActionRedo->plug( editMenu ); 2016 mActionRedo->plug( editMenu );
2011 editMenu->insertSeparator(); 2017 editMenu->insertSeparator();
2012 mActionCut->plug( editMenu ); 2018 mActionCut->plug( editMenu );
2013 mActionCopy->plug( editMenu ); 2019 mActionCopy->plug( editMenu );
2014 mActionPaste->plug( editMenu ); 2020 mActionPaste->plug( editMenu );
2015 mActionDelete->plug( editMenu ); 2021 mActionDelete->plug( editMenu );
2016 editMenu->insertSeparator(); 2022 editMenu->insertSeparator();
2017 mActionSelectAll->plug( editMenu ); 2023 mActionSelectAll->plug( editMenu );
2018 2024
2019 mActionRemoveVoice->plug( changeMenu ); 2025 mActionRemoveVoice->plug( changeMenu );
2020 // settings menu 2026 // settings menu
2021//US special menuentry to configure the addressbook resources. On KDE 2027//US special menuentry to configure the addressbook resources. On KDE
2022// you do that through the control center !!! 2028// you do that through the control center !!!
2023 mActionConfigResources->plug( settingsMenu ); 2029 mActionConfigResources->plug( settingsMenu );
2024 settingsMenu->insertSeparator(); 2030 settingsMenu->insertSeparator();
2025 2031
2026 mActionConfigKAddressbook->plug( settingsMenu ); 2032 mActionConfigKAddressbook->plug( settingsMenu );
2027 2033
2028 if ( mIsPart ) { 2034 if ( mIsPart ) {
2029 //US not implemented yet 2035 //US not implemented yet
2030 //mActionConfigShortcuts->plug( settingsMenu ); 2036 //mActionConfigShortcuts->plug( settingsMenu );
2031 //mActionConfigureToolbars->plug( settingsMenu ); 2037 //mActionConfigureToolbars->plug( settingsMenu );
2032 2038
2033 } else { 2039 } else {
2034 //US not implemented yet 2040 //US not implemented yet
2035 //mActionKeyBindings->plug( settingsMenu ); 2041 //mActionKeyBindings->plug( settingsMenu );
2036 } 2042 }
2037 2043
2038 settingsMenu->insertSeparator(); 2044 settingsMenu->insertSeparator();
2039 2045
2040 mActionJumpBar->plug( settingsMenu ); 2046 mActionJumpBar->plug( settingsMenu );
2041 mActionDetails->plug( settingsMenu ); 2047 mActionDetails->plug( settingsMenu );
2042 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2048 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2043 mActionDetails->plug( tb ); 2049 mActionDetails->plug( tb );
2044 settingsMenu->insertSeparator(); 2050 settingsMenu->insertSeparator();
2045 mActionBR->plug(settingsMenu ); 2051 mActionBR->plug(settingsMenu );
2046 settingsMenu->insertSeparator(); 2052 settingsMenu->insertSeparator();
2047 2053
2048 mActionWhoAmI->plug( settingsMenu ); 2054 mActionWhoAmI->plug( settingsMenu );
2049 mActionCategories->plug( settingsMenu ); 2055 mActionCategories->plug( settingsMenu );
2050 2056
2051 2057
2052 mActionWN->plug( helpMenu ); 2058 mActionWN->plug( helpMenu );
2053 mActionSyncHowto->plug( helpMenu ); 2059 mActionSyncHowto->plug( helpMenu );
2054 mActionLicence->plug( helpMenu ); 2060 mActionKdeSyncHowto->plug( helpMenu );
2061 mActionMultiSyncHowto->plug( helpMenu );
2055 mActionFaq->plug( helpMenu ); 2062 mActionFaq->plug( helpMenu );
2063 mActionLicence->plug( helpMenu );
2056 mActionAboutKAddressbook->plug( helpMenu ); 2064 mActionAboutKAddressbook->plug( helpMenu );
2057 2065
2058 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2066 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2059 2067
2060 mActionSave->plug( tb ); 2068 mActionSave->plug( tb );
2061 mViewManager->getFilterAction()->plug ( tb); 2069 mViewManager->getFilterAction()->plug ( tb);
2062 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2070 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2063 mActionUndo->plug( tb ); 2071 mActionUndo->plug( tb );
2064 mActionDelete->plug( tb ); 2072 mActionDelete->plug( tb );
2065 mActionRedo->plug( tb ); 2073 mActionRedo->plug( tb );
2066 } 2074 }
2067 } else { 2075 } else {
2068 mActionSave->plug( tb ); 2076 mActionSave->plug( tb );
2069 tb->enableMoving(false); 2077 tb->enableMoving(false);
2070 } 2078 }
2071 //mActionQuit->plug ( tb ); 2079 //mActionQuit->plug ( tb );
2072 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2080 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2073 2081
2074 //US link the searchwidget first to this. 2082 //US link the searchwidget first to this.
2075 // The real linkage to the toolbar happens later. 2083 // The real linkage to the toolbar happens later.
2076//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2084//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2077//US tb->insertItem( mIncSearchWidget ); 2085//US tb->insertItem( mIncSearchWidget );
2078/*US 2086/*US
2079 mIncSearchWidget = new IncSearchWidget( tb ); 2087 mIncSearchWidget = new IncSearchWidget( tb );
2080 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2088 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2081 SLOT( incrementalSearch( const QString& ) ) ); 2089 SLOT( incrementalSearch( const QString& ) ) );
2082 2090
2083 mJumpButtonBar = new JumpButtonBar( this, this ); 2091 mJumpButtonBar = new JumpButtonBar( this, this );
2084 2092
2085//US topLayout->addWidget( mJumpButtonBar ); 2093//US topLayout->addWidget( mJumpButtonBar );
2086 this->layout()->add( mJumpButtonBar ); 2094 this->layout()->add( mJumpButtonBar );
2087*/ 2095*/
2088 2096
2089#endif //KAB_EMBEDDED 2097#endif //KAB_EMBEDDED
2090 2098
2091 mActionExport2phone->plug( ExportMenu ); 2099 mActionExport2phone->plug( ExportMenu );
2092 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2100 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2093 syncManager->fillSyncMenu(); 2101 syncManager->fillSyncMenu();
2094 2102
2095} 2103}
2096void KABCore::showLicence() 2104void KABCore::showLicence()
2097{ 2105{
2098 KApplication::showLicence(); 2106 KApplication::showLicence();
2099} 2107}
2100void KABCore::removeVoice() 2108void KABCore::removeVoice()
2101{ 2109{
2102 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 ) 2110 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 )
2103 return; 2111 return;
2104 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2112 KABC::Addressee::List list = mViewManager->selectedAddressees();
2105 KABC::Addressee::List::Iterator it; 2113 KABC::Addressee::List::Iterator it;
2106 for ( it = list.begin(); it != list.end(); ++it ) { 2114 for ( it = list.begin(); it != list.end(); ++it ) {
2107 2115
2108 if ( (*it).removeVoice() ) 2116 if ( (*it).removeVoice() )
2109 contactModified((*it) ); 2117 contactModified((*it) );
2110 } 2118 }
2111} 2119}
2112 2120
2113 2121
2114 2122
2115void KABCore::clipboardDataChanged() 2123void KABCore::clipboardDataChanged()
2116{ 2124{
2117 2125
2118 if ( mReadWrite ) 2126 if ( mReadWrite )
2119 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2127 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2120 2128
2121} 2129}
2122 2130
2123void KABCore::updateActionMenu() 2131void KABCore::updateActionMenu()
2124{ 2132{
2125 UndoStack *undo = UndoStack::instance(); 2133 UndoStack *undo = UndoStack::instance();
2126 RedoStack *redo = RedoStack::instance(); 2134 RedoStack *redo = RedoStack::instance();
2127 2135
2128 if ( undo->isEmpty() ) 2136 if ( undo->isEmpty() )
2129 mActionUndo->setText( i18n( "Undo" ) ); 2137 mActionUndo->setText( i18n( "Undo" ) );
2130 else 2138 else
2131 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2139 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2132 2140
2133 mActionUndo->setEnabled( !undo->isEmpty() ); 2141 mActionUndo->setEnabled( !undo->isEmpty() );
2134 2142
2135 if ( !redo->top() ) 2143 if ( !redo->top() )
2136 mActionRedo->setText( i18n( "Redo" ) ); 2144 mActionRedo->setText( i18n( "Redo" ) );
2137 else 2145 else
2138 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2146 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2139 2147
2140 mActionRedo->setEnabled( !redo->isEmpty() ); 2148 mActionRedo->setEnabled( !redo->isEmpty() );
2141} 2149}
2142 2150
2143void KABCore::configureKeyBindings() 2151void KABCore::configureKeyBindings()
2144{ 2152{
2145#ifndef KAB_EMBEDDED 2153#ifndef KAB_EMBEDDED
2146 KKeyDialog::configure( actionCollection(), true ); 2154 KKeyDialog::configure( actionCollection(), true );
2147#else //KAB_EMBEDDED 2155#else //KAB_EMBEDDED
2148 qDebug("KABCore::configureKeyBindings() not implemented"); 2156 qDebug("KABCore::configureKeyBindings() not implemented");
2149#endif //KAB_EMBEDDED 2157#endif //KAB_EMBEDDED
2150} 2158}
2151 2159
2152#ifdef KAB_EMBEDDED 2160#ifdef KAB_EMBEDDED
2153void KABCore::configureResources() 2161void KABCore::configureResources()
2154{ 2162{
2155 KRES::KCMKResources dlg( this, "" , 0 ); 2163 KRES::KCMKResources dlg( this, "" , 0 );
2156 2164
2157 if ( !dlg.exec() ) 2165 if ( !dlg.exec() )
2158 return; 2166 return;
2159 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2167 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2160} 2168}
2161#endif //KAB_EMBEDDED 2169#endif //KAB_EMBEDDED
2162 2170
2163 2171
2164/* this method will be called through the QCop interface from Ko/Pi to select addresses 2172/* this method will be called through the QCop interface from Ko/Pi to select addresses
2165 * for the attendees list of an event. 2173 * for the attendees list of an event.
2166 */ 2174 */
2167void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2175void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2168{ 2176{
2169 QStringList nameList; 2177 QStringList nameList;
2170 QStringList emailList; 2178 QStringList emailList;
2171 QStringList uidList; 2179 QStringList uidList;
2172 2180
2173 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2181 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2174 uint i=0; 2182 uint i=0;
2175 for (i=0; i < list.count(); i++) 2183 for (i=0; i < list.count(); i++)
2176 { 2184 {
2177 nameList.append(list[i].realName()); 2185 nameList.append(list[i].realName());
2178 emailList.append(list[i].preferredEmail()); 2186 emailList.append(list[i].preferredEmail());
2179 uidList.append(list[i].uid()); 2187 uidList.append(list[i].uid());
2180 } 2188 }
2181 2189
2182 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2190 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2183 2191
@@ -2225,257 +2233,264 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString
2225 bar.setProgress( count++ ); 2233 bar.setProgress( count++ );
2226 qApp->processEvents(); 2234 qApp->processEvents();
2227 bday = (*it).birthday().date(); 2235 bday = (*it).birthday().date();
2228 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2236 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2229 2237
2230 if ( bday.isValid() || !anni.isEmpty()) 2238 if ( bday.isValid() || !anni.isEmpty())
2231 { 2239 {
2232 if (bday.isValid()) 2240 if (bday.isValid())
2233 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2241 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2234 else 2242 else
2235 formattedbday = "NOTVALID"; 2243 formattedbday = "NOTVALID";
2236 if (anni.isEmpty()) 2244 if (anni.isEmpty())
2237 anni = "INVALID"; 2245 anni = "INVALID";
2238 2246
2239 birthdayList.append(formattedbday); 2247 birthdayList.append(formattedbday);
2240 anniversaryList.append(anni); //should be ISODate 2248 anniversaryList.append(anni); //should be ISODate
2241 realNameList.append((*it).realName()); 2249 realNameList.append((*it).realName());
2242 preferredEmailList.append((*it).preferredEmail()); 2250 preferredEmailList.append((*it).preferredEmail());
2243 assembledNameList.append((*it).assembledName()); 2251 assembledNameList.append((*it).assembledName());
2244 uidList.append((*it).uid()); 2252 uidList.append((*it).uid());
2245 2253
2246 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() ); 2254 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() );
2247 } 2255 }
2248 } 2256 }
2249 2257
2250 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2258 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2251 2259
2252} 2260}
2253 2261
2254/* this method will be called through the QCop interface from other apps to show details of a contact. 2262/* this method will be called through the QCop interface from other apps to show details of a contact.
2255 */ 2263 */
2256void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2264void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2257{ 2265{
2258 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2266 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2259 2267
2260 QString foundUid = QString::null; 2268 QString foundUid = QString::null;
2261 if ( ! uid.isEmpty() ) { 2269 if ( ! uid.isEmpty() ) {
2262 Addressee adrr = mAddressBook->findByUid( uid ); 2270 Addressee adrr = mAddressBook->findByUid( uid );
2263 if ( !adrr.isEmpty() ) { 2271 if ( !adrr.isEmpty() ) {
2264 foundUid = uid; 2272 foundUid = uid;
2265 } 2273 }
2266 if ( email == "sendbacklist" ) { 2274 if ( email == "sendbacklist" ) {
2267 //qDebug("ssssssssssssssssssssssend "); 2275 //qDebug("ssssssssssssssssssssssend ");
2268 QStringList nameList; 2276 QStringList nameList;
2269 QStringList emailList; 2277 QStringList emailList;
2270 QStringList uidList; 2278 QStringList uidList;
2271 nameList.append(adrr.realName()); 2279 nameList.append(adrr.realName());
2272 emailList = adrr.emails(); 2280 emailList = adrr.emails();
2273 uidList.append( adrr.preferredEmail()); 2281 uidList.append( adrr.preferredEmail());
2274 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2282 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2275 return; 2283 return;
2276 } 2284 }
2277 2285
2278 } 2286 }
2279 2287
2280 if ( email == "sendbacklist" ) 2288 if ( email == "sendbacklist" )
2281 return; 2289 return;
2282 if (foundUid.isEmpty()) 2290 if (foundUid.isEmpty())
2283 { 2291 {
2284 //find the uid of the person first 2292 //find the uid of the person first
2285 Addressee::List namelist; 2293 Addressee::List namelist;
2286 Addressee::List emaillist; 2294 Addressee::List emaillist;
2287 2295
2288 if (!name.isEmpty()) 2296 if (!name.isEmpty())
2289 namelist = mAddressBook->findByName( name ); 2297 namelist = mAddressBook->findByName( name );
2290 2298
2291 if (!email.isEmpty()) 2299 if (!email.isEmpty())
2292 emaillist = mAddressBook->findByEmail( email ); 2300 emaillist = mAddressBook->findByEmail( email );
2293 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2301 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2294 //check if we have a match in Namelist and Emaillist 2302 //check if we have a match in Namelist and Emaillist
2295 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2303 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2296 foundUid = emaillist[0].uid(); 2304 foundUid = emaillist[0].uid();
2297 } 2305 }
2298 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2306 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2299 foundUid = namelist[0].uid(); 2307 foundUid = namelist[0].uid();
2300 else 2308 else
2301 { 2309 {
2302 for (int i = 0; i < namelist.count(); i++) 2310 for (int i = 0; i < namelist.count(); i++)
2303 { 2311 {
2304 for (int j = 0; j < emaillist.count(); j++) 2312 for (int j = 0; j < emaillist.count(); j++)
2305 { 2313 {
2306 if (namelist[i] == emaillist[j]) 2314 if (namelist[i] == emaillist[j])
2307 { 2315 {
2308 foundUid = namelist[i].uid(); 2316 foundUid = namelist[i].uid();
2309 } 2317 }
2310 } 2318 }
2311 } 2319 }
2312 } 2320 }
2313 } 2321 }
2314 else 2322 else
2315 { 2323 {
2316 foundUid = uid; 2324 foundUid = uid;
2317 } 2325 }
2318 2326
2319 if (!foundUid.isEmpty()) 2327 if (!foundUid.isEmpty())
2320 { 2328 {
2321 2329
2322 // raise Ka/Pi if it is in the background 2330 // raise Ka/Pi if it is in the background
2323#ifndef DESKTOP_VERSION 2331#ifndef DESKTOP_VERSION
2324#ifndef KORG_NODCOP 2332#ifndef KORG_NODCOP
2325 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2333 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2326#endif 2334#endif
2327#endif 2335#endif
2328 2336
2329 mMainWindow->showMaximized(); 2337 mMainWindow->showMaximized();
2330 mMainWindow-> raise(); 2338 mMainWindow-> raise();
2331 2339
2332 mViewManager->setSelected( "", false); 2340 mViewManager->setSelected( "", false);
2333 mViewManager->refreshView( "" ); 2341 mViewManager->refreshView( "" );
2334 mViewManager->setSelected( foundUid, true ); 2342 mViewManager->setSelected( foundUid, true );
2335 mViewManager->refreshView( foundUid ); 2343 mViewManager->refreshView( foundUid );
2336 2344
2337 if ( !mMultipleViewsAtOnce ) 2345 if ( !mMultipleViewsAtOnce )
2338 { 2346 {
2339 setDetailsVisible( true ); 2347 setDetailsVisible( true );
2340 mActionDetails->setChecked(true); 2348 mActionDetails->setChecked(true);
2341 } 2349 }
2342 } 2350 }
2343} 2351}
2344 2352
2345void KABCore::whatsnew() 2353void KABCore::whatsnew()
2346{ 2354{
2347 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2355 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2348} 2356}
2349void KABCore::synchowto() 2357void KABCore::synchowto()
2350{ 2358{
2351 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2359 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2352} 2360}
2353 2361void KABCore::kdesynchowto()
2362{
2363 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2364}
2365void KABCore::multisynchowto()
2366{
2367 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2368}
2354void KABCore::faq() 2369void KABCore::faq()
2355{ 2370{
2356 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2371 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2357} 2372}
2358 2373
2359#include <libkcal/syncdefines.h> 2374#include <libkcal/syncdefines.h>
2360 2375
2361KABC::Addressee KABCore::getLastSyncAddressee() 2376KABC::Addressee KABCore::getLastSyncAddressee()
2362{ 2377{
2363 Addressee lse; 2378 Addressee lse;
2364 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2379 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2365 2380
2366 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2381 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2367 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2382 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2368 if (lse.isEmpty()) { 2383 if (lse.isEmpty()) {
2369 qDebug("Creating new last-syncAddressee "); 2384 qDebug("Creating new last-syncAddressee ");
2370 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2385 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2371 QString sum = ""; 2386 QString sum = "";
2372 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2387 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2373 sum = "E: "; 2388 sum = "E: ";
2374 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2389 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2375 lse.setRevision( mLastAddressbookSync ); 2390 lse.setRevision( mLastAddressbookSync );
2376 lse.setCategories( i18n("SyncEvent") ); 2391 lse.setCategories( i18n("SyncEvent") );
2377 mAddressBook->insertAddressee( lse ); 2392 mAddressBook->insertAddressee( lse );
2378 } 2393 }
2379 return lse; 2394 return lse;
2380} 2395}
2381int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2396int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2382{ 2397{
2383 2398
2384 //void setZaurusId(int id); 2399 //void setZaurusId(int id);
2385 // int zaurusId() const; 2400 // int zaurusId() const;
2386 // void setZaurusUid(int id); 2401 // void setZaurusUid(int id);
2387 // int zaurusUid() const; 2402 // int zaurusUid() const;
2388 // void setZaurusStat(int id); 2403 // void setZaurusStat(int id);
2389 // int zaurusStat() const; 2404 // int zaurusStat() const;
2390 // 0 equal 2405 // 0 equal
2391 // 1 take local 2406 // 1 take local
2392 // 2 take remote 2407 // 2 take remote
2393 // 3 cancel 2408 // 3 cancel
2394 QDateTime lastSync = mLastAddressbookSync; 2409 QDateTime lastSync = mLastAddressbookSync;
2395 QDateTime localMod = local->revision(); 2410 QDateTime localMod = local->revision();
2396 QDateTime remoteMod = remote->revision(); 2411 QDateTime remoteMod = remote->revision();
2397 2412
2398 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2413 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2399 2414
2400 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2415 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2401 bool remCh, locCh; 2416 bool remCh, locCh;
2402 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2417 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2403 2418
2404 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2419 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2405 locCh = ( localMod > mLastAddressbookSync ); 2420 locCh = ( localMod > mLastAddressbookSync );
2406 if ( !remCh && ! locCh ) { 2421 if ( !remCh && ! locCh ) {
2407 //qDebug("both not changed "); 2422 //qDebug("both not changed ");
2408 lastSync = localMod.addDays(1); 2423 lastSync = localMod.addDays(1);
2409 if ( mode <= SYNC_PREF_ASK ) 2424 if ( mode <= SYNC_PREF_ASK )
2410 return 0; 2425 return 0;
2411 } else { 2426 } else {
2412 if ( locCh ) { 2427 if ( locCh ) {
2413 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2428 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2414 lastSync = localMod.addDays( -1 ); 2429 lastSync = localMod.addDays( -1 );
2415 if ( !remCh ) 2430 if ( !remCh )
2416 remoteMod =( lastSync.addDays( -1 ) ); 2431 remoteMod =( lastSync.addDays( -1 ) );
2417 } else { 2432 } else {
2418 //qDebug(" not loc changed "); 2433 //qDebug(" not loc changed ");
2419 lastSync = localMod.addDays( 1 ); 2434 lastSync = localMod.addDays( 1 );
2420 if ( remCh ) 2435 if ( remCh )
2421 remoteMod =( lastSync.addDays( 1 ) ); 2436 remoteMod =( lastSync.addDays( 1 ) );
2422 2437
2423 } 2438 }
2424 } 2439 }
2425 full = true; 2440 full = true;
2426 if ( mode < SYNC_PREF_ASK ) 2441 if ( mode < SYNC_PREF_ASK )
2427 mode = SYNC_PREF_ASK; 2442 mode = SYNC_PREF_ASK;
2428 } else { 2443 } else {
2429 if ( localMod == remoteMod ) 2444 if ( localMod == remoteMod )
2430 return 0; 2445 return 0;
2431 2446
2432 } 2447 }
2433 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 2448 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
2434 2449
2435 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); 2450 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod);
2436 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 2451 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
2437 //full = true; //debug only 2452 //full = true; //debug only
2438 if ( full ) { 2453 if ( full ) {
2439 bool equ = ( (*local) == (*remote) ); 2454 bool equ = ( (*local) == (*remote) );
2440 if ( equ ) { 2455 if ( equ ) {
2441 //qDebug("equal "); 2456 //qDebug("equal ");
2442 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2457 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2443 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2458 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2444 } 2459 }
2445 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2460 if ( mode < SYNC_PREF_FORCE_LOCAL )
2446 return 0; 2461 return 0;
2447 2462
2448 }//else //debug only 2463 }//else //debug only
2449 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2464 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2450 } 2465 }
2451 int result; 2466 int result;
2452 bool localIsNew; 2467 bool localIsNew;
2453 //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() ); 2468 //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() );
2454 2469
2455 if ( full && mode < SYNC_PREF_NEWEST ) 2470 if ( full && mode < SYNC_PREF_NEWEST )
2456 mode = SYNC_PREF_ASK; 2471 mode = SYNC_PREF_ASK;
2457 2472
2458 switch( mode ) { 2473 switch( mode ) {
2459 case SYNC_PREF_LOCAL: 2474 case SYNC_PREF_LOCAL:
2460 if ( lastSync > remoteMod ) 2475 if ( lastSync > remoteMod )
2461 return 1; 2476 return 1;
2462 if ( lastSync > localMod ) 2477 if ( lastSync > localMod )
2463 return 2; 2478 return 2;
2464 return 1; 2479 return 1;
2465 break; 2480 break;
2466 case SYNC_PREF_REMOTE: 2481 case SYNC_PREF_REMOTE:
2467 if ( lastSync > remoteMod ) 2482 if ( lastSync > remoteMod )
2468 return 1; 2483 return 1;
2469 if ( lastSync > localMod ) 2484 if ( lastSync > localMod )
2470 return 2; 2485 return 2;
2471 return 2; 2486 return 2;
2472 break; 2487 break;
2473 case SYNC_PREF_NEWEST: 2488 case SYNC_PREF_NEWEST:
2474 if ( localMod > remoteMod ) 2489 if ( localMod > remoteMod )
2475 return 1; 2490 return 1;
2476 else 2491 else
2477 return 2; 2492 return 2;
2478 break; 2493 break;
2479 case SYNC_PREF_ASK: 2494 case SYNC_PREF_ASK:
2480 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2495 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2481 if ( lastSync > remoteMod ) 2496 if ( lastSync > remoteMod )
@@ -2653,303 +2668,308 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2653 } 2668 }
2654 idS = inL.IDStr(); 2669 idS = inL.IDStr();
2655 local->removeAddressee( inL ); 2670 local->removeAddressee( inL );
2656 inL = inR; 2671 inL = inR;
2657 inL.setIDStr( idS ); 2672 inL.setIDStr( idS );
2658 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2673 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2659 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2674 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2660 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2675 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2661 } 2676 }
2662 inL.setResource( 0 ); 2677 inL.setResource( 0 );
2663 local->insertAddressee( inL , false ); 2678 local->insertAddressee( inL , false );
2664 ++changedLocal; 2679 ++changedLocal;
2665 } 2680 }
2666 } 2681 }
2667 } 2682 }
2668 } else { // no conflict 2683 } else { // no conflict
2669 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2684 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2670 QString des = addresseeLSync.note(); 2685 QString des = addresseeLSync.note();
2671 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 2686 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
2672 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 2687 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
2673 remote->insertAddressee( inR, false ); 2688 remote->insertAddressee( inR, false );
2674 ++deletedAddresseeR; 2689 ++deletedAddresseeR;
2675 } else { 2690 } else {
2676 inR.setRevision( modifiedCalendar ); 2691 inR.setRevision( modifiedCalendar );
2677 remote->insertAddressee( inR, false ); 2692 remote->insertAddressee( inR, false );
2678 inL = inR; 2693 inL = inR;
2679 inL.setResource( 0 ); 2694 inL.setResource( 0 );
2680 local->insertAddressee( inL , false); 2695 local->insertAddressee( inL , false);
2681 ++addedAddressee; 2696 ++addedAddressee;
2682 } 2697 }
2683 } else { 2698 } else {
2684 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { 2699 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) {
2685 inR.setRevision( modifiedCalendar ); 2700 inR.setRevision( modifiedCalendar );
2686 remote->insertAddressee( inR, false ); 2701 remote->insertAddressee( inR, false );
2687 inR.setResource( 0 ); 2702 inR.setResource( 0 );
2688 local->insertAddressee( inR, false ); 2703 local->insertAddressee( inR, false );
2689 ++addedAddressee; 2704 ++addedAddressee;
2690 } else { 2705 } else {
2691 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); 2706 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
2692 remote->removeAddressee( inR ); 2707 remote->removeAddressee( inR );
2693 ++deletedAddresseeR; 2708 ++deletedAddresseeR;
2694 } 2709 }
2695 } 2710 }
2696 } 2711 }
2697 } 2712 }
2698 ++incCounter; 2713 ++incCounter;
2699 } 2714 }
2700 er.clear(); 2715 er.clear();
2701 QStringList el = local->uidList(); 2716 QStringList el = local->uidList();
2702 modulo = (el.count()/10)+1; 2717 modulo = (el.count()/10)+1;
2703 2718
2704 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 2719 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
2705 incCounter = 0; 2720 incCounter = 0;
2706 while ( incCounter < el.count()) { 2721 while ( incCounter < el.count()) {
2707 qApp->processEvents(); 2722 qApp->processEvents();
2708 if (syncManager->isProgressBarCanceled()) 2723 if (syncManager->isProgressBarCanceled())
2709 return false; 2724 return false;
2710 if ( incCounter % modulo == 0 ) 2725 if ( incCounter % modulo == 0 )
2711 syncManager->showProgressBar(incCounter); 2726 syncManager->showProgressBar(incCounter);
2712 uid = el[ incCounter ]; 2727 uid = el[ incCounter ];
2713 bool skipIncidence = false; 2728 bool skipIncidence = false;
2714 if ( uid.left(19) == QString("last-syncAddressee-") ) 2729 if ( uid.left(19) == QString("last-syncAddressee-") )
2715 skipIncidence = true; 2730 skipIncidence = true;
2716 if ( !skipIncidence ) { 2731 if ( !skipIncidence ) {
2717 inL = local->findByUid( uid ); 2732 inL = local->findByUid( uid );
2718 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2733 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2719 inR = remote->findByUid( uid ); 2734 inR = remote->findByUid( uid );
2720 if ( inR.isEmpty() ) { 2735 if ( inR.isEmpty() ) {
2721 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2736 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2722 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2737 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
2723 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2738 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2724 local->removeAddressee( inL ); 2739 local->removeAddressee( inL );
2725 ++deletedAddresseeL; 2740 ++deletedAddresseeL;
2726 } else { 2741 } else {
2727 if ( ! syncManager->mWriteBackExistingOnly ) { 2742 if ( ! syncManager->mWriteBackExistingOnly ) {
2728 inL.removeID(mCurrentSyncDevice ); 2743 inL.removeID(mCurrentSyncDevice );
2729 ++addedAddresseeR; 2744 ++addedAddresseeR;
2730 inL.setRevision( modifiedCalendar ); 2745 inL.setRevision( modifiedCalendar );
2731 local->insertAddressee( inL, false ); 2746 local->insertAddressee( inL, false );
2732 inR = inL; 2747 inR = inL;
2733 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 2748 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
2734 inR.setResource( 0 ); 2749 inR.setResource( 0 );
2735 remote->insertAddressee( inR, false ); 2750 remote->insertAddressee( inR, false );
2736 } 2751 }
2737 } 2752 }
2738 } else { 2753 } else {
2739 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 2754 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
2740 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2755 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2741 local->removeAddressee( inL ); 2756 local->removeAddressee( inL );
2742 ++deletedAddresseeL; 2757 ++deletedAddresseeL;
2743 } else { 2758 } else {
2744 if ( ! syncManager->mWriteBackExistingOnly ) { 2759 if ( ! syncManager->mWriteBackExistingOnly ) {
2745 ++addedAddresseeR; 2760 ++addedAddresseeR;
2746 inL.setRevision( modifiedCalendar ); 2761 inL.setRevision( modifiedCalendar );
2747 local->insertAddressee( inL, false ); 2762 local->insertAddressee( inL, false );
2748 inR = inL; 2763 inR = inL;
2749 inR.setResource( 0 ); 2764 inR.setResource( 0 );
2750 remote->insertAddressee( inR, false ); 2765 remote->insertAddressee( inR, false );
2751 } 2766 }
2752 } 2767 }
2753 } 2768 }
2754 } 2769 }
2755 } 2770 }
2756 } 2771 }
2757 ++incCounter; 2772 ++incCounter;
2758 } 2773 }
2759 el.clear(); 2774 el.clear();
2760 syncManager->hideProgressBar(); 2775 syncManager->hideProgressBar();
2761 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2776 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2762 // get rid of micro seconds 2777 // get rid of micro seconds
2763 QTime t = mLastAddressbookSync.time(); 2778 QTime t = mLastAddressbookSync.time();
2764 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2779 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2765 addresseeLSync.setRevision( mLastAddressbookSync ); 2780 addresseeLSync.setRevision( mLastAddressbookSync );
2766 addresseeRSync.setRevision( mLastAddressbookSync ); 2781 addresseeRSync.setRevision( mLastAddressbookSync );
2767 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2782 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2768 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2783 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2769 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2784 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2770 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2785 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2771 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2786 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2772 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2787 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2773 addresseeRSync.setNote( "" ) ; 2788 addresseeRSync.setNote( "" ) ;
2774 addresseeLSync.setNote( "" ); 2789 addresseeLSync.setNote( "" );
2775 2790
2776 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2791 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2777 remote->insertAddressee( addresseeRSync, false ); 2792 remote->insertAddressee( addresseeRSync, false );
2778 local->insertAddressee( addresseeLSync, false ); 2793 local->insertAddressee( addresseeLSync, false );
2779 QString mes; 2794 QString mes;
2780 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2795 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2781 if ( syncManager->mShowSyncSummary ) {
2782 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") );
2783 }
2784 qDebug( mes ); 2796 qDebug( mes );
2797 if ( syncManager->mShowSyncSummary ) {
2798 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
2799 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
2800 qDebug("cancelled ");
2801 return false;
2802 }
2803 }
2785 return syncOK; 2804 return syncOK;
2786} 2805}
2787 2806
2788 2807
2789//this is a overwritten callbackmethods from the syncinterface 2808//this is a overwritten callbackmethods from the syncinterface
2790bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2809bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2791{ 2810{
2792 2811
2793 //pending prepare addresseeview for output 2812 //pending prepare addresseeview for output
2794 //pending detect, if remote file has REV field. if not switch to external sync 2813 //pending detect, if remote file has REV field. if not switch to external sync
2795 mGlobalSyncMode = SYNC_MODE_NORMAL; 2814 mGlobalSyncMode = SYNC_MODE_NORMAL;
2796 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2815 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2797 2816
2798 AddressBook abLocal(filename,"syncContact"); 2817 AddressBook abLocal(filename,"syncContact");
2799 bool syncOK = false; 2818 bool syncOK = false;
2800 if ( abLocal.load() ) { 2819 if ( abLocal.load() ) {
2801 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 2820 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2802 bool external = false; 2821 bool external = false;
2803 bool isXML = false; 2822 bool isXML = false;
2804 if ( filename.right(4) == ".xml") { 2823 if ( filename.right(4) == ".xml") {
2805 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2824 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2806 isXML = true; 2825 isXML = true;
2807 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2826 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2808 } else { 2827 } else {
2809 external = !manager->mIsKapiFile; 2828 external = !manager->mIsKapiFile;
2810 if ( external ) { 2829 if ( external ) {
2811 qDebug("Setting vcf mode to external "); 2830 qDebug("Setting vcf mode to external ");
2812 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2831 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2813 AddressBook::Iterator it; 2832 AddressBook::Iterator it;
2814 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2833 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2815 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2834 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2816 (*it).computeCsum( mCurrentSyncDevice ); 2835 (*it).computeCsum( mCurrentSyncDevice );
2817 } 2836 }
2818 } 2837 }
2819 } 2838 }
2820 //AddressBook::Iterator it; 2839 //AddressBook::Iterator it;
2821 //QStringList vcards; 2840 //QStringList vcards;
2822 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2841 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2823 // qDebug("Name %s ", (*it).familyName().latin1()); 2842 // qDebug("Name %s ", (*it).familyName().latin1());
2824 //} 2843 //}
2825 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2844 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2826 if ( syncOK ) { 2845 if ( syncOK ) {
2827 if ( syncManager->mWriteBackFile ) 2846 if ( syncManager->mWriteBackFile )
2828 { 2847 {
2829 if ( external ) 2848 if ( external )
2830 abLocal.removeSyncAddressees( !isXML); 2849 abLocal.removeSyncAddressees( !isXML);
2831 qDebug("Saving remote AB "); 2850 qDebug("Saving remote AB ");
2832 if ( ! abLocal.saveAB()) 2851 if ( ! abLocal.saveAB())
2833 qDebug("Error writing back AB to file "); 2852 qDebug("Error writing back AB to file ");
2834 if ( external ) { 2853 if ( external ) {
2835 // afterwrite processing 2854 // afterwrite processing
2836 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); 2855 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
2837 } 2856 }
2838 } 2857 }
2839 } 2858 }
2840 setModified(); 2859 setModified();
2841 2860
2842 } 2861 }
2843 if ( syncOK ) 2862 if ( syncOK )
2844 mViewManager->refreshView(); 2863 mViewManager->refreshView();
2845 return syncOK; 2864 return syncOK;
2846 2865
2847} 2866}
2848void KABCore::removeSyncInfo( QString syncProfile) 2867void KABCore::removeSyncInfo( QString syncProfile)
2849{ 2868{
2850 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); 2869 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
2851 mAddressBook->removeSyncInfo( syncProfile ); 2870 mAddressBook->removeSyncInfo( syncProfile );
2852 setModified(); 2871 setModified();
2853} 2872}
2854 2873
2855 2874
2856//this is a overwritten callbackmethods from the syncinterface 2875//this is a overwritten callbackmethods from the syncinterface
2857bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2876bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2858{ 2877{
2859 if ( resource == "phone" ) 2878 if ( resource == "phone" )
2860 return syncPhone(); 2879 return syncPhone();
2861 disableBR( true ); 2880 disableBR( true );
2862 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2881 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2863 2882
2864 AddressBook abLocal( resource,"syncContact"); 2883 AddressBook abLocal( resource,"syncContact");
2865 bool syncOK = false; 2884 bool syncOK = false;
2866 if ( abLocal.load() ) { 2885 if ( abLocal.load() ) {
2867 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2886 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2868 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2887 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2869 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 2888 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
2870 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2889 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2871 if ( syncOK ) { 2890 if ( syncOK ) {
2872 if ( syncManager->mWriteBackFile ) { 2891 if ( syncManager->mWriteBackFile ) {
2873 abLocal.removeSyncAddressees( false ); 2892 abLocal.removeSyncAddressees( false );
2874 abLocal.saveAB(); 2893 abLocal.saveAB();
2875 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 2894 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
2876 } 2895 }
2877 } 2896 } else
2897 message( i18n("Sync cancelled or failed.") );
2878 setModified(); 2898 setModified();
2879 } 2899 }
2880 if ( syncOK ) 2900 if ( syncOK )
2881 mViewManager->refreshView(); 2901 mViewManager->refreshView();
2882 disableBR( false ); 2902 disableBR( false );
2883 return syncOK; 2903 return syncOK;
2884 2904
2885} 2905}
2886void KABCore::message( QString m ) 2906void KABCore::message( QString m )
2887{ 2907{
2888 topLevelWidget()->setCaption( m ); 2908 topLevelWidget()->setCaption( m );
2889 mMessageTimer->start( 15000, true ); 2909 mMessageTimer->start( 15000, true );
2890} 2910}
2891bool KABCore::syncPhone() 2911bool KABCore::syncPhone()
2892{ 2912{
2893 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2913 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2894 QString fileName = getPhoneFile(); 2914 QString fileName = getPhoneFile();
2895 if ( !PhoneAccess::readFromPhone( fileName) ) { 2915 if ( !PhoneAccess::readFromPhone( fileName) ) {
2896 message(i18n("Phone access failed!")); 2916 message(i18n("Phone access failed!"));
2897 return false; 2917 return false;
2898 } 2918 }
2899 AddressBook abLocal( fileName,"syncContact"); 2919 AddressBook abLocal( fileName,"syncContact");
2900 bool syncOK = false; 2920 bool syncOK = false;
2901 { 2921 {
2902 abLocal.importFromFile( fileName ); 2922 abLocal.importFromFile( fileName );
2903 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2923 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2904 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2924 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2905 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 2925 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2906 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2926 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2907 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2927 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2908 if ( syncOK ) { 2928 if ( syncOK ) {
2909 if ( syncManager->mWriteBackFile ) { 2929 if ( syncManager->mWriteBackFile ) {
2910 abLocal.removeSyncAddressees( true ); 2930 abLocal.removeSyncAddressees( true );
2911 abLocal.saveABphone( fileName ); 2931 abLocal.saveABphone( fileName );
2912 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 2932 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
2913 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 2933 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
2914 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 2934 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
2915 } 2935 }
2916 } 2936 }
2917 setModified(); 2937 setModified();
2918 } 2938 }
2919 if ( syncOK ) 2939 if ( syncOK )
2920 mViewManager->refreshView(); 2940 mViewManager->refreshView();
2921 return syncOK; 2941 return syncOK;
2922} 2942}
2923void KABCore::getFile( bool success ) 2943void KABCore::getFile( bool success )
2924{ 2944{
2925 if ( ! success ) { 2945 if ( ! success ) {
2926 message( i18n("Error receiving file. Nothing changed!") ); 2946 message( i18n("Error receiving file. Nothing changed!") );
2927 return; 2947 return;
2928 } 2948 }
2929 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 2949 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
2930 if ( count ) 2950 if ( count )
2931 setModified( true ); 2951 setModified( true );
2932 message( i18n("Pi-Sync successful!") ); 2952 message( i18n("Pi-Sync successful!") );
2933 mViewManager->refreshView(); 2953 mViewManager->refreshView();
2934} 2954}
2935void KABCore::syncFileRequest() 2955void KABCore::syncFileRequest()
2936{ 2956{
2937 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { 2957 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
2938 syncManager->slotSyncMenu( 999 ); 2958 syncManager->slotSyncMenu( 999 );
2939 } 2959 }
2940 mAddressBook->export2File( sentSyncFile() ); 2960 mAddressBook->export2File( sentSyncFile() );
2941} 2961}
2942QString KABCore::sentSyncFile() 2962QString KABCore::sentSyncFile()
2943{ 2963{
2944#ifdef DESKTOP_VERSION 2964#ifdef DESKTOP_VERSION
2945 return locateLocal( "tmp", "copysyncab.vcf" ); 2965 return locateLocal( "tmp", "copysyncab.vcf" );
2946#else 2966#else
2947 return QString( "/tmp/copysyncab.vcf" ); 2967 return QString( "/tmp/copysyncab.vcf" );
2948#endif 2968#endif
2949} 2969}
2950 2970
2951void KABCore::setCaptionBack() 2971void KABCore::setCaptionBack()
2952{ 2972{
2953 mMessageTimer->stop(); 2973 mMessageTimer->stop();
2954 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 2974 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2955} 2975}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 6831ec9..c01d598 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -27,256 +27,258 @@
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#include <qtimer.h> 32#include <qtimer.h>
33 33
34#include <qwidget.h> 34#include <qwidget.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <ksyncmanager.h> 36#include <ksyncmanager.h>
37#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
38#include <qcopchannel_qws.h> 38#include <qcopchannel_qws.h>
39#endif 39#endif
40 40
41namespace KABC { 41namespace KABC {
42class AddressBook; 42class AddressBook;
43} 43}
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46class KAboutData; 46class KAboutData;
47class KConfig; 47class KConfig;
48 48
49class KAddressBookService; 49class KAddressBookService;
50class LDAPSearchDialog; 50class LDAPSearchDialog;
51#else //KAB_EMBEDDED 51#else //KAB_EMBEDDED
52class KAddressBookMain; 52class KAddressBookMain;
53//US class QAction; 53//US class QAction;
54#endif //KAB_EMBEDDED 54#endif //KAB_EMBEDDED
55class KCMultiDialog; 55class KCMultiDialog;
56class KXMLGUIClient; 56class KXMLGUIClient;
57class ExtensionManager; 57class ExtensionManager;
58class XXPortManager; 58class XXPortManager;
59class JumpButtonBar; 59class JumpButtonBar;
60class IncSearchWidget; 60class IncSearchWidget;
61class KDGanttMinimizeSplitter; 61class KDGanttMinimizeSplitter;
62class KAction; 62class KAction;
63class KActionCollection; 63class KActionCollection;
64class KToggleAction; 64class KToggleAction;
65class KSyncProfile; 65class KSyncProfile;
66 66
67class QAction; 67class QAction;
68class QMenuBar; 68class QMenuBar;
69class QSplitter; 69class QSplitter;
70class ViewContainer; 70class ViewContainer;
71class ViewManager; 71class ViewManager;
72class AddresseeEditorDialog; 72class AddresseeEditorDialog;
73class Ir; 73class Ir;
74 74
75class KABCore : public QWidget, public KSyncInterface 75class KABCore : public QWidget, public KSyncInterface
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 78
79 public: 79 public:
80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
81 81
82 82
83 ~KABCore(); 83 ~KABCore();
84 84
85 85
86#ifdef KAB_EMBEDDED 86#ifdef KAB_EMBEDDED
87 //US added functionality 87 //US added functionality
88 QPopupMenu* getViewMenu() {return viewMenu;} 88 QPopupMenu* getViewMenu() {return viewMenu;}
89 QPopupMenu* getFilterMenu() {return filterMenu;} 89 QPopupMenu* getFilterMenu() {return filterMenu;}
90 QPopupMenu* getSettingsMenu() {return settingsMenu;} 90 QPopupMenu* getSettingsMenu() {return settingsMenu;}
91 void addActionsManually(); 91 void addActionsManually();
92#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
93 /** 93 /**
94 Restores the global settings. 94 Restores the global settings.
95 */ 95 */
96 void restoreSettings(); 96 void restoreSettings();
97 97
98 /** 98 /**
99 Saves the global settings. 99 Saves the global settings.
100 */ 100 */
101 void saveSettings(); 101 void saveSettings();
102 102
103 /** 103 /**
104 Returns a pointer to the StdAddressBook of the application. 104 Returns a pointer to the StdAddressBook of the application.
105 */ 105 */
106 KABC::AddressBook *addressBook() const; 106 KABC::AddressBook *addressBook() const;
107 107
108 /** 108 /**
109 Returns a pointer to the KConfig object of the application. 109 Returns a pointer to the KConfig object of the application.
110 */ 110 */
111 static KConfig *config(); 111 static KConfig *config();
112 112
113 /** 113 /**
114 Returns a pointer to the global KActionCollection object. So 114 Returns a pointer to the global KActionCollection object. So
115 other classes can register their actions easily. 115 other classes can register their actions easily.
116 */ 116 */
117 KActionCollection *actionCollection() const; 117 KActionCollection *actionCollection() const;
118 118
119 /** 119 /**
120 Returns the current search field of the Incremental Search Widget. 120 Returns the current search field of the Incremental Search Widget.
121 */ 121 */
122 KABC::Field *currentSearchField() const; 122 KABC::Field *currentSearchField() const;
123 123
124 /** 124 /**
125 Returns the uid list of the currently selected contacts. 125 Returns the uid list of the currently selected contacts.
126 */ 126 */
127 QStringList selectedUIDs() const; 127 QStringList selectedUIDs() const;
128 128
129 /** 129 /**
130 Displays the ResourceSelectDialog and returns the selected 130 Displays the ResourceSelectDialog and returns the selected
131 resource or a null pointer if no resource was selected by 131 resource or a null pointer if no resource was selected by
132 the user. 132 the user.
133 */ 133 */
134 KABC::Resource *requestResource( QWidget *parent ); 134 KABC::Resource *requestResource( QWidget *parent );
135 135
136#ifndef KAB_EMBEDDED 136#ifndef KAB_EMBEDDED
137 static KAboutData *createAboutData(); 137 static KAboutData *createAboutData();
138#endif //KAB_EMBEDDED 138#endif //KAB_EMBEDDED
139 139
140#ifdef KAB_EMBEDDED 140#ifdef KAB_EMBEDDED
141 inline QPopupMenu* getImportMenu() { return ImportMenu;} 141 inline QPopupMenu* getImportMenu() { return ImportMenu;}
142 inline QPopupMenu* getExportMenu() { return ExportMenu;} 142 inline QPopupMenu* getExportMenu() { return ExportMenu;}
143#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
144 144
145 public slots: 145 public slots:
146#ifdef KAB_EMBEDDED 146#ifdef KAB_EMBEDDED
147 void createAboutData(); 147 void createAboutData();
148#endif //KAB_EMBEDDED 148#endif //KAB_EMBEDDED
149 void setDetailsToggle(); 149 void setDetailsToggle();
150 150
151 void showLicence(); 151 void showLicence();
152 void faq(); 152 void faq();
153 void whatsnew() ; 153 void whatsnew() ;
154 void synchowto() ; 154 void synchowto() ;
155 void multisynchowto() ;
156 void kdesynchowto() ;
155 void writeToPhone(); 157 void writeToPhone();
156 158
157 /** 159 /**
158 Is called whenever a contact is selected in the view. 160 Is called whenever a contact is selected in the view.
159 */ 161 */
160 void setContactSelected( const QString &uid ); 162 void setContactSelected( const QString &uid );
161 163
162 /** 164 /**
163 Opens the preferred mail composer with all selected contacts as 165 Opens the preferred mail composer with all selected contacts as
164 arguments. 166 arguments.
165 */ 167 */
166 void sendMail(); 168 void sendMail();
167 169
168 /** 170 /**
169 Opens the preferred mail composer with the given contacts as 171 Opens the preferred mail composer with the given contacts as
170 arguments. 172 arguments.
171 */ 173 */
172 void sendMail( const QString& email ); 174 void sendMail( const QString& email );
173 175
174 176
175 void mailVCard(); 177 void mailVCard();
176 void mailVCard(const QStringList& uids); 178 void mailVCard(const QStringList& uids);
177 179
178 /** 180 /**
179 Beams the "WhoAmI contact. 181 Beams the "WhoAmI contact.
180 */ 182 */
181 void beamMySelf(); 183 void beamMySelf();
182 184
183 void beamVCard(); 185 void beamVCard();
184 void export2phone(); 186 void export2phone();
185 void beamVCard(const QStringList& uids); 187 void beamVCard(const QStringList& uids);
186 void beamDone( Ir *ir ); 188 void beamDone( Ir *ir );
187 189
188 190
189 /** 191 /**
190 Starts the preferred web browser with the given URL as argument. 192 Starts the preferred web browser with the given URL as argument.
191 */ 193 */
192 void browse( const QString& url ); 194 void browse( const QString& url );
193 195
194 /** 196 /**
195 Select all contacts in the view. 197 Select all contacts in the view.
196 */ 198 */
197 void selectAllContacts(); 199 void selectAllContacts();
198 200
199 /** 201 /**
200 Deletes all selected contacts from the address book. 202 Deletes all selected contacts from the address book.
201 */ 203 */
202 void deleteContacts(); 204 void deleteContacts();
203 205
204 /** 206 /**
205 Deletes given contacts from the address book. 207 Deletes given contacts from the address book.
206 208
207 @param uids The uids of the contacts, which shall be deleted. 209 @param uids The uids of the contacts, which shall be deleted.
208 */ 210 */
209 void deleteContacts( const QStringList &uids ); 211 void deleteContacts( const QStringList &uids );
210 212
211 /** 213 /**
212 Copys the selected contacts into clipboard for later pasting. 214 Copys the selected contacts into clipboard for later pasting.
213 */ 215 */
214 void copyContacts(); 216 void copyContacts();
215 217
216 /** 218 /**
217 Cuts the selected contacts and stores them for later pasting. 219 Cuts the selected contacts and stores them for later pasting.
218 */ 220 */
219 void cutContacts(); 221 void cutContacts();
220 222
221 /** 223 /**
222 Paste contacts from clipboard into the address book. 224 Paste contacts from clipboard into the address book.
223 */ 225 */
224 void pasteContacts(); 226 void pasteContacts();
225 227
226 /** 228 /**
227 Paste given contacts into the address book. 229 Paste given contacts into the address book.
228 230
229 @param list The list of addressee, which shall be pasted. 231 @param list The list of addressee, which shall be pasted.
230 */ 232 */
231 void pasteContacts( KABC::Addressee::List &list ); 233 void pasteContacts( KABC::Addressee::List &list );
232 234
233 /** 235 /**
234 Sets the whoAmI contact, that is used by many other programs to 236 Sets the whoAmI contact, that is used by many other programs to
235 get personal information about the current user. 237 get personal information about the current user.
236 */ 238 */
237 void setWhoAmI(); 239 void setWhoAmI();
238 240
239 /** 241 /**
240 Displays the category dialog and applies the result to all 242 Displays the category dialog and applies the result to all
241 selected contacts. 243 selected contacts.
242 */ 244 */
243 void setCategories(); 245 void setCategories();
244 246
245 /** 247 /**
246 Sets the field list of the Incremental Search Widget. 248 Sets the field list of the Incremental Search Widget.
247 */ 249 */
248 void setSearchFields( const KABC::Field::List &fields ); 250 void setSearchFields( const KABC::Field::List &fields );
249 251
250 /** 252 /**
251 Search with the current search field for a contact, that matches 253 Search with the current search field for a contact, that matches
252 the given text, and selects it in the view. 254 the given text, and selects it in the view.
253 */ 255 */
254 void incrementalSearch( const QString& text ); 256 void incrementalSearch( const QString& text );
255 257
256 /** 258 /**
257 Marks the address book as modified. 259 Marks the address book as modified.
258 */ 260 */
259 void setModified(); 261 void setModified();
260 /** 262 /**
261 Marks the address book as modified without refreshing the view. 263 Marks the address book as modified without refreshing the view.
262 */ 264 */
263 void setModifiedWOrefresh(); 265 void setModifiedWOrefresh();
264 266
265 /** 267 /**
266 Marks the address book as modified concerning the argument. 268 Marks the address book as modified concerning the argument.
267 */ 269 */
268 void setModified( bool modified ); 270 void setModified( bool modified );
269 271
270 /** 272 /**
271 Returns whether the address book is modified. 273 Returns whether the address book is modified.
272 */ 274 */
273 bool modified() const; 275 bool modified() const;
274 276
275 /** 277 /**
276 Called whenever an contact is modified in the contact editor 278 Called whenever an contact is modified in the contact editor
277 dialog or the quick edit. 279 dialog or the quick edit.
278 */ 280 */
279 void contactModified( const KABC::Addressee &addr ); 281 void contactModified( const KABC::Addressee &addr );
280 282
281 /** 283 /**
282 DCOP METHODS. 284 DCOP METHODS.
@@ -329,176 +331,178 @@ class KABCore : public QWidget, public KSyncInterface
329 */ 331 */
330 void openLDAPDialog(); 332 void openLDAPDialog();
331 333
332 /** 334 /**
333 Creates a KAddressBookPrinter, which will display the print 335 Creates a KAddressBookPrinter, which will display the print
334 dialog and do the printing. 336 dialog and do the printing.
335 */ 337 */
336 void print(); 338 void print();
337 339
338 /** 340 /**
339 Registers a new GUI client, so plugins can register its actions. 341 Registers a new GUI client, so plugins can register its actions.
340 */ 342 */
341 void addGUIClient( KXMLGUIClient *client ); 343 void addGUIClient( KXMLGUIClient *client );
342 344
343 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 345 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
344 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 346 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
345 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 347 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
346 348
347 349
348 signals: 350 signals:
349 void contactSelected( const QString &name ); 351 void contactSelected( const QString &name );
350 void contactSelected( const QPixmap &pixmap ); 352 void contactSelected( const QPixmap &pixmap );
351 public slots: 353 public slots:
352 void recieve(QString cmsg ); 354 void recieve(QString cmsg );
353 void getFile( bool success ); 355 void getFile( bool success );
354 void syncFileRequest(); 356 void syncFileRequest();
355 void setDetailsVisible( bool visible ); 357 void setDetailsVisible( bool visible );
356 void setDetailsToState(); 358 void setDetailsToState();
357 // void slotSyncMenu( int ); 359 // void slotSyncMenu( int );
358 private slots: 360 private slots:
359 void receive( const QCString& cmsg, const QByteArray& data ); 361 void receive( const QCString& cmsg, const QByteArray& data );
360 void toggleBeamReceive( ); 362 void toggleBeamReceive( );
361 void disableBR(bool); 363 void disableBR(bool);
362 void setJumpButtonBarVisible( bool visible ); 364 void setJumpButtonBarVisible( bool visible );
363 void setCaptionBack(); 365 void setCaptionBack();
364 void importFromOL(); 366 void importFromOL();
365 void extensionModified( const KABC::Addressee::List &list ); 367 void extensionModified( const KABC::Addressee::List &list );
366 void extensionChanged( int id ); 368 void extensionChanged( int id );
367 void clipboardDataChanged(); 369 void clipboardDataChanged();
368 void updateActionMenu(); 370 void updateActionMenu();
369 void configureKeyBindings(); 371 void configureKeyBindings();
370 void removeVoice(); 372 void removeVoice();
371#ifdef KAB_EMBEDDED 373#ifdef KAB_EMBEDDED
372 void configureResources(); 374 void configureResources();
373#endif //KAB_EMBEDDED 375#endif //KAB_EMBEDDED
374 376
375 void slotEditorDestroyed( const QString &uid ); 377 void slotEditorDestroyed( const QString &uid );
376 void configurationChanged(); 378 void configurationChanged();
377 void addressBookChanged(); 379 void addressBookChanged();
378 380
379 private: 381 private:
380 bool mBRdisabled; 382 bool mBRdisabled;
381#ifndef DESKTOP_VERSION 383#ifndef DESKTOP_VERSION
382 QCopChannel* infrared; 384 QCopChannel* infrared;
383#endif 385#endif
384 QTimer *mMessageTimer; 386 QTimer *mMessageTimer;
385 void initGUI(); 387 void initGUI();
386 void initActions(); 388 void initActions();
387 QString getPhoneFile(); 389 QString getPhoneFile();
388 390
389 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 391 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
390 const char *name = 0 ); 392 const char *name = 0 );
391 393
392 KXMLGUIClient *mGUIClient; 394 KXMLGUIClient *mGUIClient;
393 395
394 KABC::AddressBook *mAddressBook; 396 KABC::AddressBook *mAddressBook;
395 397
396 ViewManager *mViewManager; 398 ViewManager *mViewManager;
397 // QSplitter *mDetailsSplitter; 399 // QSplitter *mDetailsSplitter;
398 KDGanttMinimizeSplitter *mExtensionBarSplitter; 400 KDGanttMinimizeSplitter *mExtensionBarSplitter;
399 ViewContainer *mDetails; 401 ViewContainer *mDetails;
400 KDGanttMinimizeSplitter* mMiniSplitter; 402 KDGanttMinimizeSplitter* mMiniSplitter;
401 XXPortManager *mXXPortManager; 403 XXPortManager *mXXPortManager;
402 JumpButtonBar *mJumpButtonBar; 404 JumpButtonBar *mJumpButtonBar;
403 IncSearchWidget *mIncSearchWidget; 405 IncSearchWidget *mIncSearchWidget;
404 ExtensionManager *mExtensionManager; 406 ExtensionManager *mExtensionManager;
405 407
406 KCMultiDialog *mConfigureDialog; 408 KCMultiDialog *mConfigureDialog;
407 409
408#ifndef KAB_EMBEDDED 410#ifndef KAB_EMBEDDED
409 LDAPSearchDialog *mLdapSearchDialog; 411 LDAPSearchDialog *mLdapSearchDialog;
410#endif //KAB_EMBEDDED 412#endif //KAB_EMBEDDED
411 // QDict<AddresseeEditorDialog> mEditorDict; 413 // QDict<AddresseeEditorDialog> mEditorDict;
412 AddresseeEditorDialog *mEditorDialog; 414 AddresseeEditorDialog *mEditorDialog;
413 bool mReadWrite; 415 bool mReadWrite;
414 bool mModified; 416 bool mModified;
415 bool mIsPart; 417 bool mIsPart;
416 bool mMultipleViewsAtOnce; 418 bool mMultipleViewsAtOnce;
417 419
418 420
419 //US file menu 421 //US file menu
420 KAction *mActionMail; 422 KAction *mActionMail;
421 KAction *mActionBeam; 423 KAction *mActionBeam;
422 KToggleAction *mActionBR; 424 KToggleAction *mActionBR;
423 KAction *mActionExport2phone; 425 KAction *mActionExport2phone;
424 KAction* mActionPrint; 426 KAction* mActionPrint;
425 KAction* mActionNewContact; 427 KAction* mActionNewContact;
426 KAction *mActionSave; 428 KAction *mActionSave;
427 KAction *mActionEditAddressee; 429 KAction *mActionEditAddressee;
428 KAction *mActionMailVCard; 430 KAction *mActionMailVCard;
429 KAction *mActionBeamVCard; 431 KAction *mActionBeamVCard;
430 432
431 KAction *mActionQuit; 433 KAction *mActionQuit;
432 434
433 //US edit menu 435 //US edit menu
434 KAction *mActionCopy; 436 KAction *mActionCopy;
435 KAction *mActionCut; 437 KAction *mActionCut;
436 KAction *mActionPaste; 438 KAction *mActionPaste;
437 KAction *mActionSelectAll; 439 KAction *mActionSelectAll;
438 KAction *mActionUndo; 440 KAction *mActionUndo;
439 KAction *mActionRedo; 441 KAction *mActionRedo;
440 KAction *mActionDelete; 442 KAction *mActionDelete;
441 443
442 //US settings menu 444 //US settings menu
443 KAction *mActionConfigResources; 445 KAction *mActionConfigResources;
444 KAction *mActionConfigKAddressbook; 446 KAction *mActionConfigKAddressbook;
445 KAction *mActionConfigShortcuts; 447 KAction *mActionConfigShortcuts;
446 KAction *mActionConfigureToolbars; 448 KAction *mActionConfigureToolbars;
447 KAction *mActionKeyBindings; 449 KAction *mActionKeyBindings;
448 KToggleAction *mActionJumpBar; 450 KToggleAction *mActionJumpBar;
449 KToggleAction *mActionDetails; 451 KToggleAction *mActionDetails;
450 KAction *mActionWhoAmI; 452 KAction *mActionWhoAmI;
451 KAction *mActionCategories; 453 KAction *mActionCategories;
452 KAction *mActionAboutKAddressbook; 454 KAction *mActionAboutKAddressbook;
453 KAction *mActionLicence; 455 KAction *mActionLicence;
454 KAction *mActionFaq; 456 KAction *mActionFaq;
455 KAction *mActionWN; 457 KAction *mActionWN;
456 KAction *mActionSyncHowto; 458 KAction *mActionSyncHowto;
459 KAction *mActionKdeSyncHowto;
460 KAction *mActionMultiSyncHowto;
457 461
458 KAction *mActionDeleteView; 462 KAction *mActionDeleteView;
459 463
460 QPopupMenu *viewMenu; 464 QPopupMenu *viewMenu;
461 QPopupMenu *filterMenu; 465 QPopupMenu *filterMenu;
462 QPopupMenu *settingsMenu; 466 QPopupMenu *settingsMenu;
463 QPopupMenu *changeMenu; 467 QPopupMenu *changeMenu;
464//US QAction *mActionSave; 468//US QAction *mActionSave;
465 QPopupMenu *ImportMenu; 469 QPopupMenu *ImportMenu;
466 QPopupMenu *ExportMenu; 470 QPopupMenu *ExportMenu;
467 //LR additional methods 471 //LR additional methods
468 KAction *mActionRemoveVoice; 472 KAction *mActionRemoveVoice;
469 KAction * mActionImportOL; 473 KAction * mActionImportOL;
470 474
471#ifndef KAB_EMBEDDED 475#ifndef KAB_EMBEDDED
472 KAddressBookService *mAddressBookService; 476 KAddressBookService *mAddressBookService;
473#endif //KAB_EMBEDDED 477#endif //KAB_EMBEDDED
474 478
475 class KABCorePrivate; 479 class KABCorePrivate;
476 KABCorePrivate *d; 480 KABCorePrivate *d;
477 //US bool mBlockSaveFlag; 481 //US bool mBlockSaveFlag;
478 482
479#ifdef KAB_EMBEDDED 483#ifdef KAB_EMBEDDED
480 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 484 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
481#endif //KAB_EMBEDDED 485#endif //KAB_EMBEDDED
482 486
483 //this are the overwritten callbackmethods from the syncinterface 487 //this are the overwritten callbackmethods from the syncinterface
484 virtual bool sync(KSyncManager* manager, QString filename, int mode); 488 virtual bool sync(KSyncManager* manager, QString filename, int mode);
485 virtual bool syncExternal(KSyncManager* manager, QString resource); 489 virtual bool syncExternal(KSyncManager* manager, QString resource);
486 virtual void removeSyncInfo( QString syncProfile); 490 virtual void removeSyncInfo( QString syncProfile);
487 bool syncPhone(); 491 bool syncPhone();
488 void message( QString m ); 492 void message( QString m );
489 493
490 // LR ******************************* 494 // LR *******************************
491 // sync stuff! 495 // sync stuff!
492 QString sentSyncFile(); 496 QString sentSyncFile();
493 QPopupMenu *syncMenu; 497 QPopupMenu *syncMenu;
494 KSyncManager* syncManager; 498 KSyncManager* syncManager;
495 int mGlobalSyncMode; 499 int mGlobalSyncMode;
496 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 500 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
497 KABC::Addressee getLastSyncAddressee(); 501 KABC::Addressee getLastSyncAddressee();
498 QDateTime mLastAddressbookSync; 502 QDateTime mLastAddressbookSync;
499 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 503 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
500 // ********************* 504 // *********************
501 505
502}; 506};
503 507
504#endif 508#endif