summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 755da11..d99a9cd 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1753,736 +1753,741 @@ void KABCore::initGUI()
1753 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1753 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1754 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1754 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1755 // mActionQuit->plug ( mMainWindow->toolBar()); 1755 // mActionQuit->plug ( mMainWindow->toolBar());
1756 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1756 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1757 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1757 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1758 // mIncSearchWidget->hide(); 1758 // mIncSearchWidget->hide();
1759 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1759 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1760 SLOT( incrementalSearch( const QString& ) ) ); 1760 SLOT( incrementalSearch( const QString& ) ) );
1761 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1761 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1762 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1762 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1763 1763
1764 mJumpButtonBar = new JumpButtonBar( this, this ); 1764 mJumpButtonBar = new JumpButtonBar( this, this );
1765 1765
1766 topLayout->addWidget( mJumpButtonBar ); 1766 topLayout->addWidget( mJumpButtonBar );
1767//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1767//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1768 1768
1769// mMainWindow->getIconToolBar()->raise(); 1769// mMainWindow->getIconToolBar()->raise();
1770 1770
1771#endif //KAB_EMBEDDED 1771#endif //KAB_EMBEDDED
1772 1772
1773} 1773}
1774void KABCore::initActions() 1774void KABCore::initActions()
1775{ 1775{
1776//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1776//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1777 1777
1778#ifndef KAB_EMBEDDED 1778#ifndef KAB_EMBEDDED
1779 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1779 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1780 SLOT( clipboardDataChanged() ) ); 1780 SLOT( clipboardDataChanged() ) );
1781#endif //KAB_EMBEDDED 1781#endif //KAB_EMBEDDED
1782 1782
1783 // file menu 1783 // file menu
1784 if ( mIsPart ) { 1784 if ( mIsPart ) {
1785 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1785 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1786 SLOT( sendMail() ), actionCollection(), 1786 SLOT( sendMail() ), actionCollection(),
1787 "kaddressbook_mail" ); 1787 "kaddressbook_mail" );
1788 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1788 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1789 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1789 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1790 1790
1791 } else { 1791 } else {
1792 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1792 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1793 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1793 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1794 } 1794 }
1795 1795
1796 1796
1797 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1797 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1798 SLOT( save() ), actionCollection(), "file_sync" ); 1798 SLOT( save() ), actionCollection(), "file_sync" );
1799 1799
1800 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1800 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1801 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1801 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1802 1802
1803 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1803 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1804 this, SLOT( mailVCard() ), 1804 this, SLOT( mailVCard() ),
1805 actionCollection(), "file_mail_vcard"); 1805 actionCollection(), "file_mail_vcard");
1806 1806
1807 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1807 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1808 SLOT( export2phone() ), actionCollection(), 1808 SLOT( export2phone() ), actionCollection(),
1809 "kaddressbook_ex2phone" ); 1809 "kaddressbook_ex2phone" );
1810 1810
1811 mActionBeamVCard = 0; 1811 mActionBeamVCard = 0;
1812 mActionBeam = 0; 1812 mActionBeam = 0;
1813 1813
1814#ifndef DESKTOP_VERSION 1814#ifndef DESKTOP_VERSION
1815 if ( Ir::supported() ) { 1815 if ( Ir::supported() ) {
1816 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1816 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1817 SLOT( beamVCard() ), actionCollection(), 1817 SLOT( beamVCard() ), actionCollection(),
1818 "kaddressbook_beam_vcard" ); 1818 "kaddressbook_beam_vcard" );
1819 1819
1820 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1820 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1821 SLOT( beamMySelf() ), actionCollection(), 1821 SLOT( beamMySelf() ), actionCollection(),
1822 "kaddressbook_beam_myself" ); 1822 "kaddressbook_beam_myself" );
1823 } 1823 }
1824#endif 1824#endif
1825 1825
1826 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1826 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1827 this, SLOT( editContact2() ), 1827 this, SLOT( editContact2() ),
1828 actionCollection(), "file_properties" ); 1828 actionCollection(), "file_properties" );
1829 1829
1830#ifdef KAB_EMBEDDED 1830#ifdef KAB_EMBEDDED
1831 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1831 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1832 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1832 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1833 mMainWindow, SLOT( exit() ), 1833 mMainWindow, SLOT( exit() ),
1834 actionCollection(), "quit" ); 1834 actionCollection(), "quit" );
1835#endif //KAB_EMBEDDED 1835#endif //KAB_EMBEDDED
1836 1836
1837 // edit menu 1837 // edit menu
1838 if ( mIsPart ) { 1838 if ( mIsPart ) {
1839 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1839 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1840 SLOT( copyContacts() ), actionCollection(), 1840 SLOT( copyContacts() ), actionCollection(),
1841 "kaddressbook_copy" ); 1841 "kaddressbook_copy" );
1842 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1842 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1843 SLOT( cutContacts() ), actionCollection(), 1843 SLOT( cutContacts() ), actionCollection(),
1844 "kaddressbook_cut" ); 1844 "kaddressbook_cut" );
1845 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1845 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1846 SLOT( pasteContacts() ), actionCollection(), 1846 SLOT( pasteContacts() ), actionCollection(),
1847 "kaddressbook_paste" ); 1847 "kaddressbook_paste" );
1848 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1848 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1849 SLOT( selectAllContacts() ), actionCollection(), 1849 SLOT( selectAllContacts() ), actionCollection(),
1850 "kaddressbook_select_all" ); 1850 "kaddressbook_select_all" );
1851 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1851 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1852 SLOT( undo() ), actionCollection(), 1852 SLOT( undo() ), actionCollection(),
1853 "kaddressbook_undo" ); 1853 "kaddressbook_undo" );
1854 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1854 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1855 this, SLOT( redo() ), actionCollection(), 1855 this, SLOT( redo() ), actionCollection(),
1856 "kaddressbook_redo" ); 1856 "kaddressbook_redo" );
1857 } else { 1857 } else {
1858 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1858 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1859 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1859 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1860 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1860 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1861 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1861 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1862 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1862 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1863 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1863 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1864 } 1864 }
1865 1865
1866 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1866 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1867 Key_Delete, this, SLOT( deleteContacts() ), 1867 Key_Delete, this, SLOT( deleteContacts() ),
1868 actionCollection(), "edit_delete" ); 1868 actionCollection(), "edit_delete" );
1869 1869
1870 mActionUndo->setEnabled( false ); 1870 mActionUndo->setEnabled( false );
1871 mActionRedo->setEnabled( false ); 1871 mActionRedo->setEnabled( false );
1872 1872
1873 // settings menu 1873 // settings menu
1874#ifdef KAB_EMBEDDED 1874#ifdef KAB_EMBEDDED
1875//US special menuentry to configure the addressbook resources. On KDE 1875//US special menuentry to configure the addressbook resources. On KDE
1876// you do that through the control center !!! 1876// you do that through the control center !!!
1877 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1877 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1878 SLOT( configureResources() ), actionCollection(), 1878 SLOT( configureResources() ), actionCollection(),
1879 "kaddressbook_configure_resources" ); 1879 "kaddressbook_configure_resources" );
1880#endif //KAB_EMBEDDED 1880#endif //KAB_EMBEDDED
1881 1881
1882 if ( mIsPart ) { 1882 if ( mIsPart ) {
1883 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1883 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1884 SLOT( openConfigDialog() ), actionCollection(), 1884 SLOT( openConfigDialog() ), actionCollection(),
1885 "kaddressbook_configure" ); 1885 "kaddressbook_configure" );
1886 1886
1887 //US not implemented yet 1887 //US not implemented yet
1888 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1888 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1889 // this, SLOT( configureKeyBindings() ), actionCollection(), 1889 // this, SLOT( configureKeyBindings() ), actionCollection(),
1890 // "kaddressbook_configure_shortcuts" ); 1890 // "kaddressbook_configure_shortcuts" );
1891#ifdef KAB_EMBEDDED 1891#ifdef KAB_EMBEDDED
1892 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1892 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1893 mActionConfigureToolbars->setEnabled( false ); 1893 mActionConfigureToolbars->setEnabled( false );
1894#endif //KAB_EMBEDDED 1894#endif //KAB_EMBEDDED
1895 1895
1896 } else { 1896 } else {
1897 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1897 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1898 1898
1899 //US not implemented yet 1899 //US not implemented yet
1900 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1900 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1901 } 1901 }
1902 1902
1903 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1903 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1904 actionCollection(), "options_show_jump_bar" ); 1904 actionCollection(), "options_show_jump_bar" );
1905 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1905 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1906 1906
1907 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1907 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1908 actionCollection(), "options_show_details" ); 1908 actionCollection(), "options_show_details" );
1909 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1909 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1910 1910
1911 1911
1912 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 1912 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1913 SLOT( toggleBeamReceive() ), actionCollection(), 1913 SLOT( toggleBeamReceive() ), actionCollection(),
1914 "kaddressbook_beam_rec" ); 1914 "kaddressbook_beam_rec" );
1915 1915
1916 1916
1917 // misc 1917 // misc
1918 // only enable LDAP lookup if we can handle the protocol 1918 // only enable LDAP lookup if we can handle the protocol
1919#ifndef KAB_EMBEDDED 1919#ifndef KAB_EMBEDDED
1920 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1920 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1921 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1921 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1922 this, SLOT( openLDAPDialog() ), actionCollection(), 1922 this, SLOT( openLDAPDialog() ), actionCollection(),
1923 "ldap_lookup" ); 1923 "ldap_lookup" );
1924 } 1924 }
1925#else //KAB_EMBEDDED 1925#else //KAB_EMBEDDED
1926 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1926 //qDebug("KABCore::initActions() LDAP has to be implemented");
1927#endif //KAB_EMBEDDED 1927#endif //KAB_EMBEDDED
1928 1928
1929 1929
1930 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1930 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1931 SLOT( setWhoAmI() ), actionCollection(), 1931 SLOT( setWhoAmI() ), actionCollection(),
1932 "set_personal" ); 1932 "set_personal" );
1933 1933
1934 1934
1935 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1935 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1936 SLOT( setCategories() ), actionCollection(), 1936 SLOT( setCategories() ), actionCollection(),
1937 "edit_set_categories" ); 1937 "edit_set_categories" );
1938 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, 1938 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this,
1939 SLOT( editCategories() ), actionCollection(), 1939 SLOT( editCategories() ), actionCollection(),
1940 "edit__categories" ); 1940 "edit__categories" );
1941 1941
1942 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1942 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1943 SLOT( removeVoice() ), actionCollection(), 1943 SLOT( removeVoice() ), actionCollection(),
1944 "remove_voice" ); 1944 "remove_voice" );
1945 1945
1946 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 1946 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
1947 SLOT( manageCategories() ), actionCollection(), 1947 SLOT( manageCategories() ), actionCollection(),
1948 "remove_voice" ); 1948 "remove_voice" );
1949 1949
1950 1950
1951 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1951 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1952 SLOT( importFromOL() ), actionCollection(), 1952 SLOT( importFromOL() ), actionCollection(),
1953 "import_OL" ); 1953 "import_OL" );
1954#ifdef KAB_EMBEDDED 1954#ifdef KAB_EMBEDDED
1955 mActionLicence = new KAction( i18n( "Licence" ), 0, 1955 mActionLicence = new KAction( i18n( "Licence" ), 0,
1956 this, SLOT( showLicence() ), actionCollection(), 1956 this, SLOT( showLicence() ), actionCollection(),
1957 "licence_about_data" ); 1957 "licence_about_data" );
1958 mActionFaq = new KAction( i18n( "Faq" ), 0, 1958 mActionFaq = new KAction( i18n( "Faq" ), 0,
1959 this, SLOT( faq() ), actionCollection(), 1959 this, SLOT( faq() ), actionCollection(),
1960 "faq_about_data" ); 1960 "faq_about_data" );
1961 mActionWN = new KAction( i18n( "What's New?" ), 0, 1961 mActionWN = new KAction( i18n( "What's New?" ), 0,
1962 this, SLOT( whatsnew() ), actionCollection(), 1962 this, SLOT( whatsnew() ), actionCollection(),
1963 "wn" ); 1963 "wn" );
1964 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 1964 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1965 this, SLOT( synchowto() ), actionCollection(), 1965 this, SLOT( synchowto() ), actionCollection(),
1966 "sync" ); 1966 "sync" );
1967 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 1967 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
1968 this, SLOT( kdesynchowto() ), actionCollection(), 1968 this, SLOT( kdesynchowto() ), actionCollection(),
1969 "kdesync" ); 1969 "kdesync" );
1970 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 1970 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
1971 this, SLOT( multisynchowto() ), actionCollection(), 1971 this, SLOT( multisynchowto() ), actionCollection(),
1972 "multisync" ); 1972 "multisync" );
1973 1973
1974 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1974 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1975 this, SLOT( createAboutData() ), actionCollection(), 1975 this, SLOT( createAboutData() ), actionCollection(),
1976 "kaddressbook_about_data" ); 1976 "kaddressbook_about_data" );
1977#endif //KAB_EMBEDDED 1977#endif //KAB_EMBEDDED
1978 1978
1979 clipboardDataChanged(); 1979 clipboardDataChanged();
1980 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1980 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1981 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1981 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1982} 1982}
1983 1983
1984//US we need this function, to plug all actions into the correct menues. 1984//US we need this function, to plug all actions into the correct menues.
1985// KDE uses a XML format to plug the actions, but we work her without this overhead. 1985// KDE uses a XML format to plug the actions, but we work her without this overhead.
1986void KABCore::addActionsManually() 1986void KABCore::addActionsManually()
1987{ 1987{
1988//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1988//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1989 1989
1990#ifdef KAB_EMBEDDED 1990#ifdef KAB_EMBEDDED
1991 QPopupMenu *fileMenu = new QPopupMenu( this ); 1991 QPopupMenu *fileMenu = new QPopupMenu( this );
1992 QPopupMenu *editMenu = new QPopupMenu( this ); 1992 QPopupMenu *editMenu = new QPopupMenu( this );
1993 QPopupMenu *helpMenu = new QPopupMenu( this ); 1993 QPopupMenu *helpMenu = new QPopupMenu( this );
1994 1994
1995 KToolBar* tb = mMainWindow->toolBar(); 1995 KToolBar* tb = mMainWindow->toolBar();
1996 1996
1997#ifndef DESKTOP_VERSION 1997#ifndef DESKTOP_VERSION
1998 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 1998 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
1999#endif 1999#endif
2000 QMenuBar* mb = mMainWindow->menuBar(); 2000 QMenuBar* mb = mMainWindow->menuBar();
2001 2001
2002 //US setup menubar. 2002 //US setup menubar.
2003 //Disable the following block if you do not want to have a menubar. 2003 //Disable the following block if you do not want to have a menubar.
2004 mb->insertItem( i18n("&File"), fileMenu ); 2004 mb->insertItem( i18n("&File"), fileMenu );
2005 mb->insertItem( i18n("&Edit"), editMenu ); 2005 mb->insertItem( i18n("&Edit"), editMenu );
2006 mb->insertItem( i18n("&View"), viewMenu ); 2006 mb->insertItem( i18n("&View"), viewMenu );
2007 mb->insertItem( i18n("&Settings"), settingsMenu ); 2007 mb->insertItem( i18n("&Settings"), settingsMenu );
2008 mb->insertItem( i18n("Synchronize"), syncMenu ); 2008 mb->insertItem( i18n("Synchronize"), syncMenu );
2009 mb->insertItem( i18n("&Change selected"), changeMenu ); 2009 //mb->insertItem( i18n("&Change"), changeMenu );
2010 mb->insertItem( i18n("&Help"), helpMenu ); 2010 mb->insertItem( i18n("&Help"), helpMenu );
2011 mIncSearchWidget = new IncSearchWidget( tb ); 2011 mIncSearchWidget = new IncSearchWidget( tb );
2012 // tb->insertWidget(-1, 0, mIncSearchWidget); 2012 // tb->insertWidget(-1, 0, mIncSearchWidget);
2013#ifndef DESKTOP_VERSION 2013#ifndef DESKTOP_VERSION
2014 } else { 2014 } else {
2015 //US setup toolbar 2015 //US setup toolbar
2016 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2016 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2017 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2017 QPopupMenu *popupBarTB = new QPopupMenu( this );
2018 menuBarTB->insertItem( "ME", popupBarTB); 2018 menuBarTB->insertItem( "ME", popupBarTB);
2019 tb->insertWidget(-1, 0, menuBarTB); 2019 tb->insertWidget(-1, 0, menuBarTB);
2020 mIncSearchWidget = new IncSearchWidget( tb ); 2020 mIncSearchWidget = new IncSearchWidget( tb );
2021 2021
2022 tb->enableMoving(false); 2022 tb->enableMoving(false);
2023 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2023 popupBarTB->insertItem( i18n("&File"), fileMenu );
2024 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2024 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2025 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2025 popupBarTB->insertItem( i18n("&View"), viewMenu );
2026 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2026 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2027 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2027 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2028 mViewManager->getFilterAction()->plug ( popupBarTB); 2028 mViewManager->getFilterAction()->plug ( popupBarTB);
2029 popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2029 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2030 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2030 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2031 if (QApplication::desktop()->width() > 320 ) { 2031 if (QApplication::desktop()->width() > 320 ) {
2032 // mViewManager->getFilterAction()->plug ( tb); 2032 // mViewManager->getFilterAction()->plug ( tb);
2033 } 2033 }
2034 } 2034 }
2035#endif 2035#endif
2036 // mActionQuit->plug ( mMainWindow->toolBar()); 2036 // mActionQuit->plug ( mMainWindow->toolBar());
2037 2037
2038 2038
2039 2039
2040 //US Now connect the actions with the menue entries. 2040 //US Now connect the actions with the menue entries.
2041 mActionPrint->plug( fileMenu ); 2041 mActionPrint->plug( fileMenu );
2042 mActionMail->plug( fileMenu ); 2042 mActionMail->plug( fileMenu );
2043 fileMenu->insertSeparator(); 2043 fileMenu->insertSeparator();
2044 2044
2045 mActionNewContact->plug( fileMenu ); 2045 mActionNewContact->plug( fileMenu );
2046 mActionNewContact->plug( tb ); 2046 mActionNewContact->plug( tb );
2047 2047
2048 mActionEditAddressee->plug( fileMenu ); 2048 mActionEditAddressee->plug( fileMenu );
2049 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2049 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2050 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2050 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2051 mActionEditAddressee->plug( tb ); 2051 mActionEditAddressee->plug( tb );
2052 2052
2053 fileMenu->insertSeparator(); 2053 fileMenu->insertSeparator();
2054 mActionSave->plug( fileMenu ); 2054 mActionSave->plug( fileMenu );
2055 fileMenu->insertItem( "&Import", ImportMenu ); 2055 fileMenu->insertItem( "&Import", ImportMenu );
2056 fileMenu->insertItem( "&Export", ExportMenu ); 2056 fileMenu->insertItem( "&Export", ExportMenu );
2057 fileMenu->insertItem( i18n("&Change"), changeMenu );
2057 fileMenu->insertSeparator(); 2058 fileMenu->insertSeparator();
2058 mActionMailVCard->plug( fileMenu ); 2059 mActionMailVCard->plug( fileMenu );
2059#ifndef DESKTOP_VERSION 2060#ifndef DESKTOP_VERSION
2060 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 2061 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
2061 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 2062 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
2062#endif 2063#endif
2063 fileMenu->insertSeparator(); 2064 fileMenu->insertSeparator();
2064 mActionQuit->plug( fileMenu ); 2065 mActionQuit->plug( fileMenu );
2065#ifdef _WIN32_ 2066#ifdef _WIN32_
2066 mActionImportOL->plug( ImportMenu ); 2067 mActionImportOL->plug( ImportMenu );
2067#endif 2068#endif
2068 // edit menu 2069 // edit menu
2069 mActionUndo->plug( editMenu ); 2070 mActionUndo->plug( editMenu );
2070 mActionRedo->plug( editMenu ); 2071 mActionRedo->plug( editMenu );
2071 editMenu->insertSeparator(); 2072 editMenu->insertSeparator();
2072 mActionCut->plug( editMenu ); 2073 mActionCut->plug( editMenu );
2073 mActionCopy->plug( editMenu ); 2074 mActionCopy->plug( editMenu );
2074 mActionPaste->plug( editMenu ); 2075 mActionPaste->plug( editMenu );
2075 mActionDelete->plug( editMenu ); 2076 mActionDelete->plug( editMenu );
2076 editMenu->insertSeparator(); 2077 editMenu->insertSeparator();
2077 mActionSelectAll->plug( editMenu ); 2078 mActionSelectAll->plug( editMenu );
2078 2079
2079 mActionRemoveVoice->plug( changeMenu ); 2080 mActionRemoveVoice->plug( changeMenu );
2080 // settings menu 2081 // settings menu
2081//US special menuentry to configure the addressbook resources. On KDE 2082//US special menuentry to configure the addressbook resources. On KDE
2082// you do that through the control center !!! 2083// you do that through the control center !!!
2083 mActionConfigResources->plug( settingsMenu ); 2084 mActionConfigResources->plug( settingsMenu );
2084 settingsMenu->insertSeparator(); 2085 settingsMenu->insertSeparator();
2085 2086
2086 mActionConfigKAddressbook->plug( settingsMenu ); 2087 mActionConfigKAddressbook->plug( settingsMenu );
2087 2088
2088 if ( mIsPart ) { 2089 if ( mIsPart ) {
2089 //US not implemented yet 2090 //US not implemented yet
2090 //mActionConfigShortcuts->plug( settingsMenu ); 2091 //mActionConfigShortcuts->plug( settingsMenu );
2091 //mActionConfigureToolbars->plug( settingsMenu ); 2092 //mActionConfigureToolbars->plug( settingsMenu );
2092 2093
2093 } else { 2094 } else {
2094 //US not implemented yet 2095 //US not implemented yet
2095 //mActionKeyBindings->plug( settingsMenu ); 2096 //mActionKeyBindings->plug( settingsMenu );
2096 } 2097 }
2097 2098
2098 settingsMenu->insertSeparator(); 2099 settingsMenu->insertSeparator();
2099 2100
2100 mActionJumpBar->plug( settingsMenu ); 2101 mActionJumpBar->plug( settingsMenu );
2101 mActionDetails->plug( settingsMenu ); 2102 mActionDetails->plug( settingsMenu );
2102 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2103 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2103 mActionDetails->plug( tb ); 2104 mActionDetails->plug( tb );
2104 settingsMenu->insertSeparator(); 2105 settingsMenu->insertSeparator();
2105 mActionBR->plug(settingsMenu ); 2106 mActionBR->plug(settingsMenu );
2106 settingsMenu->insertSeparator(); 2107 settingsMenu->insertSeparator();
2107 2108
2108 mActionWhoAmI->plug( settingsMenu ); 2109 mActionWhoAmI->plug( settingsMenu );
2109 mActionEditCategories->plug( settingsMenu ); 2110 mActionEditCategories->plug( settingsMenu );
2110 mActionCategories->plug( settingsMenu ); 2111 mActionCategories->plug( settingsMenu );
2111 mActionManageCategories->plug( settingsMenu ); 2112 mActionManageCategories->plug( settingsMenu );
2112 2113
2113 2114
2114 mActionWN->plug( helpMenu ); 2115 mActionWN->plug( helpMenu );
2115 mActionSyncHowto->plug( helpMenu ); 2116 mActionSyncHowto->plug( helpMenu );
2116 mActionKdeSyncHowto->plug( helpMenu ); 2117 mActionKdeSyncHowto->plug( helpMenu );
2117 mActionMultiSyncHowto->plug( helpMenu ); 2118 mActionMultiSyncHowto->plug( helpMenu );
2118 mActionFaq->plug( helpMenu ); 2119 mActionFaq->plug( helpMenu );
2119 mActionLicence->plug( helpMenu ); 2120 mActionLicence->plug( helpMenu );
2120 mActionAboutKAddressbook->plug( helpMenu ); 2121 mActionAboutKAddressbook->plug( helpMenu );
2121 2122
2122 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2123 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2123 2124
2124 mActionSave->plug( tb ); 2125 mActionSave->plug( tb );
2125 mViewManager->getFilterAction()->plug ( tb); 2126 mViewManager->getFilterAction()->plug ( tb);
2126 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2127 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2127 mActionUndo->plug( tb ); 2128 mActionUndo->plug( tb );
2128 mActionDelete->plug( tb ); 2129 mActionDelete->plug( tb );
2129 mActionRedo->plug( tb ); 2130 mActionRedo->plug( tb );
2130 } 2131 }
2131 } else { 2132 } else {
2132 mActionSave->plug( tb ); 2133 mActionSave->plug( tb );
2133 tb->enableMoving(false); 2134 tb->enableMoving(false);
2134 } 2135 }
2135 //mActionQuit->plug ( tb ); 2136 //mActionQuit->plug ( tb );
2136 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2137 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2137 2138
2138 //US link the searchwidget first to this. 2139 //US link the searchwidget first to this.
2139 // The real linkage to the toolbar happens later. 2140 // The real linkage to the toolbar happens later.
2140//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2141//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2141//US tb->insertItem( mIncSearchWidget ); 2142//US tb->insertItem( mIncSearchWidget );
2142/*US 2143/*US
2143 mIncSearchWidget = new IncSearchWidget( tb ); 2144 mIncSearchWidget = new IncSearchWidget( tb );
2144 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2145 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2145 SLOT( incrementalSearch( const QString& ) ) ); 2146 SLOT( incrementalSearch( const QString& ) ) );
2146 2147
2147 mJumpButtonBar = new JumpButtonBar( this, this ); 2148 mJumpButtonBar = new JumpButtonBar( this, this );
2148 2149
2149//US topLayout->addWidget( mJumpButtonBar ); 2150//US topLayout->addWidget( mJumpButtonBar );
2150 this->layout()->add( mJumpButtonBar ); 2151 this->layout()->add( mJumpButtonBar );
2151*/ 2152*/
2152 2153
2153#endif //KAB_EMBEDDED 2154#endif //KAB_EMBEDDED
2154 2155
2155 mActionExport2phone->plug( ExportMenu ); 2156 mActionExport2phone->plug( ExportMenu );
2156 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2157 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2157 syncManager->fillSyncMenu(); 2158 syncManager->fillSyncMenu();
2158 2159
2159} 2160}
2160void KABCore::showLicence() 2161void KABCore::showLicence()
2161{ 2162{
2162 KApplication::showLicence(); 2163 KApplication::showLicence();
2163} 2164}
2164 2165
2165void KABCore::manageCategories( ) 2166void KABCore::manageCategories( )
2166{ 2167{
2167 KABCatPrefs* cp = new KABCatPrefs(); 2168 KABCatPrefs* cp = new KABCatPrefs();
2168 cp->show(); 2169 cp->show();
2169 int w =cp->sizeHint().width() ; 2170 int w =cp->sizeHint().width() ;
2170 int h = cp->sizeHint().height() ; 2171 int h = cp->sizeHint().height() ;
2171 int dw = QApplication::desktop()->width(); 2172 int dw = QApplication::desktop()->width();
2172 int dh = QApplication::desktop()->height(); 2173 int dh = QApplication::desktop()->height();
2173 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2174 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2174 if ( !cp->exec() ) { 2175 if ( !cp->exec() ) {
2175 delete cp; 2176 delete cp;
2176 return; 2177 return;
2177 } 2178 }
2178 int count = 0; 2179 int count = 0;
2179 message( i18n("Please wait, processing categories...")); 2180 message( i18n("Please wait, processing categories..."));
2180 if ( cp->addCat() ) { 2181 if ( cp->addCat() ) {
2181 KABC::AddressBook::Iterator it; 2182 KABC::AddressBook::Iterator it;
2182 QStringList catList = KABPrefs::instance()->mCustomCategories; 2183 QStringList catList = KABPrefs::instance()->mCustomCategories;
2183 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2184 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2184 QStringList catIncList = (*it).categories(); 2185 QStringList catIncList = (*it).categories();
2185 int i; 2186 int i;
2186 for( i = 0; i< catIncList.count(); ++i ) { 2187 for( i = 0; i< catIncList.count(); ++i ) {
2187 if ( !catList.contains (catIncList[i])) { 2188 if ( !catList.contains (catIncList[i])) {
2188 catList.append( catIncList[i] ); 2189 catList.append( catIncList[i] );
2189 //qDebug("add cat %s ", catIncList[i].latin1()); 2190 //qDebug("add cat %s ", catIncList[i].latin1());
2190 ++count; 2191 ++count;
2191 } 2192 }
2192 } 2193 }
2193 } 2194 }
2194 catList.sort(); 2195 catList.sort();
2195 KABPrefs::instance()->mCustomCategories = catList; 2196 KABPrefs::instance()->mCustomCategories = catList;
2196 KABPrefs::instance()->writeConfig(); 2197 KABPrefs::instance()->writeConfig();
2197 message(QString::number( count )+ i18n(" categories added to list! ")); 2198 message(QString::number( count )+ i18n(" categories added to list! "));
2198 } else { 2199 } else {
2199 QStringList catList = KABPrefs::instance()->mCustomCategories; 2200 QStringList catList = KABPrefs::instance()->mCustomCategories;
2200 QStringList catIncList; 2201 QStringList catIncList;
2201 QStringList newCatList; 2202 QStringList newCatList;
2202 KABC::AddressBook::Iterator it; 2203 KABC::AddressBook::Iterator it;
2203 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2204 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2204 QStringList catIncList = (*it).categories(); 2205 QStringList catIncList = (*it).categories();
2205 int i; 2206 int i;
2206 if ( catIncList.count() ) { 2207 if ( catIncList.count() ) {
2207 newCatList.clear(); 2208 newCatList.clear();
2208 for( i = 0; i< catIncList.count(); ++i ) { 2209 for( i = 0; i< catIncList.count(); ++i ) {
2209 if ( catList.contains (catIncList[i])) { 2210 if ( catList.contains (catIncList[i])) {
2210 newCatList.append( catIncList[i] ); 2211 newCatList.append( catIncList[i] );
2211 } 2212 }
2212 } 2213 }
2213 newCatList.sort(); 2214 newCatList.sort();
2214 (*it).setCategories( newCatList ); 2215 (*it).setCategories( newCatList );
2215 mAddressBook->insertAddressee( (*it) ); 2216 mAddressBook->insertAddressee( (*it) );
2216 } 2217 }
2217 } 2218 }
2218 setModified( true ); 2219 setModified( true );
2219 mViewManager->refreshView(); 2220 mViewManager->refreshView();
2220 mDetails->refreshView(); 2221 mDetails->refreshView();
2221 message( i18n("Removing categories done!")); 2222 message( i18n("Removing categories done!"));
2222 } 2223 }
2223 delete cp; 2224 delete cp;
2224} 2225}
2225void KABCore::removeVoice() 2226void KABCore::removeVoice()
2226{ 2227{
2227 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 ) 2228 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 )
2228 return; 2229 return;
2229 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2230 KABC::Addressee::List list;
2231 XXPortSelectDialog dlg( this, false, this );
2232 if ( dlg.exec() )
2233 list = dlg.contacts();
2234 else
2235 return;
2230 KABC::Addressee::List::Iterator it; 2236 KABC::Addressee::List::Iterator it;
2231 for ( it = list.begin(); it != list.end(); ++it ) { 2237 for ( it = list.begin(); it != list.end(); ++it ) {
2232
2233 if ( (*it).removeVoice() ) 2238 if ( (*it).removeVoice() )
2234 contactModified((*it) ); 2239 contactModified((*it) );
2235 } 2240 }
2236} 2241}
2237 2242
2238 2243
2239 2244
2240void KABCore::clipboardDataChanged() 2245void KABCore::clipboardDataChanged()
2241{ 2246{
2242 2247
2243 if ( mReadWrite ) 2248 if ( mReadWrite )
2244 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2249 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2245 2250
2246} 2251}
2247 2252
2248void KABCore::updateActionMenu() 2253void KABCore::updateActionMenu()
2249{ 2254{
2250 UndoStack *undo = UndoStack::instance(); 2255 UndoStack *undo = UndoStack::instance();
2251 RedoStack *redo = RedoStack::instance(); 2256 RedoStack *redo = RedoStack::instance();
2252 2257
2253 if ( undo->isEmpty() ) 2258 if ( undo->isEmpty() )
2254 mActionUndo->setText( i18n( "Undo" ) ); 2259 mActionUndo->setText( i18n( "Undo" ) );
2255 else 2260 else
2256 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2261 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2257 2262
2258 mActionUndo->setEnabled( !undo->isEmpty() ); 2263 mActionUndo->setEnabled( !undo->isEmpty() );
2259 2264
2260 if ( !redo->top() ) 2265 if ( !redo->top() )
2261 mActionRedo->setText( i18n( "Redo" ) ); 2266 mActionRedo->setText( i18n( "Redo" ) );
2262 else 2267 else
2263 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2268 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2264 2269
2265 mActionRedo->setEnabled( !redo->isEmpty() ); 2270 mActionRedo->setEnabled( !redo->isEmpty() );
2266} 2271}
2267 2272
2268void KABCore::configureKeyBindings() 2273void KABCore::configureKeyBindings()
2269{ 2274{
2270#ifndef KAB_EMBEDDED 2275#ifndef KAB_EMBEDDED
2271 KKeyDialog::configure( actionCollection(), true ); 2276 KKeyDialog::configure( actionCollection(), true );
2272#else //KAB_EMBEDDED 2277#else //KAB_EMBEDDED
2273 qDebug("KABCore::configureKeyBindings() not implemented"); 2278 qDebug("KABCore::configureKeyBindings() not implemented");
2274#endif //KAB_EMBEDDED 2279#endif //KAB_EMBEDDED
2275} 2280}
2276 2281
2277#ifdef KAB_EMBEDDED 2282#ifdef KAB_EMBEDDED
2278void KABCore::configureResources() 2283void KABCore::configureResources()
2279{ 2284{
2280 KRES::KCMKResources dlg( this, "" , 0 ); 2285 KRES::KCMKResources dlg( this, "" , 0 );
2281 2286
2282 if ( !dlg.exec() ) 2287 if ( !dlg.exec() )
2283 return; 2288 return;
2284 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2289 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2285} 2290}
2286#endif //KAB_EMBEDDED 2291#endif //KAB_EMBEDDED
2287 2292
2288 2293
2289/* this method will be called through the QCop interface from Ko/Pi to select addresses 2294/* this method will be called through the QCop interface from Ko/Pi to select addresses
2290 * for the attendees list of an event. 2295 * for the attendees list of an event.
2291 */ 2296 */
2292void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2297void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2293{ 2298{
2294 QStringList nameList; 2299 QStringList nameList;
2295 QStringList emailList; 2300 QStringList emailList;
2296 QStringList uidList; 2301 QStringList uidList;
2297 2302
2298 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2303 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2299 uint i=0; 2304 uint i=0;
2300 for (i=0; i < list.count(); i++) 2305 for (i=0; i < list.count(); i++)
2301 { 2306 {
2302 nameList.append(list[i].realName()); 2307 nameList.append(list[i].realName());
2303 emailList.append(list[i].preferredEmail()); 2308 emailList.append(list[i].preferredEmail());
2304 uidList.append(list[i].uid()); 2309 uidList.append(list[i].uid());
2305 } 2310 }
2306 2311
2307 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2312 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2308 2313
2309} 2314}
2310 2315
2311/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2316/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2312 * to put them into the calendar. 2317 * to put them into the calendar.
2313 */ 2318 */
2314void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2319void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2315{ 2320{
2316 // qDebug("KABCore::requestForBirthdayList"); 2321 // qDebug("KABCore::requestForBirthdayList");
2317 QStringList birthdayList; 2322 QStringList birthdayList;
2318 QStringList anniversaryList; 2323 QStringList anniversaryList;
2319 QStringList realNameList; 2324 QStringList realNameList;
2320 QStringList preferredEmailList; 2325 QStringList preferredEmailList;
2321 QStringList assembledNameList; 2326 QStringList assembledNameList;
2322 QStringList uidList; 2327 QStringList uidList;
2323 2328
2324 KABC::AddressBook::Iterator it; 2329 KABC::AddressBook::Iterator it;
2325 2330
2326 int count = 0; 2331 int count = 0;
2327 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2332 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2328 ++count; 2333 ++count;
2329 } 2334 }
2330 QProgressBar bar(count,0 ); 2335 QProgressBar bar(count,0 );
2331 int w = 300; 2336 int w = 300;
2332 if ( QApplication::desktop()->width() < 320 ) 2337 if ( QApplication::desktop()->width() < 320 )
2333 w = 220; 2338 w = 220;
2334 int h = bar.sizeHint().height() ; 2339 int h = bar.sizeHint().height() ;
2335 int dw = QApplication::desktop()->width(); 2340 int dw = QApplication::desktop()->width();
2336 int dh = QApplication::desktop()->height(); 2341 int dh = QApplication::desktop()->height();
2337 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2342 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2338 bar.show(); 2343 bar.show();
2339 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2344 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2340 qApp->processEvents(); 2345 qApp->processEvents();
2341 2346
2342 QDate bday; 2347 QDate bday;
2343 QString anni; 2348 QString anni;
2344 QString formattedbday; 2349 QString formattedbday;
2345 2350
2346 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2351 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2347 { 2352 {
2348 if ( ! bar.isVisible() ) 2353 if ( ! bar.isVisible() )
2349 return; 2354 return;
2350 bar.setProgress( count++ ); 2355 bar.setProgress( count++ );
2351 qApp->processEvents(); 2356 qApp->processEvents();
2352 bday = (*it).birthday().date(); 2357 bday = (*it).birthday().date();
2353 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2358 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2354 2359
2355 if ( bday.isValid() || !anni.isEmpty()) 2360 if ( bday.isValid() || !anni.isEmpty())
2356 { 2361 {
2357 if (bday.isValid()) 2362 if (bday.isValid())
2358 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2363 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2359 else 2364 else
2360 formattedbday = "NOTVALID"; 2365 formattedbday = "NOTVALID";
2361 if (anni.isEmpty()) 2366 if (anni.isEmpty())
2362 anni = "INVALID"; 2367 anni = "INVALID";
2363 2368
2364 birthdayList.append(formattedbday); 2369 birthdayList.append(formattedbday);
2365 anniversaryList.append(anni); //should be ISODate 2370 anniversaryList.append(anni); //should be ISODate
2366 realNameList.append((*it).realName()); 2371 realNameList.append((*it).realName());
2367 preferredEmailList.append((*it).preferredEmail()); 2372 preferredEmailList.append((*it).preferredEmail());
2368 assembledNameList.append((*it).assembledName()); 2373 assembledNameList.append((*it).assembledName());
2369 uidList.append((*it).uid()); 2374 uidList.append((*it).uid());
2370 2375
2371 //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() ); 2376 //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() );
2372 } 2377 }
2373 } 2378 }
2374 2379
2375 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2380 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2376 2381
2377} 2382}
2378 2383
2379/* this method will be called through the QCop interface from other apps to show details of a contact. 2384/* this method will be called through the QCop interface from other apps to show details of a contact.
2380 */ 2385 */
2381void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2386void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2382{ 2387{
2383 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2388 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2384 2389
2385 QString foundUid = QString::null; 2390 QString foundUid = QString::null;
2386 if ( ! uid.isEmpty() ) { 2391 if ( ! uid.isEmpty() ) {
2387 Addressee adrr = mAddressBook->findByUid( uid ); 2392 Addressee adrr = mAddressBook->findByUid( uid );
2388 if ( !adrr.isEmpty() ) { 2393 if ( !adrr.isEmpty() ) {
2389 foundUid = uid; 2394 foundUid = uid;
2390 } 2395 }
2391 if ( email == "sendbacklist" ) { 2396 if ( email == "sendbacklist" ) {
2392 //qDebug("ssssssssssssssssssssssend "); 2397 //qDebug("ssssssssssssssssssssssend ");
2393 QStringList nameList; 2398 QStringList nameList;
2394 QStringList emailList; 2399 QStringList emailList;
2395 QStringList uidList; 2400 QStringList uidList;
2396 nameList.append(adrr.realName()); 2401 nameList.append(adrr.realName());
2397 emailList = adrr.emails(); 2402 emailList = adrr.emails();
2398 uidList.append( adrr.preferredEmail()); 2403 uidList.append( adrr.preferredEmail());
2399 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2404 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2400 return; 2405 return;
2401 } 2406 }
2402 2407
2403 } 2408 }
2404 2409
2405 if ( email == "sendbacklist" ) 2410 if ( email == "sendbacklist" )
2406 return; 2411 return;
2407 if (foundUid.isEmpty()) 2412 if (foundUid.isEmpty())
2408 { 2413 {
2409 //find the uid of the person first 2414 //find the uid of the person first
2410 Addressee::List namelist; 2415 Addressee::List namelist;
2411 Addressee::List emaillist; 2416 Addressee::List emaillist;
2412 2417
2413 if (!name.isEmpty()) 2418 if (!name.isEmpty())
2414 namelist = mAddressBook->findByName( name ); 2419 namelist = mAddressBook->findByName( name );
2415 2420
2416 if (!email.isEmpty()) 2421 if (!email.isEmpty())
2417 emaillist = mAddressBook->findByEmail( email ); 2422 emaillist = mAddressBook->findByEmail( email );
2418 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2423 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2419 //check if we have a match in Namelist and Emaillist 2424 //check if we have a match in Namelist and Emaillist
2420 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2425 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2421 foundUid = emaillist[0].uid(); 2426 foundUid = emaillist[0].uid();
2422 } 2427 }
2423 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2428 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2424 foundUid = namelist[0].uid(); 2429 foundUid = namelist[0].uid();
2425 else 2430 else
2426 { 2431 {
2427 for (int i = 0; i < namelist.count(); i++) 2432 for (int i = 0; i < namelist.count(); i++)
2428 { 2433 {
2429 for (int j = 0; j < emaillist.count(); j++) 2434 for (int j = 0; j < emaillist.count(); j++)
2430 { 2435 {
2431 if (namelist[i] == emaillist[j]) 2436 if (namelist[i] == emaillist[j])
2432 { 2437 {
2433 foundUid = namelist[i].uid(); 2438 foundUid = namelist[i].uid();
2434 } 2439 }
2435 } 2440 }
2436 } 2441 }
2437 } 2442 }
2438 } 2443 }
2439 else 2444 else
2440 { 2445 {
2441 foundUid = uid; 2446 foundUid = uid;
2442 } 2447 }
2443 2448
2444 if (!foundUid.isEmpty()) 2449 if (!foundUid.isEmpty())
2445 { 2450 {
2446 2451
2447 // raise Ka/Pi if it is in the background 2452 // raise Ka/Pi if it is in the background
2448#ifndef DESKTOP_VERSION 2453#ifndef DESKTOP_VERSION
2449#ifndef KORG_NODCOP 2454#ifndef KORG_NODCOP
2450 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2455 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2451#endif 2456#endif
2452#endif 2457#endif
2453 2458
2454 mMainWindow->showMaximized(); 2459 mMainWindow->showMaximized();
2455 mMainWindow-> raise(); 2460 mMainWindow-> raise();
2456 2461
2457 mViewManager->setSelected( "", false); 2462 mViewManager->setSelected( "", false);
2458 mViewManager->refreshView( "" ); 2463 mViewManager->refreshView( "" );
2459 mViewManager->setSelected( foundUid, true ); 2464 mViewManager->setSelected( foundUid, true );
2460 mViewManager->refreshView( foundUid ); 2465 mViewManager->refreshView( foundUid );
2461 2466
2462 if ( !mMultipleViewsAtOnce ) 2467 if ( !mMultipleViewsAtOnce )
2463 { 2468 {
2464 setDetailsVisible( true ); 2469 setDetailsVisible( true );
2465 mActionDetails->setChecked(true); 2470 mActionDetails->setChecked(true);
2466 } 2471 }
2467 } 2472 }
2468} 2473}
2469 2474
2470void KABCore::whatsnew() 2475void KABCore::whatsnew()
2471{ 2476{
2472 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2477 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2473} 2478}
2474void KABCore::synchowto() 2479void KABCore::synchowto()
2475{ 2480{
2476 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2481 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2477} 2482}
2478void KABCore::kdesynchowto() 2483void KABCore::kdesynchowto()
2479{ 2484{
2480 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2485 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2481} 2486}
2482void KABCore::multisynchowto() 2487void KABCore::multisynchowto()
2483{ 2488{
2484 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2489 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2485} 2490}
2486void KABCore::faq() 2491void KABCore::faq()
2487{ 2492{
2488 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2493 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );