-rw-r--r-- | library/backend/event.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/backend/event.h b/library/backend/event.h index 2b275a4..4610d85 100644 --- a/library/backend/event.h +++ b/library/backend/event.h @@ -88,288 +88,288 @@ public: bool operator==( const Event &e ) const; void setDescription( const QString &s ); const QString &description() const; void setLocation( const QString &s ); const QString &location() const; void setNotes( const QString &n ); const QString ¬es() const; void setType( Type t ); // Don't use me. Type type() const; // Don't use me. void setAllDay(bool); bool isAllDay() const; void setStart( const QDateTime &d ); void setStart( time_t time ); // don't use me. QDateTime start( ) const; QDateTime start( bool actual ) const; // don't use me. time_t startTime() const { return startUTC; } // don't use me. void setEnd( const QDateTime &e ); void setEnd( time_t time ); // don't use me QDateTime end( ) const; QDateTime end( bool actual ) const; // don't use me. time_t endTime() const { return endUTC; } // don't use me. void setTimeZone( const QString & ); const QString &timeZone() const; void setAlarm( int minutes, SoundTypeChoice ); void clearAlarm(); void setAlarm( bool b, int minutes, SoundTypeChoice ); // Don't use me. bool hasAlarm() const; int alarmDelay() const; int alarmTime() const; // Don't use me. SoundTypeChoice alarmSound() const; RepeatType repeatType() const; int frequency() const; int weekOffset() const; QDate repeatTill() const; bool repeatForever() const; bool repeatOnWeekDay(int day) const; void setRepeatType(RepeatType); void setFrequency(int); void setRepeatTill(const QDate &); void setRepeatForever(bool); void setRepeatOnWeekDay(int day, bool enable); // Don't use any of these. void setRepeat( bool b, const RepeatPattern &p ); void setRepeat( const RepeatPattern &p ); bool hasRepeat() const; const RepeatPattern &repeatPattern() const; RepeatPattern &repeatPattern(); bool doRepeat() const { return pattern.type != NoRepeat; } void save( QString& buf ); //void load( Node *n ); bool match( const QRegExp &r ) const; // Don't use these either. Functionality will be moved elsewhere. // helper function to calculate the week of the given date static int week( const QDate& date ); // calculates the number of occurrences of the week day of // the given date from the start of the month static int occurrence( const QDate& date ); // returns a proper days-char for a given dayOfWeek() static char day( int dayOfWeek ) { return 1 << ( dayOfWeek - 1 ); } // returns the dayOfWeek for the *first* day it finds (ignores // any further days!). Returns 1 (Monday) if there isn't any day found static int dayOfWeek( char day ); // returns the difference of months from first to second. static int monthDiff( const QDate& first, const QDate& second ); private: Qtopia::UidGen &uidGen() { return sUidGen; } static Qtopia::UidGen sUidGen; QString descript, locat, categ; Type typ : 4; bool startTimeDirty : 1; bool endTimeDirty : 1; time_t startUTC, endUTC; QString tz; bool hAlarm, hRepeat; int aMinutes; SoundTypeChoice aSound; RepeatPattern pattern; QString note; // ADDITION int mRid; // Recode ID int mRinfo; // Recode Info // EventPrivate *d; }; // Since an event spans multiple day, it is better to have this // class to represent a day instead of creating many // dummy events... class EffectiveEventPrivate; class QPC_EXPORT EffectiveEvent { public: // If we calculate the effective event of a multi-day event // we have to figure out whether we are at the first day, // at the end, or anywhere else ("middle"). This is important // for the start/end times (00:00/23:59) // MidWay: 00:00 -> 23:59, as we are "in the middle" of a multi- // day event // Start: start time -> 23:59 // End: 00:00 -> end time // Start | End == StartEnd: for single-day events (default) // here we draw start time -> end time enum Position { MidWay = 0, Start = 1, End = 2, StartEnd = 3 }; EffectiveEvent(); EffectiveEvent( const Event &event, const QDate &startDate, Position pos = StartEnd ); EffectiveEvent( const EffectiveEvent & ); EffectiveEvent& operator=( const EffectiveEvent & ); ~EffectiveEvent(); bool operator<( const EffectiveEvent &e ) const; bool operator<=( const EffectiveEvent &e ) const; bool operator==( const EffectiveEvent &e ) const; bool operator!=( const EffectiveEvent &e ) const; bool operator>( const EffectiveEvent &e ) const; bool operator>= ( const EffectiveEvent &e ) const; void setStart( const QTime &start ); void setEnd( const QTime &end ); void setEvent( Event e ); void setDate( const QDate &date ); void setEffectiveDates( const QDate &from, const QDate &to ); // QString category() const; const QString &description() const; const QString &location() const; const QString ¬es() const; const Event &event() const; const QTime &start() const; const QTime &end() const; const QDate &date() const; int length() const; int size() const; QDate startDate() const; QDate endDate() const; private: class EffectiveEventPrivate *d; Event mEvent; QDate mDate; QTime mStart, mEnd; }; inline void Event::setAlarm( int minutes, SoundTypeChoice s ) { setAlarm(TRUE, minutes, s); } inline void Event::clearAlarm() { setAlarm(FALSE, 0, Silent); } inline int Event::alarmDelay() const { return alarmTime(); } inline void Event::setAllDay(bool enable) { if (enable) setType(AllDay); else setType(Normal); }; inline bool Event::isAllDay() const { return type() == AllDay; } inline Event::RepeatType Event::repeatType() const { return repeatPattern().type; } inline int Event::frequency() const { return repeatPattern().frequency; } inline int Event::weekOffset() const { if (start().date().day() == 1) return 1; return (start().date().day() - 1) / 7 + 1; } inline QDate Event::repeatTill() const { return repeatPattern().endDate(); } inline bool Event::repeatForever() const { return !repeatPattern().hasEndDate; } inline void Event::setRepeatType(RepeatType t) { pattern.type = t; } inline void Event::setFrequency(int f) { pattern.frequency = f; } inline void Event::setRepeatTill(const QDate &d) { pattern.setEndDate(d); pattern.hasEndDate = TRUE; } inline void Event::setRepeatForever(bool b) { if (!b == pattern.hasEndDate) return; if (!b && !pattern.hasEndDate) pattern.setEndDate(end().date()); pattern.hasEndDate = !b; } inline bool Event::repeatOnWeekDay(int day) const { if (pattern.type != Weekly) return FALSE; return ( (1 << (day - 1)) & pattern.days ) != 0; } inline void Event::setRepeatOnWeekDay(int day, bool enable) { if ( repeatOnWeekDay( day ) != enable ) pattern.days ^= 1 << (day - 1); } -/* + inline QDateTime Event::start( ) const { return start(FALSE); } inline QDateTime Event::end( ) const { return end(FALSE); } -*/ + #ifdef PALMTOPCENTER class QPC_EXPORT EffectiveEventSizeSorter : public QSorter<EffectiveEvent> { public: int compare( const EffectiveEvent& a, const EffectiveEvent& b ) const { return a.size() - b.size(); } }; class QPC_EXPORT EffectiveEventTimeSorter : public QSorter<EffectiveEvent> { public: int compare( const EffectiveEvent& a, const EffectiveEvent& b ) const { return a.start().secsTo( b.start() ); } }; #endif #endif |