summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
authorzautrix <zautrix>2005-04-18 10:41:31 (UTC)
committer zautrix <zautrix>2005-04-18 10:41:31 (UTC)
commit409e329447a7d00a93a56855fcddadbb0f793163 (patch) (side-by-side diff)
tree1c92498d2dfb4c89358c64a6944aca1300a27d11 /libkcal/incidence.cpp
parent0ff0dca7ccb94ebb1381351e4e4081fe0bac500a (diff)
downloadkdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.zip
kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.gz
kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.bz2
morefixes
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 9c35b1d..762103f 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -336,30 +336,56 @@ void Incidence::setSummary(const QString &summary)
QString Incidence::summary() const
{
return mSummary;
}
void Incidence::checkCategories()
{
mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday"));
mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday"));
mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary"));
}
-void Incidence::setCategories(const QStringList &categories)
+void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false
+{
+ if (mReadOnly) return;
+ int i;
+ for( i = 0; i < categories.count(); ++i ) {
+ if ( !mCategories.contains (categories[i]))
+ mCategories.append( categories[i] );
+ }
+ checkCategories();
+ updated();
+ if ( addToRelations ) {
+ Incidence * inc;
+ QPtrList<Incidence> Relations = relations();
+ for (inc=Relations.first();inc;inc=Relations.next()) {
+ inc->addCategories( categories, true );
+ }
+ }
+}
+
+void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false
{
if (mReadOnly) return;
mCategories = categories;
checkCategories();
updated();
+ if ( setForRelations ) {
+ Incidence * inc;
+ QPtrList<Incidence> Relations = relations();
+ for (inc=Relations.first();inc;inc=Relations.next()) {
+ inc->setCategories( categories, true );
+ }
+ }
}
// TODO: remove setCategories(QString) function
void Incidence::setCategories(const QString &catStr)
{
if (mReadOnly) return;
mCategories.clear();
if (catStr.isEmpty()) return;
mCategories = QStringList::split(",",catStr);