From f0d0803312ea5607d9ba85454d39787ab626b86e Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 24 Jul 2004 21:25:24 +0000 Subject: Added connection to kphone, if kphone is available --- diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp index 71c7817..e9dc1e9 100644 --- a/libkdepim/addresseeview.cpp +++ b/libkdepim/addresseeview.cpp @@ -38,9 +38,10 @@ #ifndef DESKTOP_VERSION #include +#include #endif - +int kphoneInstalled = 0; using namespace KPIM; @@ -62,17 +63,37 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name ) } void AddresseeView::setSource(const QString& n) { - //qDebug("********AddresseeView::setSource %s", n.mid(7).latin1()); + qDebug("********AddresseeView::setSource %s", n.latin1()); #ifndef DESKTOP_VERSION - QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)"); - e << n.mid(7); + if ( n.left( 6 ) == "mailto" ) { + QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)"); + e << n.mid(7); + } + if ( n.left( 7 ) == "phoneto" ) { + QString mess = "-ring:" + n.mid(8); + QCopEnvelope e("QPE/Application/kppi", mess.latin1()); + } #endif } void AddresseeView::setAddressee( const KABC::Addressee& addr ) { - mAddressee = addr; + bool kphoneAvail = false; +#ifndef DESKTOP_VERSION + if ( ! kphoneInstalled ) { + if ( QFile::exists( QPEApplication::qpeDir() + "/bin/kppi" ) ) + kphoneInstalled = 1; + else + kphoneInstalled = -1; + } else { + if ( kphoneInstalled > 0 ) + kphoneAvail = true; + } + //if ( kphoneAvail ) + // qDebug("KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail "); +#endif + mAddressee = addr; // clear view setText( QString::null ); @@ -102,11 +123,21 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); KABC::PhoneNumber::List::ConstIterator phoneIt; for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { - dynamicPart += QString( - "%1" - "%2" ) - .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) - .arg( (*phoneIt).number() ); + if ( kphoneAvail ) { + dynamicPart += QString( + "%1" + "%3" ) + .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) + .arg( (*phoneIt).number() ) + .arg( (*phoneIt).number() ); + + } else { + dynamicPart += QString( + "%1" + "%2" ) + .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) + .arg( (*phoneIt).number() ); + } } -- cgit v0.9.0.2