summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.cpp
Unidiff
Diffstat (limited to 'libkcal/incidencebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidencebase.cpp12
1 files changed, 0 insertions, 12 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index f1db8b7..5d8785b 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -9,89 +9,87 @@
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#include <kglobal.h> 21#include <kglobal.h>
22#include <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24 24
25#include "calformat.h" 25#include "calformat.h"
26 26
27#include "incidencebase.h" 27#include "incidencebase.h"
28 28
29using namespace KCal; 29using namespace KCal;
30 30
31IncidenceBase::IncidenceBase() : 31IncidenceBase::IncidenceBase() :
32 mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), 32 mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false),
33 mPilotId(0), mSyncStatus(SYNCMOD) 33 mPilotId(0), mSyncStatus(SYNCMOD)
34{ 34{
35 setUid(CalFormat::createUniqueId()); 35 setUid(CalFormat::createUniqueId());
36 mOrganizer = ""; 36 mOrganizer = "";
37 mFloats = false; 37 mFloats = false;
38 mDuration = 0; 38 mDuration = 0;
39 mHasDuration = false; 39 mHasDuration = false;
40 mPilotId = 0; 40 mPilotId = 0;
41 mZaurusId = -1;
42 mZaurusUid = 0; 41 mZaurusUid = 0;
43 mExternalId = ":"; 42 mExternalId = ":";
44 mTempSyncStat = 0; 43 mTempSyncStat = 0;
45 mSyncStatus = 0; 44 mSyncStatus = 0;
46 mAttendees.setAutoDelete( true ); 45 mAttendees.setAutoDelete( true );
47} 46}
48 47
49IncidenceBase::IncidenceBase(const IncidenceBase &i) : 48IncidenceBase::IncidenceBase(const IncidenceBase &i) :
50 CustomProperties( i ) 49 CustomProperties( i )
51{ 50{
52 mReadOnly = i.mReadOnly; 51 mReadOnly = i.mReadOnly;
53 mDtStart = i.mDtStart; 52 mDtStart = i.mDtStart;
54 mDuration = i.mDuration; 53 mDuration = i.mDuration;
55 mHasDuration = i.mHasDuration; 54 mHasDuration = i.mHasDuration;
56 mOrganizer = i.mOrganizer; 55 mOrganizer = i.mOrganizer;
57 mUid = i.mUid; 56 mUid = i.mUid;
58 QPtrList<Attendee> attendees = i.attendees(); 57 QPtrList<Attendee> attendees = i.attendees();
59 for( Attendee *a = attendees.first(); a; a = attendees.next() ) { 58 for( Attendee *a = attendees.first(); a; a = attendees.next() ) {
60 mAttendees.append( new Attendee( *a ) ); 59 mAttendees.append( new Attendee( *a ) );
61 } 60 }
62 mFloats = i.mFloats; 61 mFloats = i.mFloats;
63 mLastModified = i.mLastModified; 62 mLastModified = i.mLastModified;
64 mPilotId = i.mPilotId; 63 mPilotId = i.mPilotId;
65 mZaurusId = i.mZaurusId;
66 mZaurusUid = i.mZaurusUid; 64 mZaurusUid = i.mZaurusUid;
67 mTempSyncStat = i.mTempSyncStat; 65 mTempSyncStat = i.mTempSyncStat;
68 mSyncStatus = i.mSyncStatus; 66 mSyncStatus = i.mSyncStatus;
69 mExternalId = i.mExternalId; 67 mExternalId = i.mExternalId;
70 // The copied object is a new one, so it isn't observed by the observer 68 // The copied object is a new one, so it isn't observed by the observer
71 // of the original object. 69 // of the original object.
72 mObservers.clear(); 70 mObservers.clear();
73 71
74 mAttendees.setAutoDelete( true ); 72 mAttendees.setAutoDelete( true );
75} 73}
76 74
77IncidenceBase::~IncidenceBase() 75IncidenceBase::~IncidenceBase()
78{ 76{
79} 77}
80 78
81 79
82bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) 80bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 )
83{ 81{
84 // do not compare mSyncStatus and mExternalId 82 // do not compare mSyncStatus and mExternalId
85 if( i1.attendees().count() != i2.attendees().count() ) { 83 if( i1.attendees().count() != i2.attendees().count() ) {
86 return false; // no need to check further 84 return false; // no need to check further
87 } 85 }
88 if ( i1.attendees().count() > 0 ) { 86 if ( i1.attendees().count() > 0 ) {
89 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; 87 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ;
90 while ( a1 ) { 88 while ( a1 ) {
91 if ( !( (*a1) == (*a2)) ) 89 if ( !( (*a1) == (*a2)) )
92 { 90 {
93 //qDebug("Attendee not equal "); 91 //qDebug("Attendee not equal ");
94 return false; 92 return false;
95 } 93 }
96 a1 = i1.attendees().next(); 94 a1 = i1.attendees().next();
97 a2 = i2.attendees().next(); 95 a2 = i2.attendees().next();
@@ -313,74 +311,64 @@ int IncidenceBase::duration() const
313 311
314void IncidenceBase::setHasDuration(bool b) 312void IncidenceBase::setHasDuration(bool b)
315{ 313{
316 mHasDuration = b; 314 mHasDuration = b;
317} 315}
318 316
319bool IncidenceBase::hasDuration() const 317bool IncidenceBase::hasDuration() const
320{ 318{
321 return mHasDuration; 319 return mHasDuration;
322} 320}
323 321
324void IncidenceBase::setSyncStatus(int stat) 322void IncidenceBase::setSyncStatus(int stat)
325{ 323{
326 if (mReadOnly) return; 324 if (mReadOnly) return;
327 mSyncStatus = stat; 325 mSyncStatus = stat;
328} 326}
329 327
330int IncidenceBase::syncStatus() const 328int IncidenceBase::syncStatus() const
331{ 329{
332 return mSyncStatus; 330 return mSyncStatus;
333} 331}
334 332
335void IncidenceBase::setPilotId( int id ) 333void IncidenceBase::setPilotId( int id )
336{ 334{
337 if (mReadOnly) return; 335 if (mReadOnly) return;
338 mPilotId = id; 336 mPilotId = id;
339} 337}
340 338
341int IncidenceBase::pilotId() const 339int IncidenceBase::pilotId() const
342{ 340{
343 return mPilotId; 341 return mPilotId;
344} 342}
345void IncidenceBase::setZaurusId( int id )
346{
347 if (mReadOnly) return;
348 mZaurusId = id;
349}
350
351int IncidenceBase::zaurusId() const
352{
353 return mZaurusId;
354}
355 343
356int IncidenceBase::zaurusUid() const 344int IncidenceBase::zaurusUid() const
357{ 345{
358 return mZaurusUid; 346 return mZaurusUid;
359} 347}
360void IncidenceBase::setZaurusUid( int id ) 348void IncidenceBase::setZaurusUid( int id )
361{ 349{
362 if (mReadOnly) return; 350 if (mReadOnly) return;
363 mZaurusUid = id; 351 mZaurusUid = id;
364} 352}
365 353
366int IncidenceBase::tempSyncStat() const 354int IncidenceBase::tempSyncStat() const
367{ 355{
368 return mTempSyncStat; 356 return mTempSyncStat;
369} 357}
370void IncidenceBase::setTempSyncStat( int id ) 358void IncidenceBase::setTempSyncStat( int id )
371{ 359{
372 if (mReadOnly) return; 360 if (mReadOnly) return;
373 mTempSyncStat = id; 361 mTempSyncStat = id;
374} 362}
375 363
376void IncidenceBase::setID( const QString & prof , int id ) 364void IncidenceBase::setID( const QString & prof , int id )
377{ 365{
378 int num = mExternalId.find( ":"+prof+";" ); 366 int num = mExternalId.find( ":"+prof+";" );
379 if ( num >= 0 ) { 367 if ( num >= 0 ) {
380 int len = prof.length()+2; 368 int len = prof.length()+2;
381 int end = mExternalId.find( ";", num+len ); 369 int end = mExternalId.find( ";", num+len );
382 if ( end > 0 ) { 370 if ( end > 0 ) {
383 mExternalId = mExternalId.left( num+len ) +QString::number( id)+mExternalId.mid( end ); 371 mExternalId = mExternalId.left( num+len ) +QString::number( id)+mExternalId.mid( end );
384 } else 372 } else
385 qDebug("Error in IncidenceBase::setID "); 373 qDebug("Error in IncidenceBase::setID ");
386 } else { 374 } else {