[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bkdepim=5D_kalarm=3A_Remove_KAEvent=27s_non-useful_m?=
From:       David Jarvie <djarvie () kde ! org>
Date:       2011-01-29 17:03:13
Message-ID: 20110129170313.01EB9A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 7499769ef5caa5e218132e9532c32f42216bda02 by David Jarvie.
Pushed by djarvie into branch 'master'.

Remove KAEvent's non-useful mUpdated member

M  +0    -1    kalarm/akonadimodel.cpp     
M  +0    -2    kalarm/alarmcalendar.cpp     
M  +1    -27   kalarm/cal/kaevent.cpp     
M  +14   -18   kalarm/cal/kaevent.h     
M  +4    -8    kalarm/kalarmapp.cpp     
M  +1    -2    kalarm/recurrenceedit.cpp     

http://commits.kde.org/ee6cc38b/7499769ef5caa5e218132e9532c32f42216bda02

diff --git a/kalarm/akonadimodel.cpp b/kalarm/akonadimodel.cpp
index dca14c3..c6465c8 100644
--- a/kalarm/akonadimodel.cpp
+++ b/kalarm/akonadimodel.cpp
@@ -1416,7 +1416,6 @@ bool AkonadiModel::setItemPayload(Item& item, KAEvent& event, \
const Collection&  kWarning() << "Invalid mime type for Collection";
         return false;
     }
-    event.clearUpdated();
     item.setMimeType(mimetype);
     item.setPayload<KAEvent>(event);
     return true;
diff --git a/kalarm/alarmcalendar.cpp b/kalarm/alarmcalendar.cpp
index 4c96954..7352518 100644
--- a/kalarm/alarmcalendar.cpp
+++ b/kalarm/alarmcalendar.cpp
@@ -1331,7 +1331,6 @@ bool AlarmCalendar::addEvent(KAEvent* event, QWidget* \
promptParent, bool useEven  #endif
         return false;
     }
-    event->clearUpdated();
 #ifdef USE_AKONADI
     evnt = *event;
     if (remove)
@@ -1526,7 +1525,6 @@ KAEvent* AlarmCalendar::updateEvent(const KAEvent* evnt)
     if (kaevnt  &&  kcalEvent)
     {
         evnt->updateKCalEvent(kcalEvent, KAEvent::UID_CHECK);
-        evnt->clearUpdated();
         bool oldEnabled = kaevnt->enabled();
         if (kaevnt != evnt)
             *kaevnt = *evnt;   // update the event instance in our lists, keeping \
                the same pointer
diff --git a/kalarm/cal/kaevent.cpp b/kalarm/cal/kaevent.cpp
index d2e55c9..fd3d1ab 100644
--- a/kalarm/cal/kaevent.cpp
+++ b/kalarm/cal/kaevent.cpp
@@ -348,7 +348,6 @@ void KAEvent::Private::copy(const KAEvent::Private& event)
     mDisplayingDefer         = event.mDisplayingDefer;
     mDisplayingEdit          = event.mDisplayingEdit;
     mEnabled                 = event.mEnabled;
-    mUpdated                 = event.mUpdated;
     mChangeCount             = 0;
     mChanged                 = false;
     delete mRecurrence;
@@ -832,8 +831,6 @@ void KAEvent::Private::set(const Event* event)
     }
     mChanged = true;
     endChanges();
-
-    mUpdated = false;
 }
 
 /******************************************************************************
@@ -1171,7 +1168,6 @@ void KAEvent::Private::set(const KDateTime& dateTime, const \
QString& text, const  if (mSpeak)
         mBeep               = false;
 
-    mUpdated                = true;
     mKMailSerialNumber      = 0;
     mReminderMinutes        = 0;
     mDeferDefaultMinutes    = 0;
@@ -1186,7 +1182,6 @@ void KAEvent::Private::set(const KDateTime& dateTime, const \
QString& text, const  mArchive                = false;
     mCancelOnPreActErr      = false;
     mDontShowPreActErr      = false;
-    mUpdated                = false;
 #ifdef USE_AKONADI
     mCompatibility          = KAlarm::Calendar::Current;
     mReadOnly               = false;
@@ -1226,7 +1221,6 @@ void KAEvent::Private::setAudioFile(const QString& filename, \
float volume, float  mFadeVolume  = -1;
         mFadeSeconds = 0;
     }
-    mUpdated = true;
 }
 
 /******************************************************************************
@@ -1240,7 +1234,6 @@ void KAEvent::Private::setCategory(KAlarm::CalEvent::Type s)
         return;
     mEventID = KAlarm::CalEvent::uid(mEventID, s);
     mCategory = s;
-    mUpdated = true;
 }
 
 /******************************************************************************
@@ -1251,7 +1244,6 @@ void KAEvent::setTemplate(const QString& name, int afterTime)
     d->setCategory(KAlarm::CalEvent::TEMPLATE);
     d->mTemplateName = name;
     d->mTemplateAfterTime = afterTime;
-    d->mUpdated = true;
     // Templates don't need trigger times to be calculated
     d->mChangeCount = 0;
     d->calcTriggerTimes();   // invalidate all trigger times
@@ -1275,7 +1267,6 @@ void KAEvent::Private::setRepeatAtLogin(bool rl)
         mAutoClose = false;
         mCopyToKOrganizer = false;
     }
-    mUpdated = true;
 }
 
 /******************************************************************************
@@ -1293,7 +1284,6 @@ void KAEvent::Private::setReminder(int minutes, bool onceOnly)
         mReminderMinutes  = minutes;
         mReminderActive   = minutes;
         mReminderOnceOnly = onceOnly;
-        mUpdated          = true;
         calcTriggerTimes();
     }
 }
@@ -2652,10 +2642,7 @@ void KAEvent::Private::removeExpiredAlarm(KAAlarm::Type type)
             break;
     }
     if (mAlarmCount != count)
-    {
-        mUpdated = true;
         calcTriggerTimes();
-    }
 }
 
 /******************************************************************************
@@ -2770,7 +2757,6 @@ bool KAEvent::Private::defer(const DateTime& dateTime, bool \
                reminder, bool adjus
             mNextRepeat = mRepetition.nextRepeatCount(mNextMainDateTime.kDateTime(), \
mDeferralTime.kDateTime());  mChanged = true;
     }
-    mUpdated = true;
     endChanges();
     return result;
 }
@@ -2784,7 +2770,6 @@ void KAEvent::Private::cancelDefer()
     {
         mDeferralTime = DateTime();
         set_deferral(NO_DEFERRAL);
-        mUpdated = true;
         calcTriggerTimes();
     }
 }
@@ -2939,7 +2924,6 @@ bool KAEvent::Private::setDisplaying(const KAEvent::Private& \
                event, KAAlarm::Typ
                 default:                                      mDisplayingFlags = 0;  \
break;  }
             ++mAlarmCount;
-            mUpdated = true;
             return true;
         }
     }
@@ -2969,7 +2953,6 @@ void KAEvent::Private::reinstateFromDisplaying(const Event* \
kcalEvent, QString&  showEdit     = mDisplayingEdit;
         mDisplaying  = false;
         --mAlarmCount;
-        mUpdated = true;
     }
 }
 
@@ -3231,10 +3214,7 @@ KAEvent::OccurType KAEvent::Private::setNextOccurrence(const \
KDateTime& preDateT  }
     }
     if (changed)
-    {
-        mUpdated = true;
         calcTriggerTimes();
-    }
     return type;
 }
 
@@ -3366,7 +3346,7 @@ void KAEvent::Private::setFirstRecurrence()
     {
         mRecurrence->setStartDateTime(next.effectiveKDateTime(), next.isDateOnly());
         mStartDateTime = mNextMainDateTime = next;
-        mUpdated = changed = true;
+        changed = true;
     }
     mRecurrence->setFrequency(frequency);    // restore the frequency
     if (changed)
@@ -3380,7 +3360,6 @@ void KAEvent::Private::setFirstRecurrence()
 void KAEvent::Private::setRecurrence(const KARecurrence& recurrence)
 {
     startChanges();   // prevent multiple trigger time evaluation here
-    mUpdated = true;
     delete mRecurrence;
     if (recurrence.recurs())
     {
@@ -3421,7 +3400,6 @@ bool KAEvent::Private::setRepetition(const Repetition& \
repetition)  {
     // Don't set mRepetition to zero at the start of this function, in case the
     // 'repetition' parameter passed in is a reference to mRepetition.
-    mUpdated    = true;
     mNextRepeat = 0;
     if (repetition  &&  !mRepeatAtLogin)
     {
@@ -3641,10 +3619,7 @@ bool KAEvent::Private::setRecur(RecurrenceRule::PeriodType \
recurType, int freq,  if (!mRecurrence)
             mRecurrence = new KARecurrence;
         if (mRecurrence->init(recurType, freq, count, mNextMainDateTime.kDateTime(), \
                end, feb29))
-        {
-            mUpdated = true;
             return true;
-        }
     }
     clearRecur();
     return false;
@@ -3659,7 +3634,6 @@ void KAEvent::Private::clearRecur()
     mRecurrence = 0;
     mRepetition.set(0, 0);
     mNextRepeat = 0;
-    mUpdated    = true;
 }
 
 /******************************************************************************
diff --git a/kalarm/cal/kaevent.h b/kalarm/cal/kaevent.h
index 5ac9403..6039279 100644
--- a/kalarm/cal/kaevent.h
+++ b/kalarm/cal/kaevent.h
@@ -336,23 +336,23 @@ class KALARM_CAL_EXPORT KAEvent
                                                                    { \
                d->setAudioFile(filename, volume, fadeVolume, fadeSeconds, \
                allowEmptyFile); }
         void               setTemplate(const QString& name, int afterTime = -1);
         void               setActions(const QString& pre, const QString& post, bool \
                cancelOnError, bool dontShowError)
-                                                                   { d->mPreAction = \
pre;  d->mPostAction = post;  d->mCancelOnPreActErr = cancelOnError;  \
d->mDontShowPreActErr = dontShowError;  d->mUpdated = true; } +                       \
{ d->mPreAction = pre;  d->mPostAction = post;  d->mCancelOnPreActErr = \
                cancelOnError;  d->mDontShowPreActErr = dontShowError; }
         OccurType          setNextOccurrence(const KDateTime& preDateTime)  { return \
                d->setNextOccurrence(preDateTime); }
         void               setFirstRecurrence()                    { \
                d->setFirstRecurrence(); }
         void               setCategory(KAlarm::CalEvent::Type s)   { \
                d->setCategory(s); }
-        void               setUid(KAlarm::CalEvent::Type s)        { d->mEventID = \
                KAlarm::CalEvent::uid(d->mEventID, s);  d->mUpdated = true; }
-        void               setEventId(const QString& id)           { d->mEventID = \
id;  d->mUpdated = true; } +        void               setUid(KAlarm::CalEvent::Type \
s)        { d->mEventID = KAlarm::CalEvent::uid(d->mEventID, s); } +        void      \
setEventId(const QString& id)           { d->mEventID = id; }  #ifdef USE_AKONADI
         void               setItemId(Akonadi::Item::Id id)         { d->mItemId = \
                id; }
-        void               setCompatibility(KAlarm::Calendar::Compat c) { if (c != \
                d->mCompatibility) { d->mCompatibility = c; d->mUpdated = true; } }
-        void               setReadOnly(bool ro)                    { if (ro != \
d->mReadOnly) { d->mReadOnly = ro; d->mUpdated = true; } } +        void              \
setCompatibility(KAlarm::Calendar::Compat c) { if (c != d->mCompatibility) { \
d->mCompatibility = c; } } +        void               setReadOnly(bool ro)           \
{ if (ro != d->mReadOnly) { d->mReadOnly = ro; } }  #endif
-        void               setTime(const KDateTime& dt)            { \
                d->mNextMainDateTime = dt;  d->mUpdated = true; }
-        void               setSaveDateTime(const KDateTime& dt)    { \
                d->mSaveDateTime = dt;  d->mUpdated = true; }
-        void               setLateCancel(int lc)                   { d->mLateCancel \
                = lc;  d->mUpdated = true; }
-        void               setAutoClose(bool ac)                   { d->mAutoClose = \
ac;  d->mUpdated = true; } +        void               setTime(const KDateTime& dt)   \
{ d->mNextMainDateTime = dt; } +        void               setSaveDateTime(const \
KDateTime& dt)    { d->mSaveDateTime = dt; } +        void               \
setLateCancel(int lc)                   { d->mLateCancel = lc; } +        void        \
                setAutoClose(bool ac)                   { d->mAutoClose = ac; }
         void               setRepeatAtLogin(bool rl)               { \
                d->setRepeatAtLogin(rl); }
-        void               setExcludeHolidays(bool ex)             { \
d->mExcludeHolidays = ex;  d->mUpdated = true; } +        void               \
                setExcludeHolidays(bool ex)             { d->mExcludeHolidays = ex; }
         void               setWorkTimeOnly(bool wto)               { \
                d->mWorkTimeOnly = wto; }
         void               setKMailSerialNumber(unsigned long n)   { \
d->mKMailSerialNumber = n; }  void               setLogFile(const QString& logfile);
@@ -361,7 +361,7 @@ class KALARM_CAL_EXPORT KAEvent
                                                                    { return \
                d->defer(dt, reminder, adjustRecurrence); }
         void               cancelDefer()                           { \
                d->cancelDefer(); }
         void               setDeferDefaultMinutes(int minutes, bool dateOnly = \
                false)
-                                                                   { \
d->mDeferDefaultMinutes = minutes;  d->mDeferDefaultDateOnly = dateOnly;  d->mUpdated \
= true; } +                                                                   { \
d->mDeferDefaultMinutes = minutes;  d->mDeferDefaultDateOnly = dateOnly; }  #ifdef \
                USE_AKONADI
         bool               setDisplaying(const KAEvent& e, KAAlarm::Type t, \
                Akonadi::Collection::Id colId, const KDateTime& dt, bool showEdit, \
                bool showDefer)
                                                                    { return \
d->setDisplaying(*e.d, t, colId, dt, showEdit, showDefer); } @@ -377,12 +377,10 @@ \
                class KALARM_CAL_EXPORT KAEvent
         void               setCommandError(CmdErrType t, bool writeConfig = true) \
                const
                                                                    { \
d->setCommandError(t, writeConfig); }  #endif
-        void               setArchive()                            { d->mArchive = \
                true;  d->mUpdated = true; }
-        void               setEnabled(bool enable)                 { d->mEnabled = \
enable;  d->mUpdated = true; } +        void               setArchive()               \
{ d->mArchive = true; } +        void               setEnabled(bool enable)           \
                { d->mEnabled = enable; }
         void               startChanges()                          { \
                d->startChanges(); }
         void               endChanges()                            { \
                d->endChanges(); }
-        void               setUpdated()                            { d->mUpdated = \
                true; }
-        void               clearUpdated() const                    { d->mUpdated = \
false; }  #ifdef USE_AKONADI
         void               clearCollectionId()                     { \
d->mCollectionId = -1; }  #else
@@ -391,7 +389,7 @@ class KALARM_CAL_EXPORT KAEvent
         void               updateWorkHours() const                 { if \
                (d->mWorkTimeOnly) d->calcTriggerTimes(); }
         void               updateHolidays() const                  { if \
                (d->mExcludeHolidays) d->calcTriggerTimes(); }
         void               removeExpiredAlarm(KAAlarm::Type t)     { \
                d->removeExpiredAlarm(t); }
-        void               incrementRevision()                     { ++d->mRevision; \
d->mUpdated = true; } +        void               incrementRevision()                 \
{ ++d->mRevision; }  
         const QString&     cleanText() const              { return d->mText; }
         QString            message() const                { return (d->mActionType \
== KAAlarmEventBase::T_MESSAGE || d->mActionType == KAAlarmEventBase::T_EMAIL) ? \
d->mText : QString(); } @@ -486,7 +484,6 @@ class KALARM_CAL_EXPORT KAEvent
         bool               deferred() const               { return d->mDeferral > 0; \
                }
         bool               toBeArchived() const           { return d->mArchive; }
         bool               enabled() const                { return d->mEnabled; }
-        bool               updated() const                { return d->mUpdated; }
         bool               mainExpired() const            { return d->mMainExpired; \
                }
         bool               expired() const                { return (d->mDisplaying \
                && d->mMainExpired)  ||  d->mCategory == KAlarm::CalEvent::ARCHIVED; \
                }
         KAlarm::CalEvent::Type category() const           { return d->mCategory; }
@@ -759,7 +756,6 @@ class KALARM_CAL_EXPORT KAEvent
                 bool               mDisplayingDefer;   // show Defer button (applies \
                to displaying calendar only)
                 bool               mDisplayingEdit;    // show Edit button (applies \
                to displaying calendar only)
                 bool               mEnabled;           // false if event is disabled
-                mutable bool       mUpdated;           // event has been updated but \
not written to calendar file  };
 
         QSharedDataPointer<class Private> d;
diff --git a/kalarm/kalarmapp.cpp b/kalarm/kalarmapp.cpp
index 0a76e9c..a227d226 100644
--- a/kalarm/kalarmapp.cpp
+++ b/kalarm/kalarmapp.cpp
@@ -1,7 +1,7 @@
 /*
  *  kalarmapp.cpp  -  the KAlarm application object
  *  Program:  kalarm
- *  Copyright  © 2001-2010 by David Jarvie <djarvie@kde.org>
+ *  Copyright  © 2001-2011 by David Jarvie <djarvie@kde.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -1384,7 +1384,9 @@ void KAlarmApp::alarmCompleted(const KAEvent& event)
 */
 bool KAlarmApp::rescheduleAlarm(KAEvent& event, const KAAlarm& alarm, bool \
updateCalAndDisplay, const KDateTime& nextDt)  {
-    kDebug();
+    kDebug() << "Alarm type:" << alarm.type();
+    if (alarm.repeatAtLogin())
+        return false;  // leave an alarm which repeats at every login until its main \
alarm triggers  bool reply = false;
     bool update = false;
     event.startChanges();
@@ -1394,12 +1396,6 @@ bool KAlarmApp::rescheduleAlarm(KAEvent& event, const KAAlarm& \
alarm, bool updat  event.removeExpiredAlarm(alarm.type());
         update = true;
     }
-    else if (alarm.repeatAtLogin())
-    {
-        // Leave an alarm which repeats at every login until its main alarm is \
                deleted
-        if (updateCalAndDisplay  &&  event.updated())
-            update = true;
-    }
     else
     {
         // Reschedule the alarm for its next occurrence.
diff --git a/kalarm/recurrenceedit.cpp b/kalarm/recurrenceedit.cpp
index 10b8730..6fe355d 100644
--- a/kalarm/recurrenceedit.cpp
+++ b/kalarm/recurrenceedit.cpp
@@ -1,7 +1,7 @@
 /*
  *  recurrenceedit.cpp  -  widget to edit the event's recurrence definition
  *  Program:  kalarm
- *  Copyright  © 2002-2010 by David Jarvie <djarvie@kde.org>
+ *  Copyright  © 2002-2011 by David Jarvie <djarvie@kde.org>
  *
  *  Based originally on KOrganizer module koeditorrecurrence.cpp,
  *  Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
@@ -1040,7 +1040,6 @@ void RecurrenceEdit::updateEvent(KAEvent& event, bool \
adjustStart)  event.setWorkTimeOnly(mWorkTimeOnly->isChecked());
     event.setExcludeHolidays(mExcludeHolidays->isChecked());
 
-    event.setUpdated();
     event.endChanges();
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic