summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp2
-rw-r--r--kabc/stdaddressbook.cpp14
-rw-r--r--kaddressbook/kabcore.cpp15
-rw-r--r--korganizer/koeventviewer.cpp50
-rw-r--r--korganizer/mainwindow.cpp2
-rw-r--r--libkdepim/externalapphandler.cpp2
6 files changed, 66 insertions, 19 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index c61b387..47d298a 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -406,49 +406,49 @@ AddressBook::Iterator AddressBook::find( const Addressee &a )
}
Addressee AddressBook::findByUid( const QString &uid )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( uid == (*it).uid() ) {
return *it;
}
}
return Addressee();
}
Addressee::List AddressBook::allAddressees()
{
return d->mAddressees;
}
Addressee::List AddressBook::findByName( const QString &name )
{
Addressee::List results;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
- if ( name == (*it).name() ) {
+ if ( name == (*it).realName() ) {
results.append( *it );
}
}
return results;
}
Addressee::List AddressBook::findByEmail( const QString &email )
{
Addressee::List results;
QStringList mailList;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
mailList = (*it).emails();
for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) {
if ( email == (*ite) ) {
results.append( *it );
}
}
}
return results;
}
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index 760820e..9f38f08 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -42,85 +42,95 @@ bool StdAddressBook::mAutomaticSave = true;
static KStaticDeleter<StdAddressBook> addressBookDeleter;
QString StdAddressBook::fileName()
{
return locateLocal( "data", "kabc/std.vcf" );
}
QString StdAddressBook::directoryName()
{
return locateLocal( "data", "kabc/stdvcf" );
}
void StdAddressBook::handleCrash()
{
StdAddressBook::self()->cleanUp();
}
StdAddressBook *StdAddressBook::self()
{
if ( !mSelf )
{
QString appdir = StdAddressBook::setTempAppDir();
-
- kdDebug(5700) << "StdAddressBook::self()" << endl;
+ qDebug("****************************************************** ");
+ qDebug("****************************************************** ");
+ qDebug("****************************************************** ");
+ qDebug("****************************************************** ");
+ qDebug("****************************************************** ");
// US im am not sure why I have to use the other format here??
#ifdef KAB_EMBEDDED
mSelf = addressBookDeleter.setObject( new StdAddressBook );
#else //KAB_EMBEDDED
addressBookDeleter.setObject( mSelf, new StdAddressBook );
#endif //KAB_EMBEDDED
KStandardDirs::setAppDir( appdir );
}
return mSelf;
}
QString StdAddressBook::setTempAppDir()
{
QString appDIR = KStandardDirs::appDir();
#ifdef DESKTOP_VERSION
QString appdir = QDir::homeDirPath();
if ( appdir.right(1) == "\\" || appdir.right(1) == "/" )
appdir += "kaddressbook/";
else
appdir += "/kaddressbook/";
KStandardDirs::setAppDir( QDir::convertSeparators( appdir ));
#else
QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook";
KStandardDirs::setAppDir( appdir );
#endif
return appDIR;
}
StdAddressBook *StdAddressBook::self( bool onlyFastResources )
{
if ( !mSelf )
{
+ qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
+ qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
+ qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
+ qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
+ qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
+ qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
+ qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
QString appdir =StdAddressBook::setTempAppDir();
#ifdef KAB_EMBEDDED
mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) );
#else //KAB_EMBEDDED
addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) );
#endif //KAB_EMBEDDED
KStandardDirs::setAppDir( appdir );
}
return mSelf;
}
StdAddressBook::StdAddressBook()
: AddressBook( "kabcrc" )
{
init( false );
}
StdAddressBook::StdAddressBook( bool onlyFastResources )
: AddressBook( "kabcrc" )
{
init( onlyFastResources );
}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4299ebd..2f9f1df 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2034,83 +2034,86 @@ 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 );
-
+ qDebug("count %d %d ", namelist.count(),emaillist.count() );
//check if we have a match in Namelist and Emaillist
- if ((namelist.count() == 0) && (emaillist.count() > 0))
- foundUid == emaillist[0].uid();
+ if ((namelist.count() == 0) && (emaillist.count() > 0)) {
+ foundUid = emaillist[0].uid();
+ }
else if ((namelist.count() > 0) && (emaillist.count() == 0))
- foundUid == namelist[0].uid();
+ 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();
+ 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()");
+ //QCopEnvelope e("QPE/Application/kapi", "raise()");
#endif
#endif
mMainWindow->showMaximized();
+ mMainWindow-> raise();
mViewManager->setSelected( "", false);
mViewManager->refreshView( "" );
mViewManager->setSelected( foundUid, true );
mViewManager->refreshView( foundUid );
if ( !mMultipleViewsAtOnce )
{
setDetailsVisible( true );
mActionDetails->setChecked(true);
}
}
}
void KABCore::faq()
{
KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
}
#ifndef KAB_EMBEDDED
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 1f69700..0866939 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -29,101 +29,122 @@
#include <libkcal/event.h>
#include <libkcal/todo.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <krun.h>
#include <kglobal.h>
#include <kprocess.h>
#include "koprefs.h"
#include <libkdepim/addresseeview.h>
#include <kabc/stdaddressbook.h>
#ifndef KORG_NODCOP
#include <dcopclient.h>
#include "korganizer.h"
#include "koprefs.h"
#include "actionmanager.h"
#endif
#include "koeventviewer.h"
#ifndef KORG_NOKABC
#include <kabc/stdaddressbook.h>
#define size count
#endif
-#ifndef DESKTOP_VERSION
+
+#ifdef DESKTOP_VERSION
+#include <kabc/addresseedialog.h>
+#else //DESKTOP_VERSION
+#include <externalapphandler.h>
#include <qtopia/qcopenvelope_qws.h>
-#endif
+#endif //DESKTOP_VERSION
KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
: QTextBrowser(parent,name)
{
mSyncMode = false;
mColorMode = 0;
}
KOEventViewer::~KOEventViewer()
{
}
void KOEventViewer::setSource(const QString& n)
{
- if ( n.left(3) == "uid" ) {
+ if ( n.left(3) == "uid" )
+#ifdef DESKTOP_VERSION
+ {
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
// LR I do not understand, why the uid string is different on zaurus and desktop
-#ifdef DESKTOP_VERSION
QString uid = "uid://"+(*it).uid();
-#else
- QString uid = "uid:"+(*it).uid();
-#endif
+
//qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
if (n == uid ) {
//qDebug("found %s ",(*it).mobileHomePhone().latin1() );
QDialog dia( this,"dia123", true );
dia.setCaption( i18n("Details of attendee") );
QVBoxLayout lay ( &dia );
KPIM::AddresseeView av ( &dia );
av.setAddressee( (*it) );
lay.addWidget( &av );
if ( QApplication::desktop()->width() < 480 )
dia.resize( 220, 240);
else {
dia.resize( 400,400);
}
dia.exec();
break;
}
}
return;
}
+#else
+ {
+ QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
+ if (attendees.count()) {
+ Attendee *a;
+ for(a=attendees.first();a;a=attendees.next()) {
+ if ( "uid:"+a->uid() == n ) {
+ bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), "");
+ return;
+ }
+ }
+ }
+ return;
+ }
+ //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
+ // the result should now arrive through method insertAttendees
+ //QString uid = "uid:"+(*it).uid();
+#endif
if ( n.left(6) == "mailto" ) {
// qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
#ifndef DESKTOP_VERSION
- QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)" );
+ QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
e << n.mid(7);
#endif
}
#ifndef KORG_NODCOP
kdDebug() << "KOEventViewer::setSource(): " << n << endl;
QString tmpStr;
if (n.startsWith("mailto:")) {
KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
//emit showIncidence(n);
return;
} else if (n.startsWith("uid:")) {
DCOPClient *client = KApplication::kApplication()->dcopClient();
const QByteArray noParamData;
const QByteArray paramData;
QByteArray replyData;
QCString replyTypeStr;
#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
bool foundAbbrowser = PING_ABBROWSER;
if (foundAbbrowser) {
//KAddressbook is already running, so just DCOP to it to bring up the contact editor
@@ -362,93 +383,106 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
}
void KOEventViewer::formatCategories(Incidence *event)
{
if (!event->categoriesStr().isEmpty()) {
if (event->categories().count() == 1) {
addTag("h3",i18n("Category"));
} else {
addTag("h3",i18n("Categories"));
}
addTag("p",event->categoriesStr());
}
}
void KOEventViewer::formatAttendees(Incidence *event)
{
QPtrList<Attendee> attendees = event->attendees();
if (attendees.count()) {
QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
addTag("h3",i18n("Organizer"));
mText.append("<ul><li>");
#ifndef KORG_NOKABC
+#ifdef DESKTOP_VERSION
KABC::AddressBook *add_book = KABC::StdAddressBook::self();
KABC::Addressee::List addressList;
addressList = add_book->findByEmail(event->organizer());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
mText += "<a href=\"uid:" + o.uid() + "\">";
mText += o.formattedName();
mText += "</a>\n";
} else {
mText.append(event->organizer());
}
+#else //DESKTOP_VERSION
+ mText.append(event->organizer());
+#endif //DESKTOP_VERSION
+
+
#else
mText.append(event->organizer());
#endif
if (iconPath) {
mText += " <a href=\"mailto:" + event->organizer() + "\">";
mText += "<IMG src=\"" + iconPath + "\">";
mText += "</a>\n";
}
mText.append("</li></ul>");
addTag("h3",i18n("Attendees"));
Attendee *a;
mText.append("<ul>");
for(a=attendees.first();a;a=attendees.next()) {
#ifndef KORG_NOKABC
+#ifdef DESKTOP_VERSION
if (a->name().isEmpty()) {
addressList = add_book->findByEmail(a->email());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
mText += "<a href=\"uid:" + o.uid() + "\">";
mText += o.formattedName();
mText += "</a>\n";
} else {
mText += "<li>";
mText.append(a->email());
mText += "\n";
}
} else {
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
}
+#else //DESKTOP_VERSION
+ mText += "<li><a href=\"uid:" + a->uid() + "\">";
+ if (!a->name().isEmpty()) mText += a->name();
+ else mText += a->email();
+ mText += "</a>\n";
+#endif //DESKTOP_VERSION
#else
//qDebug("nokabc ");
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
#endif
if (!a->email().isEmpty()) {
if (iconPath) {
mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
mText += "<IMG src=\"" + iconPath + "\">";
mText += "</a>\n";
}
}
if (a->status() != Attendee::NeedsAction )
mText +="[" + a->statusStr() + "] ";
if (a->role() == Attendee::Chair )
mText +="(" + a->roleStr().left(1) + ".)";
}
mText.append("</li></ul>");
}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index d4fadcb..7978b46 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -181,49 +181,51 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
mView->setModified( false );
mBlockAtStartup = false;
mView->setModified( false );
setCentralWidget( mView );
globalFlagBlockStartup = 0;
mView->show();
delete splash;
if ( newFile )
mView->updateConfig();
// qApp->processEvents();
//qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
fillSyncMenu();
mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
if ( showWarning ) {
KMessageBox::information( this,
"You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
qApp->processEvents();
mView->dialogManager()->showSyncOptions();
}
//US listen for result adressed from Ka/Pi
+#ifndef DESKTOP_VERSION
connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
+#endif
}
MainWindow::~MainWindow()
{
//qDebug("MainWindow::~MainWindow() ");
//save toolbar location
delete mCalendar;
delete KOPrefs::instance();
delete KIncidenceFormatter::instance();
}
void MainWindow::showMaximized ()
{
#ifndef DESKTOP_VERSION
if ( ! globalFlagBlockStartup )
mView->goToday();
#endif
QWidget::showMaximized () ;
}
void MainWindow::closeEvent( QCloseEvent* ce )
{
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index bd83626..6100097 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -285,49 +285,48 @@ bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QString
}
/*********************************************************************************/
bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
{
bool res = QCopTransferItem::appMessage( cmsg, data );
if (res == false)
{
QDataStream stream( data, IO_ReadOnly );
// qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
//we are in the source and get an answer from the target
if ((_targetMessage + _targetMessageParameters) == cmsg.data())
{
QStringList list1;
QStringList list2;
QStringList list3;
QString uid;
stream >> uid >> list1 >> list2 >> list3;
-
emit receivedMessageFromTarget(uid, list1, list2, list3);
return true;
}
}
return false;
}
/*********************************************************************************
*
********************************************************************************/
ExternalAppHandler *ExternalAppHandler::sInstance = 0;
static KStaticDeleter<ExternalAppHandler> staticDeleter;
ExternalAppHandler::ExternalAppHandler()
{
mDefaultItems.setAutoDelete(true);
@@ -949,49 +948,48 @@ void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& paramete
}
else
{
// qDebug("pass parameter << %s", key.latin1());
(*e) << key;
}
}
if (useValMap == true)
(*e) << valmap;
#endif
}
/**************************************************************************
*
**************************************************************************/
void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data )
{
bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
-
if (!res)
res = mDisplayDetails->appMessage( cmsg, data );
// if (!res)
// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
}
bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
{
mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid);
}
bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
{
mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3);
}
bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email)
{
mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);