summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--kabc/addresseeview.cpp28
2 files changed, 31 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index d75ff7e..013c3f8 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,34 +1,38 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.2.1 ************ 3********** VERSION 2.2.1 ************
4 4
5KO/Pi: 5KO/Pi:
6Fixed a problem displaying very long allday events in agenda view in single day mode. 6Fixed a problem displaying very long allday events in agenda view in single day mode.
7Fixed a problem with the default settings for new todos. 7Fixed a problem with the default settings for new todos.
8Added an error message dialog if saving of calendar files is not possible. 8Added an error message dialog if saving of calendar files is not possible.
9Made it impossible to close KO/Pi if saving fails. 9Made it impossible to close KO/Pi if saving fails.
10Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick. 10Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick.
11Added config options for conflict detection. 11Added config options for conflict detection.
12 12
13KA/Pi: 13KA/Pi:
14Added a config option to turn on asking before a contact is deleted. 14Added a config option to turn on asking before a contact is deleted.
15Fixed a problem with the default view and view selection at startup. 15Fixed a problem with the default view and view selection at startup.
16Formatted name is now set on import, if formatted name is empty. 16Formatted name is now set on import, if formatted name is empty.
17Fixed a problem of displaying images in the contact details view:
18Now the wid/hei ratio is not changed.
19I a picture is larger than 128 pixels in wid or hei it is downscaled to
20max 128 pixels wid/hei.
17 21
18********** VERSION 2.2.0 ************ 22********** VERSION 2.2.0 ************
19 23
20New stable release! 24New stable release!
21Fixed some minor usability problems. 25Fixed some minor usability problems.
22Added writing of next alarm to a file for usage on pdaXrom. 26Added writing of next alarm to a file for usage on pdaXrom.
23 27
24 28
25************************************* 29*************************************
26 30
27You can find the complete changelog 31You can find the complete changelog
28from version 1.7.7 to 2.2.0 32from version 1.7.7 to 2.2.0
29in the source package or on 33in the source package or on
30 34
31http://www.pi-sync.net/html/changelog.html 35http://www.pi-sync.net/html/changelog.html
32 36
33 37
34 38
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index f3cfb23..05d604f 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -137,525 +137,551 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
137#if 0 137#if 0
138 QString name = ( mAddressee.assembledName().isEmpty() ? 138 QString name = ( mAddressee.assembledName().isEmpty() ?
139 mAddressee.formattedName() : mAddressee.assembledName() ); 139 mAddressee.formattedName() : mAddressee.assembledName() );
140#endif 140#endif
141 141
142 QString name = mAddressee.realName(); 142 QString name = mAddressee.realName();
143 143
144 QString dynamicPart; 144 QString dynamicPart;
145 145
146 dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true ); 146 dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true );
147 QStringList emails = mAddressee.emails(); 147 QStringList emails = mAddressee.emails();
148 QStringList::ConstIterator emailIt; 148 QStringList::ConstIterator emailIt;
149 QString type = i18n( "Email" ); 149 QString type = i18n( "Email" );
150 emailIt = emails.begin(); 150 emailIt = emails.begin();
151 if ( emailIt != emails.end() ) { 151 if ( emailIt != emails.end() ) {
152 if ( kemailAvail ) { 152 if ( kemailAvail ) {
153 dynamicPart += QString( 153 dynamicPart += QString(
154 "<tr><td align=\"right\"><b>%1</b></td>" 154 "<tr><td align=\"right\"><b>%1</b></td>"
155 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 155 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
156 .arg( type ) 156 .arg( type )
157 .arg( name ) 157 .arg( name )
158 .arg( *emailIt ) 158 .arg( *emailIt )
159 .arg( *emailIt ); 159 .arg( *emailIt );
160 ++emailIt; 160 ++emailIt;
161 } else { 161 } else {
162 dynamicPart += QString( 162 dynamicPart += QString(
163 "<tr><td align=\"right\"><b>%1</b></td>" 163 "<tr><td align=\"right\"><b>%1</b></td>"
164 "<td align=\"left\">%2</td></tr>" ) 164 "<td align=\"left\">%2</td></tr>" )
165 .arg( type ) 165 .arg( type )
166 .arg( *emailIt ); 166 .arg( *emailIt );
167 ++emailIt; 167 ++emailIt;
168 } 168 }
169 } 169 }
170 if ( mAddressee.birthday().date().isValid() ) { 170 if ( mAddressee.birthday().date().isValid() ) {
171 dynamicPart += QString( 171 dynamicPart += QString(
172 "<tr><td align=\"right\"><b>%1</b></td>" 172 "<tr><td align=\"right\"><b>%1</b></td>"
173 "<td align=\"left\">%2</td></tr>" ) 173 "<td align=\"left\">%2</td></tr>" )
174 .arg( i18n ("Birthday") ) 174 .arg( i18n ("Birthday") )
175 .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); 175 .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) );
176 } 176 }
177 dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false ); 177 dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false );
178 178
179 for ( ; emailIt != emails.end(); ++emailIt ) { 179 for ( ; emailIt != emails.end(); ++emailIt ) {
180 if ( kemailAvail ) { 180 if ( kemailAvail ) {
181 dynamicPart += QString( 181 dynamicPart += QString(
182 "<tr><td align=\"right\"><b>%1</b></td>" 182 "<tr><td align=\"right\"><b>%1</b></td>"
183 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 183 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
184 .arg( type ) 184 .arg( type )
185 .arg( name ) 185 .arg( name )
186 .arg( *emailIt ) 186 .arg( *emailIt )
187 .arg( *emailIt ); 187 .arg( *emailIt );
188 } else { 188 } else {
189 dynamicPart += QString( 189 dynamicPart += QString(
190 "<tr><td align=\"right\"><b>%1</b></td>" 190 "<tr><td align=\"right\"><b>%1</b></td>"
191 "<td align=\"left\">%2</td></tr>" ) 191 "<td align=\"left\">%2</td></tr>" )
192 .arg( type ) 192 .arg( type )
193 .arg( *emailIt ); 193 .arg( *emailIt );
194 } 194 }
195 } 195 }
196 196
197 197
198 198
199 KABC::Address::List addresses = mAddressee.addresses(); 199 KABC::Address::List addresses = mAddressee.addresses();
200 KABC::Address::List::ConstIterator addrIt; 200 KABC::Address::List::ConstIterator addrIt;
201 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { 201 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
202 if ( true /*(*addrIt).label().isEmpty()*/ ) { 202 if ( true /*(*addrIt).label().isEmpty()*/ ) {
203 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); 203 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace();
204//US formattedAddress = formattedAddress.replace( '\n', "<br>" ); 204//US formattedAddress = formattedAddress.replace( '\n', "<br>" );
205 //qDebug("adresss %s ",formattedAddress.latin1() ); 205 //qDebug("adresss %s ",formattedAddress.latin1() );
206 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); 206 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" );
207 //qDebug("AddresseeView::setAddressee has to be verified."); 207 //qDebug("AddresseeView::setAddressee has to be verified.");
208 208
209 dynamicPart += QString( 209 dynamicPart += QString(
210 "<tr><td align=\"right\"><b>%1</b></td>" 210 "<tr><td align=\"right\"><b>%1</b></td>"
211 "<td align=\"left\">%2</td></tr>" ) 211 "<td align=\"left\">%2</td></tr>" )
212 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 212 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
213 .arg( formattedAddress ); 213 .arg( formattedAddress );
214 } else { 214 } else {
215 215
216 dynamicPart += QString( 216 dynamicPart += QString(
217 "<tr><td align=\"right\"><b>%1</b></td>" 217 "<tr><td align=\"right\"><b>%1</b></td>"
218 "<td align=\"left\">%2</td></tr>" ) 218 "<td align=\"left\">%2</td></tr>" )
219 .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) 219 .arg( KABC::Address::typeLabel( (*addrIt).type() ) )
220//US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); 220//US .arg( (*addrIt).label().replace( '\n', "<br>" ) );
221 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); 221 .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ );
222 222
223 } 223 }
224 } 224 }
225 225
226 226
227 QString notes; 227 QString notes;
228 if ( sFullDetailsMode ) { 228 if ( sFullDetailsMode ) {
229 notes = QString( 229 notes = QString(
230 "<tr><td align=\"right\"><b>%1</b></td>" 230 "<tr><td align=\"right\"><b>%1</b></td>"
231 "<td align=\"left\"><a href=\"notAllDetails\">%4</a></td></tr>" ) 231 "<td align=\"left\"><a href=\"notAllDetails\">%4</a></td></tr>" )
232 .arg( i18n("Details") ) 232 .arg( i18n("Details") )
233 .arg( i18n("Hide!") ); 233 .arg( i18n("Hide!") );
234 234
235 QString tempX = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 235 QString tempX = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
236 if ( !tempX.isEmpty() ) { 236 if ( !tempX.isEmpty() ) {
237 if ( tempX == "male" || tempX == "female" ) { 237 if ( tempX == "male" || tempX == "female" ) {
238 notes += QString( 238 notes += QString(
239 "<tr><td align=\"right\"><b>%1</b></td>" 239 "<tr><td align=\"right\"><b>%1</b></td>"
240 "<td align=\"left\">%2</td></tr>" ) 240 "<td align=\"left\">%2</td></tr>" )
241 .arg( i18n( "" ) ) 241 .arg( i18n( "" ) )
242 .arg( i18n(tempX) ); 242 .arg( i18n(tempX) );
243 } 243 }
244 } 244 }
245 245
246 246
247 tempX = mAddressee.secrecy().asString(); 247 tempX = mAddressee.secrecy().asString();
248 248
249 notes += QString( 249 notes += QString(
250 "<tr><td align=\"right\"><b>%1</b></td>" 250 "<tr><td align=\"right\"><b>%1</b></td>"
251 "<td align=\"left\">%2</td></tr>" ) 251 "<td align=\"left\">%2</td></tr>" )
252 .arg( "" ) 252 .arg( "" )
253 .arg( tempX ); 253 .arg( tempX );
254 254
255 255
256 tempX = mAddressee.categories().join(" - "); 256 tempX = mAddressee.categories().join(" - ");
257 if ( !tempX.isEmpty() ) { 257 if ( !tempX.isEmpty() ) {
258 notes += QString( 258 notes += QString(
259 "<tr><td align=\"right\"><b>%1</b></td>" 259 "<tr><td align=\"right\"><b>%1</b></td>"
260 "<td align=\"left\">%2</td></tr>" ) 260 "<td align=\"left\">%2</td></tr>" )
261 .arg( i18n( "Category" ) ) 261 .arg( i18n( "Category" ) )
262 .arg( tempX ); 262 .arg( tempX );
263 } 263 }
264 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Profession" ); 264 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Profession" );
265 if ( !tempX.isEmpty() ) { 265 if ( !tempX.isEmpty() ) {
266 notes += QString( 266 notes += QString(
267 "<tr><td align=\"right\"><b>%1</b></td>" 267 "<tr><td align=\"right\"><b>%1</b></td>"
268 "<td align=\"left\">%2</td></tr>" ) 268 "<td align=\"left\">%2</td></tr>" )
269 .arg( i18n( "Profession" ) ) 269 .arg( i18n( "Profession" ) )
270 .arg( tempX ); 270 .arg( tempX );
271 } 271 }
272 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Office" ); 272 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Office" );
273 if ( !tempX.isEmpty() ) { 273 if ( !tempX.isEmpty() ) {
274 notes += QString( 274 notes += QString(
275 "<tr><td align=\"right\"><b>%1</b></td>" 275 "<tr><td align=\"right\"><b>%1</b></td>"
276 "<td align=\"left\">%2</td></tr>" ) 276 "<td align=\"left\">%2</td></tr>" )
277 .arg( i18n( "Office" ) ) 277 .arg( i18n( "Office" ) )
278 .arg( tempX ); 278 .arg( tempX );
279 } 279 }
280 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Department" ); 280 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Department" );
281 if ( !tempX.isEmpty() ) { 281 if ( !tempX.isEmpty() ) {
282 notes += QString( 282 notes += QString(
283 "<tr><td align=\"right\"><b>%1</b></td>" 283 "<tr><td align=\"right\"><b>%1</b></td>"
284 "<td align=\"left\">%2</td></tr>" ) 284 "<td align=\"left\">%2</td></tr>" )
285 .arg( i18n( "Department" ) ) 285 .arg( i18n( "Department" ) )
286 .arg( tempX ); 286 .arg( tempX );
287 } 287 }
288 288
289 tempX = mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ); 289 tempX = mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" );
290 if ( !tempX.isEmpty() ) { 290 if ( !tempX.isEmpty() ) {
291 notes += QString( 291 notes += QString(
292 "<tr><td align=\"right\"><b>%1</b></td>" 292 "<tr><td align=\"right\"><b>%1</b></td>"
293 "<td align=\"left\">%2</td></tr>" ) 293 "<td align=\"left\">%2</td></tr>" )
294 .arg( i18n( "Manager" ) ) 294 .arg( i18n( "Manager" ) )
295 .arg( tempX ); 295 .arg( tempX );
296 } 296 }
297 tempX = mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ); 297 tempX = mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" );
298 if ( !tempX.isEmpty() ) { 298 if ( !tempX.isEmpty() ) {
299 notes += QString( 299 notes += QString(
300 "<tr><td align=\"right\"><b>%1</b></td>" 300 "<tr><td align=\"right\"><b>%1</b></td>"
301 "<td align=\"left\">%2</td></tr>" ) 301 "<td align=\"left\">%2</td></tr>" )
302 .arg( i18n( "Assistant" ) ) 302 .arg( i18n( "Assistant" ) )
303 .arg( tempX ); 303 .arg( tempX );
304 } 304 }
305 if ( !mAddressee.url().url().isEmpty() ) { 305 if ( !mAddressee.url().url().isEmpty() ) {
306 notes += QString( 306 notes += QString(
307 "<tr><td align=\"right\"><b>%1</b></td>" 307 "<tr><td align=\"right\"><b>%1</b></td>"
308 "<td align=\"left\">%2</td></tr>" ) 308 "<td align=\"left\">%2</td></tr>" )
309 .arg( i18n( "Homepage" ) ) 309 .arg( i18n( "Homepage" ) )
310 .arg( mAddressee.url().url() ); 310 .arg( mAddressee.url().url() );
311 } 311 }
312 tempX = mAddressee.nickName(); 312 tempX = mAddressee.nickName();
313 if ( !tempX.isEmpty() ) { 313 if ( !tempX.isEmpty() ) {
314 notes += QString( 314 notes += QString(
315 "<tr><td align=\"right\"><b>%1</b></td>" 315 "<tr><td align=\"right\"><b>%1</b></td>"
316 "<td align=\"left\">%2</td></tr>" ) 316 "<td align=\"left\">%2</td></tr>" )
317 .arg( i18n( "Nickname" ) ) 317 .arg( i18n( "Nickname" ) )
318 .arg( tempX ); 318 .arg( tempX );
319 } 319 }
320 tempX = mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ); 320 tempX = mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" );
321 if ( !tempX.isEmpty() ) { 321 if ( !tempX.isEmpty() ) {
322 notes += QString( 322 notes += QString(
323 "<tr><td align=\"right\"><b>%1</b></td>" 323 "<tr><td align=\"right\"><b>%1</b></td>"
324 "<td align=\"left\">%2</td></tr>" ) 324 "<td align=\"left\">%2</td></tr>" )
325 .arg( i18n( "Messanger" ) ) 325 .arg( i18n( "Messanger" ) )
326 .arg( tempX ); 326 .arg( tempX );
327 } 327 }
328 328
329 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Anniversary" ); 329 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Anniversary" );
330 if ( !tempX.isEmpty() ) { 330 if ( !tempX.isEmpty() ) {
331 QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d"); 331 QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d");
332 if ( dt.isValid () ) { 332 if ( dt.isValid () ) {
333 tempX = KGlobal::locale()->formatDate(dt, true); 333 tempX = KGlobal::locale()->formatDate(dt, true);
334 notes += QString( 334 notes += QString(
335 "<tr><td align=\"right\"><b>%1</b></td>" 335 "<tr><td align=\"right\"><b>%1</b></td>"
336 "<td align=\"left\">%2</td></tr>" ) 336 "<td align=\"left\">%2</td></tr>" )
337 .arg( i18n( "Anniversary" ) ) 337 .arg( i18n( "Anniversary" ) )
338 .arg( tempX ); 338 .arg( tempX );
339 } 339 }
340 } 340 }
341 tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ); 341 tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" );
342 if ( !tempX.isEmpty() ) { 342 if ( !tempX.isEmpty() ) {
343 notes += QString( 343 notes += QString(
344 "<tr><td align=\"right\"><b>%1</b></td>" 344 "<tr><td align=\"right\"><b>%1</b></td>"
345 "<td align=\"left\">%2</td></tr>" ) 345 "<td align=\"left\">%2</td></tr>" )
346 .arg( i18n( "Spouse" ) ) 346 .arg( i18n( "Spouse" ) )
347 .arg( tempX ); 347 .arg( tempX );
348 } 348 }
349 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" ); 349 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" );
350 if ( !tempX.isEmpty() ) { 350 if ( !tempX.isEmpty() ) {
351 notes += QString( 351 notes += QString(
352 "<tr><td align=\"right\"><b>%1</b></td>" 352 "<tr><td align=\"right\"><b>%1</b></td>"
353 "<td align=\"left\">%2</td></tr>" ) 353 "<td align=\"left\">%2</td></tr>" )
354 .arg( i18n( "Children" ) ) 354 .arg( i18n( "Children" ) )
355 .arg( tempX ); 355 .arg( tempX );
356 } 356 }
357 357
358 if ( !mAddressee.note().isEmpty() ) { 358 if ( !mAddressee.note().isEmpty() ) {
359 notes += QString( 359 notes += QString(
360 "<tr>" 360 "<tr>"
361 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label 361 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label
362 "<td align=\"left\">%2</td>" // note 362 "<td align=\"left\">%2</td>" // note
363 "</tr>" ).arg( i18n( "Notes" ) ) 363 "</tr>" ).arg( i18n( "Notes" ) )
364 //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); 364 //US .arg( mAddressee.note().replace( '\n', "<br>" ) );
365 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); 365 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) );
366 //qDebug("AddresseeView::setAddressee has to be verified."); 366 //qDebug("AddresseeView::setAddressee has to be verified.");
367 } 367 }
368 } else { 368 } else {
369 notes = QString( 369 notes = QString(
370 "<tr><td align=\"right\"><b>%1</b></td>" 370 "<tr><td align=\"right\"><b>%1</b></td>"
371 "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" ) 371 "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" )
372 .arg( i18n("Details") ) 372 .arg( i18n("Details") )
373 .arg( i18n("Show!") ); 373 .arg( i18n("Show!") );
374 374
375 375
376 } 376 }
377 377
378 QString aRole = ""; 378 QString aRole = "";
379 QString aOrga = ""; 379 QString aOrga = "";
380 if ( true /*!mAddressee.role().isEmpty()*/ ) { 380 if ( true /*!mAddressee.role().isEmpty()*/ ) {
381 aRole = "<tr>" 381 aRole = "<tr>"
382 "<td align=\"left\">" + mAddressee.role() + "</td>" 382 "<td align=\"left\">" + mAddressee.role() + "</td>"
383 "</tr>"; 383 "</tr>";
384 } 384 }
385 if ( true /*!mAddressee.organization().isEmpty()*/ ) { 385 if ( true /*!mAddressee.organization().isEmpty()*/ ) {
386 aOrga = "<tr>" 386 aOrga = "<tr>"
387 "<td align=\"left\">" + mAddressee.organization() + "</td>" 387 "<td align=\"left\">" + mAddressee.organization() + "</td>"
388 "</tr>"; 388 "</tr>";
389 } 389 }
390 mText = ""; 390 mText = "";
391 QString picString = ""; 391 QString picString = "";
392 KABC::Picture picture = mAddressee.photo(); 392 KABC::Picture picture = mAddressee.photo();
393 if (picture.undefined() ) picture = mAddressee.logo();
393 bool picAvailintern = false; 394 bool picAvailintern = false;
394 bool picAvailUrl = false; 395 bool picAvailUrl = false;
395 if (! picture.undefined() ) { 396 if (! picture.undefined() ) {
396 picAvailintern = (picture.isIntern() && !picture.data().isNull()); 397 picAvailintern = (picture.isIntern() && !picture.data().isNull());
397 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); 398 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
398 } 399 }
399 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { 400 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
400 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; 401 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
401 if ( picAvailintern ) { 402 if ( picAvailintern ) {
402 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); 403 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
404 int wid = picture.data().width();
405 int hei = picture.data().height();
406 if ( wid > 128 || hei > 128 ) {
407 if ( wid > hei ) {
408 hei = (hei*128)/wid;
409 wid = 128;
410 } else {
411 wid = (wid*128)/hei;
412 hei = 128;
413 }
414 }
415 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
403 } else { 416 } else {
404 if ( picAvailUrl ) { 417 if ( picAvailUrl ) {
405 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); 418 QPixmap picPix( picture.url() );
419 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix );
420 int wid = picPix.width();
421 int hei = picPix.height();
422 if ( wid > 128 || hei > 128 ) {
423 if ( wid > hei ) {
424 hei = (hei*128)/wid;
425 wid = 128;
426 } else {
427 wid = (wid*128)/hei;
428 hei = 128;
429 }
430 }
431 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
406 } else { 432 } else {
407 if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { 433 if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) {
408 static bool setDefaultImageChildren = false; 434 static bool setDefaultImageChildren = false;
409 if ( !setDefaultImageChildren ) { 435 if ( !setDefaultImageChildren ) {
410 QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) ); 436 QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
411 setDefaultImageChildren = true; 437 setDefaultImageChildren = true;
412 } 438 }
413 picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">"; 439 picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">";
414 440
415 } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) { 441 } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) {
416 static bool setDefaultImagepouses = false; 442 static bool setDefaultImagepouses = false;
417 if ( !setDefaultImagepouses ) { 443 if ( !setDefaultImagepouses ) {
418 QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) ); 444 QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
419 setDefaultImagepouses = true; 445 setDefaultImagepouses = true;
420 } 446 }
421 picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">"; 447 picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">";
422 } else { 448 } else {
423 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 449 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
424 if ( gen == "male" ) { 450 if ( gen == "male" ) {
425 static bool setDefaultImageMale = false; 451 static bool setDefaultImageMale = false;
426 if ( !setDefaultImageMale ) { 452 if ( !setDefaultImageMale ) {
427 QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) ); 453 QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
428 setDefaultImageMale = true; 454 setDefaultImageMale = true;
429 } 455 }
430 picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">"; 456 picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">";
431 457
432 } else if ( gen == "female" ) { 458 } else if ( gen == "female" ) {
433 static bool setDefaultImageFemale = false; 459 static bool setDefaultImageFemale = false;
434 if ( !setDefaultImageFemale ) { 460 if ( !setDefaultImageFemale ) {
435 QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) ); 461 QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
436 setDefaultImageFemale = true; 462 setDefaultImageFemale = true;
437 } 463 }
438 picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">"; 464 picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">";
439 465
440 } else { 466 } else {
441 static bool setDefaultImage = false; 467 static bool setDefaultImage = false;
442 if ( !setDefaultImage ) { 468 if ( !setDefaultImage ) {
443 //qDebug("Setting default pixmap "); 469 //qDebug("Setting default pixmap ");
444 QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) ); 470 QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
445 setDefaultImage = true; 471 setDefaultImage = true;
446 } 472 }
447 picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">"; 473 picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">";
448 } 474 }
449 } 475 }
450 } 476 }
451 } 477 }
452 mText = QString::fromLatin1( 478 mText = QString::fromLatin1(
453 "<html>" 479 "<html>"
454 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color 480 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color
455 "<table>" 481 "<table>"
456 "<tr>" 482 "<tr>"
457 "<td rowspan=\"3\" align=\"right\" valign=\"top\">" 483 "<td rowspan=\"3\" align=\"right\" valign=\"top\">"
458 "%3" 484 "%3"
459 "</td>" 485 "</td>"
460 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name 486 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
461 "</tr>" 487 "</tr>"
462 "%5" // role 488 "%5" // role
463 "%6" // organization 489 "%6" // organization
464 "<td colspan=\"2\">&nbsp;</td>" 490 "<td colspan=\"2\">&nbsp;</td>"
465 "%7" // dynamic part 491 "%7" // dynamic part
466 "%8" // notes 492 "%8" // notes
467 "</table>" 493 "</table>"
468 "</body>" 494 "</body>"
469 "</html>") 495 "</html>")
470//US 496//US
471 .arg( /*KGlobalSettings::textColor().name()*/ "black" ) 497 .arg( /*KGlobalSettings::textColor().name()*/ "black" )
472//US 498//US
473 .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) 499 .arg( /*KGlobalSettings::baseColor().name()*/ "white" )
474 .arg( picString ) 500 .arg( picString )
475 .arg( name ) 501 .arg( name )
476 .arg( aRole ) 502 .arg( aRole )
477 .arg( aOrga ) 503 .arg( aOrga )
478 .arg( dynamicPart ) 504 .arg( dynamicPart )
479 .arg( notes ); 505 .arg( notes );
480 506
481 } else { // no picture! 507 } else { // no picture!
482 508
483mText = "<table width=\"100%\">\n"; 509mText = "<table width=\"100%\">\n";
484 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 510 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
485#ifdef DESKTOP_VERSION 511#ifdef DESKTOP_VERSION
486 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; 512 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
487 mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; 513 mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>";
488#else 514#else
489 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; 515 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>";
490 mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; 516 mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>";
491#endif 517#endif
492 518
493 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 519 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
494 520
495 mText += "<table><td colspan=\"2\">&nbsp;</td>"; 521 mText += "<table><td colspan=\"2\">&nbsp;</td>";
496 /* 522 /*
497 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" 523 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
498 "<td align=\"left\"><b>%2</b></td></tr>" ) 524 "<td align=\"left\"><b>%2</b></td></tr>" )
499 .arg( i18n(" ") ) 525 .arg( i18n(" ") )
500 .arg( name ); 526 .arg( name );
501 */ 527 */
502 if ( ! mAddressee.role().isEmpty() ) 528 if ( ! mAddressee.role().isEmpty() )
503 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 529 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
504 "<td align=\"left\">%2</td></tr>" ) 530 "<td align=\"left\">%2</td></tr>" )
505 .arg( i18n(" ") ) 531 .arg( i18n(" ") )
506 .arg( mAddressee.role()); 532 .arg( mAddressee.role());
507 if ( ! mAddressee.organization().isEmpty() ) 533 if ( ! mAddressee.organization().isEmpty() )
508 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 534 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
509 "<td align=\"left\">%2</td></tr>" ) 535 "<td align=\"left\">%2</td></tr>" )
510 .arg( i18n(" ") ) 536 .arg( i18n(" ") )
511 .arg( mAddressee.organization()); 537 .arg( mAddressee.organization());
512 mText += dynamicPart; 538 mText += dynamicPart;
513 mText += notes; 539 mText += notes;
514 mText += "</table>"; 540 mText += "</table>";
515 541
516 } 542 }
517 543
518 // at last display it... 544 // at last display it...
519 setText( mText ); 545 setText( mText );
520 546
521} 547}
522 548
523QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred ) 549QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred )
524{ 550{
525 ExternalAppHandler* eah = ExternalAppHandler::instance(); 551 ExternalAppHandler* eah = ExternalAppHandler::instance();
526 bool kphoneAvail = eah->isPhoneAppAvailable(); 552 bool kphoneAvail = eah->isPhoneAppAvailable();
527 bool kfaxAvail = eah->isFaxAppAvailable(); 553 bool kfaxAvail = eah->isFaxAppAvailable();
528 bool ksmsAvail = eah->isSMSAppAvailable(); 554 bool ksmsAvail = eah->isSMSAppAvailable();
529 bool kpagerAvail = eah->isPagerAppAvailable(); 555 bool kpagerAvail = eah->isPagerAppAvailable();
530 bool ksipAvail = eah->isSIPAppAvailable(); 556 bool ksipAvail = eah->isSIPAppAvailable();
531 QString dynamicPart; 557 QString dynamicPart;
532 KABC::PhoneNumber::List::ConstIterator phoneIt; 558 KABC::PhoneNumber::List::ConstIterator phoneIt;
533 QString extension; 559 QString extension;
534 int phonetype; 560 int phonetype;
535 QString sms; 561 QString sms;
536 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { 562 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
537 phonetype = (*phoneIt).type(); 563 phonetype = (*phoneIt).type();
538 if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) 564 if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred )
539 continue; 565 continue;
540 if (ksmsAvail && 566 if (ksmsAvail &&
541 ( 567 (
542 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || 568 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) ||
543 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) 569 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell)
544 ) 570 )
545 ) 571 )
546 { 572 {
547 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) 573 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" )
548 .arg( (*phoneIt).number() ); 574 .arg( (*phoneIt).number() );
549 575
550 } 576 }
551 else 577 else
552 sms = ""; 578 sms = "";
553 579
554 extension = QString::null; 580 extension = QString::null;
555 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { 581 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) {
556 if (kfaxAvail) extension = "faxto:"; 582 if (kfaxAvail) extension = "faxto:";
557 } 583 }
558 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { 584 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) {
559 if (kpagerAvail) extension = "pagerto:"; 585 if (kpagerAvail) extension = "pagerto:";
560 } 586 }
561 else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { 587 else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) {
562 if (ksipAvail) extension = "sipto:"; 588 if (ksipAvail) extension = "sipto:";
563 } 589 }
564 else if (kphoneAvail) { 590 else if (kphoneAvail) {
565 extension = "phoneto:"; 591 extension = "phoneto:";
566 } 592 }
567 else 593 else
568 extension = QString::null; 594 extension = QString::null;
569 595
570 if ( !extension.isEmpty() ) { 596 if ( !extension.isEmpty() ) {
571 dynamicPart += QString( 597 dynamicPart += QString(
572 "<tr><td align=\"right\"><b>%1</b></td>" 598 "<tr><td align=\"right\"><b>%1</b></td>"
573 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) 599 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" )
574 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 600 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
575 .arg( extension ) 601 .arg( extension )
576 .arg( (*phoneIt).number() ) 602 .arg( (*phoneIt).number() )
577 .arg( (*phoneIt).number() ) 603 .arg( (*phoneIt).number() )
578 .arg( sms ); 604 .arg( sms );
579 605
580 } else { 606 } else {
581 dynamicPart += QString( 607 dynamicPart += QString(
582 "<tr><td align=\"right\"><b>%1</b></td>" 608 "<tr><td align=\"right\"><b>%1</b></td>"
583 "<td align=\"left\">%2 %3</td></tr>" ) 609 "<td align=\"left\">%2 %3</td></tr>" )
584 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 610 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
585 .arg( (*phoneIt).number() ) 611 .arg( (*phoneIt).number() )
586 .arg( sms ); 612 .arg( sms );
587 } 613 }
588 } 614 }
589 return dynamicPart; 615 return dynamicPart;
590} 616}
591/* 617/*
592KABC::Addressee AddresseeView::addressee() const 618KABC::Addressee AddresseeView::addressee() const
593{ 619{
594 return mAddressee; 620 return mAddressee;
595} 621}
596*/ 622*/
597void AddresseeView::addTag(const QString & tag,const QString & text) 623void AddresseeView::addTag(const QString & tag,const QString & text)
598{ 624{
599 if ( text.isEmpty() ) 625 if ( text.isEmpty() )
600 return; 626 return;
601 int number=text.contains("\n"); 627 int number=text.contains("\n");
602 QString str = "<" + tag + ">"; 628 QString str = "<" + tag + ">";
603 QString tmpText=text; 629 QString tmpText=text;
604 QString tmpStr=str; 630 QString tmpStr=str;
605 if(number !=-1) 631 if(number !=-1)
606 { 632 {
607 if (number > 0) { 633 if (number > 0) {
608 int pos=0; 634 int pos=0;
609 QString tmp; 635 QString tmp;
610 for(int i=0;i<=number;i++) { 636 for(int i=0;i<=number;i++) {
611 pos=tmpText.find("\n"); 637 pos=tmpText.find("\n");
612 tmp=tmpText.left(pos); 638 tmp=tmpText.left(pos);
613 tmpText=tmpText.right(tmpText.length()-pos-1); 639 tmpText=tmpText.right(tmpText.length()-pos-1);
614 tmpStr+=tmp+"<br>"; 640 tmpStr+=tmp+"<br>";
615 } 641 }
616 } 642 }
617 else tmpStr += tmpText; 643 else tmpStr += tmpText;
618 tmpStr+="</" + tag + ">"; 644 tmpStr+="</" + tag + ">";
619 mText.append(tmpStr); 645 mText.append(tmpStr);
620 } 646 }
621 else 647 else
622 { 648 {
623 str += text + "</" + tag + ">"; 649 str += text + "</" + tag + ">";
624 mText.append(str); 650 mText.append(str);
625 } 651 }
626} 652}
627 653
628AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, 654AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
629 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) 655 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
630{ 656{
631 findButton( Close )->setText( i18n("Cancel Sync")); 657 findButton( Close )->setText( i18n("Cancel Sync"));
632 findButton( Ok )->setText( i18n("Remote")); 658 findButton( Ok )->setText( i18n("Remote"));
633 findButton( User1 )->setText( i18n("Local")); 659 findButton( User1 )->setText( i18n("Local"));
634 QWidget* topframe = new QWidget( this ); 660 QWidget* topframe = new QWidget( this );
635 setMainWidget( topframe ); 661 setMainWidget( topframe );
636 QBoxLayout* bl; 662 QBoxLayout* bl;
637 if ( QApplication::desktop()->width() < 640 ) { 663 if ( QApplication::desktop()->width() < 640 ) {
638 bl = new QVBoxLayout( topframe ); 664 bl = new QVBoxLayout( topframe );
639 } else { 665 } else {
640 bl = new QHBoxLayout( topframe ); 666 bl = new QHBoxLayout( topframe );
641 } 667 }
642 QVBox* subframe = new QVBox( topframe ); 668 QVBox* subframe = new QVBox( topframe );
643 bl->addWidget(subframe ); 669 bl->addWidget(subframe );
644 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); 670 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
645 if ( takeloc ) 671 if ( takeloc )
646 lab->setBackgroundColor(Qt::green.light() ); 672 lab->setBackgroundColor(Qt::green.light() );
647 AddresseeView * av = new AddresseeView( subframe ); 673 AddresseeView * av = new AddresseeView( subframe );
648 av->setAddressee( loc ); 674 av->setAddressee( loc );
649 subframe = new QVBox( topframe ); 675 subframe = new QVBox( topframe );
650 bl->addWidget(subframe ); 676 bl->addWidget(subframe );
651 lab = new QLabel( i18n("Remote Addressee"), subframe ); 677 lab = new QLabel( i18n("Remote Addressee"), subframe );
652 if ( !takeloc ) 678 if ( !takeloc )
653 lab->setBackgroundColor(Qt::green.light() ); 679 lab->setBackgroundColor(Qt::green.light() );
654 av = new AddresseeView( subframe ); 680 av = new AddresseeView( subframe );
655 av->setAddressee( rem ); 681 av->setAddressee( rem );
656 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); 682 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
657 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); 683 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
658#ifndef DESKTOP_VERSION 684#ifndef DESKTOP_VERSION
659 showMaximized(); 685 showMaximized();
660#else 686#else
661 resize ( 640, 400 ); 687 resize ( 640, 400 );