summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-04-18 10:41:31 (UTC)
committer zautrix <zautrix>2005-04-18 10:41:31 (UTC)
commit409e329447a7d00a93a56855fcddadbb0f793163 (patch) (unidiff)
tree1c92498d2dfb4c89358c64a6944aca1300a27d11 /libkcal
parent0ff0dca7ccb94ebb1381351e4e4081fe0bac500a (diff)
downloadkdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.zip
kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.gz
kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.bz2
morefixes
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp28
-rw-r--r--libkcal/incidence.h3
2 files changed, 29 insertions, 2 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 9c35b1d..762103f 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -324,54 +324,80 @@ void Incidence::setDescription(const QString &description)
324QString Incidence::description() const 324QString Incidence::description() const
325{ 325{
326 return mDescription; 326 return mDescription;
327} 327}
328 328
329 329
330void Incidence::setSummary(const QString &summary) 330void Incidence::setSummary(const QString &summary)
331{ 331{
332 if (mReadOnly) return; 332 if (mReadOnly) return;
333 mSummary = summary; 333 mSummary = summary;
334 updated(); 334 updated();
335} 335}
336 336
337QString Incidence::summary() const 337QString Incidence::summary() const
338{ 338{
339 return mSummary; 339 return mSummary;
340} 340}
341void Incidence::checkCategories() 341void Incidence::checkCategories()
342{ 342{
343 mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); 343 mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday"));
344 mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); 344 mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday"));
345 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); 345 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary"));
346} 346}
347 347
348void Incidence::setCategories(const QStringList &categories) 348void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false
349{
350 if (mReadOnly) return;
351 int i;
352 for( i = 0; i < categories.count(); ++i ) {
353 if ( !mCategories.contains (categories[i]))
354 mCategories.append( categories[i] );
355 }
356 checkCategories();
357 updated();
358 if ( addToRelations ) {
359 Incidence * inc;
360 QPtrList<Incidence> Relations = relations();
361 for (inc=Relations.first();inc;inc=Relations.next()) {
362 inc->addCategories( categories, true );
363 }
364 }
365}
366
367void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false
349{ 368{
350 if (mReadOnly) return; 369 if (mReadOnly) return;
351 mCategories = categories; 370 mCategories = categories;
352 checkCategories(); 371 checkCategories();
353 updated(); 372 updated();
373 if ( setForRelations ) {
374 Incidence * inc;
375 QPtrList<Incidence> Relations = relations();
376 for (inc=Relations.first();inc;inc=Relations.next()) {
377 inc->setCategories( categories, true );
378 }
379 }
354} 380}
355 381
356// TODO: remove setCategories(QString) function 382// TODO: remove setCategories(QString) function
357void Incidence::setCategories(const QString &catStr) 383void Incidence::setCategories(const QString &catStr)
358{ 384{
359 if (mReadOnly) return; 385 if (mReadOnly) return;
360 mCategories.clear(); 386 mCategories.clear();
361 387
362 if (catStr.isEmpty()) return; 388 if (catStr.isEmpty()) return;
363 389
364 mCategories = QStringList::split(",",catStr); 390 mCategories = QStringList::split(",",catStr);
365 391
366 QStringList::Iterator it; 392 QStringList::Iterator it;
367 for(it = mCategories.begin();it != mCategories.end(); ++it) { 393 for(it = mCategories.begin();it != mCategories.end(); ++it) {
368 *it = (*it).stripWhiteSpace(); 394 *it = (*it).stripWhiteSpace();
369 } 395 }
370 checkCategories(); 396 checkCategories();
371 updated(); 397 updated();
372} 398}
373 399
374QStringList Incidence::categories() const 400QStringList Incidence::categories() const
375{ 401{
376 return mCategories; 402 return mCategories;
377} 403}
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 327e7dd..ebd50d0 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -130,49 +130,50 @@ class Incidence : public IncidenceBase
130 /** return time and date of creation. */ 130 /** return time and date of creation. */
131 QDateTime created() const; 131 QDateTime created() const;
132 132
133 /** set the number of revisions this event has seen */ 133 /** set the number of revisions this event has seen */
134 void setRevision(int rev); 134 void setRevision(int rev);
135 /** return the number of revisions this event has seen */ 135 /** return the number of revisions this event has seen */
136 int revision() const; 136 int revision() const;
137 137
138 /** Set starting date/time. */ 138 /** Set starting date/time. */
139 virtual void setDtStart(const QDateTime &dtStart); 139 virtual void setDtStart(const QDateTime &dtStart);
140 /** Return the incidence's ending date/time as a QDateTime. */ 140 /** Return the incidence's ending date/time as a QDateTime. */
141 virtual QDateTime dtEnd() const { return QDateTime(); } 141 virtual QDateTime dtEnd() const { return QDateTime(); }
142 142
143 /** sets the event's lengthy description. */ 143 /** sets the event's lengthy description. */
144 void setDescription(const QString &description); 144 void setDescription(const QString &description);
145 /** returns a reference to the event's description. */ 145 /** returns a reference to the event's description. */
146 QString description() const; 146 QString description() const;
147 147
148 /** sets the event's short summary. */ 148 /** sets the event's short summary. */
149 void setSummary(const QString &summary); 149 void setSummary(const QString &summary);
150 /** returns a reference to the event's summary. */ 150 /** returns a reference to the event's summary. */
151 QString summary() const; 151 QString summary() const;
152 152
153 /** set event's applicable categories */ 153 /** set event's applicable categories */
154 void setCategories(const QStringList &categories); 154 void setCategories(const QStringList &categories, bool setForRelations = false);
155 void addCategories(const QStringList &categories, bool addToRelations = false);
155 /** set event's categories based on a comma delimited string */ 156 /** set event's categories based on a comma delimited string */
156 void setCategories(const QString &catStr); 157 void setCategories(const QString &catStr);
157 /** return categories in a list */ 158 /** return categories in a list */
158 QStringList categories() const; 159 QStringList categories() const;
159 /** return categories as a comma separated string */ 160 /** return categories as a comma separated string */
160 QString categoriesStr(); 161 QString categoriesStr();
161 QString categoriesStrWithSpace(); 162 QString categoriesStrWithSpace();
162 163
163 /** point at some other event to which the event relates. This function should 164 /** point at some other event to which the event relates. This function should
164 * only be used when constructing a calendar before the related Event 165 * only be used when constructing a calendar before the related Event
165 * exists. */ 166 * exists. */
166 void setRelatedToUid(const QString &); 167 void setRelatedToUid(const QString &);
167 /** what event does this one relate to? This function should 168 /** what event does this one relate to? This function should
168 * only be used when constructing a calendar before the related Event 169 * only be used when constructing a calendar before the related Event
169 * exists. */ 170 * exists. */
170 QString relatedToUid() const; 171 QString relatedToUid() const;
171 /** point at some other event to which the event relates */ 172 /** point at some other event to which the event relates */
172 void setRelatedTo(Incidence *relatedTo); 173 void setRelatedTo(Incidence *relatedTo);
173 /** what event does this one relate to? */ 174 /** what event does this one relate to? */
174 Incidence *relatedTo() const; 175 Incidence *relatedTo() const;
175 /** All events that are related to this event */ 176 /** All events that are related to this event */
176 QPtrList<Incidence> relations() const; 177 QPtrList<Incidence> relations() const;
177 /** Add an event which is related to this event */ 178 /** Add an event which is related to this event */
178 void addRelation(Incidence *); 179 void addRelation(Incidence *);