author | zautrix <zautrix> | 2004-07-24 21:25:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-24 21:25:24 (UTC) |
commit | f0d0803312ea5607d9ba85454d39787ab626b86e (patch) (unidiff) | |
tree | 7c14022c53015a604bc2482751a978b67c9bad09 | |
parent | f27f513f6f4a464a05f5edaf3e0f74578b99af88 (diff) | |
download | kdepimpi-f0d0803312ea5607d9ba85454d39787ab626b86e.zip kdepimpi-f0d0803312ea5607d9ba85454d39787ab626b86e.tar.gz kdepimpi-f0d0803312ea5607d9ba85454d39787ab626b86e.tar.bz2 |
Added connection to kphone, if kphone is available
-rw-r--r-- | libkdepim/addresseeview.cpp | 51 |
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 | |||
@@ -1,301 +1,332 @@ | |||
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 | #include <qpe/qpeapplication.h> | ||
41 | #endif | 42 | #endif |
42 | 43 | ||
43 | 44 | int kphoneInstalled = 0; | |
44 | 45 | ||
45 | using namespace KPIM; | 46 | using namespace KPIM; |
46 | 47 | ||
47 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 48 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
48 | //US : KTextBrowser( parent, name ) | 49 | //US : KTextBrowser( parent, name ) |
49 | : QTextBrowser( parent, name ) | 50 | : QTextBrowser( parent, name ) |
50 | 51 | ||
51 | 52 | ||
52 | { | 53 | { |
53 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 54 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
54 | setLinkUnderline( false ); | 55 | setLinkUnderline( false ); |
55 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 56 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
56 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 57 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
57 | 58 | ||
58 | //US QStyleSheet *sheet = styleSheet(); | 59 | //US QStyleSheet *sheet = styleSheet(); |
59 | //US QStyleSheetItem *link = sheet->item( "a" ); | 60 | //US QStyleSheetItem *link = sheet->item( "a" ); |
60 | //US link->setColor( KGlobalSettings::linkColor() ); | 61 | //US link->setColor( KGlobalSettings::linkColor() ); |
61 | 62 | ||
62 | } | 63 | } |
63 | void AddresseeView::setSource(const QString& n) | 64 | void 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 |
67 | QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)"); | 68 | if ( n.left( 6 ) == "mailto" ) { |
68 | e << n.mid(7); | 69 | QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)"); |
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 | } |
72 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) | 79 | void 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 | ||
79 | if ( mAddressee.isEmpty() ) | 100 | if ( mAddressee.isEmpty() ) |
80 | return; | 101 | return; |
81 | 102 | ||
82 | QString name = ( mAddressee.formattedName().isEmpty() ? | 103 | QString name = ( mAddressee.formattedName().isEmpty() ? |
83 | mAddressee.assembledName() : mAddressee.formattedName() ); | 104 | mAddressee.assembledName() : mAddressee.formattedName() ); |
84 | 105 | ||
85 | QString dynamicPart; | 106 | QString dynamicPart; |
86 | 107 | ||
87 | QStringList emails = mAddressee.emails(); | 108 | QStringList emails = mAddressee.emails(); |
88 | QStringList::ConstIterator emailIt; | 109 | QStringList::ConstIterator emailIt; |
89 | QString type = i18n( "Email" ); | 110 | QString type = i18n( "Email" ); |
90 | emailIt = emails.begin(); | 111 | emailIt = emails.begin(); |
91 | if ( emailIt != emails.end() ) { | 112 | if ( emailIt != emails.end() ) { |
92 | dynamicPart += QString( | 113 | dynamicPart += QString( |
93 | "<tr><td align=\"right\"><b>%1</b></td>" | 114 | "<tr><td align=\"right\"><b>%1</b></td>" |
94 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 115 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
95 | .arg( type ) | 116 | .arg( type ) |
96 | .arg( name ) | 117 | .arg( name ) |
97 | .arg( *emailIt ) | 118 | .arg( *emailIt ) |
98 | .arg( *emailIt ); | 119 | .arg( *emailIt ); |
99 | ++emailIt; | 120 | ++emailIt; |
100 | } | 121 | } |
101 | 122 | ||
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 ) { |
105 | dynamicPart += QString( | 126 | if ( kphoneAvail ) { |
106 | "<tr><td align=\"right\"><b>%1</b></td>" | 127 | dynamicPart += QString( |
107 | "<td align=\"left\">%2</td></tr>" ) | 128 | "<tr><td align=\"right\"><b>%1</b></td>" |
108 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) | 129 | "<td align=\"left\"><a href=\"phoneto:%2 \">%3</a></td></tr>" ) |
109 | .arg( (*phoneIt).number() ); | 130 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) |
131 | .arg( (*phoneIt).number() ) | ||
132 | .arg( (*phoneIt).number() ); | ||
133 | |||
134 | } else { | ||
135 | dynamicPart += QString( | ||
136 | "<tr><td align=\"right\"><b>%1</b></td>" | ||
137 | "<td align=\"left\">%2</td></tr>" ) | ||
138 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) | ||
139 | .arg( (*phoneIt).number() ); | ||
140 | } | ||
110 | } | 141 | } |
111 | 142 | ||
112 | 143 | ||
113 | for ( ; emailIt != emails.end(); ++emailIt ) { | 144 | for ( ; emailIt != emails.end(); ++emailIt ) { |
114 | dynamicPart += QString( | 145 | dynamicPart += QString( |
115 | "<tr><td align=\"right\"><b>%1</b></td>" | 146 | "<tr><td align=\"right\"><b>%1</b></td>" |
116 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 147 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
117 | .arg( type ) | 148 | .arg( type ) |
118 | .arg( name ) | 149 | .arg( name ) |
119 | .arg( *emailIt ) | 150 | .arg( *emailIt ) |
120 | .arg( *emailIt ); | 151 | .arg( *emailIt ); |
121 | } | 152 | } |
122 | 153 | ||
123 | if ( !mAddressee.url().url().isEmpty() ) { | 154 | if ( !mAddressee.url().url().isEmpty() ) { |
124 | dynamicPart += QString( | 155 | dynamicPart += QString( |
125 | "<tr><td align=\"right\"><b>%1</b></td>" | 156 | "<tr><td align=\"right\"><b>%1</b></td>" |
126 | "<td align=\"left\">%2</td></tr>" ) | 157 | "<td align=\"left\">%2</td></tr>" ) |
127 | .arg( i18n( "Homepage" ) ) | 158 | .arg( i18n( "Homepage" ) ) |
128 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); | 159 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); |
129 | .arg( mAddressee.url().url() ); | 160 | .arg( mAddressee.url().url() ); |
130 | //qDebug("AddresseeView::setAddressee has to be verified."); | 161 | //qDebug("AddresseeView::setAddressee has to be verified."); |
131 | } | 162 | } |
132 | 163 | ||
133 | KABC::Address::List addresses = mAddressee.addresses(); | 164 | KABC::Address::List addresses = mAddressee.addresses(); |
134 | KABC::Address::List::ConstIterator addrIt; | 165 | KABC::Address::List::ConstIterator addrIt; |
135 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { | 166 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { |
136 | if ( true /*(*addrIt).label().isEmpty()*/ ) { | 167 | if ( true /*(*addrIt).label().isEmpty()*/ ) { |
137 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); | 168 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); |
138 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); | 169 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); |
139 | //qDebug("adresss %s ",formattedAddress.latin1() ); | 170 | //qDebug("adresss %s ",formattedAddress.latin1() ); |
140 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); | 171 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); |
141 | //qDebug("AddresseeView::setAddressee has to be verified."); | 172 | //qDebug("AddresseeView::setAddressee has to be verified."); |
142 | 173 | ||
143 | dynamicPart += QString( | 174 | dynamicPart += QString( |
144 | "<tr><td align=\"right\"><b>%1</b></td>" | 175 | "<tr><td align=\"right\"><b>%1</b></td>" |
145 | "<td align=\"left\">%2</td></tr>" ) | 176 | "<td align=\"left\">%2</td></tr>" ) |
146 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 177 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
147 | .arg( formattedAddress ); | 178 | .arg( formattedAddress ); |
148 | } else { | 179 | } else { |
149 | 180 | ||
150 | dynamicPart += QString( | 181 | dynamicPart += QString( |
151 | "<tr><td align=\"right\"><b>%1</b></td>" | 182 | "<tr><td align=\"right\"><b>%1</b></td>" |
152 | "<td align=\"left\">%2</td></tr>" ) | 183 | "<td align=\"left\">%2</td></tr>" ) |
153 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 184 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
154 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); | 185 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); |
155 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); | 186 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); |
156 | 187 | ||
157 | } | 188 | } |
158 | } | 189 | } |
159 | 190 | ||
160 | QString notes; | 191 | QString notes; |
161 | if ( !mAddressee.note().isEmpty() ) { | 192 | if ( !mAddressee.note().isEmpty() ) { |
162 | notes = QString( | 193 | notes = QString( |
163 | "<tr>" | 194 | "<tr>" |
164 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label | 195 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label |
165 | "<td align=\"left\">%2</td>" // note | 196 | "<td align=\"left\">%2</td>" // note |
166 | "</tr>" ).arg( i18n( "Notes" ) ) | 197 | "</tr>" ).arg( i18n( "Notes" ) ) |
167 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); | 198 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); |
168 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); | 199 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); |
169 | //qDebug("AddresseeView::setAddressee has to be verified."); | 200 | //qDebug("AddresseeView::setAddressee has to be verified."); |
170 | } | 201 | } |
171 | 202 | ||
172 | QString aRole = ""; | 203 | QString aRole = ""; |
173 | QString aOrga = ""; | 204 | QString aOrga = ""; |
174 | if ( true /*!mAddressee.role().isEmpty()*/ ) { | 205 | if ( true /*!mAddressee.role().isEmpty()*/ ) { |
175 | aRole = "<tr>" | 206 | aRole = "<tr>" |
176 | "<td align=\"left\">" + mAddressee.role() + "</td>" | 207 | "<td align=\"left\">" + mAddressee.role() + "</td>" |
177 | "</tr>"; | 208 | "</tr>"; |
178 | } | 209 | } |
179 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { | 210 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { |
180 | aOrga = "<tr>" | 211 | aOrga = "<tr>" |
181 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; | 212 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; |
182 | "</tr>"; | 213 | "</tr>"; |
183 | } | 214 | } |
184 | mText = ""; | 215 | mText = ""; |
185 | QString picString = ""; | 216 | QString picString = ""; |
186 | KABC::Picture picture = mAddressee.photo(); | 217 | KABC::Picture picture = mAddressee.photo(); |
187 | bool picAvailintern = false; | 218 | bool picAvailintern = false; |
188 | bool picAvailUrl = false; | 219 | bool picAvailUrl = false; |
189 | if (! picture.undefined() ) { | 220 | if (! picture.undefined() ) { |
190 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); | 221 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); |
191 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); | 222 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); |
192 | } | 223 | } |
193 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { | 224 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { |
194 | if ( picAvailintern ) { | 225 | if ( picAvailintern ) { |
195 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); | 226 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); |
196 | } else { | 227 | } else { |
197 | if ( picAvailUrl ) { | 228 | if ( picAvailUrl ) { |
198 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); | 229 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); |
199 | } else { | 230 | } else { |
200 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); | 231 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); |
201 | } | 232 | } |
202 | } | 233 | } |
203 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; | 234 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; |
204 | mText = QString::fromLatin1( | 235 | mText = QString::fromLatin1( |
205 | "<html>" | 236 | "<html>" |
206 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color | 237 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color |
207 | "<table>" | 238 | "<table>" |
208 | "<tr>" | 239 | "<tr>" |
209 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" | 240 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" |
210 | "%3" | 241 | "%3" |
211 | "</td>" | 242 | "</td>" |
212 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name | 243 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name |
213 | "</tr>" | 244 | "</tr>" |
214 | "%5" // role | 245 | "%5" // role |
215 | "%6" // organization | 246 | "%6" // organization |
216 | "<td colspan=\"2\"> </td>" | 247 | "<td colspan=\"2\"> </td>" |
217 | "%7" // dynamic part | 248 | "%7" // dynamic part |
218 | "%8" // notes | 249 | "%8" // notes |
219 | "</table>" | 250 | "</table>" |
220 | "</body>" | 251 | "</body>" |
221 | "</html>") | 252 | "</html>") |
222 | //US | 253 | //US |
223 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) | 254 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) |
224 | //US | 255 | //US |
225 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) | 256 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) |
226 | .arg( picString ) | 257 | .arg( picString ) |
227 | .arg( name ) | 258 | .arg( name ) |
228 | .arg( aRole ) | 259 | .arg( aRole ) |
229 | .arg( aOrga ) | 260 | .arg( aOrga ) |
230 | .arg( dynamicPart ) | 261 | .arg( dynamicPart ) |
231 | .arg( notes ); | 262 | .arg( notes ); |
232 | 263 | ||
233 | } else { // no picture! | 264 | } else { // no picture! |
234 | 265 | ||
235 | mText = "<table width=\"100%\">\n"; | 266 | mText = "<table width=\"100%\">\n"; |
236 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 267 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
237 | #ifdef DESKTOP_VERSION | 268 | #ifdef DESKTOP_VERSION |
238 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; | 269 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; |
239 | #else | 270 | #else |
240 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; | 271 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; |
241 | #endif | 272 | #endif |
242 | 273 | ||
243 | #ifdef DESKTOP_VERSION | 274 | #ifdef DESKTOP_VERSION |
244 | mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; | 275 | mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; |
245 | #else | 276 | #else |
246 | mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; | 277 | mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; |
247 | #endif | 278 | #endif |
248 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 279 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
249 | 280 | ||
250 | mText += "<table><td colspan=\"2\"> </td>"; | 281 | mText += "<table><td colspan=\"2\"> </td>"; |
251 | /* | 282 | /* |
252 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 283 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
253 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 284 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
254 | .arg( i18n(" ") ) | 285 | .arg( i18n(" ") ) |
255 | .arg( name ); | 286 | .arg( name ); |
256 | */ | 287 | */ |
257 | if ( ! mAddressee.role().isEmpty() ) | 288 | if ( ! mAddressee.role().isEmpty() ) |
258 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 289 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
259 | "<td align=\"left\">%2</td></tr>" ) | 290 | "<td align=\"left\">%2</td></tr>" ) |
260 | .arg( i18n(" ") ) | 291 | .arg( i18n(" ") ) |
261 | .arg( mAddressee.role()); | 292 | .arg( mAddressee.role()); |
262 | if ( ! mAddressee.organization().isEmpty() ) | 293 | if ( ! mAddressee.organization().isEmpty() ) |
263 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 294 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
264 | "<td align=\"left\">%2</td></tr>" ) | 295 | "<td align=\"left\">%2</td></tr>" ) |
265 | .arg( i18n(" ") ) | 296 | .arg( i18n(" ") ) |
266 | .arg( mAddressee.organization()); | 297 | .arg( mAddressee.organization()); |
267 | mText += dynamicPart; | 298 | mText += dynamicPart; |
268 | mText += notes; | 299 | mText += notes; |
269 | mText += "</table>"; | 300 | mText += "</table>"; |
270 | 301 | ||
271 | } | 302 | } |
272 | 303 | ||
273 | // at last display it... | 304 | // at last display it... |
274 | setText( mText ); | 305 | setText( mText ); |
275 | } | 306 | } |
276 | 307 | ||
277 | KABC::Addressee AddresseeView::addressee() const | 308 | KABC::Addressee AddresseeView::addressee() const |
278 | { | 309 | { |
279 | return mAddressee; | 310 | return mAddressee; |
280 | } | 311 | } |
281 | void AddresseeView::addTag(const QString & tag,const QString & text) | 312 | void AddresseeView::addTag(const QString & tag,const QString & text) |
282 | { | 313 | { |
283 | if ( text.isEmpty() ) | 314 | if ( text.isEmpty() ) |
284 | return; | 315 | return; |
285 | int number=text.contains("\n"); | 316 | int number=text.contains("\n"); |
286 | QString str = "<" + tag + ">"; | 317 | QString str = "<" + tag + ">"; |
287 | QString tmpText=text; | 318 | QString tmpText=text; |
288 | QString tmpStr=str; | 319 | QString tmpStr=str; |
289 | if(number !=-1) | 320 | if(number !=-1) |
290 | { | 321 | { |
291 | if (number > 0) { | 322 | if (number > 0) { |
292 | int pos=0; | 323 | int pos=0; |
293 | QString tmp; | 324 | QString tmp; |
294 | for(int i=0;i<=number;i++) { | 325 | for(int i=0;i<=number;i++) { |
295 | pos=tmpText.find("\n"); | 326 | pos=tmpText.find("\n"); |
296 | tmp=tmpText.left(pos); | 327 | tmp=tmpText.left(pos); |
297 | tmpText=tmpText.right(tmpText.length()-pos-1); | 328 | tmpText=tmpText.right(tmpText.length()-pos-1); |
298 | tmpStr+=tmp+"<br>"; | 329 | tmpStr+=tmp+"<br>"; |
299 | } | 330 | } |
300 | } | 331 | } |
301 | else tmpStr += tmpText; | 332 | else tmpStr += tmpText; |