summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-08-19 12:08:05 (UTC)
committer zautrix <zautrix>2005-08-19 12:08:05 (UTC)
commit9014049779be6cfec02d73e19596439f0f4f9bed (patch) (side-by-side diff)
tree3983282e83183cc15dd615ba4ac5a800da21efe0 /libkcal
parent81891a49afc2f7cd89db4e2770c3b7831644428d (diff)
downloadkdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.zip
kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.tar.gz
kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.tar.bz2
list sort fix
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp13
-rw-r--r--libkcal/incidence.h2
-rw-r--r--libkcal/incidencebase.cpp13
-rw-r--r--libkcal/incidencebase.h2
4 files changed, 29 insertions, 1 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 39c14f5..fe9f854 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -333,37 +333,50 @@ void Incidence::cloneRelations( Incidence * newInc )
void Incidence::setReadOnly( bool readOnly )
{
IncidenceBase::setReadOnly( readOnly );
if ( mRecurrence )
mRecurrence->setRecurReadOnly( readOnly);
}
void Incidence::setLastModifiedSubInvalid()
{
mLastModifiedSub = QDateTime();
if ( mRelatedTo )
mRelatedTo->setLastModifiedSubInvalid();
}
+QString Incidence::lastModifiedSubSortKey() const
+{
+ if ( mLastModifiedSubSortKey.isEmpty() )
+ return lastModifiedSortKey();
+ return mLastModifiedSubSortKey;
+}
QDateTime Incidence::lastModifiedSub()
{
if ( !mRelations.count() )
return lastModified();
if ( mLastModifiedSub.isValid() )
return mLastModifiedSub;
mLastModifiedSub = lastModified();
Incidence * inc;
QPtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
if ( inc->lastModifiedSub() > mLastModifiedSub )
mLastModifiedSub = inc->lastModifiedSub();
}
+ mLastModifiedSubSortKey.sprintf("%04d%02d%02d%02d%02d%02d",
+ mLastModifiedSub.date().year(),
+ mLastModifiedSub.date().month(),
+ mLastModifiedSub.date().day(),
+ mLastModifiedSub.time().hour(),
+ mLastModifiedSub.time().minute(),
+ mLastModifiedSub.time().second() );
return mLastModifiedSub;
}
void Incidence::setCreated(QDateTime created)
{
if (mReadOnly) return;
mCreated = getEvenTime(created);
}
QDateTime Incidence::created() const
{
return mCreated;
}
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index eef9e64..dc49640 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -270,37 +270,39 @@ class Incidence : public IncidenceBase
void setCancelled( bool b );
bool hasRecurrenceID() const;
void setHasRecurrenceID( bool b );
void setRecurrenceID(QDateTime);
QDateTime recurrenceID () const;
QDateTime dtStart() const;
bool isHoliday() const;
bool isBirthday() const;
bool isAnniversary() const;
QDateTime lastModifiedSub();
+ QString lastModifiedSubSortKey() const;
QString recurrenceText() const;
void setLastModifiedSubInvalid();
virtual QString durationText();
QString durationText4Time( int secs );
Recurrence *mRecurrence;
protected:
QPtrList<Alarm> mAlarms;
QPtrList<Incidence> mRelations;
QDateTime mRecurrenceID;
bool mHasRecurrenceID;
private:
void checkCategories();
+ QString mLastModifiedSubSortKey;
bool mHoliday, mBirthday, mAnniversary;
int mRevision;
bool mCancelled;
// base components of jounal, event and todo
QDateTime mCreated;
QDateTime mLastModifiedSub;
QString mDescription;
QString mSummary;
QStringList mCategories;
Incidence *mRelatedTo;
QString mRelatedToUid;
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 022dead..cfef973 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -184,35 +184,46 @@ bool IncidenceBase::alarmEnabled() const
void IncidenceBase::setUid(const QString &uid)
{
mUid = uid;
updated();
}
QString IncidenceBase::uid() const
{
return mUid;
}
void IncidenceBase::setLastModifiedSubInvalid()
{
-
+ // virtual method
}
void IncidenceBase::setLastModified(const QDateTime &lm)
{
if ( blockLastModified ) return;
// DON'T! updated() because we call this from
// Calendar::updateEvent().
mLastModified = getEvenTime(lm);
+ mLastModifiedKey.sprintf("%04d%02d%02d%02d%02d%02d",
+ mLastModified.date().year(),
+ mLastModified.date().month(),
+ mLastModified.date().day(),
+ mLastModified.time().hour(),
+ mLastModified.time().minute(),
+ mLastModified.time().second() );
setLastModifiedSubInvalid();
//qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
}
+QString IncidenceBase::lastModifiedSortKey() const
+{
+ return mLastModifiedKey;
+}
QDateTime IncidenceBase::lastModified() const
{
return mLastModified;
}
void IncidenceBase::setOrganizer(const QString &o)
{
// we don't check for readonly here, because it is
// possible that by setting the organizer we are changing
// the event's readonly status...
mOrganizer = o;
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 665c1f6..444d4c4 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -54,24 +54,25 @@ class IncidenceBase : public CustomProperties
virtual QCString type() const = 0;
virtual IncTypeID typeID() const = 0;
/** Set the unique id for the event */
void setUid(const QString &);
/** Return the unique id for the event */
QString uid() const;
/** Sets the time the incidence was last modified. */
void setLastModified(const QDateTime &lm);
/** Return the time the incidence was last modified. */
QDateTime lastModified() const;
+ QString lastModifiedSortKey() const;
/** sets the organizer for the event */
void setOrganizer(const QString &o);
QString organizer() const;
/** Set readonly status. */
virtual void setReadOnly( bool );
/** Return if the object is read-only. */
bool isReadOnly() const { return mReadOnly; }
/** for setting the event's starting date/time with a QDateTime. */
virtual void setDtStart(const QDateTime &dtStart);
@@ -151,24 +152,25 @@ class IncidenceBase : public CustomProperties
void setTagged( bool );
virtual void setLastModifiedSubInvalid();
protected:
bool blockLastModified;
bool mIsTagged;
QDateTime mDtStart;
bool mReadOnly;
QDateTime getEvenTime( QDateTime );
private:
// base components
QString mOrganizer;
+ QString mLastModifiedKey;
QString mUid;
int mCalID;
bool mCalEnabled;
bool mAlarmEnabled;
QDateTime mLastModified;
QPtrList<Attendee> mAttendees;
bool mFloats;
int mDuration;
bool mHasDuration;
QString mExternalId;