summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-29 21:05:07 (UTC)
committer zautrix <zautrix>2004-10-29 21:05:07 (UTC)
commit3c0edb4b4c4a77b334331749dfde776911c3a3a0 (patch) (unidiff)
tree89de7078a1a062c19b2f13ededd49f471c362abf
parenta7e2fe5bb10af47a239b8b014a210568cc79287a (diff)
downloadkdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.zip
kdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.tar.gz
kdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.tar.bz2
KO WN view fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp3
-rw-r--r--kabc/phonenumber.cpp31
-rw-r--r--kabc/plugins/ldap/ldapE.pro2
-rw-r--r--korganizer/kowhatsnextview.cpp42
-rw-r--r--korganizer/kowhatsnextview.h2
5 files changed, 38 insertions, 42 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 028d3bb..eec0f1f 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -231,193 +231,194 @@ void Addressee::computeCsum(const QString &dev)
231 // if ( !mData->logo.isEmpty() ) l.append( ); 231 // if ( !mData->logo.isEmpty() ) l.append( );
232 //if ( !mData->photo.isEmpty() ) l.append( ); 232 //if ( !mData->photo.isEmpty() ) l.append( );
233 //if ( !mData->sound.isEmpty() ) l.append( ); 233 //if ( !mData->sound.isEmpty() ) l.append( );
234 //if ( !mData->agent.isEmpty() ) l.append( ); 234 //if ( !mData->agent.isEmpty() ) l.append( );
235 if ( mData->url.isValid() ) 235 if ( mData->url.isValid() )
236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); 236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() );
237 KABC::PhoneNumber::List phoneNumbers; 237 KABC::PhoneNumber::List phoneNumbers;
238 KABC::PhoneNumber::List::Iterator phoneIter; 238 KABC::PhoneNumber::List::Iterator phoneIter;
239 239
240 QStringList t; 240 QStringList t;
241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
242 ++phoneIter ) 242 ++phoneIter )
243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
244 t.sort(); 244 t.sort();
245 uint iii; 245 uint iii;
246 for ( iii = 0; iii < t.count(); ++iii) 246 for ( iii = 0; iii < t.count(); ++iii)
247 l.append( t[iii] ); 247 l.append( t[iii] );
248 t = mData->emails; 248 t = mData->emails;
249 t.sort(); 249 t.sort();
250 for ( iii = 0; iii < t.count(); ++iii) 250 for ( iii = 0; iii < t.count(); ++iii)
251 l.append( t[iii] ); 251 l.append( t[iii] );
252 t = mData->categories; 252 t = mData->categories;
253 t.sort(); 253 t.sort();
254 for ( iii = 0; iii < t.count(); ++iii) 254 for ( iii = 0; iii < t.count(); ++iii)
255 l.append( t[iii] ); 255 l.append( t[iii] );
256 t = mData->custom; 256 t = mData->custom;
257 t.sort(); 257 t.sort();
258 for ( iii = 0; iii < t.count(); ++iii) 258 for ( iii = 0; iii < t.count(); ++iii)
259 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { 259 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) {
260 int find = t[iii].find (':')+1; 260 int find = t[iii].find (':')+1;
261 //qDebug("lennnn %d %d ", find, t[iii].length()); 261 //qDebug("lennnn %d %d ", find, t[iii].length());
262 if ( find < t[iii].length()) 262 if ( find < t[iii].length())
263 l.append( t[iii] ); 263 l.append( t[iii] );
264 264
265 } 265 }
266 KABC::Address::List::Iterator addressIter; 266 KABC::Address::List::Iterator addressIter;
267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
268 ++addressIter ) { 268 ++addressIter ) {
269 t = (*addressIter).asList(); 269 t = (*addressIter).asList();
270 t.sort(); 270 t.sort();
271 for ( iii = 0; iii < t.count(); ++iii) 271 for ( iii = 0; iii < t.count(); ++iii)
272 l.append( t[iii] ); 272 l.append( t[iii] );
273 } 273 }
274 uint cs = getCsum4List(l); 274 uint cs = getCsum4List(l);
275#if 0 275#if 0
276 for ( iii = 0; iii < l.count(); ++iii) 276 for ( iii = 0; iii < l.count(); ++iii)
277 qDebug("%d***%s***",iii,l[iii].latin1()); 277 qDebug("%d***%s***",iii,l[iii].latin1());
278 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 278 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
279#endif 279#endif
280 setCsum( dev, QString::number (cs )); 280 setCsum( dev, QString::number (cs ));
281} 281}
282 282
283void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 283void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
284{ 284{
285 285
286 detach(); 286 detach();
287 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 287 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
288 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 288 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
289 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 289 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
290 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 290 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
291 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 291 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
292 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 292 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
293 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 293 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
294 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 294 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
295 if ( !mData->birthday.isValid() ) 295 if ( !mData->birthday.isValid() )
296 if ( ad.mData->birthday.isValid()) 296 if ( ad.mData->birthday.isValid())
297 mData->birthday = ad.mData->birthday; 297 mData->birthday = ad.mData->birthday;
298 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 298 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
299 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 299 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
300 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 300 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
301 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 301 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
302 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 302 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
303 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 303 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
304 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 304 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
305 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 305 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
306 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 306 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
307 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 307 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
308 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 308 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
309 QStringList t; 309 QStringList t;
310 QStringList tAD; 310 QStringList tAD;
311 uint iii; 311 uint iii;
312 312
313 // ********** phone numbers 313 // ********** phone numbers
314 PhoneNumber::List phoneAD = ad.phoneNumbers(); 314 PhoneNumber::List phoneAD = ad.phoneNumbers();
315 PhoneNumber::List::Iterator phoneItAD; 315 PhoneNumber::List::Iterator phoneItAD;
316 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 316 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
317 bool found = false; 317 bool found = false;
318 PhoneNumber::List::Iterator it; 318 PhoneNumber::List::Iterator it;
319 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 319 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
320 if ( ( *phoneItAD ).contains( (*it) ) ) { 320 if ( ( *phoneItAD ).contains( (*it) ) ) {
321 found = true; 321 found = true;
322 (*it).setType( ( *phoneItAD ).type() ); 322 (*it).setType( ( *phoneItAD ).type() );
323 (*it).setNumber( ( *phoneItAD ).number() ); 323 (*it).setNumber( ( *phoneItAD ).number() );
324 break; 324 break;
325 } 325 }
326 } 326 }
327 if ( isSubSet && ! found ) 327 // if ( isSubSet && ! found )
328 if ( ! found ) // LR try this one...
328 mData->phoneNumbers.append( *phoneItAD ); 329 mData->phoneNumbers.append( *phoneItAD );
329 } 330 }
330 if ( isSubSet ) { 331 if ( isSubSet ) {
331 // ************* emails; 332 // ************* emails;
332 t = mData->emails; 333 t = mData->emails;
333 tAD = ad.mData->emails; 334 tAD = ad.mData->emails;
334 for ( iii = 0; iii < tAD.count(); ++iii) 335 for ( iii = 0; iii < tAD.count(); ++iii)
335 if ( !t.contains(tAD[iii] ) ) 336 if ( !t.contains(tAD[iii] ) )
336 mData->emails.append( tAD[iii] ); 337 mData->emails.append( tAD[iii] );
337 } 338 }
338 339
339 // ************* categories; 340 // ************* categories;
340 t = mData->categories; 341 t = mData->categories;
341 tAD = ad.mData->categories; 342 tAD = ad.mData->categories;
342 for ( iii = 0; iii < tAD.count(); ++iii) 343 for ( iii = 0; iii < tAD.count(); ++iii)
343 if ( !t.contains(tAD[iii] ) ) 344 if ( !t.contains(tAD[iii] ) )
344 mData->categories.append( tAD[iii] ); 345 mData->categories.append( tAD[iii] );
345 QStringList::ConstIterator it; 346 QStringList::ConstIterator it;
346 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { 347 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) {
347 QString qualifiedName = (*it).left( (*it).find( ":" )); 348 QString qualifiedName = (*it).left( (*it).find( ":" ));
348 bool found = false; 349 bool found = false;
349 QStringList::ConstIterator itL; 350 QStringList::ConstIterator itL;
350 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { 351 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) {
351 if ( (*itL).startsWith( qualifiedName ) ) { 352 if ( (*itL).startsWith( qualifiedName ) ) {
352 found = true; 353 found = true;
353 break; 354 break;
354 } 355 }
355 } 356 }
356 if ( ! found ) { 357 if ( ! found ) {
357 mData->custom.append( *it ); 358 mData->custom.append( *it );
358 } 359 }
359 } 360 }
360 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; 361 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
361 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; 362 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
362 if ( !mData->sound.isIntern() ) { 363 if ( !mData->sound.isIntern() ) {
363 if ( mData->sound.url().isEmpty() ) { 364 if ( mData->sound.url().isEmpty() ) {
364 mData->sound = ad.mData->sound; 365 mData->sound = ad.mData->sound;
365 } 366 }
366 } 367 }
367 if ( !mData->agent.isIntern() ) { 368 if ( !mData->agent.isIntern() ) {
368 if ( mData->agent.url().isEmpty() ) { 369 if ( mData->agent.url().isEmpty() ) {
369 mData->agent = ad.mData->agent; 370 mData->agent = ad.mData->agent;
370 } 371 }
371 } 372 }
372 { 373 {
373 Key::List::Iterator itA; 374 Key::List::Iterator itA;
374 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { 375 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
375 bool found = false; 376 bool found = false;
376 Key::List::Iterator it; 377 Key::List::Iterator it;
377 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 378 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
378 if ( (*it) == (*itA)) { 379 if ( (*it) == (*itA)) {
379 found = true; 380 found = true;
380 break; 381 break;
381 382
382 } 383 }
383 } 384 }
384 if ( ! found ) { 385 if ( ! found ) {
385 mData->keys.append( *itA ); 386 mData->keys.append( *itA );
386 } 387 }
387 } 388 }
388 } 389 }
389 KABC::Address::List::Iterator addressIterA; 390 KABC::Address::List::Iterator addressIterA;
390 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { 391 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) {
391 bool found = false; 392 bool found = false;
392 KABC::Address::List::Iterator addressIter; 393 KABC::Address::List::Iterator addressIter;
393 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 394 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
394 ++addressIter ) { 395 ++addressIter ) {
395 if ( (*addressIter) == (*addressIterA)) { 396 if ( (*addressIter) == (*addressIterA)) {
396 found = true; 397 found = true;
397 (*addressIter).setType( (*addressIterA).type() ); 398 (*addressIter).setType( (*addressIterA).type() );
398 break; 399 break;
399 } 400 }
400 401
401 } 402 }
402 if ( isSubSet && ! found ) { 403 if ( isSubSet && ! found ) {
403 mData->addresses.append( *addressIterA ); 404 mData->addresses.append( *addressIterA );
404 } 405 }
405 } 406 }
406 //qDebug("merge contact %s ", ad.uid().latin1()); 407 //qDebug("merge contact %s ", ad.uid().latin1());
407 setUid( ad.uid() ); 408 setUid( ad.uid() );
408 setRevision( ad.revision() ); 409 setRevision( ad.revision() );
409} 410}
410 411
411bool Addressee::removeVoice() 412bool Addressee::removeVoice()
412{ 413{
413 PhoneNumber::List phoneN = phoneNumbers(); 414 PhoneNumber::List phoneN = phoneNumbers();
414 PhoneNumber::List::Iterator phoneIt; 415 PhoneNumber::List::Iterator phoneIt;
415 bool found = false; 416 bool found = false;
416 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 417 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
417 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 418 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
418 if ((*phoneIt).type() - PhoneNumber::Voice ) { 419 if ((*phoneIt).type() - PhoneNumber::Voice ) {
419 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 420 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
420 insertPhoneNumber( (*phoneIt) ); 421 insertPhoneNumber( (*phoneIt) );
421 found = true; 422 found = true;
422 } 423 }
423 } 424 }
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 3d82553..abb3b3b 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -1,205 +1,200 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <kapplication.h> 28#include <kapplication.h>
29#include <klocale.h> 29#include <klocale.h>
30 30
31#include "phonenumber.h" 31#include "phonenumber.h"
32 32
33using namespace KABC; 33using namespace KABC;
34 34
35PhoneNumber::PhoneNumber() : 35PhoneNumber::PhoneNumber() :
36 mType( Home ) 36 mType( Home )
37{ 37{
38 init(); 38 init();
39} 39}
40 40
41PhoneNumber::PhoneNumber( const QString &number, int type ) : 41PhoneNumber::PhoneNumber( const QString &number, int type ) :
42 mType( type ), mNumber( number ) 42 mType( type ), mNumber( number )
43{ 43{
44 init(); 44 init();
45} 45}
46 46
47PhoneNumber::~PhoneNumber() 47PhoneNumber::~PhoneNumber()
48{ 48{
49} 49}
50 50
51void PhoneNumber::init() 51void PhoneNumber::init()
52{ 52{
53 mId = KApplication::randomString( 8 ); 53 mId = KApplication::randomString( 8 );
54} 54}
55 55
56bool PhoneNumber::operator==( const PhoneNumber &p ) const 56bool PhoneNumber::operator==( const PhoneNumber &p ) const
57{ 57{
58 if ( mNumber != p.mNumber ) return false; 58 if ( mNumber != p.mNumber ) return false;
59 if ( mType != p.mType ) return false; 59 if ( mType != p.mType ) return false;
60 60
61 return true; 61 return true;
62} 62}
63 63
64bool PhoneNumber::operator!=( const PhoneNumber &p ) const 64bool PhoneNumber::operator!=( const PhoneNumber &p ) const
65{ 65{
66 return !( p == *this ); 66 return !( p == *this );
67} 67}
68 68
69bool PhoneNumber::simplifyNumber() 69bool PhoneNumber::simplifyNumber()
70{ 70{
71 QString Number; 71 QString Number;
72 int i; 72 int i;
73 Number = mNumber.stripWhiteSpace (); 73 Number = mNumber.stripWhiteSpace ();
74 mNumber = ""; 74 mNumber = "";
75 for ( i = 0; i < Number.length(); ++i) { 75 for ( i = 0; i < Number.length(); ++i) {
76 if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) 76 if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' )
77 mNumber += Number.at(i); 77 mNumber += Number.at(i);
78 } 78 }
79 return ( mNumber.length() > 0 ); 79 return ( mNumber.length() > 0 );
80} 80}
81// make cellphone compatible 81// make cellphone compatible
82void PhoneNumber::simplifyType() 82void PhoneNumber::simplifyType()
83{ 83{
84 if ( mType & Fax ) mType = Fax; 84 if ( mType & Fax ) mType = Fax;
85 else if ( mType & Cell ) mType = Cell; 85 else if ( mType & Cell ) mType = Cell;
86 else if ( mType & Work ) mType = Work ; 86 else if ( mType & Work ) mType = Work ;
87 else if ( mType & Home ) mType = Home; 87 else if ( mType & Home ) mType = Home;
88 else mType = Pref; 88 else mType = Pref;
89} 89}
90bool PhoneNumber::contains( const PhoneNumber &p ) 90bool PhoneNumber::contains( const PhoneNumber &p )
91{ 91{
92 QString Number; 92 PhoneNumber myself;
93 QString Num; 93 PhoneNumber other;
94 uint i; 94 myself = *this;
95 Number = mNumber.stripWhiteSpace (); 95 other = p;
96 Num = ""; 96 myself.simplifyNumber();
97 for ( i = 0; i < Number.length(); ++i) { 97 other.simplifyNumber();
98 if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) 98 if ( myself.number() != other.number ())
99 Num += Number.at(i); 99 return false;
100 } 100 myself.simplifyType();
101 QString NumberR; 101 other.simplifyType();
102 QString NumR; 102 if ( myself.type() == other.type())
103 NumberR = p.mNumber.stripWhiteSpace (); 103 return true;
104 NumR = ""; 104 return false;
105 for ( i = 0; i < NumberR.length(); ++i) {
106 if ( NumberR.at(i).isDigit() || NumberR.at(i) == '+'|| NumberR.at(i) == '*'|| NumberR.at(i) == '#' )
107 NumR += NumberR.at(i);
108 }
109 return (Num == NumR);
110} 105}
111 106
112void PhoneNumber::setId( const QString &id ) 107void PhoneNumber::setId( const QString &id )
113{ 108{
114 mId = id; 109 mId = id;
115} 110}
116 111
117QString PhoneNumber::id() const 112QString PhoneNumber::id() const
118{ 113{
119 return mId; 114 return mId;
120} 115}
121 116
122void PhoneNumber::setNumber( const QString &number ) 117void PhoneNumber::setNumber( const QString &number )
123{ 118{
124 mNumber = number; 119 mNumber = number;
125} 120}
126 121
127QString PhoneNumber::number() const 122QString PhoneNumber::number() const
128{ 123{
129 return mNumber; 124 return mNumber;
130} 125}
131 126
132void PhoneNumber::setType( int type ) 127void PhoneNumber::setType( int type )
133{ 128{
134 mType = type; 129 mType = type;
135} 130}
136 131
137int PhoneNumber::type() const 132int PhoneNumber::type() const
138{ 133{
139 return mType; 134 return mType;
140} 135}
141 136
142QString PhoneNumber::typeLabel() const 137QString PhoneNumber::typeLabel() const
143{ 138{
144 QString label; 139 QString label;
145 bool first = true; 140 bool first = true;
146 141
147 TypeList list = typeList(); 142 TypeList list = typeList();
148 143
149 TypeList::Iterator it; 144 TypeList::Iterator it;
150 for ( it = list.begin(); it != list.end(); ++it ) { 145 for ( it = list.begin(); it != list.end(); ++it ) {
151 if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { 146 if ( ( type() & (*it) ) && ( (*it) != Pref ) ) {
152 label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); 147 label.append( ( first ? "" : "/" ) + typeLabel( *it ) );
153 if ( first ) 148 if ( first )
154 first = false; 149 first = false;
155 } 150 }
156 } 151 }
157 152
158 return label; 153 return label;
159} 154}
160 155
161QString PhoneNumber::label() const 156QString PhoneNumber::label() const
162{ 157{
163 return typeLabel( type() ); 158 return typeLabel( type() );
164} 159}
165 160
166PhoneNumber::TypeList PhoneNumber::typeList() 161PhoneNumber::TypeList PhoneNumber::typeList()
167{ 162{
168 TypeList list; 163 TypeList list;
169 164
170 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video 165 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video
171 << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip; 166 << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip;
172 167
173 return list; 168 return list;
174} 169}
175 170
176QString PhoneNumber::label( int type ) 171QString PhoneNumber::label( int type )
177{ 172{
178 return typeLabel( type ); 173 return typeLabel( type );
179} 174}
180 175
181QString PhoneNumber::typeLabel( int type ) 176QString PhoneNumber::typeLabel( int type )
182{ 177{
183 QString typeString; 178 QString typeString;
184 179
185 if ((type & Home) == Home) 180 if ((type & Home) == Home)
186 typeString += i18n("Home"); 181 typeString += i18n("Home");
187 else if ((type & Work) == Work) 182 else if ((type & Work) == Work)
188 typeString += i18n("Work"); 183 typeString += i18n("Work");
189 184
190 if (!typeString.isEmpty()) 185 if (!typeString.isEmpty())
191 typeString += " "; 186 typeString += " ";
192 187
193 if ((type & Cell) == Cell) 188 if ((type & Cell) == Cell)
194 typeString += i18n("Mobile"); 189 typeString += i18n("Mobile");
195 else if ((type & Fax) == Fax) 190 else if ((type & Fax) == Fax)
196 typeString += i18n("Fax"); 191 typeString += i18n("Fax");
197 else if ((type & Msg) == Msg) 192 else if ((type & Msg) == Msg)
198 typeString += i18n("Messenger"); 193 typeString += i18n("Messenger");
199 else if ((type & Voice) == Voice) { 194 else if ((type & Voice) == Voice) {
200// add nothing in case of the Voice flag 195// add nothing in case of the Voice flag
201// typeString += i18n("Voice"); 196// typeString += i18n("Voice");
202 } 197 }
203 else if ((type & Video) == Video) 198 else if ((type & Video) == Video)
204 typeString += i18n("Video"); 199 typeString += i18n("Video");
205 else if ((type & Bbs) == Bbs) 200 else if ((type & Bbs) == Bbs)
diff --git a/kabc/plugins/ldap/ldapE.pro b/kabc/plugins/ldap/ldapE.pro
index df3c94c..57b6f84 100644
--- a/kabc/plugins/ldap/ldapE.pro
+++ b/kabc/plugins/ldap/ldapE.pro
@@ -1,21 +1,21 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3#release debug 3#release debug
4 4
5TARGET = microkabc_ldap 5TARGET = microkabc_ldap
6INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include 6INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include
7OBJECTS_DIR = obj/$(PLATFORM) 7OBJECTS_DIR = obj/$(PLATFORM)
8MOC_DIR = moc/$(PLATFORM) 8MOC_DIR = moc/$(PLATFORM)
9DESTDIR = $(QPEDIR)/lib 9DESTDIR = $(QPEDIR)/lib
10LIBS += -lmicrokde -lkamicrokabc 10LIBS += -lmicrokde -lmicrokabc
11LIBS += -L$(QPEDIR)/lib 11LIBS += -L$(QPEDIR)/lib
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 resourceldap.h \ 16 resourceldap.h \
17 resourceldapconfig.h 17 resourceldapconfig.h
18 18
19SOURCES = \ 19SOURCES = \
20 resourceldap.cpp \ 20 resourceldap.cpp \
21 resourceldapconfig.cpp 21 resourceldapconfig.cpp
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index aa33588..2f7409d 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -1,673 +1,673 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qtextbrowser.h> 21#include <qtextbrowser.h>
22#include <qtextcodec.h> 22#include <qtextcodec.h>
23#include <qfileinfo.h> 23#include <qfileinfo.h>
24#include <qlabel.h> 24#include <qlabel.h>
25 25
26#include <qapplication.h> 26#include <qapplication.h>
27 27
28#include <kglobal.h> 28#include <kglobal.h>
29#include <klocale.h> 29#include <klocale.h>
30#include <kdebug.h> 30#include <kdebug.h>
31#include <kiconloader.h> 31#include <kiconloader.h>
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33 33
34#include <libkcal/calendar.h> 34#include <libkcal/calendar.h>
35 35
36#ifndef KORG_NOPRINTER 36#ifndef KORG_NOPRINTER
37#include "calprinter.h" 37#include "calprinter.h"
38#endif 38#endif
39#include "koglobals.h" 39#include "koglobals.h"
40#include "koprefs.h" 40#include "koprefs.h"
41#include "koeventviewerdialog.h" 41#include "koeventviewerdialog.h"
42#include <qstylesheet.h> 42#include <qstylesheet.h>
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44using namespace KOrg; 44using namespace KOrg;
45 45
46void WhatsNextTextBrowser::setSource(const QString& n) 46void WhatsNextTextBrowser::setSource(const QString& n)
47{ 47{
48 48
49 if (n.startsWith("event:")) { 49 if (n.startsWith("event:")) {
50 emit showIncidence(n); 50 emit showIncidence(n);
51 return; 51 return;
52 } else if (n.startsWith("todo:")) { 52 } else if (n.startsWith("todo:")) {
53 emit showIncidence(n); 53 emit showIncidence(n);
54 return; 54 return;
55 } else { 55 } else {
56 QTextBrowser::setSource(n); 56 QTextBrowser::setSource(n);
57 } 57 }
58} 58}
59 59
60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
61 const char *name) 61 const char *name)
62 : KOrg::BaseView(calendar, parent, name) 62 : KOrg::BaseView(calendar, parent, name)
63{ 63{
64 // mDateLabel = 64 // mDateLabel =
65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
66 // mDateLabel->setMargin(2); 66 // mDateLabel->setMargin(2);
67 // mDateLabel->setAlignment(AlignCenter); 67 // mDateLabel->setAlignment(AlignCenter);
68 setFont( KOPrefs::instance()->mWhatsNextFont ); 68 setFont( KOPrefs::instance()->mWhatsNextFont );
69 mView = new WhatsNextTextBrowser(this); 69 mView = new WhatsNextTextBrowser(this);
70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
71 QStyleSheet* stsh = mView->styleSheet(); 71 QStyleSheet* stsh = mView->styleSheet();
72 QStyleSheetItem * style ; 72 QStyleSheetItem * style ;
73 style = stsh->item ("a" );
74 if ( style ) {
75 style->setMargin(QStyleSheetItem::MarginAll,0);
76 }
77 style = stsh->item ("h2" ); 73 style = stsh->item ("h2" );
78 if ( style ) { 74 if ( style ) {
79 style->setMargin(QStyleSheetItem::MarginAll,0); 75 style->setMargin(QStyleSheetItem::MarginAll,0);
80 } 76 }
81 style = stsh->item ("h3" ); 77 style = stsh->item ("h3" );
82 if ( style ) { 78 if ( style ) {
83 style->setMargin(QStyleSheetItem::MarginAll,0); 79 style->setMargin(QStyleSheetItem::MarginAll,0);
84 } 80 }
85 style = stsh->item ("table" );
86 if ( style ) {
87 style->setMargin(QStyleSheetItem::MarginAll,0);
88 }
89 mEventViewer = 0; 81 mEventViewer = 0;
90 82
91 QBoxLayout *topLayout = new QVBoxLayout(this); 83 QBoxLayout *topLayout = new QVBoxLayout(this);
92 // topLayout->addWidget(mDateLabel); 84 // topLayout->addWidget(mDateLabel);
93 topLayout->addWidget(mView); 85 topLayout->addWidget(mView);
94 mTimer = new QTimer( this ); 86 mTimer = new QTimer( this );
95 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); 87 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
96 88
97 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 89 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
98 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 90 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
99} 91}
100 92
101KOWhatsNextView::~KOWhatsNextView() 93KOWhatsNextView::~KOWhatsNextView()
102{ 94{
103} 95}
104 96
105int KOWhatsNextView::maxDatesHint() 97int KOWhatsNextView::maxDatesHint()
106{ 98{
107 return 0; 99 return 0;
108} 100}
109 101
110int KOWhatsNextView::currentDateCount() 102int KOWhatsNextView::currentDateCount()
111{ 103{
112 return 0; 104 return 0;
113} 105}
114 106
115QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 107QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
116{ 108{
117 QPtrList<Incidence> eventList; 109 QPtrList<Incidence> eventList;
118 110
119 return eventList; 111 return eventList;
120} 112}
121 113
122 114
123void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 115void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
124 const QDate &td) 116 const QDate &td)
125{ 117{
126#ifndef KORG_NOPRINTER 118#ifndef KORG_NOPRINTER
127 calPrinter->preview(CalPrinter::Day, fd, td); 119 calPrinter->preview(CalPrinter::Day, fd, td);
128#endif 120#endif
129} 121}
130void KOWhatsNextView::updateConfig() 122void KOWhatsNextView::updateConfig()
131{ 123{
132 setFont( KOPrefs::instance()->mWhatsNextFont ); 124 setFont( KOPrefs::instance()->mWhatsNextFont );
133 updateView(); 125 updateView();
134 126
135} 127}
136void KOWhatsNextView::showEvent ( QShowEvent * e ) 128void KOWhatsNextView::showEvent ( QShowEvent * e )
137{ 129{
138 //qDebug("KOWhatsNextView::showEvent "); 130 //qDebug("KOWhatsNextView::showEvent ");
139 restartTimer(); 131 restartTimer();
140 QWidget::showEvent ( e ); 132 QWidget::showEvent ( e );
141} 133}
142void KOWhatsNextView::hideEvent ( QHideEvent * e) 134void KOWhatsNextView::hideEvent ( QHideEvent * e)
143{ 135{
144 //qDebug(" KOWhatsNextView::hideEvent"); 136 //qDebug(" KOWhatsNextView::hideEvent");
145 mTimer->stop(); 137 mTimer->stop();
146 QWidget::hideEvent ( e ); 138 QWidget::hideEvent ( e );
147} 139}
148void KOWhatsNextView::restartTimer() 140void KOWhatsNextView::restartTimer()
149{ 141{
150 //qDebug("KOWhatsNextView::restartTimer() "); 142 //qDebug("KOWhatsNextView::restartTimer() ");
151 mTimer->start( 300000 ); 143 mTimer->start( 300000 );
152 //mTimer->start( 5000 ); 144 //mTimer->start( 5000 );
153} 145}
154void KOWhatsNextView::updateView() 146void KOWhatsNextView::updateView()
155{ 147{
156 if ( mTimer->isActive() ) 148 if ( mTimer->isActive() )
157 restartTimer(); 149 restartTimer();
158 //qDebug("KOWhatsNextView::updateView() "); 150 //qDebug("KOWhatsNextView::updateView() ");
159 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); 151 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
160 KIconLoader kil("korganizer"); 152 KIconLoader kil("korganizer");
161 QString ipath;// = new QString(); 153 QString ipath;// = new QString();
162 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); 154 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
163 //<big><big><strong>" + date + "</strong></big></big>\n"; 155 //<big><big><strong>" + date + "</strong></big></big>\n";
164 mText = "<qt><table width=\"100%\">\n"; 156 mText = "<table width=\"100%\">\n";
165 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 157 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
166#ifdef DESKTOP_VERSION 158#ifdef DESKTOP_VERSION
167 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; 159 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
168#else 160#else
169 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 161 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
170#endif 162#endif
171 // mText += "<img src=\""; 163 // mText += "<img src=\"";
172 // mText += ipath; 164 // mText += ipath;
173 // mText += "\">"; 165 // mText += "\">";
174 mEventDate = QDate::currentDate(); 166 mEventDate = QDate::currentDate();
175#ifdef DESKTOP_VERSION 167#ifdef DESKTOP_VERSION
176 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; 168 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>";
177#else 169#else
178 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; 170 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>";
179#endif 171#endif
180 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 172 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
181 int iii; 173 int iii;
182 mTodos.clear(); 174 mTodos.clear();
183 QPtrList<Event> events; 175 QPtrList<Event> events;
184 QPtrList<Todo> todos = calendar()->todos(); 176 QPtrList<Todo> todos = calendar()->todos();
185 Todo * todo; 177 Todo * todo;
186 //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; 178 //mText += "<h2>" + i18n("Events: ") + "</h2>\n";
187 int daysToShow = KOPrefs::instance()->mWhatsNextDays ; 179 int daysToShow = KOPrefs::instance()->mWhatsNextDays ;
188 bool itemAdded = false; 180 bool itemAdded = false;
189 for ( iii = 0; iii < daysToShow; ++iii ) { 181 for ( iii = 0; iii < daysToShow; ++iii ) {
190 QString date; 182 QString date;
191 itemAdded = false; 183 itemAdded = false;
192 events = calendar()->events( mEventDate, true ); 184 events = calendar()->events( mEventDate, true );
193 185
194 if ( iii == 0 ) { // today !!! 186 if ( iii == 0 ) { // today !!!
195 todo = todos.first(); 187 todo = todos.first();
196 while(todo) { 188 while(todo) {
197 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { 189 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) {
198 if ( ! itemAdded ) { 190 if ( ! itemAdded ) {
199 appendDay ( iii, mEventDate ); 191 appendDay ( iii, mEventDate );
200 itemAdded = true; 192 itemAdded = true;
201 193
202 } 194 }
203 appendEvent(todo); 195 appendEvent(todo);
204 } 196 }
205 todo = todos.next(); 197 todo = todos.next();
206 } 198 }
207 } 199 }
208 200
209 201
210 if (events.count() > 0) { 202 if (events.count() > 0) {
211 // mText += "<p></p>"; 203 // mText += "<p></p>";
212 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 204 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
213 // mText += "<h2>"; 205 // mText += "<h2>";
214 //mText += " <img src=\""; 206 //mText += " <img src=\"";
215 //mText += ipath; 207 //mText += ipath;
216 //mText += "\">"; 208 //mText += "\">";
217 if ( ! itemAdded ) { 209 if ( ! itemAdded ) {
218 appendDay ( iii, mEventDate ); 210 appendDay ( iii, mEventDate );
219 itemAdded = true;
220 211
221 } 212 }
213 // for first day (iii == 0)
214 // we may have syncevents, or events in the past, which maybe should nor be diaplayed
215 // for that reason we cannot append <table> in appendDay () for iii == 0
216 // we must append it in the first successful call of appendEvent()
222 Event *ev = events.first(); 217 Event *ev = events.first();
223 while(ev) { 218 while(ev) {
224 //qDebug("+++++event append %s", ev->summary().latin1()); 219 //qDebug("+++++event append %s", ev->summary().latin1());
225 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { 220 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) {
226 appendEvent(ev, false , iii!= 0 ); 221 if ( appendEvent(ev, false , iii!= 0,!itemAdded ) )
222 itemAdded = true;
227 } 223 }
228 ev = events.next(); 224 ev = events.next();
229 } 225 }
230 226
231 //mText += "</table>\n"; 227 //mText += "</table>\n";
232 } 228 }
233 229
234 todo = todos.first(); 230 todo = todos.first();
235 while(todo) { 231 while(todo) {
236 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { 232 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) {
237 if ( ! itemAdded ) { 233 if ( ! itemAdded ) {
238 appendDay ( iii, mEventDate ); 234 appendDay ( iii, mEventDate );
239 itemAdded = true; 235 itemAdded = true;
240 } 236 }
241 appendEvent(todo); 237 appendEvent(todo);
242 } 238 }
243 todo = todos.next(); 239 todo = todos.next();
244 } 240 }
245 if ( !itemAdded && iii == 0 ) { 241 if ( !itemAdded && iii == 0 ) {
246 // appendDay ( iii, mEventDate ); 242 // appendDay ( iii, mEventDate );
247 //mText += "<table>"; 243 //mText += "<table>";
248 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; 244 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n";
249 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; 245 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n";
250 //mText +="</table>"; 246 //mText +="</table>";
251 } 247 }
252 if ( itemAdded ) 248 if ( itemAdded )
253 mText += "</table>\n"; 249 mText += "</table>\n";
254 mEventDate = mEventDate.addDays( 1 ); 250 mEventDate = mEventDate.addDays( 1 );
255 } 251 }
256 252
257 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; 253 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios;
258 if (todos.count() > 0 && topmostPrios > 0 ) { 254 if (todos.count() > 0 && topmostPrios > 0 ) {
259 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 255 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
260 // mText += "<h2>"; 256 // mText += "<h2>";
261 //<img src=\""; 257 //<img src=\"";
262 // mText += ipath; 258 // mText += ipath;
263 // mText += "\">"; 259 // mText += "\">";
264 // mText += i18n("Overdue To-Do:") + "</h2>\n"; 260 // mText += i18n("Overdue To-Do:") + "</h2>\n";
265 261
266 //mText += "<ul>\n"; 262 //mText += "<ul>\n";
267 bool gotone = false; 263 bool gotone = false;
268 int priority = 1; 264 int priority = 1;
269 int priosFound = 0; 265 int priosFound = 0;
270#ifdef DESKTOP_VERSION 266#ifdef DESKTOP_VERSION
271 mText +="<p></p>"; 267 mText +="<p></p>";
272#endif 268#endif
273 269
274 mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; 270 mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n";
275 mText += "<ul>\n"; 271 mText += "<ul>\n";
276 while (!gotone && priority<6) { 272 while (!gotone && priority<6) {
277 todo = todos.first(); 273 todo = todos.first();
278 while(todo) { 274 while(todo) {
279 if (!todo->isCompleted() && (todo->priority() == priority) ) { 275 if (!todo->isCompleted() && (todo->priority() == priority) ) {
280 if ( appendTodo(todo) ) 276 if ( appendTodo(todo) )
281 gotone = true; 277 gotone = true;
282 } 278 }
283 todo = todos.next(); 279 todo = todos.next();
284 } 280 }
285 if ( gotone ) { 281 if ( gotone ) {
286 gotone = false; 282 gotone = false;
287 ++priosFound; 283 ++priosFound;
288 if ( priosFound == topmostPrios ) 284 if ( priosFound == topmostPrios )
289 break; 285 break;
290 } 286 }
291 priority++; 287 priority++;
292 // kdDebug() << "adding the todos..." << endl; 288 // kdDebug() << "adding the todos..." << endl;
293 } 289 }
294 mText += "</ul>\n"; 290 mText += "</ul>\n";
295 } 291 }
296 292
297 int replys = 0; 293 int replys = 0;
298 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); 294 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6));
299 if (events.count() > 0) { 295 if (events.count() > 0) {
300 Event *ev = events.first(); 296 Event *ev = events.first();
301 while(ev) { 297 while(ev) {
302 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 298 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
303 if (me!=0) { 299 if (me!=0) {
304 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 300 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
305 if (replys == 0) { 301 if (replys == 0) {
306 mText += "<p></p>"; 302 mText += "<p></p>";
307 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 303 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
308 //mText += "<h2>"; 304 //mText += "<h2>";
309 //<img src=\""; 305 //<img src=\"";
310 // mText += ipath; 306 // mText += ipath;
311 // mText += "\">"; 307 // mText += "\">";
312 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; 308 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
313 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; 309 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n";
314 mText += "<table>\n"; 310 mText += "<table>\n";
315 } 311 }
316 replys++; 312 replys++;
317 appendEvent(ev,true); 313 appendEvent(ev,true);
318 } 314 }
319 } 315 }
320 ev = events.next(); 316 ev = events.next();
321 } 317 }
322 } 318 }
323 todos = calendar()->todos(); 319 todos = calendar()->todos();
324 if (todos.count() > 0) { 320 if (todos.count() > 0) {
325 Todo *to = todos.first(); 321 Todo *to = todos.first();
326 while(to) { 322 while(to) {
327 if ( !to->isCompleted() ){ 323 if ( !to->isCompleted() ){
328 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 324 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
329 if (me!=0) { 325 if (me!=0) {
330 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 326 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
331 if (replys == 0) { 327 if (replys == 0) {
332 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; 328 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n";
333 mText += "<table>\n"; 329 mText += "<table>\n";
334 } 330 }
335 replys++; 331 replys++;
336 appendEvent(to, true); 332 appendEvent(to, true);
337 } 333 }
338 } 334 }
339 } 335 }
340 to = todos.next(); 336 to = todos.next();
341 } 337 }
342 } 338 }
343 if (replys > 0 ) mText += "</table>\n"; 339 if (replys > 0 ) mText += "</table>\n";
344 340
345 341
346 mText += "</td></tr>\n</table></qt>\n"; 342 mText += "</td></tr>\n</table>\n";
347 343
348 mView->setText(mText); 344 mView->setText(mText);
349 mView->setFocus(); 345 mView->setFocus();
350 346
351 // QPixmap bPix = SmallIcon( "back" ); 347 // QPixmap bPix = SmallIcon( "back" );
352 // qDebug("xxxxxxxxxxxxxxxxxxxxx "); 348 // qDebug("xxxxxxxxxxxxxxxxxxxxx ");
353 // QWidget* test = new QWidget(); 349 // QWidget* test = new QWidget();
354 // test->setBackgroundMode(FixedPixmap ); 350 // test->setBackgroundMode(FixedPixmap );
355 // test->setBackgroundPixmap ( bPix ); 351 // test->setBackgroundPixmap ( bPix );
356 // test->resize( 300, 400 ); 352 // test->resize( 300, 400 );
357 // test->show(); 353 // test->show();
358 // mView->setBackgroundMode(FixedPixmap ); 354 // mView->setBackgroundMode(FixedPixmap );
359 // mView->setBackgroundPixmap ( bPix ); 355 // mView->setBackgroundPixmap ( bPix );
360 // qDebug("%s ",mText.latin1()); 356 qDebug("%s ",mText.latin1());
361} 357}
362 358
363void KOWhatsNextView::appendDay( int i, QDate eventDate ) 359void KOWhatsNextView::appendDay( int i, QDate eventDate )
364{ 360{
365 QString date; 361 QString date;
366 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); 362 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer);
367 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { 363 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) {
368 if ( i == 0 ) { 364 if ( i == 0 ) {
369 mText += "<table>\n"; 365 //mText += "<table>\n";
370 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; 366 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
371 } 367 }
372 else if ( i == 1 ) 368 else if ( i == 1 )
373 date = "<em><font color=\"#000080\">" + day + "</font></em>" ; 369 date = "<em><font color=\"#000080\">" + day + "</font></em>" ;
374 else date = "<em><font color=\"#000080\">" + day + "</font></em>"; 370 else date = "<em><font color=\"#000080\">" + day + "</font></em>";
375 mText += "<h2>" + date + "</h2>\n"; 371 mText += "<h2>" + date + "</h2>\n";
376 //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 372 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
377 mText += "<table>\n"; 373 mText += "<table>\n";
378 374
379 375
380 376
381 } else { 377 } else {
382 if ( i == 0 ) { 378 if ( i == 0 ) {
383 mText += "<table>\n"; 379 //mText += "<table>\n";
384 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; 380 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
385 } 381 }
386 382
387#ifdef DESKTOP_VERSION 383#ifdef DESKTOP_VERSION
388 else if ( i == 1 ) { 384 else if ( i == 1 ) {
389 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; 385 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
390 } 386 }
391 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; 387 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>";
392#else 388#else
393 else if ( i == 1 ) { 389 else if ( i == 1 ) {
394 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; 390 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ;
395 } 391 }
396 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; 392 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>";
397 393
398#endif 394#endif
399 mText += "<h2>" + date + "</h2>\n"; 395 mText += "<h2>" + date + "</h2>\n";
400 //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 396 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
401 mText += "<table>\n"; 397 mText += "<table>\n";
402 } 398 }
403} 399}
404 400
405 401
406void KOWhatsNextView::showDates(const QDate &, const QDate &) 402void KOWhatsNextView::showDates(const QDate &, const QDate &)
407{ 403{
408 updateView(); 404 updateView();
409} 405}
410 406
411void KOWhatsNextView::showEvents(QPtrList<Event>) 407void KOWhatsNextView::showEvents(QPtrList<Event>)
412{ 408{
413} 409}
414 410
415void KOWhatsNextView::changeEventDisplay(Event *, int action) 411void KOWhatsNextView::changeEventDisplay(Event *, int action)
416{ 412{
417 switch(action) { 413 switch(action) {
418 case KOGlobals::EVENTADDED: 414 case KOGlobals::EVENTADDED:
419 updateView(); 415 updateView();
420 break; 416 break;
421 case KOGlobals::EVENTEDITED: 417 case KOGlobals::EVENTEDITED:
422 updateView(); 418 updateView();
423 break; 419 break;
424 case KOGlobals::EVENTDELETED: 420 case KOGlobals::EVENTDELETED:
425 updateView(); 421 updateView();
426 break; 422 break;
427 default: 423 default:
428 updateView(); 424 updateView();
429 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; 425 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
430 } 426 }
431} 427}
432 428
433void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) 429bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable )
434{ 430{
435 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) 431 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
436 return; 432 return false;
437 QDateTime cdt = QDateTime::currentDateTime(); 433 QDateTime cdt = QDateTime::currentDateTime();
438 QDateTime noc; 434 QDateTime noc;
439 QString tempText; 435 QString tempText;
436 if ( appendTable && !notRed ) {
437 tempText = "<table>";
438 }
440 bool ok = true; 439 bool ok = true;
441 if ( reply ) { 440 if ( reply ) {
442 noc = ev->getNextOccurence( cdt, &ok ); 441 noc = ev->getNextOccurence( cdt, &ok );
443 if (! ok && ev->type() == "Event") 442 if (! ok && ev->type() == "Event")
444 return; 443 return false;
445 } 444 }
446 tempText += "<tr><td><b>"; 445 tempText += "<tr><td><b>";
447 if (ev->type()=="Event") { 446 if (ev->type()=="Event") {
448 if (reply) { 447 if (reply) {
449 if (!ev->doesFloat()) 448 if (!ev->doesFloat())
450 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 449 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
451 else 450 else
452 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 451 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
453 452
454 } else { 453 } else {
455 if (!ev->doesFloat()) { 454 if (!ev->doesFloat()) {
456 Event *event = static_cast<Event *>(ev); 455 Event *event = static_cast<Event *>(ev);
457 QDateTime st,end; 456 QDateTime st,end;
458 if ( event->recurrence()->doesRecur() ) { 457 if ( event->recurrence()->doesRecur() ) {
459 QDate recDate= mEventDate; 458 QDate recDate= mEventDate;
460 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 459 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
461 while ( ! event->recursOn( recDate ) ) { 460 while ( ! event->recursOn( recDate ) ) {
462 recDate = recDate.addDays( -1 ); 461 recDate = recDate.addDays( -1 );
463 462
464 } 463 }
465 st = QDateTime ( recDate, event->dtStart().time() ); 464 st = QDateTime ( recDate, event->dtStart().time() );
466 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); 465 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
467 } 466 }
468 else { 467 else {
469 st = event->dtStart(); 468 st = event->dtStart();
470 end = event->dtEnd(); 469 end = event->dtEnd();
471 } 470 }
472 471
473 472
474 QString dateText; 473 QString dateText;
475 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); 474 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() );
476 if ( st.date() < mEventDate ) 475 if ( st.date() < mEventDate )
477 dateText = "++:++-"; 476 dateText = "++:++-";
478 else 477 else
479 dateText = event->dtStartTimeStr() + "-"; 478 dateText = event->dtStartTimeStr() + "-";
480 if ( end.date() > mEventDate ) 479 if ( end.date() > mEventDate )
481 dateText += "++:++"; 480 dateText += "++:++";
482 else 481 else
483 dateText += event->dtEndTimeStr(); 482 dateText += event->dtEndTimeStr();
484 if ( notRed ) 483 if ( notRed )
485 tempText += dateText; 484 tempText += dateText;
486 else { 485 else {
487 if ( end < cdt ) { 486 if ( end < cdt ) {
488 if ( !KOPrefs::instance()->mWNViewShowsPast ) 487 if ( !KOPrefs::instance()->mWNViewShowsPast )
489 return; 488 return false;
490 tempText += "<font color=\"#F00000\">" + dateText + "</font>"; 489 tempText += "<font color=\"#F00000\">" + dateText + "</font>";
491 } 490 }
492 else if ( st < cdt ) 491 else if ( st < cdt )
493 tempText += "<font color=\"#008000\">" + dateText + "</font>"; 492 tempText += "<font color=\"#008000\">" + dateText + "</font>";
494 else 493 else
495 tempText += dateText; 494 tempText += dateText;
496 495
497 } 496 }
498 497
499 } else { 498 } else {
500 tempText += i18n("Allday:"); 499 tempText += i18n("Allday:");
501 500
502 } 501 }
503 } 502 }
504 } else { 503 } else {
505 mTodos.append( ev ); 504 mTodos.append( ev );
506 tempText += i18n("ToDo:"); 505 tempText += i18n("ToDo:");
507 if (reply) { 506 if (reply) {
508 tempText += " "; 507 tempText += " ";
509 if ( noc != cdt ) { 508 if ( noc != cdt ) {
510 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 509 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
511 } 510 }
512 } else { 511 } else {
513 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 512 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
514 // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 513 // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
515 QString dfs = KGlobal::locale()->dateFormatShort(); 514 QString dfs = KGlobal::locale()->dateFormatShort();
516 KGlobal::locale()->setDateFormatShort("%d.%b"); 515 KGlobal::locale()->setDateFormatShort("%d.%b");
517 tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; 516 tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
518 KGlobal::locale()->setDateFormatShort(dfs); 517 KGlobal::locale()->setDateFormatShort(dfs);
519 } else { 518 } else {
520 if (!ev->doesFloat() ) 519 if (!ev->doesFloat() )
521 if( ( (Todo*)ev)->dtDue() < cdt ) { 520 if( ( (Todo*)ev)->dtDue() < cdt ) {
522 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 521 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
523 522
524 523
525 } else 524 } else
526 tempText +=((Todo*)ev)->dtDueTimeStr(); 525 tempText +=((Todo*)ev)->dtDueTimeStr();
527 mTodos.append( ev ); 526 mTodos.append( ev );
528 } 527 }
529 } 528 }
530 } 529 }
531 tempText += "</b></td><td>"; 530 tempText += "</b></td><td>";
532 bool needClose = false; 531 bool needClose = false;
533 if ( ev->cancelled() ) { 532 if ( ev->cancelled() ) {
534 tempText += "<font color=\"#F00000\">[c"; 533 tempText += "<font color=\"#F00000\">[c";
535 needClose =true; 534 needClose =true;
536 535
537 } 536 }
538 if ( ev->isAlarmEnabled() ) { 537 if ( ev->isAlarmEnabled() ) {
539 if ( !needClose) 538 if ( !needClose)
540 tempText +="["; 539 tempText +="[";
541 tempText += "a"; 540 tempText += "a";
542 needClose =true; 541 needClose =true;
543 542
544 } 543 }
545 if ( ev->description().length() > 0 ) { 544 if ( ev->description().length() > 0 ) {
546 if ( !needClose) 545 if ( !needClose)
547 tempText +="["; 546 tempText +="[";
548 tempText += "i"; 547 tempText += "i";
549 needClose =true; 548 needClose =true;
550 } 549 }
551 if ( ev->recurrence()->doesRecur() ) { 550 if ( ev->recurrence()->doesRecur() ) {
552 if ( !needClose) 551 if ( !needClose)
553 tempText +="["; 552 tempText +="[";
554 tempText += "r"; 553 tempText += "r";
555 needClose =true; 554 needClose =true;
556 } 555 }
557 if ( needClose ) { 556 if ( needClose ) {
558 tempText += "] "; 557 tempText += "] ";
559 } 558 }
560 if ( ev->cancelled() ) 559 if ( ev->cancelled() )
561 tempText += "</font>"; 560 tempText += "</font>";
562 tempText += "<a "; 561 tempText += "<a ";
563 if (ev->type()=="Event") tempText += "href=\"event:"; 562 if (ev->type()=="Event") tempText += "href=\"event:";
564 if (ev->type()=="Todo") tempText += "href=\"todo:"; 563 if (ev->type()=="Todo") tempText += "href=\"todo:";
565 tempText += ev->uid() + "\">"; 564 tempText += ev->uid() + "\">";
566 if ( ev->summary().length() > 0 ) 565 if ( ev->summary().length() > 0 )
567 tempText += ev->summary(); 566 tempText += ev->summary();
568 else 567 else
569 tempText += i18n("-no summary-"); 568 tempText += i18n("-no summary-");
570 tempText += "</a>"; 569 tempText += "</a>";
571 if ( KOPrefs::instance()->mWNViewShowLocation ) 570 if ( KOPrefs::instance()->mWNViewShowLocation )
572 if ( !ev->location().isEmpty() ) 571 if ( !ev->location().isEmpty() )
573 tempText += " ("+ev->location() +")"; 572 tempText += " ("+ev->location() +")";
574 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 573 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
575 tempText += " ["+ev->relatedTo()->summary() +"]"; 574 tempText += " ["+ev->relatedTo()->summary() +"]";
576 tempText += "</td></tr>\n"; 575 tempText += "</td></tr>\n";
577 mText += tempText; 576 mText += tempText;
577 return true;
578} 578}
579 579
580bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 580bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
581{ 581{
582 if ( mTodos.find( ev ) != mTodos.end() ) return false; 582 if ( mTodos.find( ev ) != mTodos.end() ) return false;
583 583
584 mTodos.append( ev ); 584 mTodos.append( ev );
585 if ( !isSub ) 585 if ( !isSub )
586 mText += "<p>"; 586 mText += "<p>";
587 else 587 else
588 mText += "<li>"; 588 mText += "<li>";
589 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; 589 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
590 590
591 591
592 mText += ind; 592 mText += ind;
593 bool needClose = false; 593 bool needClose = false;
594 if ( ev->cancelled() ) { 594 if ( ev->cancelled() ) {
595 mText += "<font color=\"#F00000\">[c"; 595 mText += "<font color=\"#F00000\">[c";
596 needClose =true; 596 needClose =true;
597 597
598 } 598 }
599 if ( ev->isAlarmEnabled() ) { 599 if ( ev->isAlarmEnabled() ) {
600 if ( !needClose) 600 if ( !needClose)
601 mText +="["; 601 mText +="[";
602 mText += "a"; 602 mText += "a";
603 needClose =true; 603 needClose =true;
604 604
605 } 605 }
606 606
607 if ( ev->description().length() > 0 ) { 607 if ( ev->description().length() > 0 ) {
608 if ( !needClose) 608 if ( !needClose)
609 mText +="["; 609 mText +="[";
610 mText += "i"; 610 mText += "i";
611 needClose =true; 611 needClose =true;
612 } 612 }
613 // if ( ev->recurrence()->doesRecur() ) { 613 // if ( ev->recurrence()->doesRecur() ) {
614 // if ( !needClose) 614 // if ( !needClose)
615 // mText +="("; 615 // mText +="(";
616 // mText += "r"; 616 // mText += "r";
617 // needClose =true; 617 // needClose =true;
618 // } 618 // }
619 if ( needClose ) 619 if ( needClose )
620 mText += "] "; 620 mText += "] ";
621 if ( ev->cancelled() ) 621 if ( ev->cancelled() )
622 mText += "</font>"; 622 mText += "</font>";
623 mText += "<a href=\"todo:" + ev->uid() + "\">"; 623 mText += "<a href=\"todo:" + ev->uid() + "\">";
624 mText += ev->summary(); 624 mText += ev->summary();
625 mText += "</a>"; 625 mText += "</a>";
626 if ( ((Todo*)ev)->hasDueDate () ) { 626 if ( ((Todo*)ev)->hasDueDate () ) {
627 QString year = ""; 627 QString year = "";
628 int ye = ((Todo*)ev)->dtDue().date().year(); 628 int ye = ((Todo*)ev)->dtDue().date().year();
629 if ( QDateTime::currentDateTime().date().year() != ye ) 629 if ( QDateTime::currentDateTime().date().year() != ye )
630 year = QString::number( ye ); 630 year = QString::number( ye );
631 QString dfs = KGlobal::locale()->dateFormatShort(); 631 QString dfs = KGlobal::locale()->dateFormatShort();
632 KGlobal::locale()->setDateFormatShort("%d.%b"); 632 KGlobal::locale()->setDateFormatShort("%d.%b");
633 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; 633 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
634 KGlobal::locale()->setDateFormatShort(dfs); 634 KGlobal::locale()->setDateFormatShort(dfs);
635 } 635 }
636 if ( KOPrefs::instance()->mWNViewShowLocation ) 636 if ( KOPrefs::instance()->mWNViewShowLocation )
637 if ( !ev->location().isEmpty() ) 637 if ( !ev->location().isEmpty() )
638 mText += " ("+ev->location() +")"; 638 mText += " ("+ev->location() +")";
639 if ( !isSub ) { 639 if ( !isSub ) {
640 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) 640 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
641 mText += " ["+ev->relatedTo()->summary() +"]"; 641 mText += " ["+ev->relatedTo()->summary() +"]";
642 mText += "</p>\n"; 642 mText += "</p>\n";
643 } 643 }
644 else { 644 else {
645 ind += "-"; 645 ind += "-";
646 mText += "</li>\n"; 646 mText += "</li>\n";
647 } 647 }
648 QPtrList<Incidence> Relations = ev->relations(); 648 QPtrList<Incidence> Relations = ev->relations();
649 Incidence *to; 649 Incidence *to;
650 for (to=Relations.first();to;to=Relations.next()) { 650 for (to=Relations.first();to;to=Relations.next()) {
651 if (!((Todo*)to)->isCompleted()) 651 if (!((Todo*)to)->isCompleted())
652 appendTodo( to, ind , true ); 652 appendTodo( to, ind , true );
653 } 653 }
654 654
655 return true; 655 return true;
656} 656}
657 657
658/* 658/*
659 void KOWhatsNextView::createEventViewer() 659 void KOWhatsNextView::createEventViewer()
660 { 660 {
661 if (!mEventViewer) { 661 if (!mEventViewer) {
662 662
663 mEventViewer = new KOEventViewerDialog(this); 663 mEventViewer = new KOEventViewerDialog(this);
664 } 664 }
665 } 665 }
666*/ 666*/
667void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) 667void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
668{ 668{
669 mEventViewer = v; 669 mEventViewer = v;
670} 670}
671 671
672// TODO: Create this function in CalendarView and remove it from here 672// TODO: Create this function in CalendarView and remove it from here
673void KOWhatsNextView::showIncidence(const QString &uid) 673void KOWhatsNextView::showIncidence(const QString &uid)
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 1118bdd..9049268 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -1,96 +1,96 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOWHATSNEXTVIEW_H 19#ifndef KOWHATSNEXTVIEW_H
20#define KOWHATSNEXTVIEW_H 20#define KOWHATSNEXTVIEW_H
21 21
22#include <qtextbrowser.h> 22#include <qtextbrowser.h>
23#include <qtimer.h> 23#include <qtimer.h>
24 24
25#include <korganizer/baseview.h> 25#include <korganizer/baseview.h>
26 26
27class QListView; 27class QListView;
28class QLabel; 28class QLabel;
29 29
30class KOEventViewerDialog; 30class KOEventViewerDialog;
31 31
32class WhatsNextTextBrowser : public QTextBrowser { 32class WhatsNextTextBrowser : public QTextBrowser {
33 Q_OBJECT 33 Q_OBJECT
34 public: 34 public:
35 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} 35 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}
36 36
37 void setSource(const QString &); 37 void setSource(const QString &);
38 38
39 signals: 39 signals:
40 void showIncidence(const QString &uid); 40 void showIncidence(const QString &uid);
41}; 41};
42 42
43 43
44/** 44/**
45 This class provides a view of the next events and todos 45 This class provides a view of the next events and todos
46*/ 46*/
47class KOWhatsNextView : public KOrg::BaseView 47class KOWhatsNextView : public KOrg::BaseView
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, 51 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0,
52 const char *name = 0); 52 const char *name = 0);
53 ~KOWhatsNextView(); 53 ~KOWhatsNextView();
54 54
55 virtual int maxDatesHint(); 55 virtual int maxDatesHint();
56 virtual int currentDateCount(); 56 virtual int currentDateCount();
57 void setEventViewer(KOEventViewerDialog* v ); 57 void setEventViewer(KOEventViewerDialog* v );
58 virtual QPtrList<Incidence> selectedIncidences(); 58 virtual QPtrList<Incidence> selectedIncidences();
59 DateList selectedDates() 59 DateList selectedDates()
60 {DateList q; 60 {DateList q;
61 return q;} 61 return q;}
62 virtual void printPreview(CalPrinter *calPrinter, 62 virtual void printPreview(CalPrinter *calPrinter,
63 const QDate &, const QDate &); 63 const QDate &, const QDate &);
64 64
65 public slots: 65 public slots:
66 virtual void updateView(); 66 virtual void updateView();
67 virtual void showDates(const QDate &start, const QDate &end); 67 virtual void showDates(const QDate &start, const QDate &end);
68 virtual void showEvents(QPtrList<Event> eventList); 68 virtual void showEvents(QPtrList<Event> eventList);
69 void updateConfig(); 69 void updateConfig();
70 void changeEventDisplay(Event *, int); 70 void changeEventDisplay(Event *, int);
71 71
72 protected: 72 protected:
73 void appendEvent(Incidence *, bool reply=false, bool notRed = true); 73 bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false);
74 bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); 74 bool appendTodo(Incidence *, QString ind = "", bool isSub = false );
75 void appendDay( int i, QDate date ); 75 void appendDay( int i, QDate date );
76 QDate mEventDate; 76 QDate mEventDate;
77 virtual void showEvent ( QShowEvent * ); 77 virtual void showEvent ( QShowEvent * );
78 virtual void hideEvent ( QHideEvent * ); 78 virtual void hideEvent ( QHideEvent * );
79 79
80 private slots: 80 private slots:
81 void showIncidence(const QString &); 81 void showIncidence(const QString &);
82 void restartTimer(); 82 void restartTimer();
83 83
84 84
85 private: 85 private:
86 //void createEventViewer(); 86 //void createEventViewer();
87 QTimer* mTimer; 87 QTimer* mTimer;
88 QTextBrowser *mView; 88 QTextBrowser *mView;
89 QString mText; 89 QString mText;
90 // QLabel *mDateLabel; 90 // QLabel *mDateLabel;
91 KOEventViewerDialog *mEventViewer; 91 KOEventViewerDialog *mEventViewer;
92 92
93 QValueList<Incidence *> mTodos; 93 QValueList<Incidence *> mTodos;
94}; 94};
95 95
96#endif 96#endif