author | zautrix <zautrix> | 2004-09-07 20:33:23 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-07 20:33:23 (UTC) |
commit | 64a8ef1629f523df3006de5cb2b9882a50d96a05 (patch) (unidiff) | |
tree | b931dc5397b4eec926603080b20eddda131999ff /kaddressbook | |
parent | 9d5c8750ae671e73ec8ebc0a71f30fd30680f2c0 (diff) | |
download | kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.zip kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.tar.gz kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.tar.bz2 |
Fixed Kopi-Kapi external app communication
-rw-r--r-- | kaddressbook/kabcore.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4299ebd..2f9f1df 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1948,171 +1948,174 @@ void KABCore::removeVoice() | |||
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 | ||
1969 | void KABCore::clipboardDataChanged() | 1969 | void 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 | ||
1977 | void KABCore::updateActionMenu() | 1977 | void 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 | ||
1997 | void KABCore::configureKeyBindings() | 1997 | void 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 |
2007 | void KABCore::configureResources() | 2007 | void 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 | */ |
2021 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2021 | void 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 | */ |
2042 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2042 | void 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 | { | 2048 | { |
2049 | //find the uid of the person first | 2049 | //find the uid of the person first |
2050 | Addressee::List namelist; | 2050 | Addressee::List namelist; |
2051 | Addressee::List emaillist; | 2051 | Addressee::List emaillist; |
2052 | 2052 | ||
2053 | if (!name.isEmpty()) | 2053 | if (!name.isEmpty()) |
2054 | namelist = mAddressBook->findByName( name ); | 2054 | namelist = mAddressBook->findByName( name ); |
2055 | 2055 | ||
2056 | if (!email.isEmpty()) | 2056 | if (!email.isEmpty()) |
2057 | emaillist = mAddressBook->findByEmail( email ); | 2057 | emaillist = mAddressBook->findByEmail( email ); |
2058 | 2058 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | |
2059 | //check if we have a match in Namelist and Emaillist | 2059 | //check if we have a match in Namelist and Emaillist |
2060 | if ((namelist.count() == 0) && (emaillist.count() > 0)) | 2060 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2061 | foundUid == emaillist[0].uid(); | 2061 | foundUid = emaillist[0].uid(); |
2062 | } | ||
2062 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2063 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2063 | foundUid == namelist[0].uid(); | 2064 | foundUid = namelist[0].uid(); |
2064 | else | 2065 | else |
2065 | { | 2066 | { |
2066 | for (int i = 0; i < namelist.count(); i++) | 2067 | for (int i = 0; i < namelist.count(); i++) |
2067 | { | 2068 | { |
2068 | for (int j = 0; j < emaillist.count(); j++) | 2069 | for (int j = 0; j < emaillist.count(); j++) |
2069 | { | 2070 | { |
2070 | if (namelist[i] == emaillist[j]) | 2071 | if (namelist[i] == emaillist[j]) |
2071 | { | 2072 | { |
2072 | foundUid == namelist[i].uid(); | 2073 | foundUid = namelist[i].uid(); |
2073 | } | 2074 | } |
2074 | } | 2075 | } |
2075 | } | 2076 | } |
2076 | } | 2077 | } |
2077 | } | 2078 | } |
2078 | else | 2079 | else |
2079 | { | 2080 | { |
2080 | foundUid = uid; | 2081 | foundUid = uid; |
2081 | } | 2082 | } |
2082 | 2083 | ||
2083 | if (!foundUid.isEmpty()) | 2084 | if (!foundUid.isEmpty()) |
2084 | { | 2085 | { |
2086 | |||
2085 | // raise Ka/Pi if it is in the background | 2087 | // raise Ka/Pi if it is in the background |
2086 | #ifndef DESKTOP_VERSION | 2088 | #ifndef DESKTOP_VERSION |
2087 | #ifndef KORG_NODCOP | 2089 | #ifndef KORG_NODCOP |
2088 | QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2090 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2089 | #endif | 2091 | #endif |
2090 | #endif | 2092 | #endif |
2091 | 2093 | ||
2092 | mMainWindow->showMaximized(); | 2094 | mMainWindow->showMaximized(); |
2095 | mMainWindow-> raise(); | ||
2093 | 2096 | ||
2094 | mViewManager->setSelected( "", false); | 2097 | mViewManager->setSelected( "", false); |
2095 | mViewManager->refreshView( "" ); | 2098 | mViewManager->refreshView( "" ); |
2096 | mViewManager->setSelected( foundUid, true ); | 2099 | mViewManager->setSelected( foundUid, true ); |
2097 | mViewManager->refreshView( foundUid ); | 2100 | mViewManager->refreshView( foundUid ); |
2098 | 2101 | ||
2099 | if ( !mMultipleViewsAtOnce ) | 2102 | if ( !mMultipleViewsAtOnce ) |
2100 | { | 2103 | { |
2101 | setDetailsVisible( true ); | 2104 | setDetailsVisible( true ); |
2102 | mActionDetails->setChecked(true); | 2105 | mActionDetails->setChecked(true); |
2103 | } | 2106 | } |
2104 | } | 2107 | } |
2105 | } | 2108 | } |
2106 | 2109 | ||
2107 | 2110 | ||
2108 | void KABCore::faq() | 2111 | void KABCore::faq() |
2109 | { | 2112 | { |
2110 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2113 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2111 | } | 2114 | } |
2112 | 2115 | ||
2113 | 2116 | ||
2114 | 2117 | ||
2115 | 2118 | ||
2116 | #ifndef KAB_EMBEDDED | 2119 | #ifndef KAB_EMBEDDED |
2117 | #include "kabcore.moc" | 2120 | #include "kabcore.moc" |
2118 | #endif //KAB_EMBEDDED | 2121 | #endif //KAB_EMBEDDED |