summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/backend/event.h17
1 files changed, 2 insertions, 15 deletions
diff --git a/library/backend/event.h b/library/backend/event.h
index 4610d85..118523f 100644
--- a/library/backend/event.h
+++ b/library/backend/event.h
@@ -59,103 +59,101 @@ public:
int frequency;
int position; // the posistion in the month (e.g. the first sunday, etc) positive, count from the front negative count from the end...
char days; // a mask for days OR in your days!
bool hasEndDate;
QDate endDate() const { return TimeConversion::fromUTC( endDateUTC ).date(); }
void setEndDate( const QDate &dt ) { endDateUTC = TimeConversion::toUTC( dt ); }
time_t endDateUTC;
time_t createTime;
};
Event();
Event( const QMap<int, QString > & map );
virtual ~Event();
QMap<int, QString> toMap() const;
static void writeVCalendar( const QString &filename, const QValueList<Event> &events);
static void writeVCalendar( const QString &filename, const Event &event);
static QValueList<Event> readVCalendar( const QString &filename );
enum Type { Normal, AllDay };
enum SoundTypeChoice { Silent, Loud };
// Don't use these, there are essentially meaningless.
bool operator<( const Event &e1) const { return start() < e1.start(); };
bool operator<=( const Event &e1 ) const { return start() <= e1.start(); };
bool operator!=( const Event &e1 ) const { return !( *this == e1 ); };
bool operator>( const Event &e1 ) const { return start() > e1.start(); };
bool operator>=(const Event &e1 ) const { return start() >= e1.start(); };
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 &notes() 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.
+ QDateTime start( bool actual = FALSE) 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.
+ QDateTime end( bool actual = FALSE ) 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
@@ -296,80 +294,69 @@ inline int Event::weekOffset() const
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