-rw-r--r-- | kaddressbook/kabcore.cpp | 22 |
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 | |||
@@ -2022,50 +2022,68 @@ void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QSt | |||
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 | 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]) |