author | zautrix <zautrix> | 2004-10-12 20:38:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-12 20:38:57 (UTC) |
commit | 60a63813f7ec38fe275e7ef06033a6d3eb3ec31c (patch) (unidiff) | |
tree | e1bc86e49c5947a593f752e46acb89f06fabf7fc | |
parent | c38bc76bfec3aae65f3bc22c3e2a6ac0d6b0437d (diff) | |
download | kdepimpi-60a63813f7ec38fe275e7ef06033a6d3eb3ec31c.zip kdepimpi-60a63813f7ec38fe275e7ef06033a6d3eb3ec31c.tar.gz kdepimpi-60a63813f7ec38fe275e7ef06033a6d3eb3ec31c.tar.bz2 |
space fixes
-rw-r--r-- | kabc/addresseeview.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 0564e85..90be928 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -1,474 +1,471 @@ | |||
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 <qvbox.h> | 33 | #include <qvbox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qwidget.h> | 35 | #include <qwidget.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <qpushbutton.h> | 38 | #include <qpushbutton.h> |
39 | 39 | ||
40 | 40 | ||
41 | #include "externalapphandler.h" | 41 | #include "externalapphandler.h" |
42 | #include "addresseeview.h" | 42 | #include "addresseeview.h" |
43 | 43 | ||
44 | 44 | ||
45 | //US #ifndef DESKTOP_VERSION | 45 | //US #ifndef DESKTOP_VERSION |
46 | //US #include <qtopia/qcopenvelope_qws.h> | 46 | //US #include <qtopia/qcopenvelope_qws.h> |
47 | //US #include <qpe/qpeapplication.h> | 47 | //US #include <qpe/qpeapplication.h> |
48 | //US #endif | 48 | //US #endif |
49 | 49 | ||
50 | //US static int kphoneInstalled = 0; | 50 | //US static int kphoneInstalled = 0; |
51 | 51 | ||
52 | using namespace KPIM; | 52 | using namespace KPIM; |
53 | 53 | ||
54 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 54 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
55 | //US : KTextBrowser( parent, name ) | 55 | //US : KTextBrowser( parent, name ) |
56 | : QTextBrowser( parent, name ) | 56 | : QTextBrowser( parent, name ) |
57 | 57 | ||
58 | 58 | ||
59 | { | 59 | { |
60 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 60 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
61 | setLinkUnderline( false ); | 61 | setLinkUnderline( false ); |
62 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 62 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
63 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 63 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
64 | 64 | ||
65 | //US QStyleSheet *sheet = styleSheet(); | 65 | //US QStyleSheet *sheet = styleSheet(); |
66 | //US QStyleSheetItem *link = sheet->item( "a" ); | 66 | //US QStyleSheetItem *link = sheet->item( "a" ); |
67 | //US link->setColor( KGlobalSettings::linkColor() ); | 67 | //US link->setColor( KGlobalSettings::linkColor() ); |
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | void AddresseeView::setSource(const QString& n) | 71 | void AddresseeView::setSource(const QString& n) |
72 | { | 72 | { |
73 | //qDebug("********AddresseeView::setSource %s", n.latin1()); | 73 | //qDebug("********AddresseeView::setSource %s", n.latin1()); |
74 | 74 | ||
75 | if ( n.left( 6 ) == "mailto" ) | 75 | if ( n.left( 6 ) == "mailto" ) |
76 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); | 76 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); |
77 | else if ( n.left( 7 ) == "phoneto" ) | 77 | else if ( n.left( 7 ) == "phoneto" ) |
78 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); | 78 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); |
79 | else if ( n.left( 5 ) == "faxto" ) | 79 | else if ( n.left( 5 ) == "faxto" ) |
80 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); | 80 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); |
81 | else if ( n.left( 5 ) == "smsto" ) | 81 | else if ( n.left( 5 ) == "smsto" ) |
82 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); | 82 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); |
83 | else if ( n.left( 7 ) == "pagerto" ) | 83 | else if ( n.left( 7 ) == "pagerto" ) |
84 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); | 84 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); |
85 | else if ( n.left( 5 ) == "sipto" ) | 85 | else if ( n.left( 5 ) == "sipto" ) |
86 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); | 86 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); |
87 | 87 | ||
88 | } | 88 | } |
89 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) | 89 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) |
90 | { | 90 | { |
91 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 91 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
92 | bool kemailAvail = eah->isEmailAppAvailable(); | 92 | bool kemailAvail = eah->isEmailAppAvailable(); |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | mAddressee = addr; | 96 | mAddressee = addr; |
97 | // clear view | 97 | // clear view |
98 | setText( QString::null ); | 98 | setText( QString::null ); |
99 | 99 | ||
100 | if ( mAddressee.isEmpty() ) | 100 | if ( mAddressee.isEmpty() ) |
101 | return; | 101 | return; |
102 | 102 | ||
103 | QString name = ( mAddressee.assembledName().isEmpty() ? | 103 | QString name = ( mAddressee.assembledName().isEmpty() ? |
104 | mAddressee.formattedName() : mAddressee.assembledName() ); | 104 | mAddressee.formattedName() : mAddressee.assembledName() ); |
105 | 105 | ||
106 | QString dynamicPart; | 106 | QString dynamicPart; |
107 | 107 | ||
108 | dynamicPart += getPhoneNumbers( true ); | 108 | dynamicPart += getPhoneNumbers( true ); |
109 | QStringList emails = mAddressee.emails(); | 109 | QStringList emails = mAddressee.emails(); |
110 | QStringList::ConstIterator emailIt; | 110 | QStringList::ConstIterator emailIt; |
111 | QString type = i18n( "Email" ); | 111 | QString type = i18n( "Email" ); |
112 | emailIt = emails.begin(); | 112 | emailIt = emails.begin(); |
113 | if ( emailIt != emails.end() ) { | 113 | if ( emailIt != emails.end() ) { |
114 | if ( kemailAvail ) { | 114 | if ( kemailAvail ) { |
115 | dynamicPart += QString( | 115 | dynamicPart += QString( |
116 | "<tr><td align=\"right\"><b>%1</b></td>" | 116 | "<tr><td align=\"right\"><b>%1</b></td>" |
117 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 117 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
118 | .arg( type ) | 118 | .arg( type ) |
119 | .arg( name ) | 119 | .arg( name ) |
120 | .arg( *emailIt ) | 120 | .arg( *emailIt ) |
121 | .arg( *emailIt ); | 121 | .arg( *emailIt ); |
122 | ++emailIt; | 122 | ++emailIt; |
123 | } else { | 123 | } else { |
124 | dynamicPart += QString( | 124 | dynamicPart += QString( |
125 | "<tr><td align=\"right\"><b>%1</b></td>" | 125 | "<tr><td align=\"right\"><b>%1</b></td>" |
126 | "<td align=\"left\">%2</td></tr>" ) | 126 | "<td align=\"left\">%2</td></tr>" ) |
127 | .arg( type ) | 127 | .arg( type ) |
128 | .arg( *emailIt ); | 128 | .arg( *emailIt ); |
129 | ++emailIt; | 129 | ++emailIt; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | if ( mAddressee.birthday().date().isValid() ) { | 132 | if ( mAddressee.birthday().date().isValid() ) { |
133 | dynamicPart += QString( | 133 | dynamicPart += QString( |
134 | "<tr><td align=\"right\"><b>%1</b></td>" | 134 | "<tr><td align=\"right\"><b>%1</b></td>" |
135 | "<td align=\"left\">%2</td></tr>" ) | 135 | "<td align=\"left\">%2</td></tr>" ) |
136 | .arg( i18n ("Birthday") ) | 136 | .arg( i18n ("Birthday") ) |
137 | .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); | 137 | .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); |
138 | } | 138 | } |
139 | dynamicPart += getPhoneNumbers( false ); | 139 | dynamicPart += getPhoneNumbers( false ); |
140 | 140 | ||
141 | for ( ; emailIt != emails.end(); ++emailIt ) { | 141 | for ( ; emailIt != emails.end(); ++emailIt ) { |
142 | if ( kemailAvail ) { | 142 | if ( kemailAvail ) { |
143 | dynamicPart += QString( | 143 | dynamicPart += QString( |
144 | "<tr><td align=\"right\"><b>%1</b></td>" | 144 | "<tr><td align=\"right\"><b>%1</b></td>" |
145 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 145 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
146 | .arg( type ) | 146 | .arg( type ) |
147 | .arg( name ) | 147 | .arg( name ) |
148 | .arg( *emailIt ) | 148 | .arg( *emailIt ) |
149 | .arg( *emailIt ); | 149 | .arg( *emailIt ); |
150 | } else { | 150 | } else { |
151 | dynamicPart += QString( | 151 | dynamicPart += QString( |
152 | "<tr><td align=\"right\"><b>%1</b></td>" | 152 | "<tr><td align=\"right\"><b>%1</b></td>" |
153 | "<td align=\"left\">%2</td></tr>" ) | 153 | "<td align=\"left\">%2</td></tr>" ) |
154 | .arg( type ) | 154 | .arg( type ) |
155 | .arg( *emailIt ); | 155 | .arg( *emailIt ); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | if ( !mAddressee.url().url().isEmpty() ) { | 159 | if ( !mAddressee.url().url().isEmpty() ) { |
160 | dynamicPart += QString( | 160 | dynamicPart += QString( |
161 | "<tr><td align=\"right\"><b>%1</b></td>" | 161 | "<tr><td align=\"right\"><b>%1</b></td>" |
162 | "<td align=\"left\">%2</td></tr>" ) | 162 | "<td align=\"left\">%2</td></tr>" ) |
163 | .arg( i18n( "Homepage" ) ) | 163 | .arg( i18n( "Homepage" ) ) |
164 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); | 164 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); |
165 | .arg( mAddressee.url().url() ); | 165 | .arg( mAddressee.url().url() ); |
166 | //qDebug("AddresseeView::setAddressee has to be verified."); | 166 | //qDebug("AddresseeView::setAddressee has to be verified."); |
167 | } | 167 | } |
168 | 168 | ||
169 | KABC::Address::List addresses = mAddressee.addresses(); | 169 | KABC::Address::List addresses = mAddressee.addresses(); |
170 | KABC::Address::List::ConstIterator addrIt; | 170 | KABC::Address::List::ConstIterator addrIt; |
171 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { | 171 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { |
172 | if ( true /*(*addrIt).label().isEmpty()*/ ) { | 172 | if ( true /*(*addrIt).label().isEmpty()*/ ) { |
173 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); | 173 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); |
174 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); | 174 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); |
175 | //qDebug("adresss %s ",formattedAddress.latin1() ); | 175 | //qDebug("adresss %s ",formattedAddress.latin1() ); |
176 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); | 176 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); |
177 | //qDebug("AddresseeView::setAddressee has to be verified."); | 177 | //qDebug("AddresseeView::setAddressee has to be verified."); |
178 | 178 | ||
179 | dynamicPart += QString( | 179 | dynamicPart += QString( |
180 | "<tr><td align=\"right\"><b>%1</b></td>" | 180 | "<tr><td align=\"right\"><b>%1</b></td>" |
181 | "<td align=\"left\">%2</td></tr>" ) | 181 | "<td align=\"left\">%2</td></tr>" ) |
182 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 182 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
183 | .arg( formattedAddress ); | 183 | .arg( formattedAddress ); |
184 | } else { | 184 | } else { |
185 | 185 | ||
186 | dynamicPart += QString( | 186 | dynamicPart += QString( |
187 | "<tr><td align=\"right\"><b>%1</b></td>" | 187 | "<tr><td align=\"right\"><b>%1</b></td>" |
188 | "<td align=\"left\">%2</td></tr>" ) | 188 | "<td align=\"left\">%2</td></tr>" ) |
189 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 189 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
190 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); | 190 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); |
191 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); | 191 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); |
192 | 192 | ||
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | QString notes; | 196 | QString notes; |
197 | if ( !mAddressee.note().isEmpty() ) { | 197 | if ( !mAddressee.note().isEmpty() ) { |
198 | notes = QString( | 198 | notes = QString( |
199 | "<tr>" | 199 | "<tr>" |
200 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label | 200 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label |
201 | "<td align=\"left\">%2</td>" // note | 201 | "<td align=\"left\">%2</td>" // note |
202 | "</tr>" ).arg( i18n( "Notes" ) ) | 202 | "</tr>" ).arg( i18n( "Notes" ) ) |
203 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); | 203 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); |
204 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); | 204 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); |
205 | //qDebug("AddresseeView::setAddressee has to be verified."); | 205 | //qDebug("AddresseeView::setAddressee has to be verified."); |
206 | } | 206 | } |
207 | 207 | ||
208 | QString aRole = ""; | 208 | QString aRole = ""; |
209 | QString aOrga = ""; | 209 | QString aOrga = ""; |
210 | if ( true /*!mAddressee.role().isEmpty()*/ ) { | 210 | if ( true /*!mAddressee.role().isEmpty()*/ ) { |
211 | aRole = "<tr>" | 211 | aRole = "<tr>" |
212 | "<td align=\"left\">" + mAddressee.role() + "</td>" | 212 | "<td align=\"left\">" + mAddressee.role() + "</td>" |
213 | "</tr>"; | 213 | "</tr>"; |
214 | } | 214 | } |
215 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { | 215 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { |
216 | aOrga = "<tr>" | 216 | aOrga = "<tr>" |
217 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; | 217 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; |
218 | "</tr>"; | 218 | "</tr>"; |
219 | } | 219 | } |
220 | mText = ""; | 220 | mText = ""; |
221 | QString picString = ""; | 221 | QString picString = ""; |
222 | KABC::Picture picture = mAddressee.photo(); | 222 | KABC::Picture picture = mAddressee.photo(); |
223 | bool picAvailintern = false; | 223 | bool picAvailintern = false; |
224 | bool picAvailUrl = false; | 224 | bool picAvailUrl = false; |
225 | if (! picture.undefined() ) { | 225 | if (! picture.undefined() ) { |
226 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); | 226 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); |
227 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); | 227 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); |
228 | } | 228 | } |
229 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { | 229 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { |
230 | if ( picAvailintern ) { | 230 | if ( picAvailintern ) { |
231 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); | 231 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); |
232 | } else { | 232 | } else { |
233 | if ( picAvailUrl ) { | 233 | if ( picAvailUrl ) { |
234 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); | 234 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); |
235 | } else { | 235 | } else { |
236 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); | 236 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; | 239 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; |
240 | mText = QString::fromLatin1( | 240 | mText = QString::fromLatin1( |
241 | "<html>" | 241 | "<html>" |
242 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color | 242 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color |
243 | "<table>" | 243 | "<table>" |
244 | "<tr>" | 244 | "<tr>" |
245 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" | 245 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" |
246 | "%3" | 246 | "%3" |
247 | "</td>" | 247 | "</td>" |
248 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name | 248 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name |
249 | "</tr>" | 249 | "</tr>" |
250 | "%5" // role | 250 | "%5" // role |
251 | "%6" // organization | 251 | "%6" // organization |
252 | "<td colspan=\"2\"> </td>" | 252 | "<td colspan=\"2\"> </td>" |
253 | "%7" // dynamic part | 253 | "%7" // dynamic part |
254 | "%8" // notes | 254 | "%8" // notes |
255 | "</table>" | 255 | "</table>" |
256 | "</body>" | 256 | "</body>" |
257 | "</html>") | 257 | "</html>") |
258 | //US | 258 | //US |
259 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) | 259 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) |
260 | //US | 260 | //US |
261 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) | 261 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) |
262 | .arg( picString ) | 262 | .arg( picString ) |
263 | .arg( name ) | 263 | .arg( name ) |
264 | .arg( aRole ) | 264 | .arg( aRole ) |
265 | .arg( aOrga ) | 265 | .arg( aOrga ) |
266 | .arg( dynamicPart ) | 266 | .arg( dynamicPart ) |
267 | .arg( notes ); | 267 | .arg( notes ); |
268 | 268 | ||
269 | } else { // no picture! | 269 | } else { // no picture! |
270 | 270 | ||
271 | mText = "<table width=\"100%\">\n"; | 271 | mText = "<table width=\"100%\">\n"; |
272 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 272 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
273 | #ifdef DESKTOP_VERSION | 273 | #ifdef DESKTOP_VERSION |
274 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; | 274 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; |
275 | mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; | ||
275 | #else | 276 | #else |
276 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; | 277 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; |
278 | mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; | ||
277 | #endif | 279 | #endif |
278 | 280 | ||
279 | #ifdef DESKTOP_VERSION | ||
280 | mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; | ||
281 | #else | ||
282 | mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; | ||
283 | #endif | ||
284 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 281 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
285 | 282 | ||
286 | mText += "<table><td colspan=\"2\"> </td>"; | 283 | mText += "<table><td colspan=\"2\"> </td>"; |
287 | /* | 284 | /* |
288 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 285 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
289 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 286 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
290 | .arg( i18n(" ") ) | 287 | .arg( i18n(" ") ) |
291 | .arg( name ); | 288 | .arg( name ); |
292 | */ | 289 | */ |
293 | if ( ! mAddressee.role().isEmpty() ) | 290 | if ( ! mAddressee.role().isEmpty() ) |
294 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 291 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
295 | "<td align=\"left\">%2</td></tr>" ) | 292 | "<td align=\"left\">%2</td></tr>" ) |
296 | .arg( i18n(" ") ) | 293 | .arg( i18n(" ") ) |
297 | .arg( mAddressee.role()); | 294 | .arg( mAddressee.role()); |
298 | if ( ! mAddressee.organization().isEmpty() ) | 295 | if ( ! mAddressee.organization().isEmpty() ) |
299 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 296 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
300 | "<td align=\"left\">%2</td></tr>" ) | 297 | "<td align=\"left\">%2</td></tr>" ) |
301 | .arg( i18n(" ") ) | 298 | .arg( i18n(" ") ) |
302 | .arg( mAddressee.organization()); | 299 | .arg( mAddressee.organization()); |
303 | mText += dynamicPart; | 300 | mText += dynamicPart; |
304 | mText += notes; | 301 | mText += notes; |
305 | mText += "</table>"; | 302 | mText += "</table>"; |
306 | 303 | ||
307 | } | 304 | } |
308 | 305 | ||
309 | // at last display it... | 306 | // at last display it... |
310 | setText( mText ); | 307 | setText( mText ); |
311 | 308 | ||
312 | } | 309 | } |
313 | 310 | ||
314 | QString AddresseeView::getPhoneNumbers( bool preferred ) | 311 | QString AddresseeView::getPhoneNumbers( bool preferred ) |
315 | { | 312 | { |
316 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 313 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
317 | bool kphoneAvail = eah->isPhoneAppAvailable(); | 314 | bool kphoneAvail = eah->isPhoneAppAvailable(); |
318 | bool kfaxAvail = eah->isFaxAppAvailable(); | 315 | bool kfaxAvail = eah->isFaxAppAvailable(); |
319 | bool ksmsAvail = eah->isSMSAppAvailable(); | 316 | bool ksmsAvail = eah->isSMSAppAvailable(); |
320 | bool kpagerAvail = eah->isPagerAppAvailable(); | 317 | bool kpagerAvail = eah->isPagerAppAvailable(); |
321 | bool ksipAvail = eah->isSIPAppAvailable(); | 318 | bool ksipAvail = eah->isSIPAppAvailable(); |
322 | QString dynamicPart; | 319 | QString dynamicPart; |
323 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); | 320 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); |
324 | KABC::PhoneNumber::List::ConstIterator phoneIt; | 321 | KABC::PhoneNumber::List::ConstIterator phoneIt; |
325 | QString extension; | 322 | QString extension; |
326 | int phonetype; | 323 | int phonetype; |
327 | QString sms; | 324 | QString sms; |
328 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 325 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
329 | phonetype = (*phoneIt).type(); | 326 | phonetype = (*phoneIt).type(); |
330 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) | 327 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) |
331 | continue; | 328 | continue; |
332 | if (ksmsAvail && | 329 | if (ksmsAvail && |
333 | ( | 330 | ( |
334 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || | 331 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || |
335 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) | 332 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) |
336 | ) | 333 | ) |
337 | ) | 334 | ) |
338 | { | 335 | { |
339 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) | 336 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) |
340 | .arg( (*phoneIt).number() ); | 337 | .arg( (*phoneIt).number() ); |
341 | 338 | ||
342 | } | 339 | } |
343 | else | 340 | else |
344 | sms = ""; | 341 | sms = ""; |
345 | 342 | ||
346 | extension = QString::null; | 343 | extension = QString::null; |
347 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { | 344 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { |
348 | if (kfaxAvail) extension = "faxto:"; | 345 | if (kfaxAvail) extension = "faxto:"; |
349 | } | 346 | } |
350 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { | 347 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { |
351 | if (kpagerAvail) extension = "pagerto:"; | 348 | if (kpagerAvail) extension = "pagerto:"; |
352 | } | 349 | } |
353 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { | 350 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { |
354 | if (ksipAvail) extension = "sipto:"; | 351 | if (ksipAvail) extension = "sipto:"; |
355 | } | 352 | } |
356 | else if (kphoneAvail) { | 353 | else if (kphoneAvail) { |
357 | extension = "phoneto:"; | 354 | extension = "phoneto:"; |
358 | } | 355 | } |
359 | else | 356 | else |
360 | extension = QString::null; | 357 | extension = QString::null; |
361 | 358 | ||
362 | if ( !extension.isEmpty() ) { | 359 | if ( !extension.isEmpty() ) { |
363 | dynamicPart += QString( | 360 | dynamicPart += QString( |
364 | "<tr><td align=\"right\"><b>%1</b></td>" | 361 | "<tr><td align=\"right\"><b>%1</b></td>" |
365 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) | 362 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) |
366 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 363 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
367 | .arg( extension ) | 364 | .arg( extension ) |
368 | .arg( (*phoneIt).number() ) | 365 | .arg( (*phoneIt).number() ) |
369 | .arg( (*phoneIt).number() ) | 366 | .arg( (*phoneIt).number() ) |
370 | .arg( sms ); | 367 | .arg( sms ); |
371 | 368 | ||
372 | } else { | 369 | } else { |
373 | dynamicPart += QString( | 370 | dynamicPart += QString( |
374 | "<tr><td align=\"right\"><b>%1</b></td>" | 371 | "<tr><td align=\"right\"><b>%1</b></td>" |
375 | "<td align=\"left\">%2 %3</td></tr>" ) | 372 | "<td align=\"left\">%2 %3</td></tr>" ) |
376 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 373 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
377 | .arg( (*phoneIt).number() ) | 374 | .arg( (*phoneIt).number() ) |
378 | .arg( sms ); | 375 | .arg( sms ); |
379 | } | 376 | } |
380 | } | 377 | } |
381 | return dynamicPart; | 378 | return dynamicPart; |
382 | } | 379 | } |
383 | KABC::Addressee AddresseeView::addressee() const | 380 | KABC::Addressee AddresseeView::addressee() const |
384 | { | 381 | { |
385 | return mAddressee; | 382 | return mAddressee; |
386 | } | 383 | } |
387 | void AddresseeView::addTag(const QString & tag,const QString & text) | 384 | void AddresseeView::addTag(const QString & tag,const QString & text) |
388 | { | 385 | { |
389 | if ( text.isEmpty() ) | 386 | if ( text.isEmpty() ) |
390 | return; | 387 | return; |
391 | int number=text.contains("\n"); | 388 | int number=text.contains("\n"); |
392 | QString str = "<" + tag + ">"; | 389 | QString str = "<" + tag + ">"; |
393 | QString tmpText=text; | 390 | QString tmpText=text; |
394 | QString tmpStr=str; | 391 | QString tmpStr=str; |
395 | if(number !=-1) | 392 | if(number !=-1) |
396 | { | 393 | { |
397 | if (number > 0) { | 394 | if (number > 0) { |
398 | int pos=0; | 395 | int pos=0; |
399 | QString tmp; | 396 | QString tmp; |
400 | for(int i=0;i<=number;i++) { | 397 | for(int i=0;i<=number;i++) { |
401 | pos=tmpText.find("\n"); | 398 | pos=tmpText.find("\n"); |
402 | tmp=tmpText.left(pos); | 399 | tmp=tmpText.left(pos); |
403 | tmpText=tmpText.right(tmpText.length()-pos-1); | 400 | tmpText=tmpText.right(tmpText.length()-pos-1); |
404 | tmpStr+=tmp+"<br>"; | 401 | tmpStr+=tmp+"<br>"; |
405 | } | 402 | } |
406 | } | 403 | } |
407 | else tmpStr += tmpText; | 404 | else tmpStr += tmpText; |
408 | tmpStr+="</" + tag + ">"; | 405 | tmpStr+="</" + tag + ">"; |
409 | mText.append(tmpStr); | 406 | mText.append(tmpStr); |
410 | } | 407 | } |
411 | else | 408 | else |
412 | { | 409 | { |
413 | str += text + "</" + tag + ">"; | 410 | str += text + "</" + tag + ">"; |
414 | mText.append(str); | 411 | mText.append(str); |
415 | } | 412 | } |
416 | } | 413 | } |
417 | 414 | ||
418 | AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, | 415 | AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, |
419 | true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) | 416 | true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) |
420 | { | 417 | { |
421 | findButton( Close )->setText( i18n("Cancel Sync")); | 418 | findButton( Close )->setText( i18n("Cancel Sync")); |
422 | findButton( Ok )->setText( i18n("Remote")); | 419 | findButton( Ok )->setText( i18n("Remote")); |
423 | findButton( User1 )->setText( i18n("Local")); | 420 | findButton( User1 )->setText( i18n("Local")); |
424 | QWidget* topframe = new QWidget( this ); | 421 | QWidget* topframe = new QWidget( this ); |
425 | setMainWidget( topframe ); | 422 | setMainWidget( topframe ); |
426 | QBoxLayout* bl; | 423 | QBoxLayout* bl; |
427 | if ( QApplication::desktop()->width() < 640 ) { | 424 | if ( QApplication::desktop()->width() < 640 ) { |
428 | bl = new QVBoxLayout( topframe ); | 425 | bl = new QVBoxLayout( topframe ); |
429 | } else { | 426 | } else { |
430 | bl = new QHBoxLayout( topframe ); | 427 | bl = new QHBoxLayout( topframe ); |
431 | } | 428 | } |
432 | QVBox* subframe = new QVBox( topframe ); | 429 | QVBox* subframe = new QVBox( topframe ); |
433 | bl->addWidget(subframe ); | 430 | bl->addWidget(subframe ); |
434 | QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); | 431 | QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); |
435 | if ( takeloc ) | 432 | if ( takeloc ) |
436 | lab->setBackgroundColor(Qt::green.light() ); | 433 | lab->setBackgroundColor(Qt::green.light() ); |
437 | AddresseeView * av = new AddresseeView( subframe ); | 434 | AddresseeView * av = new AddresseeView( subframe ); |
438 | av->setAddressee( loc ); | 435 | av->setAddressee( loc ); |
439 | subframe = new QVBox( topframe ); | 436 | subframe = new QVBox( topframe ); |
440 | bl->addWidget(subframe ); | 437 | bl->addWidget(subframe ); |
441 | lab = new QLabel( i18n("Remote Addressee"), subframe ); | 438 | lab = new QLabel( i18n("Remote Addressee"), subframe ); |
442 | if ( !takeloc ) | 439 | if ( !takeloc ) |
443 | lab->setBackgroundColor(Qt::green.light() ); | 440 | lab->setBackgroundColor(Qt::green.light() ); |
444 | av = new AddresseeView( subframe ); | 441 | av = new AddresseeView( subframe ); |
445 | av->setAddressee( rem ); | 442 | av->setAddressee( rem ); |
446 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); | 443 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); |
447 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); | 444 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); |
448 | #ifndef DESKTOP_VERSION | 445 | #ifndef DESKTOP_VERSION |
449 | showMaximized(); | 446 | showMaximized(); |
450 | #else | 447 | #else |
451 | resize ( 640, 400 ); | 448 | resize ( 640, 400 ); |
452 | #endif | 449 | #endif |
453 | } | 450 | } |
454 | 451 | ||
455 | int AddresseeChooser::executeD( bool local ) | 452 | int AddresseeChooser::executeD( bool local ) |
456 | { | 453 | { |
457 | mSyncResult = 3; | 454 | mSyncResult = 3; |
458 | if ( local ) | 455 | if ( local ) |
459 | findButton( User1 )->setFocus(); | 456 | findButton( User1 )->setFocus(); |
460 | else | 457 | else |
461 | findButton( Ok )->setFocus(); | 458 | findButton( Ok )->setFocus(); |
462 | exec(); | 459 | exec(); |
463 | return mSyncResult; | 460 | return mSyncResult; |
464 | } | 461 | } |
465 | void AddresseeChooser::slot_remote() | 462 | void AddresseeChooser::slot_remote() |
466 | { | 463 | { |
467 | mSyncResult = 2; | 464 | mSyncResult = 2; |
468 | accept(); | 465 | accept(); |
469 | } | 466 | } |
470 | void AddresseeChooser::slot_local() | 467 | void AddresseeChooser::slot_local() |
471 | { | 468 | { |
472 | mSyncResult = 1; | 469 | mSyncResult = 1; |
473 | accept(); | 470 | accept(); |
474 | } | 471 | } |