summaryrefslogtreecommitdiffabout
path: root/libkdepim/addresseeview.cpp
Unidiff
Diffstat (limited to 'libkdepim/addresseeview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/addresseeview.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp
index 547441c..83aba48 100644
--- a/libkdepim/addresseeview.cpp
+++ b/libkdepim/addresseeview.cpp
@@ -34,14 +34,14 @@
34 34
35 35
36#include "addresseeview.h" 36#include "addresseeview.h"
37 37
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#include <qpe/qpeapplication.h>
42#endif 42#endif
43 43
44static int kphoneInstalled = 0; 44static int kphoneInstalled = 0;
45 45
46using namespace KPIM; 46using namespace KPIM;
47 47
@@ -56,13 +56,13 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name )
56 // setVScrollBarMode( QScrollView::AlwaysOff ); 56 // setVScrollBarMode( QScrollView::AlwaysOff );
57 //setHScrollBarMode( QScrollView::AlwaysOff ); 57 //setHScrollBarMode( QScrollView::AlwaysOff );
58 58
59//US QStyleSheet *sheet = styleSheet(); 59//US QStyleSheet *sheet = styleSheet();
60//US QStyleSheetItem *link = sheet->item( "a" ); 60//US QStyleSheetItem *link = sheet->item( "a" );
61//US link->setColor( KGlobalSettings::linkColor() ); 61//US link->setColor( KGlobalSettings::linkColor() );
62 62
63} 63}
64void AddresseeView::setSource(const QString& n) 64void AddresseeView::setSource(const QString& n)
65{ 65{
66 qDebug("********AddresseeView::setSource %s", n.latin1()); 66 qDebug("********AddresseeView::setSource %s", n.latin1());
67#ifndef DESKTOP_VERSION 67#ifndef DESKTOP_VERSION
68 if ( n.left( 6 ) == "mailto" ) { 68 if ( n.left( 6 ) == "mailto" ) {
@@ -85,20 +85,20 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
85 if ( QFile::exists( QPEApplication::qpeDir() + "/bin/kppi" ) ) 85 if ( QFile::exists( QPEApplication::qpeDir() + "/bin/kppi" ) )
86 kphoneInstalled = 1; 86 kphoneInstalled = 1;
87 else 87 else
88 kphoneInstalled = -1; 88 kphoneInstalled = -1;
89 } 89 }
90 if ( kphoneInstalled > 0 ) 90 if ( kphoneInstalled > 0 )
91 kphoneAvail = true; 91 kphoneAvail = true;
92#if 0 92#if 0
93 if ( kphoneAvail ) 93 if ( kphoneAvail )
94 qDebug("KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail "); 94 qDebug("KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail ");
95 else 95 else
96 qDebug("NOOOOOOOOOOOo KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail "); 96 qDebug("NOOOOOOOOOOOo KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail ");
97#endif 97#endif
98 98
99#endif 99#endif
100 mAddressee = addr; 100 mAddressee = addr;
101 // clear view 101 // clear view
102 setText( QString::null ); 102 setText( QString::null );
103 103
104 if ( mAddressee.isEmpty() ) 104 if ( mAddressee.isEmpty() )
@@ -141,13 +141,13 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
141 "<td align=\"left\">%2</td></tr>" ) 141 "<td align=\"left\">%2</td></tr>" )
142 .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) 142 .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
143 .arg( (*phoneIt).number() ); 143 .arg( (*phoneIt).number() );
144 } 144 }
145 } 145 }
146 146
147 147
148 for ( ; emailIt != emails.end(); ++emailIt ) { 148 for ( ; emailIt != emails.end(); ++emailIt ) {
149 dynamicPart += QString( 149 dynamicPart += QString(
150 "<tr><td align=\"right\"><b>%1</b></td>" 150 "<tr><td align=\"right\"><b>%1</b></td>"
151 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 151 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
152 .arg( type ) 152 .arg( type )
153 .arg( name ) 153 .arg( name )
@@ -178,20 +178,20 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
178 dynamicPart += QString( 178 dynamicPart += QString(
179 "<tr><td align=\"right\"><b>%1</b></td>" 179 "<tr><td align=\"right\"><b>%1</b></td>"
180 "<td align=\"left\">%2</td></tr>" ) 180 "<td align=\"left\">%2</td></tr>" )
181 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 181 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
182 .arg( formattedAddress ); 182 .arg( formattedAddress );
183 } else { 183 } else {
184 184
185 dynamicPart += QString( 185 dynamicPart += QString(
186 "<tr><td align=\"right\"><b>%1</b></td>" 186 "<tr><td align=\"right\"><b>%1</b></td>"
187 "<td align=\"left\">%2</td></tr>" ) 187 "<td align=\"left\">%2</td></tr>" )
188 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 188 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
189//US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); 189//US .arg( (*addrIt).label().replace( '\n', "<br>" ) );
190 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); 190 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ );
191 191
192 } 192 }
193 } 193 }
194 194
195 QString notes; 195 QString notes;
196 if ( !mAddressee.note().isEmpty() ) { 196 if ( !mAddressee.note().isEmpty() ) {
197 notes = QString( 197 notes = QString(
@@ -205,15 +205,15 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
205 } 205 }
206 206
207 QString aRole = ""; 207 QString aRole = "";
208 QString aOrga = ""; 208 QString aOrga = "";
209 if ( true /*!mAddressee.role().isEmpty()*/ ) { 209 if ( true /*!mAddressee.role().isEmpty()*/ ) {
210 aRole = "<tr>" 210 aRole = "<tr>"
211 "<td align=\"left\">" + mAddressee.role() + "</td>" 211 "<td align=\"left\">" + mAddressee.role() + "</td>"
212 "</tr>"; 212 "</tr>";
213 } 213 }
214 if ( true /*!mAddressee.organization().isEmpty()*/ ) { 214 if ( true /*!mAddressee.organization().isEmpty()*/ ) {
215 aOrga = "<tr>" 215 aOrga = "<tr>"
216 "<td align=\"left\">" + mAddressee.organization() + "</td>" ; 216 "<td align=\"left\">" + mAddressee.organization() + "</td>" ;
217 "</tr>"; 217 "</tr>";
218 } 218 }
219 mText = ""; 219 mText = "";
@@ -265,32 +265,32 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
265 .arg( dynamicPart ) 265 .arg( dynamicPart )
266 .arg( notes ); 266 .arg( notes );
267 267
268 } else { // no picture! 268 } else { // no picture!
269 269
270mText = "<table width=\"100%\">\n"; 270mText = "<table width=\"100%\">\n";
271 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 271 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
272#ifdef DESKTOP_VERSION 272#ifdef DESKTOP_VERSION
273 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; 273 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
274#else 274#else
275 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; 275 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>";
276#endif 276#endif
277 277
278#ifdef DESKTOP_VERSION 278#ifdef DESKTOP_VERSION
279 mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; 279 mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>";
280#else 280#else
281 mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; 281 mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>";
282#endif 282#endif
283 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 283 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
284 284
285 mText += "<table><td colspan=\"2\">&nbsp;</td>"; 285 mText += "<table><td colspan=\"2\">&nbsp;</td>";
286 /* 286 /*
287 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" 287 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
288 "<td align=\"left\"><b>%2</b></td></tr>" ) 288 "<td align=\"left\"><b>%2</b></td></tr>" )
289 .arg( i18n(" ") ) 289 .arg( i18n(" ") )
290 .arg( name ); 290 .arg( name );
291 */ 291 */
292 if ( ! mAddressee.role().isEmpty() ) 292 if ( ! mAddressee.role().isEmpty() )
293 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 293 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
294 "<td align=\"left\">%2</td></tr>" ) 294 "<td align=\"left\">%2</td></tr>" )
295 .arg( i18n(" ") ) 295 .arg( i18n(" ") )
296 .arg( mAddressee.role()); 296 .arg( mAddressee.role());
@@ -299,17 +299,18 @@ mText = "<table width=\"100%\">\n";
299 "<td align=\"left\">%2</td></tr>" ) 299 "<td align=\"left\">%2</td></tr>" )
300 .arg( i18n(" ") ) 300 .arg( i18n(" ") )
301 .arg( mAddressee.organization()); 301 .arg( mAddressee.organization());
302 mText += dynamicPart; 302 mText += dynamicPart;
303 mText += notes; 303 mText += notes;
304 mText += "</table>"; 304 mText += "</table>";
305 305
306 } 306 }
307 307
308 // at last display it... 308 // at last display it...
309 setText( mText ); 309 setText( mText );
310
310} 311}
311 312
312KABC::Addressee AddresseeView::addressee() const 313KABC::Addressee AddresseeView::addressee() const
313{ 314{
314 return mAddressee; 315 return mAddressee;
315} 316}
@@ -318,13 +319,13 @@ void AddresseeView::addTag(const QString & tag,const QString & text)
318 if ( text.isEmpty() ) 319 if ( text.isEmpty() )
319 return; 320 return;
320 int number=text.contains("\n"); 321 int number=text.contains("\n");
321 QString str = "<" + tag + ">"; 322 QString str = "<" + tag + ">";
322 QString tmpText=text; 323 QString tmpText=text;
323 QString tmpStr=str; 324 QString tmpStr=str;
324 if(number !=-1) 325 if(number !=-1)
325 { 326 {
326 if (number > 0) { 327 if (number > 0) {
327 int pos=0; 328 int pos=0;
328 QString tmp; 329 QString tmp;
329 for(int i=0;i<=number;i++) { 330 for(int i=0;i<=number;i++) {
330 pos=tmpText.find("\n"); 331 pos=tmpText.find("\n");