-rw-r--r-- | libkdepim/addresseeview.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp index 70fc57c..71c7817 100644 --- a/libkdepim/addresseeview.cpp +++ b/libkdepim/addresseeview.cpp | |||
@@ -1,298 +1,310 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | 3 | ||
4 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 4 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <kabc/address.h> | 22 | #include <kabc/address.h> |
23 | #include <kabc/addressee.h> | 23 | #include <kabc/addressee.h> |
24 | #include <kabc/phonenumber.h> | 24 | #include <kabc/phonenumber.h> |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | //US#include <kglobalsettings.h> | 26 | //US#include <kglobalsettings.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | //US #include <kstringhandler.h> | 29 | //US #include <kstringhandler.h> |
30 | #include <qscrollview.h> | 30 | #include <qscrollview.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
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 | #endif | 41 | #endif |
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | using namespace KPIM; | 45 | using namespace KPIM; |
46 | 46 | ||
47 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 47 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
48 | //US : KTextBrowser( parent, name ) | 48 | //US : KTextBrowser( parent, name ) |
49 | : QTextBrowser( parent, name ) | 49 | : QTextBrowser( parent, name ) |
50 | 50 | ||
51 | 51 | ||
52 | { | 52 | { |
53 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 53 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
54 | setLinkUnderline( false ); | 54 | setLinkUnderline( false ); |
55 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 55 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
56 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 56 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
57 | 57 | ||
58 | //US QStyleSheet *sheet = styleSheet(); | 58 | //US QStyleSheet *sheet = styleSheet(); |
59 | //US QStyleSheetItem *link = sheet->item( "a" ); | 59 | //US QStyleSheetItem *link = sheet->item( "a" ); |
60 | //US link->setColor( KGlobalSettings::linkColor() ); | 60 | //US link->setColor( KGlobalSettings::linkColor() ); |
61 | 61 | ||
62 | } | 62 | } |
63 | void AddresseeView::setSource(const QString& n) | 63 | void AddresseeView::setSource(const QString& n) |
64 | { | 64 | { |
65 | //qDebug("********AddresseeView::setSource %s", n.mid(7).latin1()); | 65 | //qDebug("********AddresseeView::setSource %s", n.mid(7).latin1()); |
66 | #ifndef DESKTOP_VERSION | 66 | #ifndef DESKTOP_VERSION |
67 | QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)"); | 67 | QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)"); |
68 | e << n.mid(7); | 68 | e << n.mid(7); |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | } | 71 | } |
72 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) | 72 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) |
73 | { | 73 | { |
74 | mAddressee = addr; | 74 | mAddressee = addr; |
75 | 75 | ||
76 | // clear view | 76 | // clear view |
77 | setText( QString::null ); | 77 | setText( QString::null ); |
78 | 78 | ||
79 | if ( mAddressee.isEmpty() ) | 79 | if ( mAddressee.isEmpty() ) |
80 | return; | 80 | return; |
81 | 81 | ||
82 | QString name = ( mAddressee.formattedName().isEmpty() ? | 82 | QString name = ( mAddressee.formattedName().isEmpty() ? |
83 | mAddressee.assembledName() : mAddressee.formattedName() ); | 83 | mAddressee.assembledName() : mAddressee.formattedName() ); |
84 | 84 | ||
85 | QString dynamicPart; | 85 | QString dynamicPart; |
86 | 86 | ||
87 | QStringList emails = mAddressee.emails(); | ||
88 | QStringList::ConstIterator emailIt; | ||
89 | QString type = i18n( "Email" ); | ||
90 | emailIt = emails.begin(); | ||
91 | if ( emailIt != emails.end() ) { | ||
92 | dynamicPart += QString( | ||
93 | "<tr><td align=\"right\"><b>%1</b></td>" | ||
94 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | ||
95 | .arg( type ) | ||
96 | .arg( name ) | ||
97 | .arg( *emailIt ) | ||
98 | .arg( *emailIt ); | ||
99 | ++emailIt; | ||
100 | } | ||
101 | |||
87 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); | 102 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); |
88 | KABC::PhoneNumber::List::ConstIterator phoneIt; | 103 | KABC::PhoneNumber::List::ConstIterator phoneIt; |
89 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 104 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
90 | dynamicPart += QString( | 105 | dynamicPart += QString( |
91 | "<tr><td align=\"right\"><b>%1</b></td>" | 106 | "<tr><td align=\"right\"><b>%1</b></td>" |
92 | "<td align=\"left\">%2</td></tr>" ) | 107 | "<td align=\"left\">%2</td></tr>" ) |
93 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) | 108 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) |
94 | .arg( (*phoneIt).number() ); | 109 | .arg( (*phoneIt).number() ); |
95 | } | 110 | } |
96 | 111 | ||
97 | QStringList emails = mAddressee.emails(); | 112 | |
98 | QStringList::ConstIterator emailIt; | 113 | for ( ; emailIt != emails.end(); ++emailIt ) { |
99 | QString type = i18n( "Email" ); | ||
100 | for ( emailIt = emails.begin(); emailIt != emails.end(); ++emailIt ) { | ||
101 | dynamicPart += QString( | 114 | dynamicPart += QString( |
102 | "<tr><td align=\"right\"><b>%1</b></td>" | 115 | "<tr><td align=\"right\"><b>%1</b></td>" |
103 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 116 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
104 | .arg( type ) | 117 | .arg( type ) |
105 | .arg( name ) | 118 | .arg( name ) |
106 | .arg( *emailIt ) | 119 | .arg( *emailIt ) |
107 | .arg( *emailIt ); | 120 | .arg( *emailIt ); |
108 | type = i18n( "Other" ); | ||
109 | } | 121 | } |
110 | 122 | ||
111 | if ( !mAddressee.url().url().isEmpty() ) { | 123 | if ( !mAddressee.url().url().isEmpty() ) { |
112 | dynamicPart += QString( | 124 | dynamicPart += QString( |
113 | "<tr><td align=\"right\"><b>%1</b></td>" | 125 | "<tr><td align=\"right\"><b>%1</b></td>" |
114 | "<td align=\"left\">%2</td></tr>" ) | 126 | "<td align=\"left\">%2</td></tr>" ) |
115 | .arg( i18n( "Homepage" ) ) | 127 | .arg( i18n( "Homepage" ) ) |
116 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); | 128 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); |
117 | .arg( mAddressee.url().url() ); | 129 | .arg( mAddressee.url().url() ); |
118 | //qDebug("AddresseeView::setAddressee has to be verified."); | 130 | //qDebug("AddresseeView::setAddressee has to be verified."); |
119 | } | 131 | } |
120 | 132 | ||
121 | KABC::Address::List addresses = mAddressee.addresses(); | 133 | KABC::Address::List addresses = mAddressee.addresses(); |
122 | KABC::Address::List::ConstIterator addrIt; | 134 | KABC::Address::List::ConstIterator addrIt; |
123 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { | 135 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { |
124 | if ( true /*(*addrIt).label().isEmpty()*/ ) { | 136 | if ( true /*(*addrIt).label().isEmpty()*/ ) { |
125 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); | 137 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); |
126 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); | 138 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); |
127 | //qDebug("adresss %s ",formattedAddress.latin1() ); | 139 | //qDebug("adresss %s ",formattedAddress.latin1() ); |
128 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); | 140 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); |
129 | //qDebug("AddresseeView::setAddressee has to be verified."); | 141 | //qDebug("AddresseeView::setAddressee has to be verified."); |
130 | 142 | ||
131 | dynamicPart += QString( | 143 | dynamicPart += QString( |
132 | "<tr><td align=\"right\"><b>%1</b></td>" | 144 | "<tr><td align=\"right\"><b>%1</b></td>" |
133 | "<td align=\"left\">%2</td></tr>" ) | 145 | "<td align=\"left\">%2</td></tr>" ) |
134 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 146 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
135 | .arg( formattedAddress ); | 147 | .arg( formattedAddress ); |
136 | } else { | 148 | } else { |
137 | 149 | ||
138 | dynamicPart += QString( | 150 | dynamicPart += QString( |
139 | "<tr><td align=\"right\"><b>%1</b></td>" | 151 | "<tr><td align=\"right\"><b>%1</b></td>" |
140 | "<td align=\"left\">%2</td></tr>" ) | 152 | "<td align=\"left\">%2</td></tr>" ) |
141 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 153 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
142 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); | 154 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); |
143 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); | 155 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); |
144 | 156 | ||
145 | } | 157 | } |
146 | } | 158 | } |
147 | 159 | ||
148 | QString notes; | 160 | QString notes; |
149 | if ( !mAddressee.note().isEmpty() ) { | 161 | if ( !mAddressee.note().isEmpty() ) { |
150 | notes = QString( | 162 | notes = QString( |
151 | "<tr>" | 163 | "<tr>" |
152 | "<td align=\"right\" valign=\"top\"><b>%1:</b></td>" // note label | 164 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label |
153 | "<td align=\"left\">%2</td>" // note | 165 | "<td align=\"left\">%2</td>" // note |
154 | "</tr>" ).arg( i18n( "Notes" ) ) | 166 | "</tr>" ).arg( i18n( "Notes" ) ) |
155 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); | 167 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); |
156 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); | 168 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); |
157 | //qDebug("AddresseeView::setAddressee has to be verified."); | 169 | //qDebug("AddresseeView::setAddressee has to be verified."); |
158 | } | 170 | } |
159 | 171 | ||
160 | QString aRole = ""; | 172 | QString aRole = ""; |
161 | QString aOrga = ""; | 173 | QString aOrga = ""; |
162 | if ( true /*!mAddressee.role().isEmpty()*/ ) { | 174 | if ( true /*!mAddressee.role().isEmpty()*/ ) { |
163 | aRole = "<tr>" | 175 | aRole = "<tr>" |
164 | "<td align=\"left\">" + mAddressee.role() + "</td>" | 176 | "<td align=\"left\">" + mAddressee.role() + "</td>" |
165 | "</tr>"; | 177 | "</tr>"; |
166 | } | 178 | } |
167 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { | 179 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { |
168 | aOrga = "<tr>" | 180 | aOrga = "<tr>" |
169 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; | 181 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; |
170 | "</tr>"; | 182 | "</tr>"; |
171 | } | 183 | } |
172 | mText = ""; | 184 | mText = ""; |
173 | QString picString = ""; | 185 | QString picString = ""; |
174 | KABC::Picture picture = mAddressee.photo(); | 186 | KABC::Picture picture = mAddressee.photo(); |
175 | bool picAvailintern = false; | 187 | bool picAvailintern = false; |
176 | bool picAvailUrl = false; | 188 | bool picAvailUrl = false; |
177 | if (! picture.undefined() ) { | 189 | if (! picture.undefined() ) { |
178 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); | 190 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); |
179 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); | 191 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); |
180 | } | 192 | } |
181 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { | 193 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { |
182 | if ( picAvailintern ) { | 194 | if ( picAvailintern ) { |
183 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); | 195 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); |
184 | } else { | 196 | } else { |
185 | if ( picAvailUrl ) { | 197 | if ( picAvailUrl ) { |
186 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); | 198 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); |
187 | } else { | 199 | } else { |
188 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); | 200 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); |
189 | } | 201 | } |
190 | } | 202 | } |
191 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; | 203 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; |
192 | mText = QString::fromLatin1( | 204 | mText = QString::fromLatin1( |
193 | "<html>" | 205 | "<html>" |
194 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color | 206 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color |
195 | "<table>" | 207 | "<table>" |
196 | "<tr>" | 208 | "<tr>" |
197 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" | 209 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" |
198 | "%3" | 210 | "%3" |
199 | "</td>" | 211 | "</td>" |
200 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name | 212 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name |
201 | "</tr>" | 213 | "</tr>" |
202 | "%5" // role | 214 | "%5" // role |
203 | "%6" // organization | 215 | "%6" // organization |
204 | "<td colspan=\"2\"> </td>" | 216 | "<td colspan=\"2\"> </td>" |
205 | "%7" // dynamic part | 217 | "%7" // dynamic part |
206 | "%8" // notes | 218 | "%8" // notes |
207 | "</table>" | 219 | "</table>" |
208 | "</body>" | 220 | "</body>" |
209 | "</html>") | 221 | "</html>") |
210 | //US | 222 | //US |
211 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) | 223 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) |
212 | //US | 224 | //US |
213 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) | 225 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) |
214 | .arg( picString ) | 226 | .arg( picString ) |
215 | .arg( name ) | 227 | .arg( name ) |
216 | .arg( aRole ) | 228 | .arg( aRole ) |
217 | .arg( aOrga ) | 229 | .arg( aOrga ) |
218 | .arg( dynamicPart ) | 230 | .arg( dynamicPart ) |
219 | .arg( notes ); | 231 | .arg( notes ); |
220 | 232 | ||
221 | } else { // no picture! | 233 | } else { // no picture! |
222 | 234 | ||
223 | mText = "<table width=\"100%\">\n"; | 235 | mText = "<table width=\"100%\">\n"; |
224 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 236 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
225 | #ifdef DESKTOP_VERSION | 237 | #ifdef DESKTOP_VERSION |
226 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; | 238 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; |
227 | #else | 239 | #else |
228 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; | 240 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; |
229 | #endif | 241 | #endif |
230 | 242 | ||
231 | #ifdef DESKTOP_VERSION | 243 | #ifdef DESKTOP_VERSION |
232 | mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; | 244 | mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; |
233 | #else | 245 | #else |
234 | mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; | 246 | mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; |
235 | #endif | 247 | #endif |
236 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 248 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
237 | 249 | ||
238 | mText += "<table><td colspan=\"2\"> </td>"; | 250 | mText += "<table><td colspan=\"2\"> </td>"; |
239 | /* | 251 | /* |
240 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 252 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
241 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 253 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
242 | .arg( i18n(" ") ) | 254 | .arg( i18n(" ") ) |
243 | .arg( name ); | 255 | .arg( name ); |
244 | */ | 256 | */ |
245 | if ( ! mAddressee.role().isEmpty() ) | 257 | if ( ! mAddressee.role().isEmpty() ) |
246 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 258 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
247 | "<td align=\"left\">%2</td></tr>" ) | 259 | "<td align=\"left\">%2</td></tr>" ) |
248 | .arg( i18n(" ") ) | 260 | .arg( i18n(" ") ) |
249 | .arg( mAddressee.role()); | 261 | .arg( mAddressee.role()); |
250 | if ( ! mAddressee.organization().isEmpty() ) | 262 | if ( ! mAddressee.organization().isEmpty() ) |
251 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 263 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
252 | "<td align=\"left\">%2</td></tr>" ) | 264 | "<td align=\"left\">%2</td></tr>" ) |
253 | .arg( i18n(" ") ) | 265 | .arg( i18n(" ") ) |
254 | .arg( mAddressee.organization()); | 266 | .arg( mAddressee.organization()); |
255 | mText += dynamicPart; | 267 | mText += dynamicPart; |
256 | mText += notes; | 268 | mText += notes; |
257 | mText += "</table>"; | 269 | mText += "</table>"; |
258 | 270 | ||
259 | } | 271 | } |
260 | 272 | ||
261 | // at last display it... | 273 | // at last display it... |
262 | setText( mText ); | 274 | setText( mText ); |
263 | } | 275 | } |
264 | 276 | ||
265 | KABC::Addressee AddresseeView::addressee() const | 277 | KABC::Addressee AddresseeView::addressee() const |
266 | { | 278 | { |
267 | return mAddressee; | 279 | return mAddressee; |
268 | } | 280 | } |
269 | void AddresseeView::addTag(const QString & tag,const QString & text) | 281 | void AddresseeView::addTag(const QString & tag,const QString & text) |
270 | { | 282 | { |
271 | if ( text.isEmpty() ) | 283 | if ( text.isEmpty() ) |
272 | return; | 284 | return; |
273 | int number=text.contains("\n"); | 285 | int number=text.contains("\n"); |
274 | QString str = "<" + tag + ">"; | 286 | QString str = "<" + tag + ">"; |
275 | QString tmpText=text; | 287 | QString tmpText=text; |
276 | QString tmpStr=str; | 288 | QString tmpStr=str; |
277 | if(number !=-1) | 289 | if(number !=-1) |
278 | { | 290 | { |
279 | if (number > 0) { | 291 | if (number > 0) { |
280 | int pos=0; | 292 | int pos=0; |
281 | QString tmp; | 293 | QString tmp; |
282 | for(int i=0;i<=number;i++) { | 294 | for(int i=0;i<=number;i++) { |
283 | pos=tmpText.find("\n"); | 295 | pos=tmpText.find("\n"); |
284 | tmp=tmpText.left(pos); | 296 | tmp=tmpText.left(pos); |
285 | tmpText=tmpText.right(tmpText.length()-pos-1); | 297 | tmpText=tmpText.right(tmpText.length()-pos-1); |
286 | tmpStr+=tmp+"<br>"; | 298 | tmpStr+=tmp+"<br>"; |
287 | } | 299 | } |
288 | } | 300 | } |
289 | else tmpStr += tmpText; | 301 | else tmpStr += tmpText; |
290 | tmpStr+="</" + tag + ">"; | 302 | tmpStr+="</" + tag + ">"; |
291 | mText.append(tmpStr); | 303 | mText.append(tmpStr); |
292 | } | 304 | } |
293 | else | 305 | else |
294 | { | 306 | { |
295 | str += text + "</" + tag + ">"; | 307 | str += text + "</" + tag + ">"; |
296 | mText.append(str); | 308 | mText.append(str); |
297 | } | 309 | } |
298 | } | 310 | } |