summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-19 00:38:41 (UTC)
committer ulf69 <ulf69>2004-08-19 00:38:41 (UTC)
commit895e3797f6437347fd73b87a3bf9d4cecfa5a5a9 (patch) (side-by-side diff)
tree514daed00896a1a902b63f2deefa745b34d51ea4
parent00101d27c9305ac3163e1a0c8ed27408b41fa192 (diff)
downloadkdepimpi-895e3797f6437347fd73b87a3bf9d4cecfa5a5a9.zip
kdepimpi-895e3797f6437347fd73b87a3bf9d4cecfa5a5a9.tar.gz
kdepimpi-895e3797f6437347fd73b87a3bf9d4cecfa5a5a9.tar.bz2
updated version of detailed view when called through QCop
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp79
-rw-r--r--kaddressbook/kabcore.h3
2 files changed, 77 insertions, 5 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e7c815e..dabb8e9 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -65,12 +65,14 @@
#include <kapplication.h>
#include "KDGanttMinimizeSplitter.h"
#include "kaddressbookmain.h"
#include "kactioncollection.h"
#include "addresseedialog.h"
+//US
+#include <libkdepim/addresseeview.h>
#include <qapp.h>
#include <qmenubar.h>
//#include <qtoolbar.h>
#include <qmessagebox.h>
#include <kdebug.h>
@@ -81,12 +83,15 @@
//#include <qlabel.h>
#ifndef DESKTOP_VERSION
#include <qpe/ir.h>
+#include <qtopia/qcopenvelope_qws.h>
+#else
+
#endif
#endif // KAB_EMBEDDED
#include "kcmconfigs/kcmkabconfig.h"
#include "kcmconfigs/kcmkdepimconfig.h"
#include "kpimglobalprefs.h"
@@ -211,13 +216,14 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
mJumpButtonBar, SLOT( recreateButtons() ) );
connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
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
connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
mXXPortManager, SLOT( importVCard( const KURL& ) ) );
@@ -1972,16 +1978,14 @@ void KABCore::configureResources()
#endif //KAB_EMBEDDED
/* 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;
KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
uint i=0;
@@ -1993,12 +1997,79 @@ void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QSt
}
bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
}
+/* 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);
+ }
+ }
+}
+
#ifndef KAB_EMBEDDED
#include "kabcore.moc"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index fe778af..040b6aa 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -325,13 +325,14 @@ class KABCore : public QWidget
/**
Registers a new GUI client, so plugins can register its actions.
*/
void addGUIClient( KXMLGUIClient *client );
- void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid, const QString& param1);
+ void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
+ void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
signals:
void contactSelected( const QString &name );
void contactSelected( const QPixmap &pixmap );
public slots: