summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-24 21:25:24 (UTC)
committer zautrix <zautrix>2004-07-24 21:25:24 (UTC)
commitf0d0803312ea5607d9ba85454d39787ab626b86e (patch) (unidiff)
tree7c14022c53015a604bc2482751a978b67c9bad09
parentf27f513f6f4a464a05f5edaf3e0f74578b99af88 (diff)
downloadkdepimpi-f0d0803312ea5607d9ba85454d39787ab626b86e.zip
kdepimpi-f0d0803312ea5607d9ba85454d39787ab626b86e.tar.gz
kdepimpi-f0d0803312ea5607d9ba85454d39787ab626b86e.tar.bz2
Added connection to kphone, if kphone is available
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/addresseeview.cpp37
1 files changed, 34 insertions, 3 deletions
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 @@
38 38
39#ifndef DESKTOP_VERSION 39#ifndef DESKTOP_VERSION
40#include <qtopia/qcopenvelope_qws.h> 40#include <qtopia/qcopenvelope_qws.h>
41#include <qpe/qpeapplication.h>
41#endif 42#endif
42 43
43 44int kphoneInstalled = 0;
44 45
45using namespace KPIM; 46using namespace KPIM;
46 47
@@ -62,17 +63,37 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name )
62} 63}
63void AddresseeView::setSource(const QString& n) 64void AddresseeView::setSource(const QString& n)
64{ 65{
65 //qDebug("********AddresseeView::setSource %s", n.mid(7).latin1()); 66 qDebug("********AddresseeView::setSource %s", n.latin1());
66#ifndef DESKTOP_VERSION 67#ifndef DESKTOP_VERSION
68 if ( n.left( 6 ) == "mailto" ) {
67 QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)"); 69 QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)");
68 e << n.mid(7); 70 e << n.mid(7);
71 }
72 if ( n.left( 7 ) == "phoneto" ) {
73 QString mess = "-ring:" + n.mid(8);
74 QCopEnvelope e("QPE/Application/kppi", mess.latin1());
75 }
69#endif 76#endif
70 77
71} 78}
72void AddresseeView::setAddressee( const KABC::Addressee& addr ) 79void AddresseeView::setAddressee( const KABC::Addressee& addr )
73{ 80{
74 mAddressee = addr; 81 bool kphoneAvail = false;
75 82
83#ifndef DESKTOP_VERSION
84 if ( ! kphoneInstalled ) {
85 if ( QFile::exists( QPEApplication::qpeDir() + "/bin/kppi" ) )
86 kphoneInstalled = 1;
87 else
88 kphoneInstalled = -1;
89 } else {
90 if ( kphoneInstalled > 0 )
91 kphoneAvail = true;
92 }
93 //if ( kphoneAvail )
94 // qDebug("KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail ");
95#endif
96 mAddressee = addr;
76 // clear view 97 // clear view
77 setText( QString::null ); 98 setText( QString::null );
78 99
@@ -102,12 +123,22 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
102 KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); 123 KABC::PhoneNumber::List phones = mAddressee.phoneNumbers();
103 KABC::PhoneNumber::List::ConstIterator phoneIt; 124 KABC::PhoneNumber::List::ConstIterator phoneIt;
104 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { 125 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
126 if ( kphoneAvail ) {
127 dynamicPart += QString(
128 "<tr><td align=\"right\"><b>%1</b></td>"
129 "<td align=\"left\"><a href=\"phoneto:%2 \">%3</a></td></tr>" )
130 .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
131 .arg( (*phoneIt).number() )
132 .arg( (*phoneIt).number() );
133
134 } else {
105 dynamicPart += QString( 135 dynamicPart += QString(
106 "<tr><td align=\"right\"><b>%1</b></td>" 136 "<tr><td align=\"right\"><b>%1</b></td>"
107 "<td align=\"left\">%2</td></tr>" ) 137 "<td align=\"left\">%2</td></tr>" )
108 .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) 138 .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
109 .arg( (*phoneIt).number() ); 139 .arg( (*phoneIt).number() );
110 } 140 }
141 }
111 142
112 143
113 for ( ; emailIt != emails.end(); ++emailIt ) { 144 for ( ; emailIt != emails.end(); ++emailIt ) {