summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp79
1 files changed, 75 insertions, 4 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e7c815e..dabb8e9 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -68,6 +68,8 @@
#include "kaddressbookmain.h"
#include "kactioncollection.h"
#include "addresseedialog.h"
+//US
+#include <libkdepim/addresseeview.h>
#include <qapp.h>
#include <qmenubar.h>
@@ -84,6 +86,9 @@
#ifndef DESKTOP_VERSION
#include <qpe/ir.h>
+#include <qtopia/qcopenvelope_qws.h>
+#else
+
#endif
#endif // KAB_EMBEDDED
@@ -214,7 +219,8 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
SLOT( sendMail( const QString& ) ) );
- connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&, const QString&)));
+ connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
+ connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
#ifndef KAB_EMBEDDED
@@ -1975,10 +1981,8 @@ void KABCore::configureResources()
/* this method will be called through the QCop interface from Ko/Pi to select addresses
* for the attendees list of an event.
*/
-void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid, const QString& param1)
+void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
{
- //param1 is usually empty for this kind of request
-
QStringList nameList;
QStringList emailList;
QStringList uidList;
@@ -1996,6 +2000,73 @@ void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QSt
}
+/* this method will be called through the QCop interface from other apps to show details of a contact.
+ */
+void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
+{
+// qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
+
+ QString foundUid = QString::null;
+ if (uid.isEmpty())
+ {
+ //find the uid of the person first
+ Addressee::List namelist;
+ Addressee::List emaillist;
+
+ if (!name.isEmpty())
+ namelist = mAddressBook->findByName( name );
+
+ if (!email.isEmpty())
+ emaillist = mAddressBook->findByEmail( email );
+
+ //check if we have a match in Namelist and Emaillist
+ if ((namelist.count() == 0) && (emaillist.count() > 0))
+ foundUid == emaillist[0].uid();
+ else if ((namelist.count() > 0) && (emaillist.count() == 0))
+ foundUid == namelist[0].uid();
+ else
+ {
+ for (int i = 0; i < namelist.count(); i++)
+ {
+ for (int j = 0; j < emaillist.count(); j++)
+ {
+ if (namelist[i] == emaillist[j])
+ {
+ foundUid == namelist[i].uid();
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ foundUid = uid;
+ }
+
+ if (!foundUid.isEmpty())
+ {
+ // raise Ka/Pi if it is in the background
+#ifndef DESKTOP_VERSION
+#ifndef KORG_NODCOP
+ QCopEnvelope e("QPE/Application/kapi", "raise()");
+#endif
+#endif
+
+ mMainWindow->showMaximized();
+
+ mViewManager->setSelected( "", false);
+ mViewManager->refreshView( "" );
+ mViewManager->setSelected( foundUid, true );
+ mViewManager->refreshView( foundUid );
+
+ if ( !mMultipleViewsAtOnce )
+ {
+ setDetailsVisible( true );
+ mActionDetails->setChecked(true);
+ }
+ }
+}
+