summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-09-07 22:51:29 (UTC)
committer zautrix <zautrix>2004-09-07 22:51:29 (UTC)
commit2676646d4744ccceab1063dc02d772a26a203c61 (patch) (unidiff)
tree0a0d5261b9a804a29b61a38f68339979051282e2 /kaddressbook
parent64a8ef1629f523df3006de5cb2b9882a50d96a05 (diff)
downloadkdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.zip
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.gz
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.bz2
Implemented Ompi - kapi connection
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2f9f1df..6522ccc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1854,268 +1854,286 @@ void KABCore::addActionsManually()
1854 fileMenu->insertSeparator(); 1854 fileMenu->insertSeparator();
1855 mActionMailVCard->plug( fileMenu ); 1855 mActionMailVCard->plug( fileMenu );
1856#ifndef DESKTOP_VERSION 1856#ifndef DESKTOP_VERSION
1857 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1857 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1858 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1858 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1859#endif 1859#endif
1860 fileMenu->insertSeparator(); 1860 fileMenu->insertSeparator();
1861 mActionQuit->plug( fileMenu ); 1861 mActionQuit->plug( fileMenu );
1862#ifdef _WIN32_ 1862#ifdef _WIN32_
1863 mActionImportOL->plug( ImportMenu ); 1863 mActionImportOL->plug( ImportMenu );
1864#endif 1864#endif
1865 // edit menu 1865 // edit menu
1866 mActionUndo->plug( editMenu ); 1866 mActionUndo->plug( editMenu );
1867 mActionRedo->plug( editMenu ); 1867 mActionRedo->plug( editMenu );
1868 editMenu->insertSeparator(); 1868 editMenu->insertSeparator();
1869 mActionCut->plug( editMenu ); 1869 mActionCut->plug( editMenu );
1870 mActionCopy->plug( editMenu ); 1870 mActionCopy->plug( editMenu );
1871 mActionPaste->plug( editMenu ); 1871 mActionPaste->plug( editMenu );
1872 mActionDelete->plug( editMenu ); 1872 mActionDelete->plug( editMenu );
1873 editMenu->insertSeparator(); 1873 editMenu->insertSeparator();
1874 mActionSelectAll->plug( editMenu ); 1874 mActionSelectAll->plug( editMenu );
1875 1875
1876 mActionRemoveVoice->plug( changeMenu ); 1876 mActionRemoveVoice->plug( changeMenu );
1877 // settings menu 1877 // settings menu
1878//US special menuentry to configure the addressbook resources. On KDE 1878//US special menuentry to configure the addressbook resources. On KDE
1879// you do that through the control center !!! 1879// you do that through the control center !!!
1880 mActionConfigResources->plug( settingsMenu ); 1880 mActionConfigResources->plug( settingsMenu );
1881 settingsMenu->insertSeparator(); 1881 settingsMenu->insertSeparator();
1882 1882
1883 mActionConfigKAddressbook->plug( settingsMenu ); 1883 mActionConfigKAddressbook->plug( settingsMenu );
1884 1884
1885 if ( mIsPart ) { 1885 if ( mIsPart ) {
1886 mActionConfigShortcuts->plug( settingsMenu ); 1886 mActionConfigShortcuts->plug( settingsMenu );
1887 mActionConfigureToolbars->plug( settingsMenu ); 1887 mActionConfigureToolbars->plug( settingsMenu );
1888 1888
1889 } else { 1889 } else {
1890 mActionKeyBindings->plug( settingsMenu ); 1890 mActionKeyBindings->plug( settingsMenu );
1891 } 1891 }
1892 1892
1893 settingsMenu->insertSeparator(); 1893 settingsMenu->insertSeparator();
1894 1894
1895 mActionJumpBar->plug( settingsMenu ); 1895 mActionJumpBar->plug( settingsMenu );
1896 mActionDetails->plug( settingsMenu ); 1896 mActionDetails->plug( settingsMenu );
1897 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 1897 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
1898 mActionDetails->plug( tb ); 1898 mActionDetails->plug( tb );
1899 settingsMenu->insertSeparator(); 1899 settingsMenu->insertSeparator();
1900 1900
1901 mActionWhoAmI->plug( settingsMenu ); 1901 mActionWhoAmI->plug( settingsMenu );
1902 mActionCategories->plug( settingsMenu ); 1902 mActionCategories->plug( settingsMenu );
1903 1903
1904 mActionLicence->plug( helpMenu ); 1904 mActionLicence->plug( helpMenu );
1905 mActionFaq->plug( helpMenu ); 1905 mActionFaq->plug( helpMenu );
1906 mActionAboutKAddressbook->plug( helpMenu ); 1906 mActionAboutKAddressbook->plug( helpMenu );
1907 1907
1908 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1908 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1909 1909
1910 mActionSave->plug( tb ); 1910 mActionSave->plug( tb );
1911 mViewManager->getFilterAction()->plug ( tb); 1911 mViewManager->getFilterAction()->plug ( tb);
1912 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 1912 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1913 mActionUndo->plug( tb ); 1913 mActionUndo->plug( tb );
1914 mActionDelete->plug( tb ); 1914 mActionDelete->plug( tb );
1915 mActionRedo->plug( tb ); 1915 mActionRedo->plug( tb );
1916 } 1916 }
1917 } 1917 }
1918 //mActionQuit->plug ( tb ); 1918 //mActionQuit->plug ( tb );
1919 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1919 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1920 1920
1921 //US link the searchwidget first to this. 1921 //US link the searchwidget first to this.
1922 // The real linkage to the toolbar happens later. 1922 // The real linkage to the toolbar happens later.
1923//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1923//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1924//US tb->insertItem( mIncSearchWidget ); 1924//US tb->insertItem( mIncSearchWidget );
1925/*US 1925/*US
1926 mIncSearchWidget = new IncSearchWidget( tb ); 1926 mIncSearchWidget = new IncSearchWidget( tb );
1927 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1927 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1928 SLOT( incrementalSearch( const QString& ) ) ); 1928 SLOT( incrementalSearch( const QString& ) ) );
1929 1929
1930 mJumpButtonBar = new JumpButtonBar( this, this ); 1930 mJumpButtonBar = new JumpButtonBar( this, this );
1931 1931
1932//US topLayout->addWidget( mJumpButtonBar ); 1932//US topLayout->addWidget( mJumpButtonBar );
1933 this->layout()->add( mJumpButtonBar ); 1933 this->layout()->add( mJumpButtonBar );
1934*/ 1934*/
1935 1935
1936#endif //KAB_EMBEDDED 1936#endif //KAB_EMBEDDED
1937} 1937}
1938void KABCore::showLicence() 1938void KABCore::showLicence()
1939{ 1939{
1940 KApplication::showLicence(); 1940 KApplication::showLicence();
1941} 1941}
1942void KABCore::removeVoice() 1942void KABCore::removeVoice()
1943{ 1943{
1944 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 ) 1944 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 )
1945 return; 1945 return;
1946 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1946 KABC::Addressee::List list = mViewManager->selectedAddressees();
1947 KABC::Addressee::List::Iterator it; 1947 KABC::Addressee::List::Iterator it;
1948 for ( it = list.begin(); it != list.end(); ++it ) { 1948 for ( it = list.begin(); it != list.end(); ++it ) {
1949 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1949 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1950 PhoneNumber::List::Iterator phoneIt; 1950 PhoneNumber::List::Iterator phoneIt;
1951 bool found = false; 1951 bool found = false;
1952 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1952 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1953 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1953 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1954 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1954 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1955 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1955 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1956 (*it).insertPhoneNumber( (*phoneIt) ); 1956 (*it).insertPhoneNumber( (*phoneIt) );
1957 found = true; 1957 found = true;
1958 } 1958 }
1959 } 1959 }
1960 1960
1961 } 1961 }
1962 if ( found ) 1962 if ( found )
1963 contactModified((*it) ); 1963 contactModified((*it) );
1964 } 1964 }
1965} 1965}
1966 1966
1967 1967
1968 1968
1969void KABCore::clipboardDataChanged() 1969void KABCore::clipboardDataChanged()
1970{ 1970{
1971 1971
1972 if ( mReadWrite ) 1972 if ( mReadWrite )
1973 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1973 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1974 1974
1975} 1975}
1976 1976
1977void KABCore::updateActionMenu() 1977void KABCore::updateActionMenu()
1978{ 1978{
1979 UndoStack *undo = UndoStack::instance(); 1979 UndoStack *undo = UndoStack::instance();
1980 RedoStack *redo = RedoStack::instance(); 1980 RedoStack *redo = RedoStack::instance();
1981 1981
1982 if ( undo->isEmpty() ) 1982 if ( undo->isEmpty() )
1983 mActionUndo->setText( i18n( "Undo" ) ); 1983 mActionUndo->setText( i18n( "Undo" ) );
1984 else 1984 else
1985 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1985 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1986 1986
1987 mActionUndo->setEnabled( !undo->isEmpty() ); 1987 mActionUndo->setEnabled( !undo->isEmpty() );
1988 1988
1989 if ( !redo->top() ) 1989 if ( !redo->top() )
1990 mActionRedo->setText( i18n( "Redo" ) ); 1990 mActionRedo->setText( i18n( "Redo" ) );
1991 else 1991 else
1992 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1992 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1993 1993
1994 mActionRedo->setEnabled( !redo->isEmpty() ); 1994 mActionRedo->setEnabled( !redo->isEmpty() );
1995} 1995}
1996 1996
1997void KABCore::configureKeyBindings() 1997void KABCore::configureKeyBindings()
1998{ 1998{
1999#ifndef KAB_EMBEDDED 1999#ifndef KAB_EMBEDDED
2000 KKeyDialog::configure( actionCollection(), true ); 2000 KKeyDialog::configure( actionCollection(), true );
2001#else //KAB_EMBEDDED 2001#else //KAB_EMBEDDED
2002 qDebug("KABCore::configureKeyBindings() not implemented"); 2002 qDebug("KABCore::configureKeyBindings() not implemented");
2003#endif //KAB_EMBEDDED 2003#endif //KAB_EMBEDDED
2004} 2004}
2005 2005
2006#ifdef KAB_EMBEDDED 2006#ifdef KAB_EMBEDDED
2007void KABCore::configureResources() 2007void KABCore::configureResources()
2008{ 2008{
2009 KRES::KCMKResources dlg( this, "" , 0 ); 2009 KRES::KCMKResources dlg( this, "" , 0 );
2010 2010
2011 if ( !dlg.exec() ) 2011 if ( !dlg.exec() )
2012 return; 2012 return;
2013 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2013 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2014} 2014}
2015#endif //KAB_EMBEDDED 2015#endif //KAB_EMBEDDED
2016 2016
2017 2017
2018/* this method will be called through the QCop interface from Ko/Pi to select addresses 2018/* this method will be called through the QCop interface from Ko/Pi to select addresses
2019 * for the attendees list of an event. 2019 * for the attendees list of an event.
2020 */ 2020 */
2021void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2021void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2022{ 2022{
2023 QStringList nameList; 2023 QStringList nameList;
2024 QStringList emailList; 2024 QStringList emailList;
2025 QStringList uidList; 2025 QStringList uidList;
2026 2026
2027 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2027 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2028 uint i=0; 2028 uint i=0;
2029 for (i=0; i < list.count(); i++) 2029 for (i=0; i < list.count(); i++)
2030 { 2030 {
2031 nameList.append(list[i].realName()); 2031 nameList.append(list[i].realName());
2032 emailList.append(list[i].preferredEmail()); 2032 emailList.append(list[i].preferredEmail());
2033 uidList.append(list[i].uid()); 2033 uidList.append(list[i].uid());
2034 } 2034 }
2035 2035
2036 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2036 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2037 2037
2038} 2038}
2039 2039
2040/* this method will be called through the QCop interface from other apps to show details of a contact. 2040/* this method will be called through the QCop interface from other apps to show details of a contact.
2041 */ 2041 */
2042void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2042void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2043{ 2043{
2044 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2044 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2045 2045
2046 QString foundUid = QString::null; 2046 QString foundUid = QString::null;
2047 if (uid.isEmpty()) 2047 if ( ! uid.isEmpty() ) {
2048 Addressee adrr = mAddressBook->findByUid( uid );
2049 if ( !adrr.isEmpty() ) {
2050 foundUid = uid;
2051 if ( email == "sendbacklist" ) {
2052 QStringList nameList;
2053 QStringList emailList;
2054 QStringList uidList;
2055 nameList.append(adrr.realName());
2056 emailList = adrr.emails();
2057 uidList.append( adrr.preferredEmail());
2058 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2059 }
2060 }
2061 }
2062
2063 if ( email == "sendback" )
2064 return;
2065 if (foundUid.isEmpty())
2048 { 2066 {
2049 //find the uid of the person first 2067 //find the uid of the person first
2050 Addressee::List namelist; 2068 Addressee::List namelist;
2051 Addressee::List emaillist; 2069 Addressee::List emaillist;
2052 2070
2053 if (!name.isEmpty()) 2071 if (!name.isEmpty())
2054 namelist = mAddressBook->findByName( name ); 2072 namelist = mAddressBook->findByName( name );
2055 2073
2056 if (!email.isEmpty()) 2074 if (!email.isEmpty())
2057 emaillist = mAddressBook->findByEmail( email ); 2075 emaillist = mAddressBook->findByEmail( email );
2058 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2076 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2059 //check if we have a match in Namelist and Emaillist 2077 //check if we have a match in Namelist and Emaillist
2060 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2078 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2061 foundUid = emaillist[0].uid(); 2079 foundUid = emaillist[0].uid();
2062 } 2080 }
2063 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2081 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2064 foundUid = namelist[0].uid(); 2082 foundUid = namelist[0].uid();
2065 else 2083 else
2066 { 2084 {
2067 for (int i = 0; i < namelist.count(); i++) 2085 for (int i = 0; i < namelist.count(); i++)
2068 { 2086 {
2069 for (int j = 0; j < emaillist.count(); j++) 2087 for (int j = 0; j < emaillist.count(); j++)
2070 { 2088 {
2071 if (namelist[i] == emaillist[j]) 2089 if (namelist[i] == emaillist[j])
2072 { 2090 {
2073 foundUid = namelist[i].uid(); 2091 foundUid = namelist[i].uid();
2074 } 2092 }
2075 } 2093 }
2076 } 2094 }
2077 } 2095 }
2078 } 2096 }
2079 else 2097 else
2080 { 2098 {
2081 foundUid = uid; 2099 foundUid = uid;
2082 } 2100 }
2083 2101
2084 if (!foundUid.isEmpty()) 2102 if (!foundUid.isEmpty())
2085 { 2103 {
2086 2104
2087 // raise Ka/Pi if it is in the background 2105 // raise Ka/Pi if it is in the background
2088#ifndef DESKTOP_VERSION 2106#ifndef DESKTOP_VERSION
2089#ifndef KORG_NODCOP 2107#ifndef KORG_NODCOP
2090 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2108 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2091#endif 2109#endif
2092#endif 2110#endif
2093 2111
2094 mMainWindow->showMaximized(); 2112 mMainWindow->showMaximized();
2095 mMainWindow-> raise(); 2113 mMainWindow-> raise();
2096 2114
2097 mViewManager->setSelected( "", false); 2115 mViewManager->setSelected( "", false);
2098 mViewManager->refreshView( "" ); 2116 mViewManager->refreshView( "" );
2099 mViewManager->setSelected( foundUid, true ); 2117 mViewManager->setSelected( foundUid, true );
2100 mViewManager->refreshView( foundUid ); 2118 mViewManager->refreshView( foundUid );
2101 2119
2102 if ( !mMultipleViewsAtOnce ) 2120 if ( !mMultipleViewsAtOnce )
2103 { 2121 {
2104 setDetailsVisible( true ); 2122 setDetailsVisible( true );
2105 mActionDetails->setChecked(true); 2123 mActionDetails->setChecked(true);
2106 } 2124 }
2107 } 2125 }
2108} 2126}
2109 2127
2110 2128
2111void KABCore::faq() 2129void KABCore::faq()
2112{ 2130{
2113 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2131 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2114} 2132}
2115 2133
2116 2134
2117 2135
2118 2136
2119#ifndef KAB_EMBEDDED 2137#ifndef KAB_EMBEDDED
2120#include "kabcore.moc" 2138#include "kabcore.moc"
2121#endif //KAB_EMBEDDED 2139#endif //KAB_EMBEDDED