summaryrefslogtreecommitdiffabout
path: root/libkdepim/addresseeview.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/addresseeview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/addresseeview.cpp51
1 files changed, 41 insertions, 10 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp
index 71c7817..e9dc1e9 100644
--- a/libkdepim/addresseeview.cpp
+++ b/libkdepim/addresseeview.cpp
@@ -33,19 +33,20 @@
#include <qapplication.h>
#include "addresseeview.h"
#ifndef DESKTOP_VERSION
#include <qtopia/qcopenvelope_qws.h>
+#include <qpe/qpeapplication.h>
#endif
-
+int kphoneInstalled = 0;
using namespace KPIM;
AddresseeView::AddresseeView( QWidget *parent, const char *name )
//US : KTextBrowser( parent, name )
: QTextBrowser( parent, name )
@@ -57,27 +58,47 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name )
//US QStyleSheet *sheet = styleSheet();
//US QStyleSheetItem *link = sheet->item( "a" );
//US link->setColor( KGlobalSettings::linkColor() );
}
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 );
if ( mAddressee.isEmpty() )
return;
QString name = ( mAddressee.formattedName().isEmpty() ?
mAddressee.assembledName() : mAddressee.formattedName() );
@@ -97,21 +118,31 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
.arg( *emailIt )
.arg( *emailIt );
++emailIt;
}
KABC::PhoneNumber::List phones = mAddressee.phoneNumbers();
KABC::PhoneNumber::List::ConstIterator phoneIt;
for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
- dynamicPart += QString(
- "<tr><td align=\"right\"><b>%1</b></td>"
- "<td align=\"left\">%2</td></tr>" )
- .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
- .arg( (*phoneIt).number() );
+ if ( kphoneAvail ) {
+ dynamicPart += QString(
+ "<tr><td align=\"right\"><b>%1</b></td>"
+ "<td align=\"left\"><a href=\"phoneto:%2 \">%3</a></td></tr>" )
+ .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
+ .arg( (*phoneIt).number() )
+ .arg( (*phoneIt).number() );
+
+ } else {
+ dynamicPart += QString(
+ "<tr><td align=\"right\"><b>%1</b></td>"
+ "<td align=\"left\">%2</td></tr>" )
+ .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
+ .arg( (*phoneIt).number() );
+ }
}
for ( ; emailIt != emails.end(); ++emailIt ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
.arg( type )